@backstage-community/plugin-tech-insights 0.6.0 → 0.6.2
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 +19 -0
- package/README.md +31 -0
- package/dist/components/ScorecardsBadge/ScorecardsBadge.esm.js +49 -0
- package/dist/components/ScorecardsBadge/ScorecardsBadge.esm.js.map +1 -0
- package/dist/components/ScorecardsBadge/index.esm.js +2 -0
- package/dist/components/ScorecardsBadge/index.esm.js.map +1 -0
- package/dist/components/ScorecardsCard/ScorecardsCard.esm.js +18 -3
- package/dist/components/ScorecardsCard/ScorecardsCard.esm.js.map +1 -1
- package/dist/components/ScorecardsContent/ScorecardContent.esm.js +3 -2
- package/dist/components/ScorecardsContent/ScorecardContent.esm.js.map +1 -1
- package/dist/components/ScorecardsGauge/ScorecardsGauge.esm.js +51 -0
- package/dist/components/ScorecardsGauge/ScorecardsGauge.esm.js.map +1 -0
- package/dist/components/ScorecardsGauge/index.esm.js +2 -0
- package/dist/components/ScorecardsGauge/index.esm.js.map +1 -0
- package/dist/components/ScorecardsInfo/ScorecardInfo.esm.js +30 -6
- package/dist/components/ScorecardsInfo/ScorecardInfo.esm.js.map +1 -1
- package/dist/components/ScorecardsList/ScorecardsList.esm.js +32 -25
- package/dist/components/ScorecardsList/ScorecardsList.esm.js.map +1 -1
- package/dist/components/ScorecardsPage/ScorecardsPage.esm.js +11 -5
- package/dist/components/ScorecardsPage/ScorecardsPage.esm.js.map +1 -1
- package/dist/index.d.ts +15 -2
- package/dist/plugin.esm.js +16 -0
- package/dist/plugin.esm.js.map +1 -1
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
# @backstage-community/plugin-tech-insights
|
|
2
2
|
|
|
3
|
+
## 0.6.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 43064bf: Updated default non-dense behavior to include a description instead of reverting to tooltip
|
|
8
|
+
- Updated dependencies [ba5bf7b]
|
|
9
|
+
- @backstage-community/plugin-tech-insights-common@0.7.1
|
|
10
|
+
- @backstage-community/plugin-tech-insights-react@1.2.1
|
|
11
|
+
|
|
12
|
+
## 0.6.1
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- d97a34e: Added support for alternate visualizations of boolean checks:
|
|
17
|
+
|
|
18
|
+
- Content lists can be rendered with smaller text size and reduced padding (option `dense`)
|
|
19
|
+
- Checks in the overview page can be rendered as a badge (option `badge`)
|
|
20
|
+
- Checks in the entity card can be rendered as a gauge (option `gauge`)
|
|
21
|
+
|
|
3
22
|
## 0.6.0
|
|
4
23
|
|
|
5
24
|
### 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
|
+

|
|
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
|
+

|
|
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":";;;;;;;AAwBa,MAAA,eAAA,GAAkB,CAAC,KAG1B,KAAA;AACJ,EAAM,MAAA,EAAE,YAAc,EAAA,MAAA,EAAW,GAAA,KAAA;AAEjC,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;AAC9D,EAAM,MAAA,wBAAA,GAA2B,YAAa,CAAA,GAAA,CAAI,CAAW,MAAA,MAAA;AAAA,IAC3D,MAAA;AAAA,IACA,UAAU,oBAAqB,CAAA,IAAA;AAAA,MAC7B,CAAY,QAAA,KAAA,QAAA,CAAS,IAAS,KAAA,MAAA,CAAO,KAAM,CAAA;AAAA;AAC7C,GACA,CAAA,CAAA;AAEF,EAAA,MAAM,YAAY,wBAAyB,CAAA,MAAA;AAAA,IACzC,CAAC,EAAE,MAAQ,EAAA,QAAA,OAAe,CAAC,QAAA,EAAU,WAAW,MAAM;AAAA,GACtD,CAAA,MAAA;AAEF,EACE,uBAAA,GAAA;AAAA,IAAC,OAAA;AAAA,IAAA;AAAA,MACC,KACE,kBAAA,GAAA;AAAA,QAAC,cAAA;AAAA,QAAA;AAAA,UACC,YAAA;AAAA,UACA,MAAA;AAAA,UACA,KAAK,EAAA,IAAA;AAAA,UACL,eAAe,EAAA;AAAA;AAAA,OACjB;AAAA,MAGF,QAAA,kBAAA,GAAA;AAAA,QAAC,IAAA;AAAA,QAAA;AAAA,UACC,KAAO,EAAA,CAAA,EAAG,SAAS,CAAA,CAAA,EAAI,aAAa,MAAM,CAAA,CAAA;AAAA,UAC1C,IAAK,EAAA,OAAA;AAAA,UACL,KAAO,EAAA;AAAA,YACL,eACE,EAAA,SAAA,KAAc,YAAa,CAAA,MAAA,GAAS,gBAAmB,GAAA;AAAA;AAC3D;AAAA;AACF;AAAA,GACF;AAEJ;;;;"}
|
|
@@ -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,9 @@ const ScorecardsCard = (props) => {
|
|
|
15
16
|
checksId,
|
|
16
17
|
filter,
|
|
17
18
|
onlyFailed,
|
|
18
|
-
|
|
19
|
+
gauge,
|
|
20
|
+
expanded = !gauge,
|
|
21
|
+
dense = true
|
|
19
22
|
} = props;
|
|
20
23
|
const api = useApi(techInsightsApiRef);
|
|
21
24
|
const { entity } = useEntity();
|
|
@@ -40,7 +43,18 @@ const ScorecardsCard = (props) => {
|
|
|
40
43
|
const filteredValue = !onlyFailed ? filteredValues || [] : (filteredValues || []).filter(
|
|
41
44
|
(val) => checkResultRenderers[val.check.type]?.isFailed?.(val)
|
|
42
45
|
);
|
|
43
|
-
return /* @__PURE__ */ jsx(
|
|
46
|
+
return gauge ? /* @__PURE__ */ jsx(
|
|
47
|
+
ScorecardsGauge,
|
|
48
|
+
{
|
|
49
|
+
title,
|
|
50
|
+
description,
|
|
51
|
+
entity,
|
|
52
|
+
checkResults: filteredValue,
|
|
53
|
+
noWarning: onlyFailed,
|
|
54
|
+
expanded,
|
|
55
|
+
dense
|
|
56
|
+
}
|
|
57
|
+
) : /* @__PURE__ */ jsx(
|
|
44
58
|
ScorecardInfo,
|
|
45
59
|
{
|
|
46
60
|
title,
|
|
@@ -48,7 +62,8 @@ const ScorecardsCard = (props) => {
|
|
|
48
62
|
entity,
|
|
49
63
|
checkResults: filteredValue,
|
|
50
64
|
noWarning: onlyFailed,
|
|
51
|
-
expanded
|
|
65
|
+
expanded,
|
|
66
|
+
dense
|
|
52
67
|
}
|
|
53
68
|
);
|
|
54
69
|
};
|
|
@@ -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={filteredValue}\n noWarning={onlyFailed}\n expanded={expanded}\n />\n );\n};\n"],"names":[],"mappings":"
|
|
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 dense?: boolean;\n}) => {\n const {\n title,\n description,\n checksId,\n filter,\n onlyFailed,\n gauge,\n expanded = !gauge,\n dense = 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 gauge ? (\n <ScorecardsGauge\n title={title}\n description={description}\n entity={entity}\n checkResults={filteredValue}\n noWarning={onlyFailed}\n expanded={expanded}\n dense={dense}\n />\n ) : (\n <ScorecardInfo\n title={title}\n description={description}\n entity={entity}\n checkResults={filteredValue}\n noWarning={onlyFailed}\n expanded={expanded}\n dense={dense}\n />\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;AA2Ba,MAAA,cAAA,GAAiB,CAAC,KASzB,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,CAAC,KAAA;AAAA,IACZ,KAAQ,GAAA;AAAA,GACN,GAAA,KAAA;AACJ,EAAM,MAAA,GAAA,GAAM,OAAO,kBAAkB,CAAA;AACrC,EAAM,MAAA,EAAE,MAAO,EAAA,GAAI,SAAU,EAAA;AAC7B,EAAA,MAAM,EAAE,KAAA,EAAO,OAAS,EAAA,KAAA,EAAU,GAAA,QAAA;AAAA,IAChC,YAAY,MAAM,GAAA,CAAI,UAAU,oBAAqB,CAAA,MAAM,GAAG,QAAQ,CAAA;AAAA,IACtE,CAAC,GAAK,EAAA,MAAA,EAAQ,IAAK,CAAA,SAAA,CAAU,QAAQ,CAAC;AAAA,GACxC;AAEA,EAAA,MAAM,cACJ,GAAA,CAAC,MAAU,IAAA,CAAC,KAAQ,GAAA,KAAA,GAAQ,KAAM,CAAA,MAAA,CAAO,CAAO,GAAA,KAAA,MAAA,CAAO,GAAI,CAAA,KAAK,CAAC,CAAA;AAEnE,EAAM,MAAA,oBAAA,GAAuB,QAAQ,MAAM;AACzC,IAAA,IAAI,CAAC,UAAA,IAAc,CAAC,cAAA,SAAuB,EAAC;AAE5C,IAAA,M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yles = 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,
|
|
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 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,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,KAM5B,KAAA;AACJ,EAAA,MAAM,EAAE,KAAO,EAAA,WAAA,EAAa,QAAU,EAAA,MAAA,EAAQ,OAAU,GAAA,KAAA;AACxD,EAAA,MAAM,UAAU,SAAU,EAAA;AAC1B,EAAM,MAAA,GAAA,GAAM,OAAO,kBAAkB,CAAA;AACrC,EAAM,MAAA,EAAE,MAAO,EAAA,GAAI,SAAU,EAAA;AAC7B,EAAA,MAAM,EAAE,SAAW,EAAA,IAAA,EAAM,IAAK,EAAA,GAAI,qBAAqB,MAAM,CAAA;AAC7D,EAAA,MAAM,EAAE,KAAA,EAAO,OAAS,EAAA,KAAA,EAAU,GAAA,QAAA;AAAA,IAChC,YAAY,MAAM,GAAI,CAAA,SAAA,CAAU,EAAE,SAAW,EAAA,IAAA,EAAM,IAAK,EAAA,EAAG,QAAQ;AAAA,GACrE;AAEA,EAAA,MAAM,cACJ,GAAA,CAAC,MAAU,IAAA,CAAC,KAAQ,GAAA,KAAA,GAAQ,KAAM,CAAA,MAAA,CAAO,CAAO,GAAA,KAAA,MAAA,CAAO,GAAI,CAAA,KAAK,CAAC,CAAA;AAEnE,EAAA,IAAI,OAAS,EAAA;AACX,IAAA,2BAAQ,QAAS,EAAA,EAAA,CAAA;AAAA,aACR,KAAO,EAAA;AAChB,IAAA,uBAAQ,GAAA,CAAA,KAAA,EAAA,EAAM,QAAS,EAAA,OAAA,EAAS,gBAAM,OAAQ,EAAA,CAAA;AAAA;AAGhD,EACE,uBAAA,GAAA,CAAC,QAAK,OAAQ,EAAA,MAAA,EACZ,8BAAC,OAAQ,EAAA,EAAA,SAAA,EAAW,QAAQ,iBAC1B,EAAA,QAAA,kBAAA,GAAA;AAAA,IAAC,aAAA;AAAA,IAAA;AAAA,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,51 @@
|
|
|
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 {
|
|
11
|
+
checkResults,
|
|
12
|
+
entity,
|
|
13
|
+
title,
|
|
14
|
+
description,
|
|
15
|
+
noWarning,
|
|
16
|
+
expanded,
|
|
17
|
+
dense = true,
|
|
18
|
+
hideDescription
|
|
19
|
+
} = props;
|
|
20
|
+
const api = useApi(techInsightsApiRef);
|
|
21
|
+
const types = [...new Set(checkResults.map(({ check }) => check.type))];
|
|
22
|
+
const checkResultRenderers = api.getCheckResultRenderers(types);
|
|
23
|
+
const checkResultsWithRenderer = checkResults.map((result) => ({
|
|
24
|
+
result,
|
|
25
|
+
renderer: checkResultRenderers.find(
|
|
26
|
+
(renderer) => renderer.type === result.check.type
|
|
27
|
+
)
|
|
28
|
+
}));
|
|
29
|
+
const succeeded = checkResultsWithRenderer.filter(
|
|
30
|
+
({ result, renderer }) => !renderer?.isFailed?.(result)
|
|
31
|
+
).length;
|
|
32
|
+
const progress = succeeded / checkResults.length;
|
|
33
|
+
return /* @__PURE__ */ jsxs(InfoCard, { title, subheader: description, children: [
|
|
34
|
+
/* @__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" }) }) }),
|
|
35
|
+
/* @__PURE__ */ jsx(
|
|
36
|
+
ScorecardInfo,
|
|
37
|
+
{
|
|
38
|
+
title: /* @__PURE__ */ jsx(Typography, { variant: "h6", children: "Checks" }),
|
|
39
|
+
checkResults,
|
|
40
|
+
entity,
|
|
41
|
+
noWarning,
|
|
42
|
+
expanded,
|
|
43
|
+
dense,
|
|
44
|
+
hideDescription
|
|
45
|
+
}
|
|
46
|
+
)
|
|
47
|
+
] });
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
export { ScorecardsGauge };
|
|
51
|
+
//# 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 dense?: boolean;\n hideDescription?: boolean;\n}) => {\n const {\n checkResults,\n entity,\n title,\n description,\n noWarning,\n expanded,\n dense = true,\n hideDescription,\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\">Checks</Typography>}\n checkResults={checkResults}\n entity={entity}\n noWarning={noWarning}\n expanded={expanded}\n dense={dense}\n hideDescription={hideDescription}\n />\n </InfoCard>\n );\n};\n"],"names":[],"mappings":";;;;;;;;AAyBa,MAAA,eAAA,GAAkB,CAAC,KAS1B,KAAA;AACJ,EAAM,MAAA;AAAA,IACJ,YAAA;AAAA,IACA,MAAA;AAAA,IACA,KAAA;AAAA,IACA,WAAA;AAAA,IACA,SAAA;AAAA,IACA,QAAA;AAAA,IACA,KAAQ,GAAA,IAAA;AAAA,IACR;AAAA,GACE,GAAA,KAAA;AAEJ,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;AAC9D,EAAM,MAAA,wBAAA,GAA2B,YAAa,CAAA,GAAA,CAAI,CAAW,MAAA,MAAA;AAAA,IAC3D,MAAA;AAAA,IACA,UAAU,oBAAqB,CAAA,IAAA;AAAA,MAC7B,CAAY,QAAA,KAAA,QAAA,CAAS,IAAS,KAAA,MAAA,CAAO,KAAM,CAAA;AAAA;AAC7C,GACA,CAAA,CAAA;AAEF,EAAA,MAAM,YAAY,wBAAyB,CAAA,MAAA;AAAA,IACzC,CAAC,EAAE,MAAQ,EAAA,QAAA,OAAe,CAAC,QAAA,EAAU,WAAW,MAAM;AAAA,GACtD,CAAA,MAAA;AACF,EAAM,MAAA,QAAA,GAAW,YAAY,YAAa,CAAA,MAAA;AAE1C,EAAA,uBACG,IAAA,CAAA,QAAA,EAAA,EAAS,KAAc,EAAA,SAAA,EAAW,WACjC,EAAA,QAAA,EAAA;AAAA,oBAAC,GAAA,CAAA,IAAA,EAAA,EAAK,WAAS,IAAC,EAAA,cAAA,EAAe,UAC7B,QAAC,kBAAA,GAAA,CAAA,IAAA,EAAA,EAAK,IAAI,EAAA,IAAA,EAAC,KAAO,EAAA,EAAE,OAAO,OAAS,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,QAAA;AAAA,QACA,KAAA;AAAA,QACA;AAAA;AAAA;AACF,GACF,EAAA,CAAA;AAEJ;;;;"}
|
|
@@ -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
|
|
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, {
|
|
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,9 @@ const ScorecardInfo = (props) => {
|
|
|
58
72
|
entity,
|
|
59
73
|
description,
|
|
60
74
|
noWarning,
|
|
61
|
-
expanded = true
|
|
75
|
+
expanded = true,
|
|
76
|
+
dense,
|
|
77
|
+
hideDescription = dense
|
|
62
78
|
} = props;
|
|
63
79
|
const classes = useStyles();
|
|
64
80
|
const api = useApi(techInsightsApiRef);
|
|
@@ -84,7 +100,15 @@ const ScorecardInfo = (props) => {
|
|
|
84
100
|
title,
|
|
85
101
|
description,
|
|
86
102
|
classes,
|
|
87
|
-
/* @__PURE__ */ jsx(
|
|
103
|
+
/* @__PURE__ */ jsx(
|
|
104
|
+
ScorecardsList,
|
|
105
|
+
{
|
|
106
|
+
checkResults,
|
|
107
|
+
entity,
|
|
108
|
+
dense,
|
|
109
|
+
hideDescription
|
|
110
|
+
}
|
|
111
|
+
),
|
|
88
112
|
expanded,
|
|
89
113
|
`${checkResults.filter((checkResult) => !api.isCheckResultFailed(checkResult)).length}/${checkResults.length}`
|
|
90
114
|
);
|
|
@@ -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';\
|
|
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 { 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 hideDescription?: boolean;\n}) => {\n const {\n checkResults,\n title,\n entity,\n description,\n noWarning,\n expanded = true,\n dense,\n hideDescription = 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 dense={dense}\n hideDescription={hideDescription}\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,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,GAC7B;AAAA,EACA,gBAAkB,EAAA;AAAA,IAChB,MAAQ,EAAA,CAAA;AAAA,IACR,aAAe,EAAA;AAAA;AAEnB,CAAE,CAAA,CAAA;AAEF,MAA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A,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,KAAA;AAAA,QACA;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
|
-
(
|
|
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
|
|
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,KAA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EAAc,IAC5C,EAAA,QAAA,EAAA;AAAA,wBAAA,GAAA;AAAA,UAAC,YAAA;AAAA,UAAA;AAAA,YAEC,OAAA,EAAS,OAAO,KAAM,CAAA,IAAA;AAAA,YACrB,GAAI,CAAC,KAAA,CAAM,eACR,GAAA;AAAA,cACE,SAAW,EAAA;AAAA,gBAEb,EAAC;AAAA,YACL,WAAW,OAAQ,CAAA;AAAA,WAAA;AAAA,UAPd;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,14 +22,19 @@ 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();
|
|
28
32
|
const result = await api.runBulkChecks([], filterSelectedChecks);
|
|
29
33
|
return {
|
|
30
34
|
checks,
|
|
31
|
-
result: filterWithResults ? result.filter((response) => response.results.length > 0) : result
|
|
35
|
+
result: filterWithResults ? result.filter((response) => response.results.length > 0) : result.filter(
|
|
36
|
+
(response) => (response.results?.length ?? 0) === 0 || response.results.every((r) => r.result === false)
|
|
37
|
+
)
|
|
32
38
|
};
|
|
33
39
|
}, [api, filterSelectedChecks, filterWithResults]);
|
|
34
40
|
const tableColumns = useMemo(() => {
|
|
@@ -41,7 +47,7 @@ const ScorecardsPage = () => {
|
|
|
41
47
|
{
|
|
42
48
|
field: "results",
|
|
43
49
|
title: "Results",
|
|
44
|
-
render: (row) => /* @__PURE__ */ jsx(ScorecardsList, { checkResults: row.results }),
|
|
50
|
+
render: (row) => props.badge ? /* @__PURE__ */ jsx(ScorecardsBadge, { checkResults: row.results }) : /* @__PURE__ */ jsx(ScorecardsList, { checkResults: row.results, dense: props.dense }),
|
|
45
51
|
export: false
|
|
46
52
|
}
|
|
47
53
|
];
|
|
@@ -57,7 +63,7 @@ const ScorecardsPage = () => {
|
|
|
57
63
|
});
|
|
58
64
|
});
|
|
59
65
|
return columns;
|
|
60
|
-
}, [value, filterSelectedChecks]);
|
|
66
|
+
}, [props, value, filterSelectedChecks]);
|
|
61
67
|
if (error) {
|
|
62
68
|
return /* @__PURE__ */ jsx(ErrorPanel, { error });
|
|
63
69
|
}
|
|
@@ -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
|
|
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.filter(\n response =>\n (response.results?.length ?? 0) === 0 ||\n response.results.every(r => r.result === false),\n ),\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,E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J;;;;"}
|
package/dist/index.d.ts
CHANGED
|
@@ -20,17 +20,24 @@ 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
|
|
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;
|
|
28
|
+
hideDescription?: boolean | undefined;
|
|
27
29
|
}) => react_jsx_runtime.JSX.Element;
|
|
28
30
|
/**
|
|
29
31
|
* @public
|
|
30
32
|
*/
|
|
31
33
|
declare const ScorecardsList: (props: {
|
|
32
34
|
checkResults: _backstage_community_plugin_tech_insights_common.CheckResult[];
|
|
35
|
+
/**
|
|
36
|
+
* @public
|
|
37
|
+
*/
|
|
33
38
|
entity?: _backstage_catalog_model.Entity | undefined;
|
|
39
|
+
dense?: boolean | undefined;
|
|
40
|
+
hideDescription?: boolean | undefined;
|
|
34
41
|
}) => react_jsx_runtime.JSX.Element;
|
|
35
42
|
/**
|
|
36
43
|
* @public
|
|
@@ -40,6 +47,7 @@ declare const EntityTechInsightsScorecardContent: (props: {
|
|
|
40
47
|
description?: string | undefined;
|
|
41
48
|
checksId?: string[] | undefined;
|
|
42
49
|
filter?: ((check: _backstage_community_plugin_tech_insights_common.Check) => boolean) | undefined;
|
|
50
|
+
dense?: boolean | undefined;
|
|
43
51
|
}) => react_jsx_runtime.JSX.Element;
|
|
44
52
|
/**
|
|
45
53
|
* @public
|
|
@@ -51,11 +59,16 @@ declare const EntityTechInsightsScorecardCard: (props: {
|
|
|
51
59
|
filter?: ((check: _backstage_community_plugin_tech_insights_common.Check) => boolean) | undefined;
|
|
52
60
|
onlyFailed?: boolean | undefined;
|
|
53
61
|
expanded?: boolean | undefined;
|
|
62
|
+
gauge?: boolean | undefined;
|
|
63
|
+
dense?: boolean | undefined;
|
|
54
64
|
}) => react_jsx_runtime.JSX.Element;
|
|
55
65
|
/**
|
|
56
66
|
* @public
|
|
57
67
|
*/
|
|
58
|
-
declare const TechInsightsScorecardPage: (
|
|
68
|
+
declare const TechInsightsScorecardPage: (props: {
|
|
69
|
+
badge?: boolean | undefined;
|
|
70
|
+
dense?: boolean | undefined;
|
|
71
|
+
}) => react_jsx_runtime.JSX.Element;
|
|
59
72
|
/**
|
|
60
73
|
* @public
|
|
61
74
|
* @deprecated Use `ResultCheckIcon` from `@backstage-community/plugin-tech-insights-react` instead
|
package/dist/plugin.esm.js
CHANGED
|
@@ -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",
|
package/dist/plugin.esm.js.map
CHANGED
|
@@ -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,MAC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CAAE,CAAA;AAAA;AACT;AACJ,GACD;AACH;AAMO,MAAM,wBAAwB,kBAAmB,CAAA,OAAA;AAAA,EACtD,wBAAyB,CAAA;AAAA,IACvB,IAAM,EAAA,uBAAA;AAAA,IACN,SAAW,EAAA;AAAA,MACT,IAAM,EAAA,MACJ,OAAO,iDAAiD,CAAE,CAAA,IAAA;AAAA,QACxD,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,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,EAAM,MACJ,OAAO,0CAA6B,EAAE,IAAK,CAAA,CAAA,CAAA,KAAK,EAAE,cAAc;AAAA;AACpE,GACD;AACH;AAK8B,kBAAmB,CAAA,OAAA;AAAA,EAC/C,wBAAyB,CAAA;AAAA,IACvB,IAAM,EAAA,gBAAA;AAAA,IACN,SAAW,EAAA;AAAA,MACT,IAAA,EAAM,MACJ,OAAO,2CAA8B,EAAE,IAAK,CAAA,CAAA,CAAA,KAAK,EAAE,eAA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A;AAAA,EACtD,wBAAyB,CAAA;AAAA,IACvB,IAAM,EAAA,uBAAA;AAAA,IACN,SAAW,EAAA;AAAA,MACT,IAAM,EAAA,MACJ,OAAO,iDAAiD,CAAE,CAAA,IAAA;AAAA,QACxD,OAAK,CAAE,CAAA;AAAA;AACT;AACJ,GACD;AACH;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@backstage-community/plugin-tech-insights",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.2",
|
|
4
4
|
"backstage": {
|
|
5
5
|
"role": "frontend-plugin",
|
|
6
6
|
"pluginId": "tech-insights",
|
|
@@ -42,8 +42,8 @@
|
|
|
42
42
|
"test": "backstage-cli package test"
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"@backstage-community/plugin-tech-insights-common": "^0.7.
|
|
46
|
-
"@backstage-community/plugin-tech-insights-react": "^1.2.
|
|
45
|
+
"@backstage-community/plugin-tech-insights-common": "^0.7.1",
|
|
46
|
+
"@backstage-community/plugin-tech-insights-react": "^1.2.1",
|
|
47
47
|
"@backstage/catalog-model": "^1.7.4",
|
|
48
48
|
"@backstage/core-components": "^0.17.2",
|
|
49
49
|
"@backstage/core-plugin-api": "^1.10.7",
|