@backstage-community/plugin-tech-insights 0.6.0 → 0.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # @backstage-community/plugin-tech-insights
2
2
 
3
+ ## 0.6.1
4
+
5
+ ### Patch Changes
6
+
7
+ - d97a34e: Added support for alternate visualizations of boolean checks:
8
+
9
+ - Content lists can be rendered with smaller text size and reduced padding (option `dense`)
10
+ - Checks in the overview page can be rendered as a badge (option `badge`)
11
+ - Checks in the entity card can be rendered as a gauge (option `gauge`)
12
+
3
13
  ## 0.6.0
4
14
 
5
15
  ### Minor Changes
package/README.md CHANGED
@@ -60,6 +60,8 @@ You can also pass a `filter` function to both `EntityTechInsightsScorecardConten
60
60
 
61
61
  To only show failed checks, you can pass the boolean `onlyFailed` to these components.
62
62
 
63
+ If you prefer a condensed list (with smaller text size and less padding) in `EntityTechInsightsScorecardContent`, you can pass the boolean `dense`.
64
+
63
65
  If you want to show checks in the overview of an entity use `EntityTechInsightsScorecardCard`.
64
66
 
65
67
  ```tsx
@@ -88,6 +90,29 @@ const overviewContent = (
88
90
  );
89
91
  ```
90
92
 
93
+ If you want to display checks as a gauge visualization, pass the boolean `gauge` to `EntityTechInsightsScorecardCard`.
94
+
95
+ ```tsx
96
+ // packages/app/src/components/catalog/EntityPage.tsx
97
+
98
+ import { EntityTechInsightsScorecardCard } from '@backstage-community/plugin-tech-insights';
99
+
100
+ const overviewContent = (
101
+ <Grid container spacing={3} alignItems="stretch">
102
+ ...
103
+ <Grid item md={4}>
104
+ <EntityTechInsightsScorecardCard
105
+ title="Customized title for the scorecard"
106
+ description="Small description about scorecards"
107
+ gauge
108
+ />
109
+ </Grid>
110
+ </Grid>
111
+ );
112
+ ```
113
+
114
+ ![Gauge Scorecard Example](docs/gauge-scorecard-overview.png)
115
+
91
116
  ## Boolean Scorecard Example
92
117
 
93
118
  If you follow the [Backend Example](../tech-insights-backend#backend-example), once the needed facts have been generated the default boolean scorecard will look like this:
@@ -113,6 +138,12 @@ const routes = (
113
138
  );
114
139
  ```
115
140
 
141
+ To show a condensed list (with smaller text size and less padding), you can pass the boolean `dense`.
142
+
143
+ If you want to display checks as a badge visualization, pass the boolean `badge` to `TechInsightsScorecardPage`.
144
+
145
+ ![Badge Scorecard Overview](./docs/badge-scorecard-overview.png)
146
+
116
147
  Then add it to the navigation menu
117
148
 
118
149
  ```tsx
@@ -0,0 +1,49 @@
1
+ import { jsx } from 'react/jsx-runtime';
2
+ import Chip from '@material-ui/core/Chip';
3
+ import { useApi } from '@backstage/core-plugin-api';
4
+ import { techInsightsApiRef } from '@backstage-community/plugin-tech-insights-react';
5
+ import Tooltip from '@material-ui/core/Tooltip';
6
+ import { ScorecardsList } from '../ScorecardsList/ScorecardsList.esm.js';
7
+
8
+ const ScorecardsBadge = (props) => {
9
+ const { checkResults, entity } = props;
10
+ const api = useApi(techInsightsApiRef);
11
+ const types = [...new Set(checkResults.map(({ check }) => check.type))];
12
+ const checkResultRenderers = api.getCheckResultRenderers(types);
13
+ const checkResultsWithRenderer = checkResults.map((result) => ({
14
+ result,
15
+ renderer: checkResultRenderers.find(
16
+ (renderer) => renderer.type === result.check.type
17
+ )
18
+ }));
19
+ const succeeded = checkResultsWithRenderer.filter(
20
+ ({ result, renderer }) => !renderer?.isFailed?.(result)
21
+ ).length;
22
+ return /* @__PURE__ */ jsx(
23
+ Tooltip,
24
+ {
25
+ title: /* @__PURE__ */ jsx(
26
+ ScorecardsList,
27
+ {
28
+ checkResults,
29
+ entity,
30
+ dense: true,
31
+ hideDescription: true
32
+ }
33
+ ),
34
+ children: /* @__PURE__ */ jsx(
35
+ Chip,
36
+ {
37
+ label: `${succeeded}/${checkResults.length}`,
38
+ size: "small",
39
+ style: {
40
+ backgroundColor: succeeded === checkResults.length ? "mediumseagreen" : "orangered"
41
+ }
42
+ }
43
+ )
44
+ }
45
+ );
46
+ };
47
+
48
+ export { ScorecardsBadge };
49
+ //# sourceMappingURL=ScorecardsBadge.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ScorecardsBadge.esm.js","sources":["../../../src/components/ScorecardsBadge/ScorecardsBadge.tsx"],"sourcesContent":["/*\n * Copyright 2025 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { CheckResult } from '@backstage-community/plugin-tech-insights-common';\nimport { Entity } from '@backstage/catalog-model';\nimport Chip from '@material-ui/core/Chip';\nimport { useApi } from '@backstage/core-plugin-api';\nimport { techInsightsApiRef } from '@backstage-community/plugin-tech-insights-react';\nimport Tooltip from '@material-ui/core/Tooltip';\nimport { ScorecardsList } from '../ScorecardsList';\n\nexport const ScorecardsBadge = (props: {\n checkResults: CheckResult[];\n entity?: Entity;\n}) => {\n const { checkResults, entity } = props;\n\n const api = useApi(techInsightsApiRef);\n\n const types = [...new Set(checkResults.map(({ check }) => check.type))];\n const checkResultRenderers = api.getCheckResultRenderers(types);\n const checkResultsWithRenderer = checkResults.map(result => ({\n result,\n renderer: checkResultRenderers.find(\n renderer => renderer.type === result.check.type,\n ),\n }));\n\n const succeeded = checkResultsWithRenderer.filter(\n ({ result, renderer }) => !renderer?.isFailed?.(result),\n ).length;\n\n return (\n <Tooltip\n title={\n <ScorecardsList\n checkResults={checkResults}\n entity={entity}\n dense\n hideDescription\n />\n }\n >\n <Chip\n label={`${succeeded}/${checkResults.length}`}\n size=\"small\"\n style={{\n backgroundColor:\n succeeded === checkResults.length ? 'mediumseagreen' : 'orangered',\n }}\n />\n </Tooltip>\n );\n};\n"],"names":[],"mappings":";;;;;;;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AAS,gBAAmB,GAAA;AAAA;AAC3D;AAAA;AACF;AAAA,GACF;AAEJ;;;;"}
@@ -0,0 +1,2 @@
1
+ export { ScorecardsBadge } from './ScorecardsBadge.esm.js';
2
+ //# sourceMappingURL=index.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -7,6 +7,7 @@ import { ScorecardInfo } from '../ScorecardsInfo/ScorecardInfo.esm.js';
7
7
  import { techInsightsApiRef } from '@backstage-community/plugin-tech-insights-react';
8
8
  import { useEntity } from '@backstage/plugin-catalog-react';
9
9
  import { getCompoundEntityRef } from '@backstage/catalog-model';
10
+ import { ScorecardsGauge } from '../ScorecardsGauge/ScorecardsGauge.esm.js';
10
11
 
11
12
  const ScorecardsCard = (props) => {
12
13
  const {
@@ -15,7 +16,8 @@ const ScorecardsCard = (props) => {
15
16
  checksId,
16
17
  filter,
17
18
  onlyFailed,
18
- expanded = true
19
+ gauge,
20
+ expanded = !gauge
19
21
  } = props;
20
22
  const api = useApi(techInsightsApiRef);
21
23
  const { entity } = useEntity();
@@ -40,7 +42,17 @@ const ScorecardsCard = (props) => {
40
42
  const filteredValue = !onlyFailed ? filteredValues || [] : (filteredValues || []).filter(
41
43
  (val) => checkResultRenderers[val.check.type]?.isFailed?.(val)
42
44
  );
43
- return /* @__PURE__ */ jsx(
45
+ return gauge ? /* @__PURE__ */ jsx(
46
+ ScorecardsGauge,
47
+ {
48
+ title,
49
+ description,
50
+ entity,
51
+ checkResults: filteredValue,
52
+ noWarning: onlyFailed,
53
+ expanded
54
+ }
55
+ ) : /* @__PURE__ */ jsx(
44
56
  ScorecardInfo,
45
57
  {
46
58
  title,
@@ -1 +1 @@
1
- {"version":3,"file":"ScorecardsCard.esm.js","sources":["../../../src/components/ScorecardsCard/ScorecardsCard.tsx"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { useMemo } from 'react';\nimport useAsync from 'react-use/esm/useAsync';\nimport { ErrorPanel, Progress } from '@backstage/core-components';\nimport { useApi } from '@backstage/core-plugin-api';\nimport { ScorecardInfo } from '../ScorecardsInfo';\nimport { techInsightsApiRef } from '@backstage-community/plugin-tech-insights-react';\nimport { useEntity } from '@backstage/plugin-catalog-react';\nimport { getCompoundEntityRef } from '@backstage/catalog-model';\nimport { Check } from '@backstage-community/plugin-tech-insights-common';\n\nexport const ScorecardsCard = (props: {\n title: string;\n description?: string;\n checksId?: string[];\n filter?: (check: Check) => boolean;\n onlyFailed?: boolean;\n expanded?: boolean;\n}) => {\n const {\n title,\n description,\n checksId,\n filter,\n onlyFailed,\n expanded = true,\n } = props;\n const api = useApi(techInsightsApiRef);\n const { entity } = useEntity();\n const { value, loading, error } = useAsync(\n async () => await api.runChecks(getCompoundEntityRef(entity), checksId),\n [api, entity, JSON.stringify(checksId)],\n );\n\n const filteredValues =\n !filter || !value ? value : value.filter(val => filter(val.check));\n\n const checkResultRenderers = useMemo(() => {\n if (!onlyFailed || !filteredValues) return {};\n\n const types = [...new Set(filteredValues.map(({ check }) => check.type))];\n const renderers = api.getCheckResultRenderers(types);\n return Object.fromEntries(\n renderers.map(renderer => [renderer.type, renderer]),\n );\n }, [api, filteredValues, onlyFailed]);\n\n if (loading) {\n return <Progress />;\n } else if (error) {\n return <ErrorPanel error={error} />;\n }\n\n const filteredValue = !onlyFailed\n ? filteredValues || []\n : (filteredValues || []).filter(val =>\n checkResultRenderers[val.check.type]?.isFailed?.(val),\n );\n\n return (\n <ScorecardInfo\n title={title}\n description={description}\n entity={entity}\n checkResults={filte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CAAC;AAAA,KACrD;AAAA,GACC,EAAA,CAAC,GAAK,EAAA,cAAA,EAAgB,UAAU,CAAC,CAAA;AAEpC,EAAA,IAAI,OAAS,EAAA;AACX,IAAA,2BAAQ,QAAS,EAAA,EAAA,CAAA;AAAA,aACR,KAAO,EAAA;AAChB,IAAO,uBAAA,GAAA,CAAC,cAAW,KAAc,EAAA,CAAA;AAAA;AAGnC,EAAM,MAAA,aAAA,GAAgB,CAAC,UACnB,GAAA,cAAA,IAAkB,EACjB,GAAA,CAAA,cAAA,IAAkB,EAAI,EAAA,MAAA;AAAA,IAAO,SAC5B,oBAAqB,CAAA,GAAA,CAAI,MAAM,IAAI,CAAA,EAAG,WAAW,GAAG;AAAA,GACtD;AAEJ,EACE,uBAAA,GAAA;AAAA,IAAC,aAAA;AAAA,IAAA;AAAA,MACC,KAAA;AAAA,MACA,WAAA;AAAA,MACA,MAAA;AAAA,MACA,YAAc,EAAA,aAAA;AAAA,MACd,SAAW,EAAA,UAAA;AAAA,MACX;AAAA;AAAA,GACF;AAEJ;;;;"}
1
+ {"version":3,"file":"ScorecardsCard.esm.js","sources":["../../../src/components/ScorecardsCard/ScorecardsCard.tsx"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { useMemo } from 'react';\nimport useAsync from 'react-use/esm/useAsync';\nimport { ErrorPanel, Progress } from '@backstage/core-components';\nimport { useApi } from '@backstage/core-plugin-api';\nimport { ScorecardInfo } from '../ScorecardsInfo';\nimport { techInsightsApiRef } from '@backstage-community/plugin-tech-insights-react';\nimport { useEntity } from '@backstage/plugin-catalog-react';\nimport { getCompoundEntityRef } from '@backstage/catalog-model';\nimport { Check } from '@backstage-community/plugin-tech-insights-common';\nimport { ScorecardsGauge } from '../ScorecardsGauge';\n\nexport const ScorecardsCard = (props: {\n title: string;\n description?: string;\n checksId?: string[];\n filter?: (check: Check) => boolean;\n onlyFailed?: boolean;\n expanded?: boolean;\n gauge?: boolean;\n}) => {\n const {\n title,\n description,\n checksId,\n filter,\n onlyFailed,\n gauge,\n expanded = !gauge,\n } = props;\n const api = useApi(techInsightsApiRef);\n const { entity } = useEntity();\n const { value, loading, error } = useAsync(\n async () => await api.runChecks(getCompoundEntityRef(entity), checksId),\n [api, entity, JSON.stringify(checksId)],\n );\n\n const filteredValues =\n !filter || !value ? value : value.filter(val => filter(val.check));\n\n const checkResultRenderers = useMemo(() => {\n if (!onlyFailed || !filteredValues) return {};\n\n const types = [...new Set(filteredValues.map(({ check }) => check.type))];\n const renderers = api.getCheckResultRenderers(types);\n return Object.fromEntries(\n renderers.map(renderer => [renderer.type, renderer]),\n );\n }, [api, filteredValues, onlyFailed]);\n\n if (loading) {\n return <Progress />;\n } else if (error) {\n return <ErrorPanel error={error} />;\n }\n\n const filteredValue = !onlyFailed\n ? filteredValues || []\n : (filteredValues || []).filter(val =>\n checkResultRenderers[val.check.type]?.isFailed?.(val),\n );\n\n return gauge ? (\n <ScorecardsGauge\n title={title}\n description={description}\n entity={entity}\n checkResults={filteredValue}\n noWarning={onlyFailed}\n expanded={expanded}\n />\n ) : (\n <ScorecardInfo\n title={title}\n description={description}\n entity={entity}\n checkResults={filteredValue}\n noWarning={onlyFailed}\n expanded={expanded}\n />\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;AA2Ba,MAAA,cAAA,GAAiB,CAAC,KAQzB,KAAA;AACJ,EAAM,MAAA;AAAA,IACJ,KAAA;AAAA,IACA,WAAA;AAAA,IACA,QAAA;AAAA,IACA,MAAA;AAAA,IACA,UAAA;AAAA,IACA,KAAA;AAAA,IACA,WAAW,CA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AAGnC,EAAM,MAAA,aAAA,GAAgB,CAAC,UACnB,GAAA,cAAA,IAAkB,EACjB,GAAA,CAAA,cAAA,IAAkB,EAAI,EAAA,MAAA;AAAA,IAAO,SAC5B,oBAAqB,CAAA,GAAA,CAAI,MAAM,IAAI,CAAA,EAAG,WAAW,GAAG;AAAA,GACtD;AAEJ,EAAA,OAAO,KACL,mBAAA,GAAA;AAAA,IAAC,eAAA;AAAA,IAAA;AAAA,MACC,KAAA;AAAA,MACA,WAAA;AAAA,MACA,MAAA;AAAA,MACA,YAAc,EAAA,aAAA;AAAA,MACd,SAAW,EAAA,UAAA;AAAA,MACX;AAAA;AAAA,GAGF,mBAAA,GAAA;AAAA,IAAC,aAAA;AAAA,IAAA;AAAA,MACC,KAAA;AAAA,MACA,WAAA;AAAA,MACA,MAAA;AAAA,MACA,YAAc,EAAA,aAAA;AAAA,MACd,SAAW,EAAA,UAAA;AAAA,MACX;AAAA;AAAA,GACF;AAEJ;;;;"}
@@ -16,7 +16,7 @@ const useStyles = makeStyles(() => ({
16
16
  }
17
17
  }));
18
18
  const ScorecardsContent = (props) => {
19
- const { title, description, checksId, filter } = props;
19
+ const { title, description, checksId, filter, dense } = props;
20
20
  const classes = useStyles();
21
21
  const api = useApi(techInsightsApiRef);
22
22
  const { entity } = useEntity();
@@ -36,7 +36,8 @@ const ScorecardsContent = (props) => {
36
36
  title,
37
37
  description,
38
38
  entity,
39
- checkResults: filteredValues || []
39
+ checkResults: filteredValues || [],
40
+ dense
40
41
  }
41
42
  ) }) });
42
43
  };
@@ -1 +1 @@
1
- {"version":3,"file":"ScorecardContent.esm.js","sources":["../../../src/components/ScorecardsContent/ScorecardContent.tsx"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport useAsync from 'react-use/esm/useAsync';\nimport { Content, Page, Progress } from '@backstage/core-components';\nimport { useApi } from '@backstage/core-plugin-api';\nimport { ScorecardInfo } from '../ScorecardsInfo';\nimport Alert from '@material-ui/lab/Alert';\nimport { techInsightsApiRef } from '@backstage-community/plugin-tech-insights-react';\nimport { makeStyles } from '@material-ui/core/styles';\nimport { useEntity } from '@backstage/plugin-catalog-react';\nimport { getCompoundEntityRef } from '@backstage/catalog-model';\nimport { Check } from '@backstage-community/plugin-tech-insights-common';\n\nconst useStyles = makeStyles(() => ({\n contentScorecards: {\n paddingLeft: 0,\n paddingRight: 0,\n },\n}));\n\nexport const ScorecardsContent = (props: {\n title: string;\n description?: string;\n checksId?: string[];\n filter?: (check: Check) => boolean;\n}) => {\n const { title, description, checksId, filter } = props;\n const classes = useStyles();\n const api = useApi(techInsightsApiRef);\n const { entity } = useEntity();\n const { namespace, kind, name } = getCompoundEntityRef(entity);\n const { value, loading, error } = useAsync(\n async () => await api.runChecks({ namespace, kind, name }, checksId),\n );\n\n const filteredValues =\n !filter || !value ? value : value.filter(val => filter(val.check));\n\n if (loading) {\n return <Progress />;\n } else if (error) {\n return <Alert severity=\"error\">{error.message}</Alert>;\n }\n\n return (\n <Page themeId=\"home\">\n <Content className={classes.contentScorecards}>\n <ScorecardInfo\n title={title}\n description={description}\n entity={entity}\n checkResults={filteredValues || []}\n />\n </Content>\n </Page>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;AA2BA,MAAM,SAAA,GAAY,WAAW,OAAO;AAAA,EAClC,iBAAmB,EAAA;AAAA,IACjB,WAAa,EAAA,CAAA;AAAA,IACb,YAAc,EAAA;AAAA;AAElB,CAAE,CAAA,CAAA;AAEW,MAAA,iBAAA,GAAoB,CAAC,KAK5B,KAAA;AACJ,EAAA,MAAM,EAAE,K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* Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport useAsync from 'react-use/esm/useAsync';\nimport { Content, Page, Progress } from '@backstage/core-components';\nimport { useApi } from '@backstage/core-plugin-api';\nimport { ScorecardInfo } from '../ScorecardsInfo';\nimport Alert from '@material-ui/lab/Alert';\nimport { techInsightsApiRef } from '@backstage-community/plugin-tech-insights-react';\nimport { makeStyles } from '@material-ui/core/styles';\nimport { useEntity } from '@backstage/plugin-catalog-react';\nimport { getCompoundEntityRef } from '@backstage/catalog-model';\nimport { Check } from '@backstage-community/plugin-tech-insights-common';\n\nconst useStyles = makeStyles(() => ({\n contentScorecards: {\n paddingLeft: 0,\n paddingRight: 0,\n },\n}));\n\nexport const ScorecardsContent = (props: {\n title: string;\n description?: string;\n checksId?: string[];\n filter?: (check: Check) => boolean;\n dense?: boolean;\n}) => {\n const { title, description, checksId, filter, dense } = props;\n const classes = useStyles();\n const api = useApi(techInsightsApiRef);\n const { entity } = useEntity();\n const { namespace, kind, name } = getCompoundEntityRef(entity);\n const { value, loading, error } = useAsync(\n async () => await api.runChecks({ namespace, kind, name }, checksId),\n );\n\n const filteredValues =\n !filter || !value ? value : value.filter(val => filter(val.check));\n\n if (loading) {\n return <Progress />;\n } else if (error) {\n return <Alert severity=\"error\">{error.message}</Alert>;\n }\n\n return (\n <Page themeId=\"home\">\n <Content className={classes.contentScorecards}>\n <ScorecardInfo\n title={title}\n description={description}\n entity={entity}\n checkResults={filteredValues || []}\n dense={dense}\n />\n </Content>\n </Page>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;AA2BA,MAAM,SAA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,MACC,KAAA;AAAA,MACA,WAAA;AAAA,MACA,MAAA;AAAA,MACA,YAAA,EAAc,kBAAkB,EAAC;AAAA,MACjC;AAAA;AAAA,KAEJ,CACF,EAAA,CAAA;AAEJ;;;;"}
@@ -0,0 +1,40 @@
1
+ import { jsxs, jsx } from 'react/jsx-runtime';
2
+ import { useApi } from '@backstage/core-plugin-api';
3
+ import { techInsightsApiRef } from '@backstage-community/plugin-tech-insights-react';
4
+ import { InfoCard, Gauge } from '@backstage/core-components';
5
+ import { ScorecardInfo } from '../ScorecardsInfo/ScorecardInfo.esm.js';
6
+ import Typography from '@material-ui/core/Typography';
7
+ import Grid from '@material-ui/core/Grid';
8
+
9
+ const ScorecardsGauge = (props) => {
10
+ const { checkResults, entity, title, description, noWarning, expanded } = props;
11
+ const api = useApi(techInsightsApiRef);
12
+ const types = [...new Set(checkResults.map(({ check }) => check.type))];
13
+ const checkResultRenderers = api.getCheckResultRenderers(types);
14
+ const checkResultsWithRenderer = checkResults.map((result) => ({
15
+ result,
16
+ renderer: checkResultRenderers.find(
17
+ (renderer) => renderer.type === result.check.type
18
+ )
19
+ }));
20
+ const succeeded = checkResultsWithRenderer.filter(
21
+ ({ result, renderer }) => !renderer?.isFailed?.(result)
22
+ ).length;
23
+ const progress = succeeded / checkResults.length;
24
+ return /* @__PURE__ */ jsxs(InfoCard, { title, subheader: description, children: [
25
+ /* @__PURE__ */ jsx(Grid, { container: true, justifyContent: "center", children: /* @__PURE__ */ jsx(Grid, { item: true, style: { width: "160px", marginBottom: "1em" }, children: /* @__PURE__ */ jsx(Gauge, { value: progress, size: "small" }) }) }),
26
+ /* @__PURE__ */ jsx(
27
+ ScorecardInfo,
28
+ {
29
+ title: /* @__PURE__ */ jsx(Typography, { variant: "h6", children: "Checks" }),
30
+ checkResults,
31
+ entity,
32
+ noWarning,
33
+ expanded
34
+ }
35
+ )
36
+ ] });
37
+ };
38
+
39
+ export { ScorecardsGauge };
40
+ //# sourceMappingURL=ScorecardsGauge.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ScorecardsGauge.esm.js","sources":["../../../src/components/ScorecardsGauge/ScorecardsGauge.tsx"],"sourcesContent":["/*\n * Copyright 2025 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { CheckResult } from '@backstage-community/plugin-tech-insights-common';\nimport { Entity } from '@backstage/catalog-model';\nimport { useApi } from '@backstage/core-plugin-api';\nimport { techInsightsApiRef } from '@backstage-community/plugin-tech-insights-react';\nimport { Gauge, InfoCard } from '@backstage/core-components';\nimport { ScorecardInfo } from '../ScorecardsInfo';\nimport Typography from '@material-ui/core/Typography';\nimport Grid from '@material-ui/core/Grid';\n\nexport const ScorecardsGauge = (props: {\n checkResults: CheckResult[];\n entity?: Entity;\n title: string;\n description?: string;\n noWarning?: boolean;\n expanded?: boolean;\n}) => {\n const { checkResults, entity, title, description, noWarning, expanded } =\n props;\n\n const api = useApi(techInsightsApiRef);\n\n const types = [...new Set(checkResults.map(({ check }) => check.type))];\n const checkResultRenderers = api.getCheckResultRenderers(types);\n const checkResultsWithRenderer = checkResults.map(result => ({\n result,\n renderer: checkResultRenderers.find(\n renderer => renderer.type === result.check.type,\n ),\n }));\n\n const succeeded = checkResultsWithRenderer.filter(\n ({ result, renderer }) => !renderer?.isFailed?.(result),\n ).length;\n const progress = succeeded / checkResults.length;\n\n return (\n <InfoCard title={title} subheader={description}>\n <Grid container justifyContent=\"center\">\n <Grid item style={{ width: '160px', marginBottom: '1em' }}>\n <Gauge value={progress} size=\"small\" />\n </Grid>\n </Grid>\n <ScorecardInfo\n title={<Typography variant=\"h6\">Chec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AAS,EAAA,YAAA,EAAc,KAAM,EAAA,EACtD,QAAC,kBAAA,GAAA,CAAA,KAAA,EAAA,EAAM,OAAO,QAAU,EAAA,IAAA,EAAK,OAAQ,EAAA,CAAA,EACvC,CACF,EAAA,CAAA;AAAA,oBACA,GAAA;AAAA,MAAC,aAAA;AAAA,MAAA;AAAA,QACC,KAAO,kBAAA,GAAA,CAAC,UAAW,EAAA,EAAA,OAAA,EAAQ,MAAK,QAAM,EAAA,QAAA,EAAA,CAAA;AAAA,QACtC,YAAA;AAAA,QACA,MAAA;AAAA,QACA,SAAA;AAAA,QACA;AAAA;AAAA;AACF,GACF,EAAA,CAAA;AAEJ;;;;"}
@@ -0,0 +1,2 @@
1
+ export { ScorecardsGauge } from './ScorecardsGauge.esm.js';
2
+ //# sourceMappingURL=index.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -21,9 +21,13 @@ const useStyles = makeStyles((theme) => ({
21
21
  },
22
22
  accordionHeaderContent: {
23
23
  margin: `${theme.spacing(2)}px 0 !important`
24
+ },
25
+ accordionDetails: {
26
+ margin: 0,
27
+ paddingBottom: 0
24
28
  }
25
29
  }));
26
- const infoCard = (title, description, classes, element, expanded, summary) => /* @__PURE__ */ jsx(Grid, { item: true, xs: 12, children: /* @__PURE__ */ jsxs(Accordion, { defaultExpanded: expanded, children: [
30
+ const infoAccordion = (title, children, classes, expanded, summary) => /* @__PURE__ */ jsxs(Accordion, { defaultExpanded: expanded, children: [
27
31
  /* @__PURE__ */ jsx(
28
32
  AccordionSummary,
29
33
  {
@@ -38,7 +42,10 @@ const infoCard = (title, description, classes, element, expanded, summary) => /*
38
42
  ] })
39
43
  }
40
44
  ),
41
- /* @__PURE__ */ jsx(AccordionDetails, { children: /* @__PURE__ */ jsxs(Grid, { container: true, children: [
45
+ /* @__PURE__ */ jsx(AccordionDetails, { classes: { root: classes.accordionDetails }, children })
46
+ ] });
47
+ const infoDetails = (description, classes, element) => {
48
+ return /* @__PURE__ */ jsxs(Grid, { container: true, children: [
42
49
  description && /* @__PURE__ */ jsx(Grid, { item: true, xs: 12, children: /* @__PURE__ */ jsx(
43
50
  Typography,
44
51
  {
@@ -49,8 +56,15 @@ const infoCard = (title, description, classes, element, expanded, summary) => /*
49
56
  }
50
57
  ) }),
51
58
  /* @__PURE__ */ jsx(Grid, { item: true, xs: 12, children: element })
52
- ] }) })
53
- ] }) });
59
+ ] });
60
+ };
61
+ const infoCard = (title, description, classes, element, expanded, summary) => /* @__PURE__ */ jsx(Grid, { item: true, xs: 12, children: infoAccordion(
62
+ title,
63
+ infoDetails(description, classes, element),
64
+ classes,
65
+ expanded,
66
+ summary
67
+ ) });
54
68
  const ScorecardInfo = (props) => {
55
69
  const {
56
70
  checkResults,
@@ -58,7 +72,8 @@ const ScorecardInfo = (props) => {
58
72
  entity,
59
73
  description,
60
74
  noWarning,
61
- expanded = true
75
+ expanded = true,
76
+ dense
62
77
  } = props;
63
78
  const classes = useStyles();
64
79
  const api = useApi(techInsightsApiRef);
@@ -84,7 +99,15 @@ const ScorecardInfo = (props) => {
84
99
  title,
85
100
  description,
86
101
  classes,
87
- /* @__PURE__ */ jsx(ScorecardsList, { checkResults, entity }),
102
+ /* @__PURE__ */ jsx(
103
+ ScorecardsList,
104
+ {
105
+ checkResults,
106
+ entity,
107
+ hideDescription: true,
108
+ dense
109
+ }
110
+ ),
88
111
  expanded,
89
112
  `${checkResults.filter((checkResult) => !api.isCheckResultFailed(checkResult)).length}/${checkResults.length}`
90
113
  );
@@ -1 +1 @@
1
- {"version":3,"file":"ScorecardInfo.esm.js","sources":["../../../src/components/ScorecardsInfo/ScorecardInfo.tsx"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { ReactNode } from 'react';\n\nimport * as React from 'react';\nimport Grid from '@material-ui/core/Grid';\nimport Typography from '@material-ui/core/Typography';\nimport { makeStyles } from '@material-ui/core/styles';\nimport { CheckResult } from '@backstage-community/plugin-tech-insights-common';\nimport Alert from '@material-ui/lab/Alert';\nimport { ScorecardsList } from '../ScorecardsList';\nimport ExpandMoreIcon from '@material-ui/icons/ExpandMore';\nimport Accordion from '@material-ui/core/Accordion';\nimport AccordionDetails from '@material-ui/core/AccordionDetails';\nimport AccordionSummary from '@material-ui/core/AccordionSummary';\nimport { useApi } from '@backstage/core-plugin-api';\nimport { Entity } from '@backstage/catalog-model';\nimport { MarkdownContent } from '@backstage/core-components';\nimport { techInsightsApiRef } from '@backstage-community/plugin-tech-insights-react';\n\nconst useStyles = makeStyles(theme => ({\n subheader: {\n paddingLeft: theme.spacing(0.5),\n },\n accordionHeader: {\n borderBottom: `1px solid ${theme.palette.border}`,\n },\n accordionHeaderContent: {\n margin: `${theme.spacing(2)}px 0 !important`,\n },\n}));\n\nconst infoCard = (\n title: React.ReactNode,\n description: string | undefined,\n classes: ReturnType<typeof useStyles>,\n element: React.ReactElement,\n expanded: boolean,\n summary?: string,\n) => (\n <Grid item xs={12}>\n <Accordion defaultExpanded={expanded}>\n <AccordionSummary\n expandIcon={<ExpandMoreIcon />}\n className={classes.accordionHeader}\n classes={{\n content: classes.accordionHeaderContent,\n }}\n >\n <Grid container justifyContent=\"space-between\" alignItems=\"center\">\n <Grid item>\n <Typography variant=\"h5\">{title}</Typography>\n </Grid>\n <Grid item>\n <Typography>{summary}</Typography>\n </Grid>\n </Grid>\n </AccordionSummary>\n <AccordionDetails>\n <Grid container>\n {description && (\n <Grid item xs={12}>\n <Typography\n className={classes.subheader}\n variant=\"body1\"\n gutterBottom\n >\n <MarkdownContent content={description} />\n </Typography>\n </Grid>\n )}\n <Grid item xs={12}>\n {element}\n </Grid>\n </Grid>\n </AccordionDetails>\n </Accordion>\n </Grid>\n);\n\nexport const ScorecardInfo = (props: {\n checkResults: CheckResult[];\n title: ReactNode;\n entity: Entity;\n description?: string;\n noWarning?: boolean;\n expanded?: boolean;\n}) => {\n const {\n checkResults,\n title,\n entity,\n description,\n noWarning,\n expanded = true,\n } = props;\n const classes = useStyles();\n const api = useApi(techInsightsApiRef);\n\n if (!checkResults.length) {\n if (noWarning) {\n return infoCard(\n title,\n description,\n classes,\n <Alert severity=\"info\">\n All checks passed, or no checks have been performed yet\n </Alert>,\n expanded,\n );\n }\n return infoCard(\n title,\n description,\n classes,\n <Alert severity=\"warning\">No checks have any data yet.</Alert>,\n expanded,\n );\n }\n\n return infoCard(\n title,\n description,\n classes,\n <ScorecardsList checkResults={checkResults} entity={entity} />,\n expanded,\n `${\n checkResults.filter(checkResult => !api.isCheckResultFailed(checkResult))\n .length\n }/${checkResults.length}`,\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;AAkCA,MAAM,SAAA,GAAY,WAAW,CAAU,KAAA,MAAA;AAAA,EACrC,SAAW,EAAA;AAAA,IACT,WAAA,EAAa,KAAM,CAAA,OAAA,CAAQ,GAAG;AAAA,GAChC;AAAA,EACA,eAAiB,EAAA;AAAA,IACf,YAAc,EAAA,CAAA,UAAA,EAAa,KAAM,CAAA,OAAA,CAAQ,MAAM,CAAA;AAAA,GACjD;AAAA,EACA,sBAAwB,EAAA;AAAA,IACtB,MAAQ,EAAA,CAAA,EAAG,KAAM,CAAA,OAAA,CAAQ,CAAC,CAAC,CAAA,eAAA;AAAA;AAE/B,CAAE,CAAA,CAAA;AAEF,MAAM,WAAW,CACf,KAAA,EACA,WACA,EAAA,OAAA,EACA,SACA,QACA,EAAA,OAAA,qBAEC,GAAA,CAAA,IAAA,EAAA,EAAK,MAAI,IAAC,EAAA,EAAA,EAAI,IACb,QAAC,k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/ScorecardInfo.tsx"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { ReactElement, ReactNode } from 'react';\nimport Grid from '@material-ui/core/Grid';\nimport Typography from '@material-ui/core/Typography';\nimport { makeStyles } from '@material-ui/core/styles';\nimport { CheckResult } from '@backstage-community/plugin-tech-insights-common';\nimport Alert from '@material-ui/lab/Alert';\nimport { ScorecardsList } from '../ScorecardsList';\nimport ExpandMoreIcon from '@material-ui/icons/ExpandMore';\nimport Accordion from '@material-ui/core/Accordion';\nimport AccordionDetails from '@material-ui/core/AccordionDetails';\nimport AccordionSummary from '@material-ui/core/AccordionSummary';\nimport { useApi } from '@backstage/core-plugin-api';\nimport { Entity } from '@backstage/catalog-model';\nimport { MarkdownContent } from '@backstage/core-components';\nimport { techInsightsApiRef } from '@backstage-community/plugin-tech-insights-react';\n\nconst useStyles = makeStyles(theme => ({\n subheader: {\n paddingLeft: theme.spacing(0.5),\n },\n accordionHeader: {\n borderBottom: `1px solid ${theme.palette.border}`,\n },\n accordionHeaderContent: {\n margin: `${theme.spacing(2)}px 0 !important`,\n },\n accordionDetails: {\n margin: 0,\n paddingBottom: 0,\n },\n}));\n\nconst infoAccordion = (\n title: ReactNode,\n children: ReactNode,\n classes: ReturnType<typeof useStyles>,\n expanded: boolean,\n summary?: string,\n) => (\n <Accordion defaultExpanded={expanded}>\n <AccordionSummary\n expandIcon={<ExpandMoreIcon />}\n className={classes.accordionHeader}\n classes={{\n content: classes.accordionHeaderContent,\n }}\n >\n <Grid container justifyContent=\"space-between\" alignItems=\"center\">\n <Grid item>\n <Typography variant=\"h5\">{title}</Typography>\n </Grid>\n <Grid item>\n <Typography>{summary}</Typography>\n </Grid>\n </Grid>\n </AccordionSummary>\n <AccordionDetails classes={{ root: classes.accordionDetails }}>\n {children}\n </AccordionDetails>\n </Accordion>\n);\n\nconst infoDetails = (\n description: string | undefined,\n classes: ReturnType<typeof useStyles>,\n element: ReactElement,\n) => {\n return (\n <Grid container>\n {description && (\n <Grid item xs={12}>\n <Typography\n className={classes.subheader}\n variant=\"body1\"\n gutterBottom\n >\n <MarkdownContent content={description} />\n </Typography>\n </Grid>\n )}\n <Grid item xs={12}>\n {element}\n </Grid>\n </Grid>\n );\n};\n\nconst infoCard = (\n title: ReactNode,\n description: string | undefined,\n classes: ReturnType<typeof useStyles>,\n element: ReactElement,\n expanded: boolean,\n summary?: string,\n) => (\n <Grid item xs={12}>\n {infoAccordion(\n title,\n infoDetails(description, classes, element),\n classes,\n expanded,\n summary,\n )}\n </Grid>\n);\n\nexport const ScorecardInfo = (props: {\n checkResults: CheckResult[];\n title: ReactNode;\n entity?: Entity;\n description?: string;\n noWarning?: boolean;\n expanded?: boolean;\n dense?: boolean;\n}) => {\n const {\n checkResults,\n title,\n entity,\n description,\n noWarning,\n expanded = true,\n dense,\n } = props;\n const classes = useStyles();\n const api = useApi(techInsightsApiRef);\n\n if (!checkResults.length) {\n if (noWarning) {\n return infoCard(\n title,\n description,\n classes,\n <Alert severity=\"info\">\n All checks passed, or no checks have been performed yet\n </Alert>,\n expanded,\n );\n }\n return infoCard(\n title,\n description,\n classes,\n <Alert severity=\"warning\">No checks have any data yet.</Alert>,\n expanded,\n );\n }\n\n return infoCard(\n title,\n description,\n classes,\n <ScorecardsList\n checkResults={checkResults}\n entity={entity}\n hideDescription\n dense={dense}\n />,\n expanded,\n `${\n checkResults.filter(checkResult => !api.isCheckResultFailed(checkResult))\n .length\n }/${checkResults.length}`,\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;AAgCA,MAAM,SAAA,GAAY,WAA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;AAAA,IACX;AAAA,GACE,GAAA,KAAA;AACJ,EAAA,MAAM,UAAU,SAAU,EAAA;AAC1B,EAAM,MAAA,GAAA,GAAM,OAAO,kBAAkB,CAAA;AAErC,EAAI,IAAA,CAAC,aAAa,MAAQ,EAAA;AACxB,IAAA,IAAI,SAAW,EAAA;AACb,MAAO,OAAA,QAAA;AAAA,QACL,KAAA;AAAA,QACA,WAAA;AAAA,QACA,OAAA;AAAA,wBACC,GAAA,CAAA,KAAA,EAAA,EAAM,QAAS,EAAA,MAAA,EAAO,QAEvB,EAAA,yDAAA,EAAA,CAAA;AAAA,QACA;AAAA,OACF;AAAA;AAEF,IAAO,OAAA,QAAA;AAAA,MACL,KAAA;AAAA,MACA,WAAA;AAAA,MACA,OAAA;AAAA,sBACC,GAAA,CAAA,KAAA,EAAA,EAAM,QAAS,EAAA,SAAA,EAAU,QAA4B,EAAA,8BAAA,EAAA,CAAA;AAAA,MACtD;AAAA,KACF;AAAA;AAGF,EAAO,OAAA,QAAA;AAAA,IACL,KAAA;AAAA,IACA,WAAA;AAAA,IACA,OAAA;AAAA,oBACA,GAAA;AAAA,MAAC,cAAA;AAAA,MAAA;AAAA,QACC,YAAA;AAAA,QACA,MAAA;AAAA,QACA,eAAe,EAAA,IAAA;AAAA,QACf;AAAA;AAAA,KACF;AAAA,IACA,QAAA;AAAA,IACA,CACE,EAAA,YAAA,CAAa,MAAO,CAAA,CAAA,WAAA,KAAe,CAAC,GAAA,CAAI,mBAAoB,CAAA,WAAW,CAAC,CAAA,CACrE,MACL,CAAA,CAAA,EAAI,aAAa,MAAM,CAAA;AAAA,GACzB;AACF;;;;"}
@@ -2,48 +2,55 @@ import { jsx, jsxs } from 'react/jsx-runtime';
2
2
  import { useApi } from '@backstage/core-plugin-api';
3
3
  import List from '@material-ui/core/List';
4
4
  import ListItem from '@material-ui/core/ListItem';
5
- import ListItemSecondaryAction from '@material-ui/core/ListItemSecondaryAction';
6
5
  import ListItemText from '@material-ui/core/ListItemText';
7
6
  import { makeStyles } from '@material-ui/core/styles';
8
7
  import { MarkdownContent } from '@backstage/core-components';
9
8
  import { techInsightsApiRef, ResultCheckIcon } from '@backstage-community/plugin-tech-insights-react';
9
+ import Tooltip from '@material-ui/core/Tooltip';
10
10
 
11
11
  const useStyles = makeStyles((theme) => ({
12
12
  listItemText: {
13
13
  paddingRight: theme.spacing(0.5)
14
14
  }
15
15
  }));
16
+ const itemTooltip = (children, title, enabled) => enabled ? /* @__PURE__ */ jsx(Tooltip, { title, children }) : children;
16
17
  const ScorecardsList = (props) => {
17
- const { checkResults, entity } = props;
18
+ const { checkResults, entity, dense, hideDescription } = props;
18
19
  const classes = useStyles();
19
20
  const api = useApi(techInsightsApiRef);
20
21
  const types = [...new Set(checkResults.map(({ check }) => check.type))];
21
22
  const checkResultRenderers = api.getCheckResultRenderers(types);
22
- return /* @__PURE__ */ jsx(List, { children: checkResults.map((result, index) => {
23
+ return /* @__PURE__ */ jsx(List, { dense, disablePadding: true, children: checkResults.map((result, index) => {
23
24
  const checkResultRenderer = checkResultRenderers.find(
24
- (renderer) => renderer.type === result.check.type
25
+ (renderer2) => renderer2.type === result.check.type
26
+ );
27
+ const renderer = checkResultRenderer?.description;
28
+ const description = renderer ? renderer(result) : /* @__PURE__ */ jsx(MarkdownContent, { content: result.check.description });
29
+ return itemTooltip(
30
+ /* @__PURE__ */ jsxs(ListItem, { disableGutters: true, children: [
31
+ /* @__PURE__ */ jsx(
32
+ ListItemText,
33
+ {
34
+ primary: result.check.name,
35
+ ...!props.hideDescription ? {
36
+ secondary: description
37
+ } : {},
38
+ className: classes.listItemText
39
+ },
40
+ index
41
+ ),
42
+ /* @__PURE__ */ jsx(
43
+ ResultCheckIcon,
44
+ {
45
+ result,
46
+ entity,
47
+ checkResultRenderer
48
+ }
49
+ )
50
+ ] }, result.check.id),
51
+ description,
52
+ hideDescription
25
53
  );
26
- const description = checkResultRenderer?.description;
27
- return /* @__PURE__ */ jsxs(ListItem, { children: [
28
- /* @__PURE__ */ jsx(
29
- ListItemText,
30
- {
31
- primary: result.check.name,
32
- secondary: description ? description(result) : /* @__PURE__ */ jsx(MarkdownContent, { content: result.check.description }),
33
- className: classes.listItemText
34
- },
35
- index
36
- ),
37
- /* @__PURE__ */ jsx(
38
- ResultCheckIcon,
39
- {
40
- result,
41
- entity,
42
- component: ListItemSecondaryAction,
43
- checkResultRenderer
44
- }
45
- )
46
- ] }, result.check.id);
47
54
  }) });
48
55
  };
49
56
 
@@ -1 +1 @@
1
- {"version":3,"file":"ScorecardsList.esm.js","sources":["../../../src/components/ScorecardsList/ScorecardsList.tsx"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { useApi } from '@backstage/core-plugin-api';\nimport List from '@material-ui/core/List';\nimport ListItem from '@material-ui/core/ListItem';\nimport ListItemSecondaryAction from '@material-ui/core/ListItemSecondaryAction';\nimport ListItemText from '@material-ui/core/ListItemText';\nimport { makeStyles } from '@material-ui/core/styles';\nimport { CheckResult } from '@backstage-community/plugin-tech-insights-common';\nimport { MarkdownContent } from '@backstage/core-components';\nimport { Entity } from '@backstage/catalog-model';\nimport {\n ResultCheckIcon,\n techInsightsApiRef,\n} from '@backstage-community/plugin-tech-insights-react';\n\nconst useStyles = makeStyles(theme => ({\n listItemText: {\n paddingRight: theme.spacing(0.5),\n },\n}));\n\nexport const ScorecardsList = (props: {\n checkResults: CheckResult[];\n entity?: Entity;\n}) => {\n const { checkResults, entity } = props;\n\n const classes = useStyles();\n const api = useApi(techInsightsApiRef);\n\n const types = [...new Set(checkResults.map(({ check }) => check.type))];\n const checkResultRenderers = api.getCheckResultRenderers(types);\n\n return (\n <List>\n {checkResults.map((result, index) => {\n const checkResultRenderer = checkResultRenderers.find(\n renderer => renderer.type === result.check.type,\n );\n\n const description = checkResultRenderer?.description;\n\n return (\n <ListItem key={result.check.id}>\n <ListItemText\n key={index}\n primary={result.check.name}\n secondary={\n description ? (\n description(result)\n ) : (\n <MarkdownContent content={result.check.description} />\n )\n }\n className={classes.listItemText}\n />\n <ResultCheckIcon\n result={result}\n entity={entity}\n component={ListItemSecondaryAction}\n checkResultRenderer={checkResultRenderer}\n />\n </ListItem>\n );\n })}\n </List>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;AA8BA,MAAM,SAAA,GAAY,WAAW,CAAU,KAAA,MAAA;AAAA,EACrC,YAAc,EAAA;AAAA,IACZ,YAAA,EAAc,KAAM,CAAA,OAAA,CAAQ,GAAG;AAAA;AAEnC,CAAE,CAAA,CAAA;AAEW,MAAA,cAAA,GAAiB,CAAC,KAGzB,KAAA;AACJ,EAAM,MAAA,EAAE,YAAc,EAAA,MAAA,EAAW,GAAA,KAAA;AAEjC,EAAA,MAAM,UAAU,SAAU,EAAA;AAC1B,EAAM,MAAA,GAAA,GAAM,OAAO,kBAAkB,CAAA;AAErC,EAAA,MAAM,KAAQ,GAAA,CAAC,GAAG,IAAI,IAAI,YAAa,CAAA,GAAA,CAAI,CAAC,EAAE,KAAM,EAAA,KAAM,KAAM,CAAA,IAAI,CAAC,CAAC,CAAA;AACtE,EAAM,MAAA,oBAAA,GAAuB,GAAI,CAAA,uBAAA,CAAwB,KAAK,CAAA;AAE9D,EAAA,2BACG,IACE,EAAA,EAAA,QAAA,EAAA,YAAA,CAAa,GAAI,CAAA,CAAC,QAAQ,KAAU,KAAA;AACnC,IAAA,MAAM,sBAAsB,oBAAqB,CAAA,IAAA;AAAA,MAC/C,CAAY,QAAA,KAAA,QAAA,CAAS,IAAS,KAAA,MAAA,CAAO,KAAM,CAAA;AAAA,KAC7C;AAEA,IAAA,MAAM,cAAc,mBAAqB,EAAA,WAAA;AAEzC,IAAA,4BACG,QACC,EAAA,EAAA,QAAA,EAAA;AAAA,sBAAA,GAAA;AAAA,QAAC,YAAA;AAAA,QAAA;AAAA,UAEC,OAAA,EAAS,OAAO,KAAM,CAAA,IAAA;AAAA,UACtB,SAAA,EACE,WACE,GAAA,WAAA,CAAY,MAAM,CAAA,uBAEjB,eAAgB,EAAA,EAAA,OAAA,EAAS,MAAO,CAAA,KAAA,CAAM,WAAa,EAAA,CAAA;AAAA,UAGxD,WAAW,OAAQ,CAAA;AAAA,SAAA;AAAA,QATd;AAAA,OAUP;AAAA,sBACA,GAAA;AAAA,QAAC,eAAA;AAAA,QAAA;AAAA,UACC,MAAA;AAAA,UACA,MAAA;AAAA,UACA,SAAW,EAAA,uBAAA;AAAA,UACX;AAAA;AAAA;AACF,KAlBa,EAAA,EAAA,MAAA,CAAO,MAAM,EAmB5B,CAAA;AAAA,GAEH,CACH,EAAA,CAAA;AAEJ;;;;"}
1
+ {"version":3,"file":"ScorecardsList.esm.js","sources":["../../../src/components/ScorecardsList/ScorecardsList.tsx"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { useApi } from '@backstage/core-plugin-api';\nimport List from '@material-ui/core/List';\nimport ListItem from '@material-ui/core/ListItem';\nimport ListItemText from '@material-ui/core/ListItemText';\nimport { makeStyles } from '@material-ui/core/styles';\nimport { CheckResult } from '@backstage-community/plugin-tech-insights-common';\nimport { MarkdownContent } from '@backstage/core-components';\nimport { Entity } from '@backstage/catalog-model';\nimport {\n ResultCheckIcon,\n techInsightsApiRef,\n} from '@backstage-community/plugin-tech-insights-react';\nimport Tooltip from '@material-ui/core/Tooltip';\n\nconst useStyles = makeStyles(theme => ({\n listItemText: {\n paddingRight: theme.spacing(0.5),\n },\n}));\nconst itemTooltip = (\n children: React.ReactElement,\n title: string | NonNullable<React.ReactNode>,\n enabled?: boolean,\n) => (enabled ? <Tooltip title={title}>{children}</Tooltip> : children);\n\nexport const ScorecardsList = (props: {\n checkResults: CheckResult[];\n entity?: Entity;\n dense?: boolean;\n hideDescription?: boolean;\n}) => {\n const { checkResults, entity, dense, hideDescription } = props;\n\n const classes = useStyles();\n const api = useApi(techInsightsApiRef);\n\n const types = [...new Set(checkResults.map(({ check }) => check.type))];\n const checkResultRenderers = api.getCheckResultRenderers(types);\n\n return (\n <List dense={dense} disablePadding>\n {checkResults.map((result, index) => {\n const checkResultRenderer = checkResultRenderers.find(\n renderer => renderer.type === result.check.type,\n );\n const renderer = checkResultRenderer?.description;\n const description = renderer ? (\n renderer(result)\n ) : (\n <MarkdownContent content={result.check.description} />\n );\n\n return itemTooltip(\n <ListItem key={result.check.id} disableGutters>\n <ListItemText\n key={index}\n primary={result.check.name}\n {...(!props.hideDescription\n ? {\n secondary: description,\n }\n : {})}\n className={classes.listItemText}\n />\n <ResultCheckIcon\n result={result}\n entity={entity}\n checkResultRenderer={checkResultRenderer}\n />\n </ListItem>,\n description,\n hideDescription,\n );\n })}\n </List>\n );\n};\n"],"names":["renderer"],"mappings":";;;;;;;;;;AA8BA,MAAM,SAAA,GAAY,WAAW,CAAU,KAAA,MAAA;AAAA,EACrC,YAAc,EAAA;AAAA,IACZ,YAAA,EAAc,KAAM,CAAA,OAAA,CAAQ,GAAG;AAAA;AAEnC,CAAE,CAAA,CAAA;AACF,MAAM,WAAA,GAAc,CAClB,QAAA,EACA,KACA,EAAA,OAAA,KACI,0BAAW,GAAA,CAAA,OAAA,EAAA,EAAQ,KAAe,EAAA,QAAA,EAAS,CAAa,GAAA,QAAA;AAEjD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APd;AAAA,SAQP;AAAA,wBACA,GAAA;AAAA,UAAC,eAAA;AAAA,UAAA;AAAA,YACC,MAAA;AAAA,YACA,MAAA;AAAA,YACA;AAAA;AAAA;AACF,OAfa,EAAA,EAAA,MAAA,CAAO,MAAM,EAgB5B,CAAA;AAAA,MACA,WAAA;AAAA,MACA;AAAA,KACF;AAAA,GACD,CACH,EAAA,CAAA;AAEJ;;;;"}
@@ -9,8 +9,9 @@ import Grid from '@material-ui/core/Grid';
9
9
  import { Filters } from './Filters.esm.js';
10
10
  import { ExportCsv } from '@material-table/exporters';
11
11
  import { techInsightsApiRef } from '@backstage-community/plugin-tech-insights-react';
12
+ import { ScorecardsBadge } from '../ScorecardsBadge/ScorecardsBadge.esm.js';
12
13
 
13
- const ScorecardsPage = () => {
14
+ const ScorecardsPage = (props) => {
14
15
  const api = useApi(techInsightsApiRef);
15
16
  const [filterSelectedChecks, setFilterSelectedChecks] = useState([]);
16
17
  const [filterWithResults, setFilterWithResults] = useState(true);
@@ -21,7 +22,10 @@ const ScorecardsPage = () => {
21
22
  label: "Export CSV",
22
23
  exportFunc: (cols, datas) => ExportCsv(cols, datas, "tech-insights")
23
24
  }
24
- ]
25
+ ],
26
+ pageSize: props.badge ? 15 : 5,
27
+ pageSizeOptions: props.badge ? [15, 30, 100] : [5, 10, 20],
28
+ padding: `${props.dense ? "dense" : "default"}`
25
29
  };
26
30
  const { value, loading, error } = useAsync(async () => {
27
31
  const checks = await api.getAllChecks();
@@ -41,7 +45,7 @@ const ScorecardsPage = () => {
41
45
  {
42
46
  field: "results",
43
47
  title: "Results",
44
- render: (row) => /* @__PURE__ */ jsx(ScorecardsList, { checkResults: row.results }),
48
+ render: (row) => props.badge ? /* @__PURE__ */ jsx(ScorecardsBadge, { checkResults: row.results }) : /* @__PURE__ */ jsx(ScorecardsList, { checkResults: row.results, dense: props.dense }),
45
49
  export: false
46
50
  }
47
51
  ];
@@ -57,7 +61,7 @@ const ScorecardsPage = () => {
57
61
  });
58
62
  });
59
63
  return columns;
60
- }, [value, filterSelectedChecks]);
64
+ }, [props, value, filterSelectedChecks]);
61
65
  if (error) {
62
66
  return /* @__PURE__ */ jsx(ErrorPanel, { error });
63
67
  }
@@ -1 +1 @@
1
- {"version":3,"file":"ScorecardsPage.esm.js","sources":["../../../src/components/ScorecardsPage/ScorecardsPage.tsx"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { useMemo, useState } from 'react';\nimport {\n Content,\n ErrorPanel,\n Header,\n HeaderLabel,\n Page,\n TableColumn,\n Table,\n TableOptions,\n} from '@backstage/core-components';\nimport { useApi } from '@backstage/core-plugin-api';\nimport {\n Check,\n BulkCheckResponse,\n} from '@backstage-community/plugin-tech-insights-common';\nimport useAsync from 'react-use/lib/useAsync';\nimport { EntityRefLink } from '@backstage/plugin-catalog-react';\nimport { ScorecardsList } from '../ScorecardsList';\nimport Grid from '@material-ui/core/Grid';\nimport { Filters } from './Filters';\nimport { ExportCsv as exportCsv } from '@material-table/exporters';\nimport { techInsightsApiRef } from '@backstage-community/plugin-tech-insights-react';\n\nexport const ScorecardsPage = () => {\n const api = useApi(techInsightsApiRef);\n const [filterSelectedChecks, setFilterSelectedChecks] = useState<Check[]>([]);\n const [filterWithResults, setFilterWithResults] = useState<boolean>(true);\n const tableOptions: TableOptions = {\n exportAllData: true,\n exportMenu: [\n {\n label: 'Export CSV',\n exportFunc: (cols, datas) => exportCsv(cols, datas, 'tech-insights'),\n },\n ],\n };\n\n const { value, loading, error } = useAsync(async () => {\n const checks = await api.getAllChecks();\n const result = await api.runBulkChecks([], filterSelectedChecks);\n\n return {\n checks,\n result: filterWithResults\n ? result.filter(response => response.results.length > 0)\n : result,\n };\n }, [api, filterSelectedChecks, filterWithResults]);\n\n const tableColumns = useMemo(() => {\n const columns: TableColumn<BulkCheckResponse[0]>[] = [\n {\n field: 'entity',\n title: 'Entity',\n render: row => <EntityRefLink entityRef={row.entity} />,\n },\n {\n field: 'results',\n title: 'Results',\n render: row => <ScorecardsList checkResults={row.results} />,\n export: false,\n },\n ];\n\n (filterSelectedChecks.length === 0\n ? value?.checks || []\n : filterSelectedChecks\n ).forEach(check => {\n columns.push({\n field: check.id,\n title: check.name,\n customExport: row =>\n `${\n row.results.filter(\n result => result && result.check && result.check.id === check.id,\n )[0]?.result\n }`,\n hidden: true,\n export: true,\n });\n });\n\n return columns;\n }, [value, filterSelectedChecks]);\n\n if (error) {\n return <ErrorPanel error={error} />;\n }\n\n return (\n <Page themeId=\"tool\">\n <Header title=\"Tech insights\">\n <HeaderLabel label=\"Entities\" value={value?.result.length ?? 0} />\n <HeaderLabel label=\"Checks\" value={value?.checks.length ?? 0} />\n </Header>\n <Content>\n <Grid container>\n <Grid item style={{ width: '300px' }}>\n <Filters\n checksChanged={checks => setFilterSelectedChecks(checks)}\n withResultsChanged={withResults =>\n setFilterWithResults(withResults)\n }\n />\n </Grid>\n <Grid item xs>\n <Table\n columns={tableColumns}\n data={value?.result ?? []}\n isLoading={loading}\n options={tableOptions}\n />\n </Grid>\n </Grid>\n </Content>\n </Page>\n );\n};\n"],"names":["exportCsv"],"mappings":";;;;;;;;;;;;AAwCO,MAAM,iBAAiB,MAAM;AAClC,EAAM,MAAA,GAAA,GAAM,OAAO,kBAAkB,CAAA;AACrC,EAAA,MAAM,CAAC,oBAAsB,EAAA,uBAAuB,CAAI,GAAA,QAAA,CAAkB,EAAE,CAAA;AAC5E,EAAA,MAAM,CAAC,iBAAA,EAAmB,oBAAoB,CAAA,GAAI,SAAkB,IAAI,CAAA;AACxE,EAAA,MAAM,YAA6B,GA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A;AAAA,QAAA;AAAA,UACC,aAAA,EAAe,CAAU,MAAA,KAAA,uBAAA,CAAwB,MAAM,CAAA;AAAA,UACvD,kBAAA,EAAoB,CAClB,WAAA,KAAA,oBAAA,CAAqB,WAAW;AAAA;AAAA,OAGtC,EAAA,CAAA;AAAA,sBACC,GAAA,CAAA,IAAA,EAAA,EAAK,IAAI,EAAA,IAAA,EAAC,IAAE,IACX,EAAA,QAAA,kBAAA,GAAA;AAAA,QAAC,KAAA;AAAA,QAAA;AAAA,UACC,OAAS,EAAA,YAAA;AAAA,UACT,IAAA,EAAM,KAAO,EAAA,MAAA,IAAU,EAAC;AAAA,UACxB,SAAW,EAAA,OAAA;AAAA,UACX,OAAS,EAAA;AAAA;AAAA,OAEb,EAAA;AAAA,KAAA,EACF,CACF,EAAA;AAAA,GACF,EAAA,CAAA;AAEJ;;;;"}
1
+ {"version":3,"file":"ScorecardsPage.esm.js","sources":["../../../src/components/ScorecardsPage/ScorecardsPage.tsx"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { useMemo, useState } from 'react';\nimport {\n Content,\n ErrorPanel,\n Header,\n HeaderLabel,\n Page,\n TableColumn,\n Table,\n TableOptions,\n} from '@backstage/core-components';\nimport { useApi } from '@backstage/core-plugin-api';\nimport {\n Check,\n BulkCheckResponse,\n} from '@backstage-community/plugin-tech-insights-common';\nimport useAsync from 'react-use/lib/useAsync';\nimport { EntityRefLink } from '@backstage/plugin-catalog-react';\nimport { ScorecardsList } from '../ScorecardsList';\nimport Grid from '@material-ui/core/Grid';\nimport { Filters } from './Filters';\nimport { ExportCsv as exportCsv } from '@material-table/exporters';\nimport { techInsightsApiRef } from '@backstage-community/plugin-tech-insights-react';\nimport { ScorecardsBadge } from '../ScorecardsBadge';\n\nexport const ScorecardsPage = (props: { badge?: boolean; dense?: boolean }) => {\n const api = useApi(techInsightsApiRef);\n const [filterSelectedChecks, setFilterSelectedChecks] = useState<Check[]>([]);\n const [filterWithResults, setFilterWithResults] = useState<boolean>(true);\n const tableOptions: TableOptions = {\n exportAllData: true,\n exportMenu: [\n {\n label: 'Export CSV',\n exportFunc: (cols, datas) => exportCsv(cols, datas, 'tech-insights'),\n },\n ],\n pageSize: props.badge ? 15 : 5,\n pageSizeOptions: props.badge ? [15, 30, 100] : [5, 10, 20],\n padding: `${props.dense ? 'dense' : 'default'}`,\n };\n\n const { value, loading, error } = useAsync(async () => {\n const checks = await api.getAllChecks();\n const result = await api.runBulkChecks([], filterSelectedChecks);\n\n return {\n checks,\n result: filterWithResults\n ? result.filter(response => response.results.length > 0)\n : result,\n };\n }, [api, filterSelectedChecks, filterWithResults]);\n\n const tableColumns = useMemo(() => {\n const columns: TableColumn<BulkCheckResponse[0]>[] = [\n {\n field: 'entity',\n title: 'Entity',\n render: row => <EntityRefLink entityRef={row.entity} />,\n },\n {\n field: 'results',\n title: 'Results',\n render: row =>\n props.badge ? (\n <ScorecardsBadge checkResults={row.results} />\n ) : (\n <ScorecardsList checkResults={row.results} dense={props.dense} />\n ),\n export: false,\n },\n ];\n\n (filterSelectedChecks.length === 0\n ? value?.checks || []\n : filterSelectedChecks\n ).forEach(check => {\n columns.push({\n field: check.id,\n title: check.name,\n customExport: row =>\n `${\n row.results.filter(\n result => result && result.check && result.check.id === check.id,\n )[0]?.result\n }`,\n hidden: true,\n export: true,\n });\n });\n\n return columns;\n }, [props, value, filterSelectedChecks]);\n\n if (error) {\n return <ErrorPanel error={error} />;\n }\n\n return (\n <Page themeId=\"tool\">\n <Header title=\"Tech insights\">\n <HeaderLabel label=\"Entities\" value={value?.result.length ?? 0} />\n <HeaderLabel label=\"Checks\" value={value?.checks.length ?? 0} />\n </Header>\n <Content>\n <Grid container>\n <Grid item style={{ width: '300px' }}>\n <Filters\n checksChanged={checks => setFilterSelectedChecks(checks)}\n withResultsChanged={withResults =>\n setFilterWithResults(withResults)\n }\n />\n </Grid>\n <Grid item xs>\n <Table\n columns={tableColumns}\n data={value?.result ?? []}\n isLoading={loading}\n options={tableOptions}\n />\n </Grid>\n </Grid>\n </Content>\n </Page>\n );\n};\n"],"names":["exportCsv"],"mappings":";;;;;;;;;;;;;AAyCa,MAAA,cAAA,GAAiB,CAAC,KAAgD,KAAA;AAC7E,EAAM,MAAA,GAAA,GAAM,OAAO,kBAAkB,CAAA;AACrC,EAAA,MAAM,CAAC,oBAAsB,EAAA,uBAAuB,CAAI,GAAA,QAAA,CAAkB,EAAE,CAAA;AAC5E,EAAA,MAAM,CAAC,iBAAA,EAAmB,oBAAoB,CAAA,GAAI,SAAkB,IAAI,CAAA;AACxE,EAAA,MAAM,YAA6B,GAAA;AAAA,IACjC,aAAe,EAAA,IAAA;AAAA,IACf,UAAY,EAAA;AAAA,MACV;AAAA,QACE,KAAO,EAAA,YAAA;AAAA,QACP,YAAY,CAAC,IAAA,EAAM,UAAUA,SAAU,CAAA,IAAA,EAAM,OAAO,eAAe;AAAA;AACrE,KACF;AAAA,IACA,QAAA,EAAU,KAAM,CAAA,KAAA,GAAQ,EAAK,GAAA,CAAA;AAAA,IAC7B,eAAA,EAAiB,KAAM,CAAA,KAAA,GAAQ,CAAC,EAAA,EAAI,EAAI,EAAA,GAAG,CAAI,GAAA,CAAC,CAAG,EAAA,EAAA,EAAI,EAAE,CAAA;AAAA,IACzD,OAAS,EAAA,CAAA,EAAG,KAAM,CAAA,KAAA,GAAQ,UAAU,SAAS,CAAA;AAAA,GAC/C;AAEA,EAAA,MAAM,EAAE,KAAO,EAAA,OAAA,EAAS,KAAM,EAAA,GAAI,SAAS,YAAY;AACrD,IAAM,MAAA,MAAA,GAAS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AAA,sBACC,GAAA,CAAA,IAAA,EAAA,EAAK,IAAI,EAAA,IAAA,EAAC,IAAE,IACX,EAAA,QAAA,kBAAA,GAAA;AAAA,QAAC,KAAA;AAAA,QAAA;AAAA,UACC,OAAS,EAAA,YAAA;AAAA,UACT,IAAA,EAAM,KAAO,EAAA,MAAA,IAAU,EAAC;AAAA,UACxB,SAAW,EAAA,OAAA;AAAA,UACX,OAAS,EAAA;AAAA;AAAA,OAEb,EAAA;AAAA,KAAA,EACF,CACF,EAAA;AAAA,GACF,EAAA,CAAA;AAEJ;;;;"}
package/dist/index.d.ts CHANGED
@@ -20,17 +20,23 @@ declare const techInsightsPlugin: _backstage_core_plugin_api.BackstagePlugin<{
20
20
  declare const ScorecardInfo: (props: {
21
21
  checkResults: _backstage_community_plugin_tech_insights_common.CheckResult[];
22
22
  title: react.ReactNode;
23
- entity: _backstage_catalog_model.Entity;
23
+ entity?: _backstage_catalog_model.Entity | undefined;
24
24
  description?: string | undefined;
25
25
  noWarning?: boolean | undefined;
26
26
  expanded?: boolean | undefined;
27
+ dense?: boolean | undefined;
27
28
  }) => react_jsx_runtime.JSX.Element;
28
29
  /**
29
30
  * @public
30
31
  */
31
32
  declare const ScorecardsList: (props: {
32
33
  checkResults: _backstage_community_plugin_tech_insights_common.CheckResult[];
34
+ /**
35
+ * @public
36
+ */
33
37
  entity?: _backstage_catalog_model.Entity | undefined;
38
+ dense?: boolean | undefined;
39
+ hideDescription?: boolean | undefined;
34
40
  }) => react_jsx_runtime.JSX.Element;
35
41
  /**
36
42
  * @public
@@ -40,6 +46,7 @@ declare const EntityTechInsightsScorecardContent: (props: {
40
46
  description?: string | undefined;
41
47
  checksId?: string[] | undefined;
42
48
  filter?: ((check: _backstage_community_plugin_tech_insights_common.Check) => boolean) | undefined;
49
+ dense?: boolean | undefined;
43
50
  }) => react_jsx_runtime.JSX.Element;
44
51
  /**
45
52
  * @public
@@ -51,11 +58,15 @@ declare const EntityTechInsightsScorecardCard: (props: {
51
58
  filter?: ((check: _backstage_community_plugin_tech_insights_common.Check) => boolean) | undefined;
52
59
  onlyFailed?: boolean | undefined;
53
60
  expanded?: boolean | undefined;
61
+ gauge?: boolean | undefined;
54
62
  }) => react_jsx_runtime.JSX.Element;
55
63
  /**
56
64
  * @public
57
65
  */
58
- declare const TechInsightsScorecardPage: () => react_jsx_runtime.JSX.Element;
66
+ declare const TechInsightsScorecardPage: (props: {
67
+ badge?: boolean | undefined;
68
+ dense?: boolean | undefined;
69
+ }) => react_jsx_runtime.JSX.Element;
59
70
  /**
60
71
  * @public
61
72
  * @deprecated Use `ResultCheckIcon` from `@backstage-community/plugin-tech-insights-react` instead
@@ -31,6 +31,22 @@ const ScorecardsList = techInsightsPlugin.provide(
31
31
  }
32
32
  })
33
33
  );
34
+ techInsightsPlugin.provide(
35
+ createComponentExtension({
36
+ name: "ScorecardBadge",
37
+ component: {
38
+ lazy: () => import('./components/ScorecardsBadge/index.esm.js').then((m) => m.ScorecardsBadge)
39
+ }
40
+ })
41
+ );
42
+ techInsightsPlugin.provide(
43
+ createComponentExtension({
44
+ name: "ScorecardGauge",
45
+ component: {
46
+ lazy: () => import('./components/ScorecardsGauge/index.esm.js').then((m) => m.ScorecardsGauge)
47
+ }
48
+ })
49
+ );
34
50
  const EntityTechInsightsScorecardContent = techInsightsPlugin.provide(
35
51
  createRoutableExtension({
36
52
  name: "EntityTechInsightsScorecardContent",
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.esm.js","sources":["../src/plugin.ts"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport {\n createPlugin,\n createComponentExtension,\n createRoutableExtension,\n createApiFactory,\n discoveryApiRef,\n identityApiRef,\n} from '@backstage/core-plugin-api';\nimport {\n techInsightsApiRef,\n TechInsightsClient,\n} from '@backstage-community/plugin-tech-insights-react';\nimport { rootRouteRef } from './routes';\n\n/**\n * @public\n */\nexport const techInsightsPlugin = createPlugin({\n id: 'tech-insights',\n apis: [\n createApiFactory({\n api: techInsightsApiRef,\n deps: { discoveryApi: discoveryApiRef, identityApi: identityApiRef },\n factory: ({ discoveryApi, identityApi }) =>\n new TechInsightsClient({ discoveryApi, identityApi }),\n }),\n ],\n routes: {\n root: rootRouteRef,\n },\n});\n\n/**\n * @public\n */\nexport const ScorecardInfo = techInsightsPlugin.provide(\n createComponentExtension({\n name: 'ScorecardInfo',\n component: {\n lazy: () =>\n import('./components/ScorecardsInfo').then(m => m.ScorecardInfo),\n },\n }),\n);\n\n/**\n * @public\n */\nexport const ScorecardsList = techInsightsPlugin.provide(\n createComponentExtension({\n name: 'ScorecardsList',\n component: {\n lazy: () =>\n import('./components/ScorecardsList').then(m => m.ScorecardsList),\n },\n }),\n);\n\n/**\n * @public\n */\nexport const EntityTechInsightsScorecardContent = techInsightsPlugin.provide(\n createRoutableExtension({\n name: 'EntityTechInsightsScorecardContent',\n component: () =>\n import('./components/ScorecardsContent').then(m => m.ScorecardsContent),\n mountPoint: rootRouteRef,\n }),\n);\n\n/**\n * @public\n */\nexport const EntityTechInsightsScorecardCard = techInsightsPlugin.provide(\n createRoutableExtension({\n name: 'EntityTechInsightsScorecardCard',\n component: () =>\n import('./components/ScorecardsCard').then(m => m.ScorecardsCard),\n mountPoint: rootRouteRef,\n }),\n);\n\n/**\n * @public\n */\nexport const TechInsightsScorecardPage = techInsightsPlugin.provide(\n createRoutableExtension({\n name: 'TechInsightsScorecardPage',\n component: () =>\n import('./components/ScorecardsPage').then(m => m.ScorecardsPage),\n mountPoint: rootRouteRef,\n }),\n);\n\n/**\n * @public\n * @deprecated Use `ResultCheckIcon` from `@backstage-community/plugin-tech-insights-react` instead\n */\nexport const TechInsightsCheckIcon = techInsightsPlugin.provide(\n createComponentExtension({\n name: 'TechInsightsCheckIcon',\n component: {\n lazy: () =>\n import('@backstage-community/plugin-tech-insights-react').then(\n m => m.ResultCheckIcon,\n ),\n },\n }),\n);\n\n/**\n * @public\n * @deprecated Use `ResultLinksMenu` from `@backstage-community/plugin-tech-insights-react` instead\n */\nexport const TechInsightsLinksMenu = techInsightsPlugin.provide(\n createComponentExtension({\n name: 'TechInsightsLinksMenu',\n component: {\n lazy: () =>\n import('@backstage-community/plugin-tech-insights-react').then(\n m => m.ResultLinksMenu,\n ),\n },\n }),\n);\n"],"names":[],"mappings":";;;;AAgCO,MAAM,qBAAqB,YAAa,CAAA;AAAA,EAC7C,EAAI,EAAA,eAAA;AAAA,EACJ,IAAM,EAAA;AAAA,IACJ,gBAAiB,CAAA;AAAA,MACf,GAAK,EAAA,kBAAA;AAAA,MACL,IAAM,EAAA,EAAE,YAAc,EAAA,eAAA,EAAiB,aAAa,cAAe,EAAA;AAAA,MACnE,OAAA,EAAS,CAAC,EAAE,YAAc,EAAA,WAAA,EACxB,KAAA,IAAI,kBAAmB,CAAA,EAAE,YAAc,EAAA,WAAA,EAAa;AAAA,KACvD;AAAA,GACH;AAAA,EACA,MAAQ,EAAA;AAAA,IACN,IAAM,EAAA;AAAA;AAEV,CAAC;AAKM,MAAM,gBAAgB,kBAAmB,CAAA,OAAA;AAAA,EAC9C,wBAAyB,CAAA;AAAA,IACvB,IAAM,EAAA,eAAA;AAAA,IACN,SAAW,EAAA;AAAA,MACT,IAAA,EAAM,MACJ,OAAO,0CAA6B,EAAE,IAAK,CAAA,CAAA,CAAA,KAAK,EAAE,aAAa;AAAA;AACnE,GACD;AACH;AAKO,MAAM,iBAAiB,kBAAmB,CAAA,OAAA;AAAA,EAC/C,wBAAyB,CAAA;AAAA,IACvB,IAAM,EAAA,gBAAA;AAAA,IACN,SAAW,EAAA;AAAA,MACT,IAAA,E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ACxD,OAAK,CAAE,CAAA;AAAA;AACT;AACJ,GACD;AACH;;;;"}
1
+ {"version":3,"file":"plugin.esm.js","sources":["../src/plugin.ts"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport {\n createPlugin,\n createComponentExtension,\n createRoutableExtension,\n createApiFactory,\n discoveryApiRef,\n identityApiRef,\n} from '@backstage/core-plugin-api';\nimport {\n techInsightsApiRef,\n TechInsightsClient,\n} from '@backstage-community/plugin-tech-insights-react';\nimport { rootRouteRef } from './routes';\n\n/**\n * @public\n */\nexport const techInsightsPlugin = createPlugin({\n id: 'tech-insights',\n apis: [\n createApiFactory({\n api: techInsightsApiRef,\n deps: { discoveryApi: discoveryApiRef, identityApi: identityApiRef },\n factory: ({ discoveryApi, identityApi }) =>\n new TechInsightsClient({ discoveryApi, identityApi }),\n }),\n ],\n routes: {\n root: rootRouteRef,\n },\n});\n\n/**\n * @public\n */\nexport const ScorecardInfo = techInsightsPlugin.provide(\n createComponentExtension({\n name: 'ScorecardInfo',\n component: {\n lazy: () =>\n import('./components/ScorecardsInfo').then(m => m.ScorecardInfo),\n },\n }),\n);\n\n/**\n * @public\n */\nexport const ScorecardsList = techInsightsPlugin.provide(\n createComponentExtension({\n name: 'ScorecardsList',\n component: {\n lazy: () =>\n import('./components/ScorecardsList').then(m => m.ScorecardsList),\n },\n }),\n);\n\n/**\n * @public\n */\nexport const ScorecardBadge = techInsightsPlugin.provide(\n createComponentExtension({\n name: 'ScorecardBadge',\n component: {\n lazy: () =>\n import('./components/ScorecardsBadge').then(m => m.ScorecardsBadge),\n },\n }),\n);\n\n/**\n * @public\n */\nexport const ScorecardGauge = techInsightsPlugin.provide(\n createComponentExtension({\n name: 'ScorecardGauge',\n component: {\n lazy: () =>\n import('./components/ScorecardsGauge').then(m => m.ScorecardsGauge),\n },\n }),\n);\n\n/**\n * @public\n */\nexport const EntityTechInsightsScorecardContent = techInsightsPlugin.provide(\n createRoutableExtension({\n name: 'EntityTechInsightsScorecardContent',\n component: () =>\n import('./components/ScorecardsContent').then(m => m.ScorecardsContent),\n mountPoint: rootRouteRef,\n }),\n);\n\n/**\n * @public\n */\nexport const EntityTechInsightsScorecardCard = techInsightsPlugin.provide(\n createRoutableExtension({\n name: 'EntityTechInsightsScorecardCard',\n component: () =>\n import('./components/ScorecardsCard').then(m => m.ScorecardsCard),\n mountPoint: rootRouteRef,\n }),\n);\n\n/**\n * @public\n */\nexport const TechInsightsScorecardPage = techInsightsPlugin.provide(\n createRoutableExtension({\n name: 'TechInsightsScorecardPage',\n component: () =>\n import('./components/ScorecardsPage').then(m => m.ScorecardsPage),\n mountPoint: rootRouteRef,\n }),\n);\n\n/**\n * @public\n * @deprecated Use `ResultCheckIcon` from `@backstage-community/plugin-tech-insights-react` instead\n */\nexport const TechInsightsCheckIcon = techInsightsPlugin.provide(\n createComponentExtension({\n name: 'TechInsightsCheckIcon',\n component: {\n lazy: () =>\n import('@backstage-community/plugin-tech-insights-react').then(\n m => m.ResultCheckIcon,\n ),\n },\n }),\n);\n\n/**\n * @public\n * @deprecated Use `ResultLinksMenu` from `@backstage-community/plugin-tech-insights-react` instead\n */\nexport const TechInsightsLinksMenu = techInsightsPlugin.provide(\n createComponentExtension({\n name: 'TechInsightsLinksMenu',\n component: {\n lazy: () =>\n import('@backstage-community/plugin-tech-insights-react').then(\n m => m.ResultLinksMenu,\n ),\n },\n }),\n);\n"],"names":[],"mappings":";;;;AAgCO,MAAM,qBAAqB,YAAa,CAAA;AAAA,EAC7C,EAAI,EAAA,eAAA;AAAA,EACJ,IAAM,EAAA;AAAA,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 @@
1
1
  {
2
2
  "name": "@backstage-community/plugin-tech-insights",
3
- "version": "0.6.0",
3
+ "version": "0.6.1",
4
4
  "backstage": {
5
5
  "role": "frontend-plugin",
6
6
  "pluginId": "tech-insights",