@backstage-community/plugin-tech-insights 1.0.3 → 1.1.0
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 +11 -0
- package/README.md +33 -0
- package/dist/alpha/entityContent.esm.js +70 -11
- package/dist/alpha/entityContent.esm.js.map +1 -1
- package/dist/alpha/plugin.esm.js +2 -2
- package/dist/alpha/plugin.esm.js.map +1 -1
- package/dist/alpha.d.ts +27 -7
- package/dist/components/ScorecardsContent/ScorecardContent.esm.js +3 -11
- package/dist/components/ScorecardsContent/ScorecardContent.esm.js.map +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# @backstage-community/plugin-tech-insights
|
|
2
2
|
|
|
3
|
+
## 1.1.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 1a5b5e4: Added `TechInsightsScorecardBlueprint` for creating custom entity scorecard content filtered to specific entities on the new frontend system. See the plugin README for usage details.
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies [1a5b5e4]
|
|
12
|
+
- @backstage-community/plugin-tech-insights-react@1.4.0
|
|
13
|
+
|
|
3
14
|
## 1.0.3
|
|
4
15
|
|
|
5
16
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -25,6 +25,39 @@ If you are using Backstage's [new frontend system](https://backstage.io/docs/fro
|
|
|
25
25
|
- Entity content for displaying scorecards on entity pages
|
|
26
26
|
- Entity cards for displaying scorecards in entity overview
|
|
27
27
|
|
|
28
|
+
#### Creating custom scorecards with TechInsightsScorecardBlueprint
|
|
29
|
+
|
|
30
|
+
The `TechInsightsScorecardBlueprint` allows you to create custom scorecard content that can be filtered to specific entities. This is useful when you want different scorecards to appear for different entity types or based on entity metadata. The `filter` parameter uses the same entity predicate format as other Backstage entity filters, allowing you to match on `kind`, `metadata`, `spec` fields, and more.
|
|
31
|
+
|
|
32
|
+
```ts
|
|
33
|
+
import { createFrontendModule } from '@backstage/frontend-plugin-api';
|
|
34
|
+
import { TechInsightsScorecardBlueprint } from '@backstage-community/plugin-tech-insights-react/alpha';
|
|
35
|
+
|
|
36
|
+
// In this example, all API entities would get the first scorecard, but only the production APIs would get the second scorecard.
|
|
37
|
+
const techInsightsModule = createFrontendModule({
|
|
38
|
+
pluginId: 'tech-insights',
|
|
39
|
+
extensions: [
|
|
40
|
+
TechInsightsScorecardBlueprint.make({
|
|
41
|
+
name: 'apis',
|
|
42
|
+
params: {
|
|
43
|
+
filter: { kind: 'api' },
|
|
44
|
+
title: 'API Scorecard',
|
|
45
|
+
description: 'Checks specific to API entities',
|
|
46
|
+
checkIds: ['apiDefinitionCheck'],
|
|
47
|
+
},
|
|
48
|
+
}),
|
|
49
|
+
TechInsightsScorecardBlueprint.make({
|
|
50
|
+
name: 'production-apis',
|
|
51
|
+
params: {
|
|
52
|
+
filter: { kind: 'api', 'spec.lifecycle': 'production' },
|
|
53
|
+
title: 'Production API Scorecard',
|
|
54
|
+
checkIds: ['groupOwnerCheck', 'productionReadinessCheck'],
|
|
55
|
+
},
|
|
56
|
+
}),
|
|
57
|
+
],
|
|
58
|
+
});
|
|
59
|
+
```
|
|
60
|
+
|
|
28
61
|
### Integrating with the Legacy Frontend System
|
|
29
62
|
|
|
30
63
|
The following sections describe how to integrate the plugin with the legacy frontend system.
|
|
@@ -1,17 +1,76 @@
|
|
|
1
|
-
import { jsx } from 'react/jsx-runtime';
|
|
1
|
+
import { jsx, Fragment } from 'react/jsx-runtime';
|
|
2
2
|
import { compatWrapper } from '@backstage/core-compat-api';
|
|
3
|
-
import {
|
|
3
|
+
import { createExtensionInput } from '@backstage/frontend-plugin-api';
|
|
4
|
+
import { useEntity } from '@backstage/plugin-catalog-react';
|
|
5
|
+
import { EntityContentBlueprint, entityPredicateToFilterFunction } from '@backstage/plugin-catalog-react/alpha';
|
|
6
|
+
import { TechInsightsScorecardBlueprint } from '@backstage-community/plugin-tech-insights-react/alpha';
|
|
4
7
|
|
|
5
|
-
const
|
|
6
|
-
name: "scorecards",
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
(
|
|
12
|
-
|
|
8
|
+
const entityTechInsightsContent = EntityContentBlueprint.makeWithOverrides({
|
|
9
|
+
name: "scorecards-content",
|
|
10
|
+
config: {
|
|
11
|
+
schema: {
|
|
12
|
+
description: (z) => z.string().optional(),
|
|
13
|
+
checkIds: (z) => z.array(z.string()).optional(),
|
|
14
|
+
dense: (z) => z.boolean().optional()
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
inputs: {
|
|
18
|
+
scorecards: createExtensionInput([
|
|
19
|
+
TechInsightsScorecardBlueprint.dataRefs.props,
|
|
20
|
+
TechInsightsScorecardBlueprint.dataRefs.entityFilter.optional()
|
|
21
|
+
])
|
|
22
|
+
},
|
|
23
|
+
factory(originalFactory, { inputs, config }) {
|
|
24
|
+
return originalFactory(
|
|
25
|
+
(defineParams) => defineParams({
|
|
26
|
+
path: config.path ?? "/tech-insights",
|
|
27
|
+
title: config.title ?? "Tech Insights",
|
|
28
|
+
loader: async () => {
|
|
29
|
+
const { ScorecardsContent } = await import('../components/ScorecardsContent/index.esm.js');
|
|
30
|
+
const scorecards = inputs.scorecards.map((scorecard) => {
|
|
31
|
+
const entityFilter = scorecard.get(
|
|
32
|
+
TechInsightsScorecardBlueprint.dataRefs.entityFilter
|
|
33
|
+
);
|
|
34
|
+
return {
|
|
35
|
+
props: scorecard.get(
|
|
36
|
+
TechInsightsScorecardBlueprint.dataRefs.props
|
|
37
|
+
),
|
|
38
|
+
entityFilter: entityFilter ? entityPredicateToFilterFunction(entityFilter) : () => true
|
|
39
|
+
};
|
|
40
|
+
});
|
|
41
|
+
if (scorecards.length === 0) {
|
|
42
|
+
return /* @__PURE__ */ jsx(
|
|
43
|
+
ScorecardsContent,
|
|
44
|
+
{
|
|
45
|
+
title: config.title ?? "Scorecards",
|
|
46
|
+
description: config.description,
|
|
47
|
+
checksId: config.checkIds ?? void 0,
|
|
48
|
+
dense: config.dense
|
|
49
|
+
}
|
|
50
|
+
);
|
|
51
|
+
}
|
|
52
|
+
const Component = () => {
|
|
53
|
+
const { entity } = useEntity();
|
|
54
|
+
const matchingScorecards = scorecards.filter(
|
|
55
|
+
(s) => s.entityFilter(entity)
|
|
56
|
+
);
|
|
57
|
+
return /* @__PURE__ */ jsx(Fragment, { children: matchingScorecards.map((s) => /* @__PURE__ */ jsx(
|
|
58
|
+
ScorecardsContent,
|
|
59
|
+
{
|
|
60
|
+
title: s.props.title ?? "Scorecards",
|
|
61
|
+
description: s.props.description,
|
|
62
|
+
checksId: s.props.checkIds ?? [],
|
|
63
|
+
dense: s.props.dense,
|
|
64
|
+
filter: s.props.checkFilter
|
|
65
|
+
}
|
|
66
|
+
)) });
|
|
67
|
+
};
|
|
68
|
+
return compatWrapper(/* @__PURE__ */ jsx(Component, {}));
|
|
69
|
+
}
|
|
70
|
+
})
|
|
71
|
+
);
|
|
13
72
|
}
|
|
14
73
|
});
|
|
15
74
|
|
|
16
|
-
export {
|
|
75
|
+
export { entityTechInsightsContent };
|
|
17
76
|
//# sourceMappingURL=entityContent.esm.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"entityContent.esm.js","sources":["../../src/alpha/entityContent.tsx"],"sourcesContent":["/*\n * Copyright 2026 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 { compatWrapper } from '@backstage/core-compat-api';\nimport {
|
|
1
|
+
{"version":3,"file":"entityContent.esm.js","sources":["../../src/alpha/entityContent.tsx"],"sourcesContent":["/*\n * Copyright 2026 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 { compatWrapper } from '@backstage/core-compat-api';\nimport { createExtensionInput } from '@backstage/frontend-plugin-api';\nimport { useEntity } from '@backstage/plugin-catalog-react';\nimport {\n entityPredicateToFilterFunction,\n EntityContentBlueprint,\n} from '@backstage/plugin-catalog-react/alpha';\nimport { TechInsightsScorecardBlueprint } from '@backstage-community/plugin-tech-insights-react/alpha';\n\nexport const entityTechInsightsContent =\n EntityContentBlueprint.makeWithOverrides({\n name: 'scorecards-content',\n config: {\n schema: {\n description: z => z.string().optional(),\n checkIds: z => z.array(z.string()).optional(),\n dense: z => z.boolean().optional(),\n },\n },\n inputs: {\n scorecards: createExtensionInput([\n TechInsightsScorecardBlueprint.dataRefs.props,\n TechInsightsScorecardBlueprint.dataRefs.entityFilter.optional(),\n ]),\n },\n factory(originalFactory, { inputs, config }) {\n return originalFactory(defineParams =>\n defineParams({\n path: config.path ?? '/tech-insights',\n title: config.title ?? 'Tech Insights',\n loader: async () => {\n const { ScorecardsContent } = await import(\n '../components/ScorecardsContent'\n );\n\n const scorecards = inputs.scorecards.map(scorecard => {\n const entityFilter = scorecard.get(\n TechInsightsScorecardBlueprint.dataRefs.entityFilter,\n );\n\n return {\n props: scorecard.get(\n TechInsightsScorecardBlueprint.dataRefs.props,\n ),\n entityFilter: entityFilter\n ? entityPredicateToFilterFunction(entityFilter)\n : () => true,\n };\n });\n\n if (scorecards.length === 0) {\n return (\n <ScorecardsContent\n title={config.title ?? 'Scorecards'}\n description={config.description}\n checksId={config.checkIds ?? undefined}\n dense={config.dense}\n />\n );\n }\n\n const Component = () => {\n const { entity } = useEntity();\n\n const matchingScorecards = scorecards.filter(s =>\n s.entityFilter(entity),\n );\n\n return (\n <>\n {matchingScorecards.map(s => (\n <ScorecardsContent\n title={s.props.title ?? 'Scorecards'}\n description={s.props.description}\n checksId={s.props.checkIds ?? []}\n dense={s.props.dense}\n filter={s.props.checkFilter}\n />\n ))}\n </>\n );\n };\n\n return compatWrapper(<Component />);\n },\n }),\n );\n },\n });\n"],"names":[],"mappings":";;;;;;;AAyBa,MAAA,yBAAA,GACX,uBAAuB,iBAAkB,CAAA;AAAA,EACvC,IAAM,EAAA,oBAAA;AAAA,EACN,MAAQ,EAAA;AAAA,IACN,MAAQ,EAAA;AAAA,MACN,WAAa,EAAA,CAAA,CAAA,KAAK,CAAE,CAAA,MAAA,GAAS,QAAS,EAAA;AAAA,MACtC,QAAA,EAAU,OAAK,CAAE,CAAA,KAAA,CAAM,EAAE,MAAO,EAAC,EAAE,QAAS,EAAA;AAAA,MAC5C,KAAO,EAAA,CAAA,CAAA,KAAK,CAAE,CAAA,OAAA,GAAU,QAAS;AAAA;AACnC,GACF;AAAA,EACA,MAAQ,EAAA;AAAA,IACN,YAAY,oBAAqB,CAAA;AAAA,MAC/B,+BAA+B,QAAS,CAAA,KAAA;AAAA,MACxC,8BAAA,CAA+B,QAAS,CAAA,YAAA,CAAa,QAAS;AAAA,KAC/D;AAAA,GACH;AAAA,EACA,OAAQ,CAAA,eAAA,EAAiB,EAAE,MAAA,EAAQ,QAAU,EAAA;AAC3C,IAAO,OAAA,eAAA;AAAA,MAAgB,kBACrB,YAAa,CAAA;AAAA,QACX,IAAA,EAAM,OAAO,IAAQ,IAAA,gBAAA;AAAA,QACrB,KAAA,EAAO,OAAO,KAAS,IAAA,eAAA;AAAA,QACvB,QAAQ,YAAY;AAClB,UAAA,MAAM,EAAE,iBAAA,EAAsB,GAAA,MAAM,OAClC,8CACF,CAAA;AAEA,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AAA,KAAA;AAAA,gBACf,MAAA,EAAQ,EAAE,KAAM,CAAA;AAAA;AAAA,aAEnB,CACH,EAAA,CAAA;AAAA,WAEJ;AAEA,UAAO,OAAA,aAAA,iBAAe,GAAA,CAAA,SAAA,EAAA,EAAU,CAAE,CAAA;AAAA;AACpC,OACD;AAAA,KACH;AAAA;AAEJ,CAAC;;;;"}
|
package/dist/alpha/plugin.esm.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createFrontendPlugin } from '@backstage/frontend-plugin-api';
|
|
2
2
|
import { techInsightsApi } from './apis.esm.js';
|
|
3
|
-
import {
|
|
3
|
+
import { entityTechInsightsContent } from './entityContent.esm.js';
|
|
4
4
|
import { entityTechInsightsScorecardCard } from './entityCards.esm.js';
|
|
5
5
|
import { techInsightsScorecardPage } from './pages.esm.js';
|
|
6
6
|
import { techInsightsNavItem } from './navItems.esm.js';
|
|
@@ -10,7 +10,7 @@ const techInsightsPlugin = createFrontendPlugin({
|
|
|
10
10
|
extensions: [
|
|
11
11
|
techInsightsApi,
|
|
12
12
|
techInsightsScorecardPage,
|
|
13
|
-
|
|
13
|
+
entityTechInsightsContent,
|
|
14
14
|
entityTechInsightsScorecardCard,
|
|
15
15
|
techInsightsNavItem
|
|
16
16
|
]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.esm.js","sources":["../../src/alpha/plugin.ts"],"sourcesContent":["/*\n * Copyright 2026 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 { createFrontendPlugin } from '@backstage/frontend-plugin-api';\nimport { techInsightsApi } from './apis';\nimport {
|
|
1
|
+
{"version":3,"file":"plugin.esm.js","sources":["../../src/alpha/plugin.ts"],"sourcesContent":["/*\n * Copyright 2026 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 { createFrontendPlugin } from '@backstage/frontend-plugin-api';\nimport { techInsightsApi } from './apis';\nimport { entityTechInsightsContent } from './entityContent';\nimport { entityTechInsightsScorecardCard } from './entityCards';\nimport { techInsightsScorecardPage } from './pages';\nimport { techInsightsNavItem } from './navItems';\n\n/**\n * The Tech Insights frontend plugin for the new Backstage frontend system.\n *\n * @alpha\n */\nconst techInsightsPlugin = createFrontendPlugin({\n pluginId: 'tech-insights',\n extensions: [\n techInsightsApi,\n techInsightsScorecardPage,\n entityTechInsightsContent,\n entityTechInsightsScorecardCard,\n techInsightsNavItem,\n ],\n});\n\nexport default techInsightsPlugin;\n"],"names":[],"mappings":";;;;;;;AA2BA,MAAM,qBAAqB,oBAAqB,CAAA;AAAA,EAC9C,QAAU,EAAA,eAAA;AAAA,EACV,UAAY,EAAA;AAAA,IACV,eAAA;AAAA,IACA,yBAAA;AAAA,IACA,yBAAA;AAAA,IACA,+BAAA;AAAA,IACA;AAAA;AAEJ,CAAC;;;;"}
|
package/dist/alpha.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import * as _backstage_community_plugin_tech_insights_common from '@backstage-community/plugin-tech-insights-common';
|
|
1
2
|
import * as _backstage_catalog_model from '@backstage/catalog-model';
|
|
2
3
|
import * as react from 'react';
|
|
3
4
|
import * as _backstage_plugin_catalog_react_alpha from '@backstage/plugin-catalog-react/alpha';
|
|
@@ -43,20 +44,24 @@ declare const techInsightsPlugin: _backstage_frontend_plugin_api.OverridableFron
|
|
|
43
44
|
type?: _backstage_plugin_catalog_react_alpha.EntityCardType;
|
|
44
45
|
};
|
|
45
46
|
}>;
|
|
46
|
-
"entity-content:tech-insights/scorecards": _backstage_frontend_plugin_api.OverridableExtensionDefinition<{
|
|
47
|
-
kind: "entity-content";
|
|
48
|
-
name: "scorecards";
|
|
47
|
+
"entity-content:tech-insights/scorecards-content": _backstage_frontend_plugin_api.OverridableExtensionDefinition<{
|
|
49
48
|
config: {
|
|
49
|
+
description: string | undefined;
|
|
50
|
+
checkIds: string[] | undefined;
|
|
51
|
+
dense: boolean | undefined;
|
|
50
52
|
path: string | undefined;
|
|
51
53
|
title: string | undefined;
|
|
52
54
|
filter: _backstage_plugin_catalog_react_alpha.EntityPredicate | undefined;
|
|
53
55
|
group: string | false | undefined;
|
|
54
56
|
};
|
|
55
57
|
configInput: {
|
|
58
|
+
description?: string | undefined;
|
|
59
|
+
dense?: boolean | undefined;
|
|
60
|
+
checkIds?: string[] | undefined;
|
|
56
61
|
filter?: _backstage_plugin_catalog_react_alpha.EntityPredicate | undefined;
|
|
57
|
-
title?: string | undefined;
|
|
58
|
-
path?: string | undefined;
|
|
59
|
-
group?: string | false | undefined;
|
|
62
|
+
title?: string | undefined | undefined;
|
|
63
|
+
path?: string | undefined | undefined;
|
|
64
|
+
group?: string | false | undefined | undefined;
|
|
60
65
|
};
|
|
61
66
|
output: _backstage_frontend_plugin_api.ExtensionDataRef<react.JSX.Element, "core.reactElement", {}> | _backstage_frontend_plugin_api.ExtensionDataRef<string, "core.routing.path", {}> | _backstage_frontend_plugin_api.ExtensionDataRef<_backstage_frontend_plugin_api.RouteRef<_backstage_frontend_plugin_api.AnyRouteRefParams>, "core.routing.ref", {
|
|
62
67
|
optional: true;
|
|
@@ -67,7 +72,22 @@ declare const techInsightsPlugin: _backstage_frontend_plugin_api.OverridableFron
|
|
|
67
72
|
}> | _backstage_frontend_plugin_api.ExtensionDataRef<string, "catalog.entity-content-title", {}> | _backstage_frontend_plugin_api.ExtensionDataRef<string, "catalog.entity-content-group", {
|
|
68
73
|
optional: true;
|
|
69
74
|
}>;
|
|
70
|
-
inputs: {
|
|
75
|
+
inputs: {
|
|
76
|
+
scorecards: _backstage_frontend_plugin_api.ExtensionInput<_backstage_frontend_plugin_api.ConfigurableExtensionDataRef<{
|
|
77
|
+
title?: string;
|
|
78
|
+
description?: string;
|
|
79
|
+
checkIds?: string[];
|
|
80
|
+
dense?: boolean;
|
|
81
|
+
checkFilter?: (check: _backstage_community_plugin_tech_insights_common.Check) => boolean;
|
|
82
|
+
}, "tech-insights-scorecard.props", {}> | _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<_backstage_plugin_catalog_react_alpha.EntityPredicate, "tech-insights-scorecard.entity-filter", {
|
|
83
|
+
optional: true;
|
|
84
|
+
}>, {
|
|
85
|
+
singleton: false;
|
|
86
|
+
optional: false;
|
|
87
|
+
}>;
|
|
88
|
+
};
|
|
89
|
+
kind: "entity-content";
|
|
90
|
+
name: "scorecards-content";
|
|
71
91
|
params: {
|
|
72
92
|
defaultPath?: [Error: `Use the 'path' param instead`];
|
|
73
93
|
path: string;
|
|
@@ -1,23 +1,15 @@
|
|
|
1
1
|
import { jsx } from 'react/jsx-runtime';
|
|
2
2
|
import useAsync from 'react-use/esm/useAsync';
|
|
3
|
-
import { Progress,
|
|
3
|
+
import { Progress, Content } from '@backstage/core-components';
|
|
4
4
|
import { useApi } from '@backstage/core-plugin-api';
|
|
5
5
|
import { ScorecardInfo } from '../ScorecardsInfo/ScorecardInfo.esm.js';
|
|
6
6
|
import Alert from '@material-ui/lab/Alert';
|
|
7
7
|
import { techInsightsApiRef } from '@backstage-community/plugin-tech-insights-react';
|
|
8
|
-
import { makeStyles } from '@material-ui/core/styles';
|
|
9
8
|
import { useEntity } from '@backstage/plugin-catalog-react';
|
|
10
9
|
import { getCompoundEntityRef } from '@backstage/catalog-model';
|
|
11
10
|
|
|
12
|
-
const useStyles = makeStyles(() => ({
|
|
13
|
-
contentScorecards: {
|
|
14
|
-
paddingLeft: 0,
|
|
15
|
-
paddingRight: 0
|
|
16
|
-
}
|
|
17
|
-
}));
|
|
18
11
|
const ScorecardsContent = (props) => {
|
|
19
12
|
const { title, description, checksId, filter, dense } = props;
|
|
20
|
-
const classes = useStyles();
|
|
21
13
|
const api = useApi(techInsightsApiRef);
|
|
22
14
|
const { entity } = useEntity();
|
|
23
15
|
const { namespace, kind, name } = getCompoundEntityRef(entity);
|
|
@@ -30,7 +22,7 @@ const ScorecardsContent = (props) => {
|
|
|
30
22
|
} else if (error) {
|
|
31
23
|
return /* @__PURE__ */ jsx(Alert, { severity: "error", children: error.message });
|
|
32
24
|
}
|
|
33
|
-
return /* @__PURE__ */ jsx(
|
|
25
|
+
return /* @__PURE__ */ jsx(Content, { children: /* @__PURE__ */ jsx(
|
|
34
26
|
ScorecardInfo,
|
|
35
27
|
{
|
|
36
28
|
title,
|
|
@@ -39,7 +31,7 @@ const ScorecardsContent = (props) => {
|
|
|
39
31
|
checkResults: filteredValues || [],
|
|
40
32
|
dense
|
|
41
33
|
}
|
|
42
|
-
) })
|
|
34
|
+
) });
|
|
43
35
|
};
|
|
44
36
|
|
|
45
37
|
export { ScorecardsContent };
|
|
@@ -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,
|
|
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, 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 { useEntity } from '@backstage/plugin-catalog-react';\nimport { getCompoundEntityRef } from '@backstage/catalog-model';\nimport { Check } from '@backstage-community/plugin-tech-insights-common';\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 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 <Content>\n <ScorecardInfo\n title={title}\n description={description}\n entity={entity}\n checkResults={filteredValues || []}\n dense={dense}\n />\n </Content>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;AA0Ba,MAAA,iBAAA,GAAoB,CAAC,KAM5B,KAAA;AACJ,EAAA,MAAM,EAAE,KAAO,EAA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
6
6
|
"pluginId": "tech-insights",
|
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
},
|
|
69
69
|
"dependencies": {
|
|
70
70
|
"@backstage-community/plugin-tech-insights-common": "^0.8.2",
|
|
71
|
-
"@backstage-community/plugin-tech-insights-react": "^1.
|
|
71
|
+
"@backstage-community/plugin-tech-insights-react": "^1.4.0",
|
|
72
72
|
"@backstage/catalog-model": "^1.7.6",
|
|
73
73
|
"@backstage/core-compat-api": "^0.5.7",
|
|
74
74
|
"@backstage/core-components": "^0.18.6",
|