@backstage-community/plugin-tech-insights 0.3.33 → 0.3.35

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.
Files changed (30) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/README.md +54 -0
  3. package/dist/api/TechInsightsApi.esm.js.map +1 -1
  4. package/dist/api/TechInsightsClient.esm.js +10 -63
  5. package/dist/api/TechInsightsClient.esm.js.map +1 -1
  6. package/dist/components/ResultCheckIcon/ResultCheckIcon.esm.js +42 -0
  7. package/dist/components/ResultCheckIcon/ResultCheckIcon.esm.js.map +1 -0
  8. package/dist/components/ResultCheckIcon/index.esm.js +2 -0
  9. package/dist/components/ResultCheckIcon/index.esm.js.map +1 -0
  10. package/dist/components/ResultLinksMenu/ResultLinksMenu.esm.js +65 -0
  11. package/dist/components/ResultLinksMenu/ResultLinksMenu.esm.js.map +1 -0
  12. package/dist/components/ResultLinksMenu/index.esm.js +2 -0
  13. package/dist/components/ResultLinksMenu/index.esm.js.map +1 -0
  14. package/dist/components/ScorecardsCard/ScorecardsCard.esm.js +3 -3
  15. package/dist/components/ScorecardsCard/ScorecardsCard.esm.js.map +1 -1
  16. package/dist/components/ScorecardsContent/ScorecardContent.esm.js +3 -1
  17. package/dist/components/ScorecardsContent/ScorecardContent.esm.js.map +1 -1
  18. package/dist/components/ScorecardsInfo/ScorecardInfo.esm.js +3 -4
  19. package/dist/components/ScorecardsInfo/ScorecardInfo.esm.js.map +1 -1
  20. package/dist/components/ScorecardsList/ScorecardsList.esm.js +14 -8
  21. package/dist/components/ScorecardsList/ScorecardsList.esm.js.map +1 -1
  22. package/dist/components/ScorecardsPage/Filters.esm.js +1 -3
  23. package/dist/components/ScorecardsPage/Filters.esm.js.map +1 -1
  24. package/dist/components/ScorecardsPage/ScorecardsPage.esm.js +1 -3
  25. package/dist/components/ScorecardsPage/ScorecardsPage.esm.js.map +1 -1
  26. package/dist/index.d.ts +127 -69
  27. package/dist/index.esm.js +1 -1
  28. package/dist/plugin.esm.js +15 -1
  29. package/dist/plugin.esm.js.map +1 -1
  30. package/package.json +2 -3
package/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # @backstage-community/plugin-tech-insights
2
2
 
3
+ ## 0.3.35
4
+
5
+ ### Patch Changes
6
+
7
+ - 1d33996: Added support for links for checks. Static links are defined in the backend for each check. Dynamic links (based on the entity, e.g. to go to github repos, sonarqube projects, etc) are defined with functions in the frontend, when registering the tech-insights API. Two new components are added, TechInsightsCheckIcon and TechInsightsLinksMenu. The former to wrap a result icon with a popup menu with links, the second is the component to show the popup with links (which can be arbitrarily componsed in other UI views).
8
+ - Updated dependencies [1d33996]
9
+ - @backstage-community/plugin-tech-insights-common@0.2.18
10
+
11
+ ## 0.3.34
12
+
13
+ ### Patch Changes
14
+
15
+ - a84eb44: Move client to common package and allow to use backend auth system
16
+ - Updated dependencies [a84eb44]
17
+ - @backstage-community/plugin-tech-insights-common@0.2.17
18
+
3
19
  ## 0.3.33
4
20
 
5
21
  ### Patch Changes
package/README.md CHANGED
@@ -183,3 +183,57 @@ export const Root = ({ children }: PropsWithChildren<{}>) => (
183
183
  ...
184
184
  );
185
185
  ```
186
+
187
+ ## Custom views rendering tech-insights results
188
+
189
+ If you create a custom view which renders tech-insights results, you can use the `TechInsightsCheckIcon`, which also (by default) is clickable and opens a popup menu with links for this particular check and entity.
190
+
191
+ You can also render the icon using the tech-insights renderer or pass the `disableLinksMenu` prop to `TechInsightsCheckIcon` to disable the menu, and render it elsewhere, by importing `TechInsightsLinksMenu`.
192
+
193
+ ### Render the check icon with a popup menu for links
194
+
195
+ ```tsx
196
+ import { TechInsightsCheckIcon } from '@backstage-community/plugin-tech-insights';
197
+
198
+ export const MyComponent = () => {
199
+ const entity = getEntitySomehow();
200
+ const result = getCheckResultSomehow();
201
+
202
+ return <TechInsightsCheckIcon result={result} entity={entity} />;
203
+ };
204
+ ```
205
+
206
+ ### Render the popup menu for links
207
+
208
+ You can render a custom component (like a button) which opens the popup menu with links.
209
+
210
+ The menu will be anchored to an element, likely the button being pressed, or icon being clicked. The `setMenu` prop is used to get a function to open the menu.
211
+
212
+ ```tsx
213
+ import {
214
+ TechInsightsLinksMenu,
215
+ ResultLinksMenuInfo,
216
+ } from '@backstage-community/plugin-tech-insights';
217
+
218
+ export const MyComponent = () => {
219
+ const entity = getEntitySomehow();
220
+ const result = getCheckResultSomehow();
221
+
222
+ const [menu, setMenu] = useState<ResultLinksMenuInfo | undefined>();
223
+
224
+ return (
225
+ <>
226
+ <Button
227
+ title="Show links"
228
+ disabled={!menu}
229
+ onClick={event => menu?.open(event.currentTarget)}
230
+ />
231
+ <TechInsightsLinksMenu
232
+ result={result}
233
+ entity={entity}
234
+ setMenu={setMenu}
235
+ />
236
+ </>
237
+ );
238
+ };
239
+ ```
@@ -1 +1 @@
1
- {"version":3,"file":"TechInsightsApi.esm.js","sources":["../../src/api/TechInsightsApi.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 */\n\nimport { createApiRef } from '@backstage/core-plugin-api';\nimport {\n CheckResult,\n BulkCheckResponse,\n FactSchema,\n} from '@backstage-community/plugin-tech-insights-common';\nimport { Check, InsightFacts } from './types';\nimport { CheckResultRenderer } from '../components/CheckResultRenderer';\nimport { CompoundEntityRef } from '@backstage/catalog-model';\n\n/**\n * {@link @backstage/core-plugin-api#ApiRef} for the {@link TechInsightsApi}\n *\n * @public\n */\nexport const techInsightsApiRef = createApiRef<TechInsightsApi>({\n id: 'plugin.techinsights.service',\n});\n\n/**\n * API client interface for the Tech Insights plugin\n *\n * @public\n */\nexport interface TechInsightsApi {\n getCheckResultRenderers: (types: string[]) => CheckResultRenderer[];\n isCheckResultFailed: (check: CheckResult) => boolean;\n getAllChecks(): Promise<Check[]>;\n runChecks(\n entityParams: CompoundEntityRef,\n checks?: string[],\n ): Promise<CheckResult[]>;\n runBulkChecks(\n entities: CompoundEntityRef[],\n checks?: Check[],\n ): Promise<BulkCheckResponse>;\n getFacts(entity: CompoundEntityRef, facts: string[]): Promise<InsightFacts>;\n getFactSchemas(): Promise<FactSchema[]>;\n}\n"],"names":[],"mappings":";;AA+BO,MAAM,qBAAqB,YAA8B,CAAA;AAAA,EAC9D,EAAI,EAAA,6BAAA;AACN,CAAC;;;;"}
1
+ {"version":3,"file":"TechInsightsApi.esm.js","sources":["../../src/api/TechInsightsApi.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 */\n\nimport { createApiRef } from '@backstage/core-plugin-api';\nimport {\n CheckResult,\n BulkCheckResponse,\n FactSchema,\n CheckLink,\n} from '@backstage-community/plugin-tech-insights-common';\nimport { Check, InsightFacts } from './types';\nimport { CheckResultRenderer } from '../components/CheckResultRenderer';\nimport { CompoundEntityRef, Entity } from '@backstage/catalog-model';\n\n/**\n * {@link @backstage/core-plugin-api#ApiRef} for the {@link TechInsightsApi}\n *\n * @public\n */\nexport const techInsightsApiRef = createApiRef<TechInsightsApi>({\n id: 'plugin.techinsights.service',\n});\n\n/**\n * API client interface for the Tech Insights plugin\n *\n * @public\n */\nexport interface TechInsightsApi {\n getCheckResultRenderers: (types: string[]) => CheckResultRenderer[];\n isCheckResultFailed: (check: CheckResult) => boolean;\n getAllChecks(): Promise<Check[]>;\n runChecks(\n entityParams: CompoundEntityRef,\n checks?: string[],\n ): Promise<CheckResult[]>;\n runBulkChecks(\n entities: CompoundEntityRef[],\n checks?: Check[],\n ): Promise<BulkCheckResponse>;\n getFacts(entity: CompoundEntityRef, facts: string[]): Promise<InsightFacts>;\n getFactSchemas(): Promise<FactSchema[]>;\n getLinksForEntity(\n result: CheckResult,\n entity: Entity,\n options?: { includeStaticLinks?: boolean },\n ): CheckLink[];\n}\n"],"names":[],"mappings":";;AAgCO,MAAM,qBAAqB,YAA8B,CAAA;AAAA,EAC9D,EAAI,EAAA,6BAAA;AACN,CAAC;;;;"}
@@ -1,23 +1,13 @@
1
- import { ResponseError } from '@backstage/errors';
2
- import { stringifyEntityRef } from '@backstage/catalog-model';
1
+ import { TechInsightsClient as TechInsightsClient$1 } from '@backstage-community/plugin-tech-insights-common/client';
3
2
  import { jsonRulesEngineCheckResultRenderer } from '../components/CheckResultRenderer.esm.js';
4
- import qs from 'qs';
5
3
 
6
- class TechInsightsClient {
7
- discoveryApi;
8
- identityApi;
4
+ class TechInsightsClient extends TechInsightsClient$1 {
9
5
  renderers;
6
+ customGetEntityLinks;
10
7
  constructor(options) {
11
- this.discoveryApi = options.discoveryApi;
12
- this.identityApi = options.identityApi;
8
+ super(options);
13
9
  this.renderers = options.renderers;
14
- }
15
- async getFacts(entity, facts) {
16
- const query = qs.stringify({
17
- entity: stringifyEntityRef(entity),
18
- ids: facts
19
- });
20
- return await this.api(`/facts/latest?${query}`);
10
+ this.customGetEntityLinks = options.getEntityLinks ?? (() => []);
21
11
  }
22
12
  getCheckResultRenderers(types) {
23
13
  const renderers = this.renderers ?? [jsonRulesEngineCheckResultRenderer];
@@ -32,55 +22,12 @@ class TechInsightsClient {
32
22
  }
33
23
  return true;
34
24
  }
35
- async getAllChecks() {
36
- return this.api("/checks");
37
- }
38
- async getFactSchemas() {
39
- return this.api("/fact-schemas");
40
- }
41
- async runChecks(entityParams, checks) {
42
- const { namespace, kind, name } = entityParams;
43
- const requestBody = { checks };
44
- return this.api(
45
- `/checks/run/${encodeURIComponent(namespace)}/${encodeURIComponent(
46
- kind
47
- )}/${encodeURIComponent(name)}`,
48
- {
49
- method: "POST",
50
- body: JSON.stringify(requestBody)
51
- }
52
- );
53
- }
54
- async runBulkChecks(entities, checks) {
55
- const checkIds = checks ? checks.map((check) => check.id) : [];
56
- const requestBody = {
57
- entities,
58
- checks: checkIds.length > 0 ? checkIds : void 0
59
- };
60
- return this.api("/checks/run", {
61
- method: "POST",
62
- body: JSON.stringify(requestBody)
63
- });
64
- }
65
- async api(path, init) {
66
- const url = await this.discoveryApi.getBaseUrl("tech-insights");
67
- const { token } = await this.identityApi.getCredentials();
68
- const headers = new Headers(init?.headers);
69
- if (!headers.has("content-type"))
70
- headers.set("content-type", "application/json");
71
- if (token && !headers.has("authorization")) {
72
- headers.set("authorization", `Bearer ${token}`);
25
+ getLinksForEntity(result, entity, options = {}) {
26
+ const links = this.customGetEntityLinks(result, entity);
27
+ if (options.includeStaticLinks) {
28
+ links.push(...result.check.links ?? []);
73
29
  }
74
- const request = new Request(`${url}${path}`, {
75
- ...init,
76
- headers
77
- });
78
- return fetch(request).then(async (response) => {
79
- if (!response.ok) {
80
- throw await ResponseError.fromResponse(response);
81
- }
82
- return response.json();
83
- });
30
+ return links;
84
31
  }
85
32
  }
86
33
 
@@ -1 +1 @@
1
- {"version":3,"file":"TechInsightsClient.esm.js","sources":["../../src/api/TechInsightsClient.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 */\n\nimport { TechInsightsApi } from './TechInsightsApi';\nimport {\n BulkCheckResponse,\n CheckResult,\n FactSchema,\n} from '@backstage-community/plugin-tech-insights-common';\nimport { Check, InsightFacts } from './types';\nimport { DiscoveryApi, IdentityApi } from '@backstage/core-plugin-api';\nimport { ResponseError } from '@backstage/errors';\nimport {\n CompoundEntityRef,\n stringifyEntityRef,\n} from '@backstage/catalog-model';\n\nimport {\n CheckResultRenderer,\n jsonRulesEngineCheckResultRenderer,\n} from '../components/CheckResultRenderer';\nimport qs from 'qs';\n\n/** @public */\nexport class TechInsightsClient implements TechInsightsApi {\n private readonly discoveryApi: DiscoveryApi;\n private readonly identityApi: IdentityApi;\n private readonly renderers?: CheckResultRenderer[];\n\n constructor(options: {\n discoveryApi: DiscoveryApi;\n identityApi: IdentityApi;\n renderers?: CheckResultRenderer[];\n }) {\n this.discoveryApi = options.discoveryApi;\n this.identityApi = options.identityApi;\n this.renderers = options.renderers;\n }\n\n async getFacts(\n entity: CompoundEntityRef,\n facts: string[],\n ): Promise<InsightFacts> {\n const query = qs.stringify({\n entity: stringifyEntityRef(entity),\n ids: facts,\n });\n return await this.api<InsightFacts>(`/facts/latest?${query}`);\n }\n\n getCheckResultRenderers(types: string[]): CheckResultRenderer[] {\n const renderers = this.renderers ?? [jsonRulesEngineCheckResultRenderer];\n return renderers.filter(d => types.includes(d.type));\n }\n\n isCheckResultFailed(check: CheckResult) {\n const checkResultRenderers = this.getCheckResultRenderers([\n check.check.type,\n ]);\n if (checkResultRenderers[0] && checkResultRenderers[0].isFailed) {\n return checkResultRenderers[0].isFailed(check);\n }\n return true;\n }\n\n async getAllChecks(): Promise<Check[]> {\n return this.api('/checks');\n }\n\n async getFactSchemas(): Promise<FactSchema[]> {\n return this.api('/fact-schemas');\n }\n\n async runChecks(\n entityParams: CompoundEntityRef,\n checks?: string[],\n ): Promise<CheckResult[]> {\n const { namespace, kind, name } = entityParams;\n const requestBody = { checks };\n return this.api(\n `/checks/run/${encodeURIComponent(namespace)}/${encodeURIComponent(\n kind,\n )}/${encodeURIComponent(name)}`,\n {\n method: 'POST',\n body: JSON.stringify(requestBody),\n },\n );\n }\n\n async runBulkChecks(\n entities: CompoundEntityRef[],\n checks?: Check[],\n ): Promise<BulkCheckResponse> {\n const checkIds = checks ? checks.map(check => check.id) : [];\n const requestBody = {\n entities,\n checks: checkIds.length > 0 ? checkIds : undefined,\n };\n return this.api('/checks/run', {\n method: 'POST',\n body: JSON.stringify(requestBody),\n });\n }\n\n private async api<T>(path: string, init?: RequestInit): Promise<T> {\n const url = await this.discoveryApi.getBaseUrl('tech-insights');\n const { token } = await this.identityApi.getCredentials();\n\n const headers: HeadersInit = new Headers(init?.headers);\n if (!headers.has('content-type'))\n headers.set('content-type', 'application/json');\n if (token && !headers.has('authorization')) {\n headers.set('authorization', `Bearer ${token}`);\n }\n\n const request = new Request(`${url}${path}`, {\n ...init,\n headers,\n });\n\n return fetch(request).then(async response => {\n if (!response.ok) {\n throw await ResponseError.fromResponse(response);\n }\n return response.json() as Promise<T>;\n });\n }\n}\n"],"names":[],"mappings":";;;;;AAqCO,MAAM,kBAA8C,CAAA;AAAA,EACxC,YAAA,CAAA;AAAA,EACA,WAAA,CAAA;AAAA,EACA,SAAA,CAAA;AAAA,EAEjB,YAAY,OAIT,EAAA;AACD,IAAA,IAAA,CAAK,eAAe,OAAQ,CAAA,YAAA,CAAA;AAC5B,IAAA,IAAA,CAAK,cAAc,OAAQ,CAAA,WAAA,CAAA;AAC3B,IAAA,IAAA,CAAK,YAAY,OAAQ,CAAA,SAAA,CAAA;AAAA,GAC3B;AAAA,EAEA,MAAM,QACJ,CAAA,MAAA,EACA,KACuB,EAAA;AACvB,IAAM,MAAA,KAAA,GAAQ,GAAG,SAAU,CAAA;AAAA,MACzB,MAAA,EAAQ,mBAAmB,MAAM,CAAA;AAAA,MACjC,GAAK,EAAA,KAAA;AAAA,KACN,CAAA,CAAA;AACD,IAAA,OAAO,MAAM,IAAA,CAAK,GAA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A,KAAK,CAAE,CAAA,CAAA,CAAA;AAAA,KAChD;AAEA,IAAA,MAAM,UAAU,IAAI,OAAA,CAAQ,GAAG,GAAG,CAAA,EAAG,IAAI,CAAI,CAAA,EAAA;AAAA,MAC3C,GAAG,IAAA;AAAA,MACH,OAAA;AAAA,KACD,CAAA,CAAA;AAED,IAAA,OAAO,KAAM,CAAA,OAAO,CAAE,CAAA,IAAA,CAAK,OAAM,QAAY,KAAA;AAC3C,MAAI,IAAA,CAAC,SAAS,EAAI,EAAA;AAChB,QAAM,MAAA,MAAM,aAAc,CAAA,YAAA,CAAa,QAAQ,CAAA,CAAA;AAAA,OACjD;AACA,MAAA,OAAO,SAAS,IAAK,EAAA,CAAA;AAAA,KACtB,CAAA,CAAA;AAAA,GACH;AACF;;;;"}
1
+ {"version":3,"file":"TechInsightsClient.esm.js","sources":["../../src/api/TechInsightsClient.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 */\n\nimport { TechInsightsApi } from './TechInsightsApi';\nimport { DiscoveryApi, IdentityApi } from '@backstage/core-plugin-api';\nimport { TechInsightsClient as TechInsightsClientBase } from '@backstage-community/plugin-tech-insights-common/client';\nimport {\n CheckLink,\n CheckResult,\n} from '@backstage-community/plugin-tech-insights-common';\n\nimport {\n CheckResultRenderer,\n jsonRulesEngineCheckResultRenderer,\n} from '../components/CheckResultRenderer';\nimport { Entity } from '@backstage/catalog-model';\n\n/** @public */\nexport class TechInsightsClient\n extends TechInsightsClientBase\n implements TechInsightsApi\n{\n private readonly renderers?: CheckResultRenderer[];\n private readonly customGetEntityLinks: (\n result: CheckResult,\n entity: Entity,\n ) => CheckLink[];\n\n constructor(options: {\n discoveryApi: DiscoveryApi;\n identityApi: IdentityApi;\n renderers?: CheckResultRenderer[];\n getEntityLinks?: (result: CheckResult, entity: Entity) => CheckLink[];\n }) {\n super(options);\n this.renderers = options.renderers;\n this.customGetEntityLinks = options.getEntityLinks ?? (() => []);\n }\n\n getCheckResultRenderers(types: string[]): CheckResultRenderer[] {\n const renderers = this.renderers ?? [jsonRulesEngineCheckResultRenderer];\n return renderers.filter(d => types.includes(d.type));\n }\n\n isCheckResultFailed(check: CheckResult) {\n const checkResultRenderers = this.getCheckResultRenderers([\n check.check.type,\n ]);\n if (checkResultRenderers[0] && checkResultRenderers[0].isFailed) {\n return checkResultRenderers[0].isFailed(check);\n }\n return true;\n }\n\n getLinksForEntity(\n result: CheckResult,\n entity: Entity,\n options: { includeStaticLinks?: boolean } = {},\n ): CheckLink[] {\n const links = this.customGetEntityLinks(result, entity);\n if (options.includeStaticLinks) {\n links.push(...(result.check.links ?? []));\n }\n return links;\n }\n}\n"],"names":["TechInsightsClientBase"],"mappings":";;;AA+BO,MAAM,2BACHA,oBAEV,CAAA;AAAA,EACmB,SAAA,CAAA;AAAA,EACA,oBAAA,CAAA;AAAA,EAKjB,YAAY,OAKT,EAAA;AACD,IAAA,KAAA,CAAM,OAAO,CAAA,CAAA;AACb,IAAA,IAAA,CAAK,YAAY,OAAQ,CAAA,SAAA,CAAA;AACzB,IAAA,IAAA,CAAK,oBAAuB,GAAA,OAAA,CAAQ,cAAmB,KAAA,MAAM,EAAC,CAAA,CAAA;AAAA,GAChE;AAAA,EAEA,wBAAwB,KAAwC,EAAA;AAC9D,IAAA,MAAM,SAAY,GAAA,IAAA,CAAK,SAAa,IAAA,CAAC,kCAAkC,CAAA,CAAA;AACvE,IAAA,OAAO,UAAU,MAAO,CAAA,CAAA,CAAA,KAAK,MAAM,QAAS,CAAA,CAAA,CAAE,IAAI,CAAC,CAAA,CAAA;AAAA,GACrD;AAAA,EAEA,oBAAoB,KAAoB,EAAA;AACtC,IAAM,MAAA,oBAAA,GAAuB,KAAK,uBAAwB,CAAA;AAAA,MACxD,MAAM,KAAM,CAAA,IAAA;AAAA,KACb,CAAA,CAAA;AACD,IAAA,IAAI,qBAAqB,CAAC,CAAA,IAAK,oBAAqB,CAAA,CAAC,EAAE,QAAU,EAAA;AAC/D,MAAA,OAAO,oBAAqB,CAAA,CAAC,CAAE,CAAA,QAAA,CAAS,KAAK,CAAA,CAAA;AAAA,KAC/C;AACA,IAAO,OAAA,IAAA,CAAA;AAAA,GACT;AAAA,EAEA,iBACE,CAAA,MAAA,EACA,MACA,EAAA,OAAA,GAA4C,EAC/B,EAAA;AACb,IAAA,MAAM,KAAQ,GAAA,IAAA,CAAK,oBAAqB,CAAA,MAAA,EAAQ,MAAM,CAAA,CAAA;AACtD,IAAA,IAAI,QAAQ,kBAAoB,EAAA;AAC9B,MAAA,KAAA,CAAM,KAAK,GAAI,MAAA,CAAO,KAAM,CAAA,KAAA,IAAS,EAAG,CAAA,CAAA;AAAA,KAC1C;AACA,IAAO,OAAA,KAAA,CAAA;AAAA,GACT;AACF;;;;"}
@@ -0,0 +1,42 @@
1
+ import React, { useState } from 'react';
2
+ import { useApi } from '@backstage/core-plugin-api';
3
+ import ListItemSecondaryAction from '@material-ui/core/ListItemSecondaryAction';
4
+ import IconButton from '@material-ui/core/IconButton';
5
+ import Alert from '@material-ui/lab/Alert';
6
+ import { techInsightsApiRef } from '../../api/TechInsightsApi.esm.js';
7
+ import '@backstage-community/plugin-tech-insights-common/client';
8
+ import '@material-ui/icons/CheckCircleOutline';
9
+ import '@material-ui/icons/ErrorOutline';
10
+ import { ResultLinksMenu } from '../ResultLinksMenu/ResultLinksMenu.esm.js';
11
+
12
+ const ResultCheckIcon = (props) => {
13
+ const {
14
+ result,
15
+ entity,
16
+ disableLinksMenu,
17
+ componentProps,
18
+ missingRendererComponent = /* @__PURE__ */ React.createElement(Alert, { severity: "error" }, "Unknown type.")
19
+ } = props;
20
+ const Component = props.component ?? ListItemSecondaryAction;
21
+ const api = useApi(techInsightsApiRef);
22
+ const checkResultRenderer = props.checkResultRenderer ?? api.getCheckResultRenderers([result.check.type])[0];
23
+ const [menu, setMenu] = useState();
24
+ const iconComponent = checkResultRenderer?.component(result);
25
+ const wrapActions = (component) => {
26
+ if (!menu) {
27
+ return component;
28
+ }
29
+ return /* @__PURE__ */ React.createElement(
30
+ Component,
31
+ {
32
+ ...componentProps,
33
+ onClick: (event) => menu?.open(event.currentTarget)
34
+ },
35
+ /* @__PURE__ */ React.createElement(IconButton, { edge: "end", "aria-label": "comments" }, component)
36
+ );
37
+ };
38
+ return /* @__PURE__ */ React.createElement(React.Fragment, null, !disableLinksMenu && /* @__PURE__ */ React.createElement(ResultLinksMenu, { result, entity, setMenu }), wrapActions(iconComponent ?? missingRendererComponent));
39
+ };
40
+
41
+ export { ResultCheckIcon };
42
+ //# sourceMappingURL=ResultCheckIcon.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ResultCheckIcon.esm.js","sources":["../../../src/components/ResultCheckIcon/ResultCheckIcon.tsx"],"sourcesContent":["/*\n * Copyright 2024 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 React, {\n ComponentProps,\n ComponentType,\n MouseEventHandler,\n ReactNode,\n useState,\n} from 'react';\n\nimport { useApi } from '@backstage/core-plugin-api';\nimport { CheckResult } from '@backstage-community/plugin-tech-insights-common';\nimport { Entity } from '@backstage/catalog-model';\n\nimport ListItemSecondaryAction from '@material-ui/core/ListItemSecondaryAction';\nimport IconButton from '@material-ui/core/IconButton';\nimport Alert from '@material-ui/lab/Alert';\n\nimport { techInsightsApiRef } from '../../api';\nimport { CheckResultRenderer } from '../CheckResultRenderer';\nimport { ResultLinksMenu, ResultLinksMenuInfo } from '../ResultLinksMenu';\n\n/** @public */\nexport type ResultCheckIconBaseComponent = ComponentType<{\n onClick?: MouseEventHandler | undefined;\n}>;\n\n/**\n * ResultCheckIcon props\n *\n * The only necessary prop is {@link ResultCheckIconProps.result}, but if\n * {@link ResultCheckIconProps.entity} is provided, the popup menu with links\n * will also include links specifically for this entity.\n *\n * @public\n */\nexport interface ResultCheckIconProps<C extends ResultCheckIconBaseComponent> {\n /**\n * The CheckResult object to create an icon for\n */\n result: CheckResult;\n /**\n * The entity for which this check result is created. This is optional, but if\n * provided, entity-specific links will be added to the popup menu, if any.\n */\n entity?: Entity;\n /**\n * This can optionally be provided, with a small performance improvement, if\n * it is already cashed upstream.\n */\n checkResultRenderer?: CheckResultRenderer;\n /**\n * Will disable the popup menu\n */\n disableLinksMenu?: boolean;\n /**\n * By default, the icon (and the parent `IconButton`) is wrapped inside a\n * `ListItemSecondaryAction` which handles the `onClick` to open the popup\n * menu.\n *\n * This can be changed by providing a custom component here.\n *\n * The {@link ResultCheckIconProps.componentProps} prop can be specified to\n * add props to the wrapping component.\n */\n component?: C;\n /**\n * Props to provide to the wrapping component, which by default is a\n * `ListItemSecondaryAction` but can be overridden using\n * {@link ResultCheckIconProps.component}.\n */\n componentProps?: Omit<ComponentProps<C>, 'onClick'>;\n /**\n * Override the component used to display instead of a result icon, when no\n * renderer was found for this check type.\n */\n missingRendererComponent?: ReactNode;\n}\n\nexport const ResultCheckIcon = <\n C extends ResultCheckIconBaseComponent = typeof ListItemSecondaryAction,\n>(\n props: ResultCheckIconProps<C>,\n) => {\n const {\n result,\n entity,\n disableLinksMenu,\n componentProps,\n missingRendererComponent = <Alert severity=\"error\">Unknown type.</Alert>,\n } = props;\n\n const Component = props.component ?? ListItemSecondaryAction;\n\n const api = useApi(techInsightsApiRef);\n\n const checkResultRenderer =\n props.checkResultRenderer ??\n api.getCheckResultRenderers([result.check.type])[0];\n\n const [menu, setMenu] = useState<ResultLinksMenuInfo | undefined>();\n\n const iconComponent = checkResultRenderer?.component(result);\n\n const wrapActions = (component: React.ReactElement): ReactNode => {\n if (!menu) {\n return component;\n }\n return (\n <Component\n {...componentProps}\n onClick={event => menu?.open(event.currentTarget)}\n >\n <IconButton edge=\"end\" aria-label=\"comments\">\n {component}\n </IconButton>\n </Component>\n );\n };\n\n return (\n <>\n {!disableLinksMenu && (\n <ResultLinksMenu result={result} entity={entity} setMenu={setMenu} />\n )}\n {wrapActions(iconComponent ?? missingRendererComponent)}\n </>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;AA6Fa,MAAA,eAAA,GAAkB,CAG7B,KACG,KAAA;AACH,EAAM,MAAA;AAAA,IACJ,MAAA;AAAA,IACA,MAAA;AAAA,IACA,gBAAA;AAAA,IACA,cAAA;AAAA,IACA,wBAA2B,mBAAA,KAAA,CAAA,aAAA,CAAC,KAAM,EAAA,EAAA,QAAA,EAAS,WAAQ,eAAa,CAAA;AAAA,GAC9D,GAAA,KAAA,CAAA;AAEJ,EAAM,MAAA,SAAA,GAAY,MAAM,SAAa,IAAA,uBAAA,CAAA;AAErC,EAAM,MAAA,GAAA,GAAM,OAAO,kBAAkB,CAAA,CAAA;AAErC,EAAM,MAAA,mBAAA,GACJ,KAAM,CAAA,mBAAA,IACN,GAAI,CAAA,uBAAA,CAAwB,CAAC,MAAA,CAAO,KAAM,CAAA,IAAI,CAAC,CAAA,CAAE,CAAC,CAAA,CAAA;AAEpD,EAAA,MAAM,CAAC,IAAA,EAAM,OAAO,CAAA,GAAI,QAA0C,EAAA,CAAA;AAElE,EAAM,MAAA,aAAA,GAAgB,mBAAqB,EAAA,SAAA,CAAU,MAAM,CAAA,CAAA;AAE3D,EAAM,MAAA,WAAA,GAAc,CAAC,SAA6C,KAAA;AAChE,IAAA,IAAI,CAAC,IAAM,EAAA;AACT,MAAO,OAAA,SAAA,CAAA;AAAA,KACT;AACA,IACE,uBAAA,KAAA,CAAA,aAAA;AAAA,MAAC,SAAA;AAAA,MAAA;AAAA,QACE,GAAG,cAAA;AAAA,QACJ,OAAS,EAAA,CAAA,KAAA,KAAS,IAAM,EAAA,IAAA,CAAK,MAAM,aAAa,CAAA;AAAA,OAAA;AAAA,0CAE/C,UAAW,EAAA,EAAA,IAAA,EAAK,KAAM,EAAA,YAAA,EAAW,cAC/B,SACH,CAAA;AAAA,KACF,CAAA;AAAA,GAEJ,CAAA;AAEA,EAAA,uBAEK,KAAA,CAAA,aAAA,CAAA,KAAA,CAAA,QAAA,EAAA,IAAA,EAAA,CAAC,gBACA,oBAAA,KAAA,CAAA,aAAA,CAAC,eAAgB,EAAA,EAAA,MAAA,EAAgB,MAAgB,EAAA,OAAA,EAAkB,CAEpE,EAAA,WAAA,CAAY,aAAiB,IAAA,wBAAwB,CACxD,CAAA,CAAA;AAEJ;;;;"}
@@ -0,0 +1,2 @@
1
+ export { ResultCheckIcon } from './ResultCheckIcon.esm.js';
2
+ //# sourceMappingURL=index.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -0,0 +1,65 @@
1
+ import React, { useMemo, useId, useEffect, useCallback } from 'react';
2
+ import { useApi } from '@backstage/core-plugin-api';
3
+ import Menu from '@material-ui/core/Menu';
4
+ import MenuItem from '@material-ui/core/MenuItem';
5
+ import { techInsightsApiRef } from '../../api/TechInsightsApi.esm.js';
6
+ import '@backstage-community/plugin-tech-insights-common/client';
7
+ import '@material-ui/icons/CheckCircleOutline';
8
+ import '@material-ui/icons/ErrorOutline';
9
+
10
+ const ResultLinksMenu = (props) => {
11
+ const { result, entity, setMenu } = props;
12
+ const api = useApi(techInsightsApiRef);
13
+ const links = useMemo(
14
+ () => entity ? api.getLinksForEntity(result, entity, {
15
+ includeStaticLinks: true
16
+ }) : result.check.links ?? [],
17
+ [api, result, entity]
18
+ );
19
+ const menuId = `menu-${useId()}`;
20
+ const [anchorEl, setAnchorEl] = React.useState(
21
+ void 0
22
+ );
23
+ useEffect(() => {
24
+ if (links.length === 0) {
25
+ setMenu(void 0);
26
+ return;
27
+ }
28
+ setMenu({
29
+ open: (elem) => {
30
+ setAnchorEl(elem);
31
+ }
32
+ });
33
+ }, [setMenu, links]);
34
+ const handleClose = useCallback(() => {
35
+ setAnchorEl(void 0);
36
+ }, [setAnchorEl]);
37
+ if (links.length === 0) {
38
+ return null;
39
+ }
40
+ return /* @__PURE__ */ React.createElement(
41
+ Menu,
42
+ {
43
+ id: menuId,
44
+ anchorEl: anchorEl ?? null,
45
+ keepMounted: true,
46
+ open: Boolean(anchorEl),
47
+ onClose: handleClose
48
+ },
49
+ links.map((link, i) => /* @__PURE__ */ React.createElement(
50
+ MenuItem,
51
+ {
52
+ key: `${i}-${link.url}`,
53
+ button: true,
54
+ component: "a",
55
+ href: link.url,
56
+ target: link.url.startsWith("/") ? void 0 : "_blank",
57
+ onClick: handleClose
58
+ },
59
+ link.title
60
+ ))
61
+ );
62
+ };
63
+
64
+ export { ResultLinksMenu };
65
+ //# sourceMappingURL=ResultLinksMenu.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ResultLinksMenu.esm.js","sources":["../../../src/components/ResultLinksMenu/ResultLinksMenu.tsx"],"sourcesContent":["/*\n * Copyright 2024 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 React, {\n PropsWithChildren,\n useCallback,\n useEffect,\n useId,\n useMemo,\n} from 'react';\nimport { useApi } from '@backstage/core-plugin-api';\nimport Menu from '@material-ui/core/Menu';\nimport MenuItem from '@material-ui/core/MenuItem';\nimport { techInsightsApiRef } from '../../api';\nimport { CheckResult } from '@backstage-community/plugin-tech-insights-common';\nimport { Entity } from '@backstage/catalog-model';\n\n/**\n * TechInsightsLinksMenu setMenu receiver.\n *\n * This object contains an {@link ResultLinksMenuInfo.open | open} function,\n * which can be used to open the popup menu. It closes automatically on\n * click-away.\n *\n * @public\n */\nexport type ResultLinksMenuInfo = {\n /**\n * Call this function to open the popup menu. The element argument should be\n * an element which is used as an anchor for the menu - where to display it.\n */\n open: (element: Element) => void;\n};\n\nexport const ResultLinksMenu = (\n props: PropsWithChildren<{\n result: CheckResult;\n entity?: Entity;\n setMenu(opener: ResultLinksMenuInfo | undefined): void;\n }>,\n) => {\n const { result, entity, setMenu } = props;\n\n const api = useApi(techInsightsApiRef);\n\n const links = useMemo(\n () =>\n entity\n ? api.getLinksForEntity(result, entity, {\n includeStaticLinks: true,\n })\n : result.check.links ?? [],\n [api, result, entity],\n );\n\n const menuId = `menu-${useId()}`;\n\n const [anchorEl, setAnchorEl] = React.useState<Element | undefined>(\n undefined,\n );\n\n useEffect(() => {\n if (links.length === 0) {\n setMenu(undefined);\n return;\n }\n setMenu({\n open: (elem: Element) => {\n setAnchorEl(elem);\n },\n });\n }, [setMenu, links]);\n\n const handleClose = useCallback(() => {\n setAnchorEl(undefined);\n }, [setAnchorEl]);\n\n if (links.length === 0) {\n return null;\n }\n\n return (\n <Menu\n id={menuId}\n anchorEl={anchorEl ?? null}\n keepMounted\n open={Boolean(anchorEl)}\n onClose={handleClose}\n >\n {links.map((link, i) => (\n <MenuItem\n key={`${i}-${link.url}`}\n button\n component=\"a\"\n href={link.url}\n target={link.url.startsWith('/') ? undefined : '_blank'}\n onClick={handleClose}\n >\n {link.title}\n </MenuItem>\n ))}\n </Menu>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;AA+Ca,MAAA,eAAA,GAAkB,CAC7B,KAKG,KAAA;AACH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A,IAAC,IAAA;AAAA,IAAA;AAAA,MACC,EAAI,EAAA,MAAA;AAAA,MACJ,UAAU,QAAY,IAAA,IAAA;AAAA,MACtB,WAAW,EAAA,IAAA;AAAA,MACX,IAAA,EAAM,QAAQ,QAAQ,CAAA;AAAA,MACtB,OAAS,EAAA,WAAA;AAAA,KAAA;AAAA,IAER,KAAM,CAAA,GAAA,CAAI,CAAC,IAAA,EAAM,CAChB,qBAAA,KAAA,CAAA,aAAA;AAAA,MAAC,QAAA;AAAA,MAAA;AAAA,QACC,GAAK,EAAA,CAAA,EAAG,CAAC,CAAA,CAAA,EAAI,KAAK,GAAG,CAAA,CAAA;AAAA,QACrB,MAAM,EAAA,IAAA;AAAA,QACN,SAAU,EAAA,GAAA;AAAA,QACV,MAAM,IAAK,CAAA,GAAA;AAAA,QACX,QAAQ,IAAK,CAAA,GAAA,CAAI,UAAW,CAAA,GAAG,IAAI,KAAY,CAAA,GAAA,QAAA;AAAA,QAC/C,OAAS,EAAA,WAAA;AAAA,OAAA;AAAA,MAER,IAAK,CAAA,KAAA;AAAA,KAET,CAAA;AAAA,GACH,CAAA;AAEJ;;;;"}
@@ -0,0 +1,2 @@
1
+ export { ResultLinksMenu } from './ResultLinksMenu.esm.js';
2
+ //# sourceMappingURL=index.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -4,12 +4,11 @@ import { Progress, ErrorPanel } 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 { techInsightsApiRef } from '../../api/TechInsightsApi.esm.js';
7
- import '@backstage/errors';
8
- import { getCompoundEntityRef } from '@backstage/catalog-model';
7
+ import '@backstage-community/plugin-tech-insights-common/client';
9
8
  import '@material-ui/icons/CheckCircleOutline';
10
9
  import '@material-ui/icons/ErrorOutline';
11
- import 'qs';
12
10
  import { useEntity } from '@backstage/plugin-catalog-react';
11
+ import { getCompoundEntityRef } from '@backstage/catalog-model';
13
12
 
14
13
  const ScorecardsCard = (props) => {
15
14
  const { title, description, checksId, onlyFailed, expanded = true } = props;
@@ -40,6 +39,7 @@ const ScorecardsCard = (props) => {
40
39
  {
41
40
  title,
42
41
  description,
42
+ entity,
43
43
  checkResults: filteredValue,
44
44
  noWarning: onlyFailed,
45
45
  expanded
@@ -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 React, { 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 '../../api';\nimport { useEntity } from '@backstage/plugin-catalog-react';\nimport { getCompoundEntityRef } from '@backstage/catalog-model';\n\nexport const ScorecardsCard = (props: {\n title: string;\n description?: string;\n checksId?: string[];\n onlyFailed?: boolean;\n expanded?: boolean;\n}) => {\n const { title, description, checksId, onlyFailed, expanded = true } = 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 checkResultRenderers = useMemo(() => {\n if (!onlyFailed || !value) return {};\n\n const types = [...new Set(value.map(({ check }) => check.type))];\n const renderers = api.getCheckResultRenderers(types);\n return Object.fromEntries(\n renderers.map(renderer => [renderer.type, renderer]),\n );\n }, [api, value, onlyFailed]);\n\n if (loading) {\n return <Progress />;\n } else if (error) {\n return <ErrorPanel error={error} />;\n }\n\n const filteredValue = !onlyFailed\n ? value || []\n : (value || []).filter(val =>\n checkResultRenderers[val.check.type]?.isFailed?.(val),\n );\n\n return (\n <ScorecardInfo\n title={title}\n description={description}\n checkResults={filteredValue}\n noWarning={onlyFailed}\n expanded={expanded}\n />\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;AAyBa,MAAA,cAAA,GAAiB,CAAC,KAMzB,KAAA;AACJ,EAAA,MAAM,EAAE,KAAO,EAAA,WAAA,EAAa,UAAU,UAAY,EAAA,QAAA,GAAW,MAAS,GAAA,KAAA,CAAA;AACtE,EAAM,MAAA,GAAA,GAAM,OAAO,kBAAkB,CAAA,CAAA;AACrC,EAAM,MAAA,EAAE,MAAO,EAAA,GAAI,SAAU,EAAA,CAAA;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,CAAA;AAAA,GACxC,CAAA;AAEA,EAAM,MAAA,oBAAA,GAAuB,QAAQ,MAAM;AACzC,IAAA,IAAI,CAAC,UAAA,IAAc,CAAC,KAAA,SAAc,EAAC,CAAA;AAEnC,IAAA,MAAM,KAAQ,GAAA,CAAC,GAAG,IAAI,IAAI,KAAM,CAAA,GAAA,CAAI,CAAC,EAAE,KAAM,EAAA,KAAM,KAAM,CAAA,IAAI,CAAC,CAAC,CAAA,CAAA;AAC/D,IAAM,MAAA,SAAA,GAAY,GAAI,CAAA,uBAAA,CAAwB,KAAK,CAAA,CAAA;AACnD,IAAA,OAAO,MAAO,CAAA,WAAA;AAAA,MACZ,UAAU,GAAI,CAAA,CAAA,QAAA,KAAY,CAAC,QAAS,CAAA,IAAA,EAAM,QAAQ,CAAC,CAAA;AAAA,KACrD,CAAA;AAAA,GACC,EAAA,CAAC,GAAK,EAAA,KAAA,EAAO,UAAU,CAAC,CAAA,CAAA;AAE3B,EAAA,IAAI,OAAS,EAAA;AACX,IAAA,2CAAQ,QAAS,EAAA,IAAA,CAAA,CAAA;AAAA,aACR,KAAO,EAAA;AAChB,IAAO,uBAAA,KAAA,CAAA,aAAA,CAAC,cAAW,KAAc,EAAA,CAAA,CAAA;AAAA,GACnC;AAEA,EAAM,MAAA,aAAA,GAAgB,CAAC,UACnB,GAAA,KAAA,IAAS,EACR,GAAA,CAAA,KAAA,IAAS,EAAI,EAAA,MAAA;AAAA,IAAO,SACnB,oBAAqB,CAAA,GAAA,CAAI,MAAM,IAAI,CAAA,EAAG,WAAW,GAAG,CAAA;AAAA,GACtD,CAAA;AAEJ,EACE,uBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,aAAA;AAAA,IAAA;AAAA,MACC,KAAA;AAAA,MACA,WAAA;AAAA,MACA,YAAc,EAAA,aAAA;AAAA,MACd,SAAW,EAAA,UAAA;AAAA,MACX,QAAA;AAAA,KAAA;AAAA,GACF,CAAA;AAEJ;;;;"}
1
+ {"version":3,"file":"ScorecardsCard.esm.js","sources":["../../../src/components/ScorecardsCard/ScorecardsCard.tsx"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React, { 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 '../../api';\nimport { useEntity } from '@backstage/plugin-catalog-react';\nimport { getCompoundEntityRef } from '@backstage/catalog-model';\n\nexport const ScorecardsCard = (props: {\n title: string;\n description?: string;\n checksId?: string[];\n onlyFailed?: boolean;\n expanded?: boolean;\n}) => {\n const { title, description, checksId, onlyFailed, expanded = true } = 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 checkResultRenderers = useMemo(() => {\n if (!onlyFailed || !value) return {};\n\n const types = [...new Set(value.map(({ check }) => check.type))];\n const renderers = api.getCheckResultRenderers(types);\n return Object.fromEntries(\n renderers.map(renderer => [renderer.type, renderer]),\n );\n }, [api, value, onlyFailed]);\n\n if (loading) {\n return <Progress />;\n } else if (error) {\n return <ErrorPanel error={error} />;\n }\n\n const filteredValue = !onlyFailed\n ? value || []\n : (value || []).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":";;;;;;;;;;;;AAyBa,MAAA,cAAA,GAAiB,CAAC,KAMzB,KAAA;AACJ,EAAA,MAAM,EAAE,KAAO,EAAA,WAAA,EAAa,UAAU,UAAY,EAAA,QAAA,GAAW,MAAS,GAAA,KAAA,CAAA;AACtE,EAAM,MAAA,GAAA,GAAM,OAAO,kBAAkB,CAAA,CAAA;AACrC,EAAM,MAAA,EAAE,MAAO,EAAA,GAAI,SAAU,EAAA,CAAA;AAC7B,EAAA,MAAM,EAAE,KAAA,EAAO,OAAS,EAAA,KAAA,EAAU,GAAA,QAAA;AAAA,IAChC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ACA,WAAA;AAAA,MACA,MAAA;AAAA,MACA,YAAc,EAAA,aAAA;AAAA,MACd,SAAW,EAAA,UAAA;AAAA,MACX,QAAA;AAAA,KAAA;AAAA,GACF,CAAA;AAEJ;;;;"}
@@ -19,7 +19,8 @@ const ScorecardsContent = (props) => {
19
19
  const { title, description, checksId } = props;
20
20
  const classes = useStyles();
21
21
  const api = useApi(techInsightsApiRef);
22
- const { namespace, kind, name } = getCompoundEntityRef(useEntity().entity);
22
+ const { entity } = useEntity();
23
+ const { namespace, kind, name } = getCompoundEntityRef(entity);
23
24
  const { value, loading, error } = useAsync(
24
25
  async () => await api.runChecks({ namespace, kind, name }, checksId)
25
26
  );
@@ -33,6 +34,7 @@ const ScorecardsContent = (props) => {
33
34
  {
34
35
  title,
35
36
  description,
37
+ entity,
36
38
  checkResults: value || []
37
39
  }
38
40
  )));
@@ -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 React from 'react';\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 '../../api/TechInsightsApi';\nimport { makeStyles } from '@material-ui/core/styles';\nimport { useEntity } from '@backstage/plugin-catalog-react';\nimport { getCompoundEntityRef } from '@backstage/catalog-model';\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}) => {\n const { title, description, checksId } = props;\n const classes = useStyles();\n const api = useApi(techInsightsApiRef);\n const { namespace, kind, name } = getCompoundEntityRef(useEntity().entity);\n const { value, loading, error } = useAsync(\n async () => await api.runChecks({ namespace, kind, name }, checksId),\n );\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 checkResults={value || []}\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,CAAA;AAAA,GAChB;AACF,CAAE,CAAA,CAAA,CAAA;AAEW,MAAA,iBAAA,GAAoB,CAAC,KAI5B,KAAA;AACJ,EAAA,MAAM,EAAE,KAAA,EAAO,WAAa,EAAA,QAAA,EAAa,GAAA,KAAA,CAAA;AACzC,EAAA,MAAM,UAAU,SAAU,EAAA,CAAA;AAC1B,EAAM,MAAA,GAAA,GAAM,OAAO,kBAAkB,CAAA,CAAA;AACrC,EAAM,MAAA,EAAE,WAAW,IAAM,EAAA,IAAA,KAAS,oBAAqB,CAAA,SAAA,GAAY,MAAM,CAAA,CAAA;AACzE,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,CAAA;AAAA,GACrE,CAAA;AAEA,EAAA,IAAI,OAAS,EAAA;AACX,IAAA,2CAAQ,QAAS,EAAA,IAAA,CAAA,CAAA;AAAA,aACR,KAAO,EAAA;AAChB,IAAA,uBAAQ,KAAA,CAAA,aAAA,CAAA,KAAA,EAAA,EAAM,QAAS,EAAA,OAAA,EAAA,EAAS,MAAM,OAAQ,CAAA,CAAA;AAAA,GAChD;AAEA,EACE,uBAAA,KAAA,CAAA,aAAA,CAAC,QAAK,OAAQ,EAAA,MAAA,EAAA,sCACX,OAAQ,EAAA,EAAA,SAAA,EAAW,QAAQ,iBAC1B,EAAA,kBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,aAAA;AAAA,IAAA;AAAA,MACC,KAAA;AAAA,MACA,WAAA;AAAA,MACA,YAAA,EAAc,SAAS,EAAC;AAAA,KAAA;AAAA,GAE5B,CACF,CAAA,CAAA;AAEJ;;;;"}
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 React from 'react';\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 '../../api/TechInsightsApi';\nimport { makeStyles } from '@material-ui/core/styles';\nimport { useEntity } from '@backstage/plugin-catalog-react';\nimport { getCompoundEntityRef } from '@backstage/catalog-model';\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}) => {\n const { title, description, checksId } = 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 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={value || []}\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,CAAA;AAAA,GAChB;AACF,CAAE,CAAA,CAAA,CAAA;AAEW,MAAA,iBAAA,GAAoB,CAAC,KAI5B,KAAA;AACJ,EAAA,MAAM,EAAE,KAAA,EAAO,WAAa,EAAA,QAAA,EAAa,GAAA,KAAA,CAAA;AACzC,EAAA,MAAM,UAAU,SAAU,EAAA,CAAA;AAC1B,EAAM,MAAA,GAAA,GAAM,OAAO,kBAAkB,CAAA,CAAA;AACrC,EAAM,MAAA,EAAE,MAAO,EAAA,GAAI,SAAU,EAAA,CAAA;AAC7B,EAAA,MAAM,EAAE,SAAW,EAAA,IAAA,EAAM,IAAK,EAAA,GAAI,qBAAqB,MAAM,CAAA,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,CAAA;AAAA,GACrE,CAAA;AAEA,EAAA,IAAI,OAAS,EAAA;AACX,IAAA,2CAAQ,QAAS,EAAA,IAAA,CAAA,CAAA;AAAA,aACR,KAAO,EAAA;AAChB,IAAA,uBAAQ,KAAA,CAAA,aAAA,CAAA,KAAA,EAAA,EAAM,QAAS,EAAA,OAAA,EAAA,EAAS,MAAM,OAAQ,CAAA,CAAA;AAAA,GAChD;AAEA,EACE,uBAAA,KAAA,CAAA,aAAA,CAAC,QAAK,OAAQ,EAAA,MAAA,EAAA,sCACX,OAAQ,EAAA,EAAA,SAAA,EAAW,QAAQ,iBAC1B,EAAA,kBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,aAAA;AAAA,IAAA;AAAA,MACC,KAAA;AAAA,MACA,WAAA;AAAA,MACA,MAAA;AAAA,MACA,YAAA,EAAc,SAAS,EAAC;AAAA,KAAA;AAAA,GAE5B,CACF,CAAA,CAAA;AAEJ;;;;"}
@@ -10,11 +10,9 @@ import AccordionDetails from '@material-ui/core/AccordionDetails';
10
10
  import AccordionSummary from '@material-ui/core/AccordionSummary';
11
11
  import { useApi } from '@backstage/core-plugin-api';
12
12
  import { techInsightsApiRef } from '../../api/TechInsightsApi.esm.js';
13
- import '@backstage/errors';
14
- import '@backstage/catalog-model';
13
+ import '@backstage-community/plugin-tech-insights-common/client';
15
14
  import '@material-ui/icons/CheckCircleOutline';
16
15
  import '@material-ui/icons/ErrorOutline';
17
- import 'qs';
18
16
 
19
17
  const useStyles = makeStyles((theme) => ({
20
18
  subheader: {
@@ -50,6 +48,7 @@ const ScorecardInfo = (props) => {
50
48
  const {
51
49
  checkResults,
52
50
  title,
51
+ entity,
53
52
  description,
54
53
  noWarning,
55
54
  expanded = true
@@ -78,7 +77,7 @@ const ScorecardInfo = (props) => {
78
77
  title,
79
78
  description,
80
79
  classes,
81
- /* @__PURE__ */ React.createElement(ScorecardsList, { checkResults }),
80
+ /* @__PURE__ */ React.createElement(ScorecardsList, { checkResults, entity }),
82
81
  expanded,
83
82
  `${checkResults.filter((checkResult) => !api.isCheckResultFailed(checkResult)).length}/${checkResults.length}`
84
83
  );
@@ -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 React, { 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 { techInsightsApiRef } from '../../api';\n\nconst useStyles = makeStyles(theme => ({\n subheader: {\n paddingLeft: theme.spacing(0.5),\n },\n accordionHeader: {\n borderBottom: `1px solid ${theme.palette.border}`,\n },\n accordionHeaderContent: {\n margin: `${theme.spacing(2)}px 0 !important`,\n },\n}));\n\nconst infoCard = (\n title: React.ReactNode,\n description: string | undefined,\n classes: ReturnType<typeof useStyles>,\n element: React.ReactElement,\n expanded: boolean,\n summary?: string,\n) => (\n <Grid item xs={12}>\n <Accordion defaultExpanded={expanded}>\n <AccordionSummary\n expandIcon={<ExpandMoreIcon />}\n className={classes.accordionHeader}\n classes={{\n content: classes.accordionHeaderContent,\n }}\n >\n <Grid container justifyContent=\"space-between\" alignItems=\"center\">\n <Grid item>\n <Typography variant=\"h5\">{title}</Typography>\n </Grid>\n <Grid item>\n <Typography>{summary}</Typography>\n </Grid>\n </Grid>\n </AccordionSummary>\n <AccordionDetails>\n <Grid container>\n {description && (\n <Grid item xs={12}>\n <Typography\n className={classes.subheader}\n variant=\"body1\"\n gutterBottom\n >\n {description}\n </Typography>\n </Grid>\n )}\n <Grid item xs={12}>\n {element}\n </Grid>\n </Grid>\n </AccordionDetails>\n </Accordion>\n </Grid>\n);\n\nexport const ScorecardInfo = (props: {\n checkResults: CheckResult[];\n title: ReactNode;\n description?: string;\n noWarning?: boolean;\n expanded?: boolean;\n}) => {\n const {\n checkResults,\n title,\n description,\n noWarning,\n expanded = true,\n } = props;\n const classes = useStyles();\n const api = useApi(techInsightsApiRef);\n\n if (!checkResults.length) {\n if (noWarning) {\n return infoCard(\n title,\n description,\n classes,\n <Alert severity=\"info\">\n All checks passed, or no checks have been performed yet\n </Alert>,\n expanded,\n );\n }\n return infoCard(\n title,\n description,\n classes,\n <Alert severity=\"warning\">No checks have any data yet.</Alert>,\n expanded,\n );\n }\n\n return infoCard(\n title,\n description,\n classes,\n <ScorecardsList checkResults={checkResults} />,\n expanded,\n `${\n checkResults.filter(checkResult => !api.isCheckResultFailed(checkResult))\n .length\n }/${checkResults.length}`,\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AA8BA,MAAM,SAAA,GAAY,WAAW,CAAU,KAAA,MAAA;AAAA,EACrC,SAAW,EAAA;AAAA,IACT,WAAA,EAAa,KAAM,CAAA,OAAA,CAAQ,GAAG,CAAA;AAAA,GAChC;AAAA,EACA,eAAiB,EAAA;AAAA,IACf,YAAc,EAAA,CAAA,UAAA,EAAa,KAAM,CAAA,OAAA,CAAQ,MAAM,CAAA,CAAA;AAAA,GACjD;AAAA,EACA,sBAAwB,EAAA;AAAA,IACtB,MAAQ,EAAA,CAAA,EAAG,KAAM,CAAA,OAAA,CAAQ,CAAC,CAAC,CAAA,eAAA,CAAA;AAAA,GAC7B;AACF,CAAE,CAAA,CAAA,CAAA;AAEF,MAAM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AAA,CAAA,WAAA,KAAe,CAAC,GAAA,CAAI,mBAAoB,CAAA,WAAW,CAAC,CAAA,CACrE,MACL,CAAA,CAAA,EAAI,aAAa,MAAM,CAAA,CAAA;AAAA,GACzB,CAAA;AACF;;;;"}
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 React, { 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 { techInsightsApiRef } from '../../api';\n\nconst useStyles = makeStyles(theme => ({\n subheader: {\n paddingLeft: theme.spacing(0.5),\n },\n accordionHeader: {\n borderBottom: `1px solid ${theme.palette.border}`,\n },\n accordionHeaderContent: {\n margin: `${theme.spacing(2)}px 0 !important`,\n },\n}));\n\nconst infoCard = (\n title: React.ReactNode,\n description: string | undefined,\n classes: ReturnType<typeof useStyles>,\n element: React.ReactElement,\n expanded: boolean,\n summary?: string,\n) => (\n <Grid item xs={12}>\n <Accordion defaultExpanded={expanded}>\n <AccordionSummary\n expandIcon={<ExpandMoreIcon />}\n className={classes.accordionHeader}\n classes={{\n content: classes.accordionHeaderContent,\n }}\n >\n <Grid container justifyContent=\"space-between\" alignItems=\"center\">\n <Grid item>\n <Typography variant=\"h5\">{title}</Typography>\n </Grid>\n <Grid item>\n <Typography>{summary}</Typography>\n </Grid>\n </Grid>\n </AccordionSummary>\n <AccordionDetails>\n <Grid container>\n {description && (\n <Grid item xs={12}>\n <Typography\n className={classes.subheader}\n variant=\"body1\"\n gutterBottom\n >\n {description}\n </Typography>\n </Grid>\n )}\n <Grid item xs={12}>\n {element}\n </Grid>\n </Grid>\n </AccordionDetails>\n </Accordion>\n </Grid>\n);\n\nexport const ScorecardInfo = (props: {\n checkResults: CheckResult[];\n title: ReactNode;\n entity: Entity;\n description?: string;\n noWarning?: boolean;\n expanded?: boolean;\n}) => {\n const {\n checkResults,\n title,\n entity,\n description,\n noWarning,\n expanded = true,\n } = props;\n const classes = useStyles();\n const api = useApi(techInsightsApiRef);\n\n if (!checkResults.length) {\n if (noWarning) {\n return infoCard(\n title,\n description,\n classes,\n <Alert severity=\"info\">\n All checks passed, or no checks have been performed yet\n </Alert>,\n expanded,\n );\n }\n return infoCard(\n title,\n description,\n classes,\n <Alert severity=\"warning\">No checks have any data yet.</Alert>,\n expanded,\n );\n }\n\n return infoCard(\n title,\n description,\n classes,\n <ScorecardsList checkResults={checkResults} entity={entity} />,\n expanded,\n `${\n checkResults.filter(checkResult => !api.isCheckResultFailed(checkResult))\n .length\n }/${checkResults.length}`,\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;AA+BA,MAAM,SAAA,GAAY,WAAW,CAAU,KAAA,MAAA;AAAA,EACrC,SAAW,EAAA;AAAA,IACT,WAAA,EAAa,KAAM,CAAA,OAAA,CAAQ,GAAG,CAAA;AAAA,GAChC;AAAA,EACA,eAAiB,EAAA;AAAA,IACf,YAAc,EAAA,CAAA,UAAA,EAAa,KAAM,CAA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D,QAAA;AAAA,KACF,CAAA;AAAA,GACF;AAEA,EAAO,OAAA,QAAA;AAAA,IACL,KAAA;AAAA,IACA,WAAA;AAAA,IACA,OAAA;AAAA,oBACA,KAAA,CAAA,aAAA,CAAC,cAAe,EAAA,EAAA,YAAA,EAA4B,MAAgB,EAAA,CAAA;AAAA,IAC5D,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,CAAA;AAAA,GACzB,CAAA;AACF;;;;"}
@@ -5,13 +5,11 @@ import ListItem from '@material-ui/core/ListItem';
5
5
  import ListItemText from '@material-ui/core/ListItemText';
6
6
  import { makeStyles } from '@material-ui/core/styles';
7
7
  import { techInsightsApiRef } from '../../api/TechInsightsApi.esm.js';
8
- import '@backstage/errors';
9
- import '@backstage/catalog-model';
8
+ import '@backstage-community/plugin-tech-insights-common/client';
10
9
  import '@material-ui/icons/CheckCircleOutline';
11
10
  import '@material-ui/icons/ErrorOutline';
12
- import 'qs';
13
- import Alert from '@material-ui/lab/Alert';
14
11
  import { MarkdownContent } from '@backstage/core-components';
12
+ import { ResultCheckIcon } from '../ResultCheckIcon/ResultCheckIcon.esm.js';
15
13
 
16
14
  const useStyles = makeStyles((theme) => ({
17
15
  listItemText: {
@@ -19,15 +17,16 @@ const useStyles = makeStyles((theme) => ({
19
17
  }
20
18
  }));
21
19
  const ScorecardsList = (props) => {
22
- const { checkResults } = props;
20
+ const { checkResults, entity } = props;
23
21
  const classes = useStyles();
24
22
  const api = useApi(techInsightsApiRef);
25
23
  const types = [...new Set(checkResults.map(({ check }) => check.type))];
26
24
  const checkResultRenderers = api.getCheckResultRenderers(types);
27
25
  return /* @__PURE__ */ React.createElement(List, null, checkResults.map((result, index) => {
28
- const description = checkResultRenderers.find(
26
+ const checkResultRenderer = checkResultRenderers.find(
29
27
  (renderer) => renderer.type === result.check.type
30
- )?.description;
28
+ );
29
+ const description = checkResultRenderer?.description;
31
30
  return /* @__PURE__ */ React.createElement(ListItem, { key: result.check.id }, /* @__PURE__ */ React.createElement(
32
31
  ListItemText,
33
32
  {
@@ -36,7 +35,14 @@ const ScorecardsList = (props) => {
36
35
  secondary: description ? description(result) : /* @__PURE__ */ React.createElement(MarkdownContent, { content: result.check.description }),
37
36
  className: classes.listItemText
38
37
  }
39
- ), checkResultRenderers.find(({ type }) => type === result.check.type)?.component(result) ?? /* @__PURE__ */ React.createElement(Alert, { severity: "error" }, "Unknown type."));
38
+ ), /* @__PURE__ */ React.createElement(
39
+ ResultCheckIcon,
40
+ {
41
+ result,
42
+ entity,
43
+ checkResultRenderer
44
+ }
45
+ ));
40
46
  }));
41
47
  };
42
48
 
@@ -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 React from 'react';\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 { techInsightsApiRef } from '../../api';\nimport { CheckResult } from '@backstage-community/plugin-tech-insights-common';\nimport Alert from '@material-ui/lab/Alert';\nimport { MarkdownContent } from '@backstage/core-components';\n\nconst useStyles = makeStyles(theme => ({\n listItemText: {\n paddingRight: theme.spacing(0.5),\n },\n}));\n\nexport const ScorecardsList = (props: { checkResults: CheckResult[] }) => {\n const { checkResults } = props;\n const classes = useStyles();\n const api = useApi(techInsightsApiRef);\n\n const types = [...new Set(checkResults.map(({ check }) => check.type))];\n const checkResultRenderers = api.getCheckResultRenderers(types);\n\n return (\n <List>\n {checkResults.map((result, index) => {\n const description = checkResultRenderers.find(\n renderer => renderer.type === result.check.type,\n )?.description;\n\n return (\n <ListItem key={result.check.id}>\n <ListItemText\n key={index}\n primary={result.check.name}\n secondary={\n description ? (\n description(result)\n ) : (\n <MarkdownContent content={result.check.description} />\n )\n }\n className={classes.listItemText}\n />\n {checkResultRenderers\n .find(({ type }) => type === result.check.type)\n ?.component(result) ?? (\n <Alert severity=\"error\">Unknown type.</Alert>\n )}\n </ListItem>\n );\n })}\n </List>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;AA2BA,MAAM,SAAA,GAAY,WAAW,CAAU,KAAA,MAAA;AAAA,EACrC,YAAc,EAAA;AAAA,IACZ,YAAA,EAAc,KAAM,CAAA,OAAA,CAAQ,GAAG,CAAA;AAAA,GACjC;AACF,CAAE,CAAA,CAAA,CAAA;AAEW,MAAA,cAAA,GAAiB,CAAC,KAA2C,KAAA;AACxE,EAAM,MAAA,EAAE,cAAiB,GAAA,KAAA,CAAA;AACzB,EAAA,MAAM,UAAU,SAAU,EAAA,CAAA;AAC1B,EAAM,MAAA,GAAA,GAAM,OAAO,kBAAkB,CAAA,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,CAAA;AACtE,EAAM,MAAA,oBAAA,GAAuB,GAAI,CAAA,uBAAA,CAAwB,KAAK,CAAA,CAAA;AAE9D,EAAA,2CACG,IACE,EAAA,IAAA,EAAA,YAAA,CAAa,GAAI,CAAA,CAAC,QAAQ,KAAU,KAAA;AACnC,IAAA,MAAM,cAAc,oBAAqB,CAAA,IAAA;AAAA,MACvC,CAAY,QAAA,KAAA,QAAA,CAAS,IAAS,KAAA,MAAA,CAAO,KAAM,CAAA,IAAA;AAAA,KAC1C,EAAA,WAAA,CAAA;AAEH,IAAA,uBACG,KAAA,CAAA,aAAA,CAAA,QAAA,EAAA,EAAS,GAAK,EAAA,MAAA,CAAO,MAAM,EAC1B,EAAA,kBAAA,KAAA,CAAA,aAAA;AAAA,MAAC,YAAA;AAAA,MAAA;AAAA,QACC,GAAK,EAAA,KAAA;AAAA,QACL,OAAA,EAAS,OAAO,KAAM,CAAA,IAAA;AAAA,QACtB,SAAA,EACE,WACE,GAAA,WAAA,CAAY,MAAM,CAAA,uCAEjB,eAAgB,EAAA,EAAA,OAAA,EAAS,MAAO,CAAA,KAAA,CAAM,WAAa,EAAA,CAAA;AAAA,QAGxD,WAAW,OAAQ,CAAA,YAAA;AAAA,OAAA;AAAA,KACrB,EACC,qBACE,IAAK,CAAA,CAAC,EAAE,IAAK,EAAA,KAAM,SAAS,MAAO,CAAA,KAAA,CAAM,IAAI,CAC5C,EAAA,SAAA,CAAU,MAAM,CAClB,oBAAA,KAAA,CAAA,aAAA,CAAC,SAAM,QAAS,EAAA,OAAA,EAAA,EAAQ,eAAa,CAEzC,CAAA,CAAA;AAAA,GAEH,CACH,CAAA,CAAA;AAEJ;;;;"}
1
+ {"version":3,"file":"ScorecardsList.esm.js","sources":["../../../src/components/ScorecardsList/ScorecardsList.tsx"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React from 'react';\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 { techInsightsApiRef } from '../../api';\nimport { CheckResult } from '@backstage-community/plugin-tech-insights-common';\nimport { MarkdownContent } from '@backstage/core-components';\nimport { Entity } from '@backstage/catalog-model';\nimport { ResultCheckIcon } from '../ResultCheckIcon';\n\nconst useStyles = makeStyles(theme => ({\n listItemText: {\n paddingRight: theme.spacing(0.5),\n },\n}));\n\nexport const ScorecardsList = (props: {\n checkResults: CheckResult[];\n entity?: Entity;\n}) => {\n const { checkResults, entity } = props;\n\n const classes = useStyles();\n const api = useApi(techInsightsApiRef);\n\n const types = [...new Set(checkResults.map(({ check }) => check.type))];\n const checkResultRenderers = api.getCheckResultRenderers(types);\n\n return (\n <List>\n {checkResults.map((result, index) => {\n const checkResultRenderer = checkResultRenderers.find(\n renderer => renderer.type === result.check.type,\n );\n\n const description = checkResultRenderer?.description;\n\n return (\n <ListItem key={result.check.id}>\n <ListItemText\n key={index}\n primary={result.check.name}\n secondary={\n description ? (\n description(result)\n ) : (\n <MarkdownContent content={result.check.description} />\n )\n }\n className={classes.listItemText}\n />\n <ResultCheckIcon\n result={result}\n entity={entity}\n checkResultRenderer={checkResultRenderer}\n />\n </ListItem>\n );\n })}\n </List>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;AA4BA,MAAM,SAAA,GAAY,WAAW,CAAU,KAAA,MAAA;AAAA,EACrC,YAAc,EAAA;AAAA,IACZ,YAAA,EAAc,KAAM,CAAA,OAAA,CAAQ,GAAG,CAAA;AAAA,GACjC;AACF,CAAE,CAAA,CAAA,CAAA;AAEW,MAAA,cAAA,GAAiB,CAAC,KAGzB,KAAA;AACJ,EAAM,MAAA,EAAE,YAAc,EAAA,MAAA,EAAW,GAAA,KAAA,CAAA;AAEjC,EAAA,MAAM,UAAU,SAAU,EAAA,CAAA;AAC1B,EA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
2
  import { techInsightsApiRef } from '../../api/TechInsightsApi.esm.js';
3
- import '@backstage/errors';
4
- import '@backstage/catalog-model';
3
+ import '@backstage-community/plugin-tech-insights-common/client';
5
4
  import '@material-ui/icons/CheckCircleOutline';
6
5
  import '@material-ui/icons/ErrorOutline';
7
- import 'qs';
8
6
  import Typography from '@material-ui/core/Typography';
9
7
  import Autocomplete from '@material-ui/lab/Autocomplete';
10
8
  import ExpandMoreIcon from '@material-ui/icons/ExpandMore';
@@ -1 +1 @@
1
- {"version":3,"file":"Filters.esm.js","sources":["../../../src/components/ScorecardsPage/Filters.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 React from 'react';\nimport { Check, techInsightsApiRef } from '../../api';\nimport Typography from '@material-ui/core/Typography';\nimport Autocomplete from '@material-ui/lab/Autocomplete';\nimport ExpandMoreIcon from '@material-ui/icons/ExpandMore';\nimport TextField from '@material-ui/core/TextField';\nimport Box from '@material-ui/core/Box';\nimport { makeStyles, withStyles } from '@material-ui/core/styles';\nimport FormControlLabel from '@material-ui/core/FormControlLabel';\nimport CheckBoxOutlineBlankIcon from '@material-ui/icons/CheckBoxOutlineBlank';\nimport CheckBoxIcon from '@material-ui/icons/CheckBox';\nimport Checkbox from '@material-ui/core/Checkbox';\nimport Tooltip from '@material-ui/core/Tooltip';\nimport { useApi } from '@backstage/core-plugin-api';\nimport useAsync from 'react-use/lib/useAsync';\nimport { ErrorPanel } from '@backstage/core-components';\n\nconst useStyles = makeStyles({\n fullWidth: { width: '100%' },\n boxLabel: {\n width: '100%',\n textOverflow: 'ellipsis',\n overflow: 'hidden',\n },\n});\n\nconst FixedWidthFormControlLabel = withStyles(_theme => ({\n label: {\n width: '100%',\n },\n root: {\n width: '90%',\n },\n}))(FormControlLabel);\n\nconst icon = <CheckBoxOutlineBlankIcon fontSize=\"small\" />;\nconst checkedIcon = <CheckBoxIcon fontSize=\"small\" />;\n\nfunction RenderOptionLabel(props: { check: Check; isSelected: boolean }) {\n const classes = useStyles();\n const { check, isSelected } = props;\n return (\n <Box className={classes.fullWidth}>\n <FixedWidthFormControlLabel\n className={classes.fullWidth}\n control={\n <Checkbox\n icon={icon}\n checkedIcon={checkedIcon}\n checked={isSelected}\n />\n }\n onClick={event => event.preventDefault()}\n label={\n <Tooltip title={check.id}>\n <Box display=\"flex\" alignItems=\"center\">\n <Box className={classes.boxLabel}>\n <Typography noWrap>{check.name}</Typography>\n </Box>\n </Box>\n </Tooltip>\n }\n />\n </Box>\n );\n}\n\nconst withResultsOptions = [\n { label: 'Yes', value: true },\n { label: 'No', value: false },\n];\n\n/** public **/\nexport type FiltersProps = {\n checksChanged: (checks: Check[]) => void;\n withResultsChanged: (withResults: boolean) => void;\n};\n\nexport const Filters = (props: FiltersProps) => {\n const { checksChanged, withResultsChanged } = props;\n const api = useApi(techInsightsApiRef);\n\n const { value, loading, error } = useAsync(async () => {\n return api.getAllChecks();\n }, [api]);\n\n if (error) {\n return <ErrorPanel error={error} />;\n }\n\n return (\n <>\n <Box pb={1} pt={1}>\n <Typography variant=\"button\" component=\"label\">\n Checks\n <Autocomplete\n multiple\n disableCloseOnSelect\n options={value ?? []}\n loading={loading}\n getOptionLabel={o => o.name}\n onChange={(_: object, changedChecks) => {\n checksChanged(changedChecks);\n }}\n filterOptions={x => x}\n renderOption={(check, { selected }) => {\n return <RenderOptionLabel check={check} isSelected={selected} />;\n }}\n size=\"small\"\n popupIcon={<ExpandMoreIcon />}\n renderInput={params => <TextField {...params} variant=\"outlined\" />}\n />\n </Typography>\n </Box>\n <Box pb={1} pt={1}>\n <Typography variant=\"button\" component=\"label\">\n Only with results\n <Autocomplete\n defaultValue={withResultsOptions[0]}\n options={withResultsOptions}\n getOptionLabel={o => o.label}\n onChange={(_: object, selectedItem) => {\n if (selectedItem) {\n withResultsChanged(selectedItem.value);\n }\n }}\n disableClearable\n size=\"small\"\n popupIcon={<ExpandMoreIcon />}\n renderInput={params => <TextField {...params} variant=\"outlined\" />}\n />\n </Typography>\n </Box>\n </>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAiCA,MAAM,YAAY,UAAW,CAAA;AAAA,EAC3B,SAAA,EAAW,EAAE,KAAA,EAAO,MAAO,EAAA;AAAA,EAC3B,QAAU,EAAA;AAAA,IACR,KAAO,EAAA,MAAA;AAAA,IACP,YAAc,EAAA,UAAA;AAAA,IACd,QAAU,EAAA,QAAA;AAAA,GACZ;AACF,CAAC,CAAA,CAAA;AAED,MAAM,0BAAA,GAA6B,WAAW,CAAW,MAAA,MAAA;AAAA,EACvD,KAAO,EAAA;AAAA,IACL,KAAO,EAAA,MAAA;AAAA,GACT;AAAA,EACA,IAAM,EAAA;AAAA,IACJ,KAAO,EAAA,KAAA;AAAA,GACT;AACF,CAAA,CAAE,EAAE,gBAAgB,CAAA,CAAA;AAEpB,MAAM,IAAO,mBAAA,KAAA,CAAA,aAAA,CAAC,wBAAyB,EAAA,EAAA,QAAA,EAAS,OAAQ,EAAA,CAAA,CAAA;AACxD,MAAM,WAAc,mBAAA,KAAA,CAAA,aAAA,CAAC,YAAa,EAAA,EAAA,QAAA,EAAS,OAAQ,EAAA,CAAA,CAAA;AAEnD,SAAS,kBAAkB,KAA8C,EAAA;AACvE,EAAA,MAAM,UAAU,SAAU,EAAA,CAAA;AAC1B,EAAM,MAAA,EAAE,KAAO,EAAA,UAAA,EAAe,GAAA,KAAA,CAAA;AAC9B,EAAA,uBACG,KAAA,CAAA,aAAA,CAAA,GAAA,EAAA,EAAI,SAAW,EAAA,OAAA,CAAQ,SACtB,EAAA,kBAAA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,CAAA,EAAG,EAAI,EAAA,CAAA,EAAA,sCACb,UAAW,EAAA,EAAA,OAAA,EAAQ,QAAS,EAAA,SAAA,EAAU,WAAQ,mBAE7C,kBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,YAAA;AAAA,IAAA;AAAA,MACC,YAAA,EAAc,mBAAmB,CAAC,CAAA;AAAA,MAClC,OAAS,EAAA,kBAAA;AAAA,MACT,cAAA,EAAgB,OAAK,CAAE,CAAA,KAAA;AAAA,MACvB,QAAA,EAAU,CAAC,CAAA,EAAW,YAAiB,KAAA;AACrC,QAAA,IAAI,YAAc,EAAA;AAChB,UAAA,kBAAA,CAAmB,aAAa,KAAK,CAAA,CAAA;AAAA,SACvC;AAAA,OACF;AAAA,MACA,gBAAgB,EAAA,IAAA;AAAA,MAChB,IAAK,EAAA,OAAA;AAAA,MACL,SAAA,sCAAY,cAAe,EAAA,IAAA,CAAA;AAAA,MAC3B,aAAa,CAAU,MAAA,qBAAA,KAAA,CAAA,aAAA,CAAC,aAAW,GAAG,MAAA,EAAQ,SAAQ,UAAW,EAAA,CAAA;AAAA,KAAA;AAAA,GAErE,CACF,CACF,CAAA,CAAA;AAEJ;;;;"}
1
+ {"version":3,"file":"Filters.esm.js","sources":["../../../src/components/ScorecardsPage/Filters.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 React from 'react';\nimport { Check, techInsightsApiRef } from '../../api';\nimport Typography from '@material-ui/core/Typography';\nimport Autocomplete from '@material-ui/lab/Autocomplete';\nimport ExpandMoreIcon from '@material-ui/icons/ExpandMore';\nimport TextField from '@material-ui/core/TextField';\nimport Box from '@material-ui/core/Box';\nimport { makeStyles, withStyles } from '@material-ui/core/styles';\nimport FormControlLabel from '@material-ui/core/FormControlLabel';\nimport CheckBoxOutlineBlankIcon from '@material-ui/icons/CheckBoxOutlineBlank';\nimport CheckBoxIcon from '@material-ui/icons/CheckBox';\nimport Checkbox from '@material-ui/core/Checkbox';\nimport Tooltip from '@material-ui/core/Tooltip';\nimport { useApi } from '@backstage/core-plugin-api';\nimport useAsync from 'react-use/lib/useAsync';\nimport { ErrorPanel } from '@backstage/core-components';\n\nconst useStyles = makeStyles({\n fullWidth: { width: '100%' },\n boxLabel: {\n width: '100%',\n textOverflow: 'ellipsis',\n overflow: 'hidden',\n },\n});\n\nconst FixedWidthFormControlLabel = withStyles(_theme => ({\n label: {\n width: '100%',\n },\n root: {\n width: '90%',\n },\n}))(FormControlLabel);\n\nconst icon = <CheckBoxOutlineBlankIcon fontSize=\"small\" />;\nconst checkedIcon = <CheckBoxIcon fontSize=\"small\" />;\n\nfunction RenderOptionLabel(props: { check: Check; isSelected: boolean }) {\n const classes = useStyles();\n const { check, isSelected } = props;\n return (\n <Box className={classes.fullWidth}>\n <FixedWidthFormControlLabel\n className={classes.fullWidth}\n control={\n <Checkbox\n icon={icon}\n checkedIcon={checkedIcon}\n checked={isSelected}\n />\n }\n onClick={event => event.preventDefault()}\n label={\n <Tooltip title={check.id}>\n <Box display=\"flex\" alignItems=\"center\">\n <Box className={classes.boxLabel}>\n <Typography noWrap>{check.name}</Typography>\n </Box>\n </Box>\n </Tooltip>\n }\n />\n </Box>\n );\n}\n\nconst withResultsOptions = [\n { label: 'Yes', value: true },\n { label: 'No', value: false },\n];\n\n/** public **/\nexport type FiltersProps = {\n checksChanged: (checks: Check[]) => void;\n withResultsChanged: (withResults: boolean) => void;\n};\n\nexport const Filters = (props: FiltersProps) => {\n const { checksChanged, withResultsChanged } = props;\n const api = useApi(techInsightsApiRef);\n\n const { value, loading, error } = useAsync(async () => {\n return api.getAllChecks();\n }, [api]);\n\n if (error) {\n return <ErrorPanel error={error} />;\n }\n\n return (\n <>\n <Box pb={1} pt={1}>\n <Typography variant=\"button\" component=\"label\">\n Checks\n <Autocomplete\n multiple\n disableCloseOnSelect\n options={value ?? []}\n loading={loading}\n getOptionLabel={o => o.name}\n onChange={(_: object, changedChecks) => {\n checksChanged(changedChecks);\n }}\n filterOptions={x => x}\n renderOption={(check, { selected }) => {\n return <RenderOptionLabel check={check} isSelected={selected} />;\n }}\n size=\"small\"\n popupIcon={<ExpandMoreIcon />}\n renderInput={params => <TextField {...params} variant=\"outlined\" />}\n />\n </Typography>\n </Box>\n <Box pb={1} pt={1}>\n <Typography variant=\"button\" component=\"label\">\n Only with results\n <Autocomplete\n defaultValue={withResultsOptions[0]}\n options={withResultsOptions}\n getOptionLabel={o => o.label}\n onChange={(_: object, selectedItem) => {\n if (selectedItem) {\n withResultsChanged(selectedItem.value);\n }\n }}\n disableClearable\n size=\"small\"\n popupIcon={<ExpandMoreIcon />}\n renderInput={params => <TextField {...params} variant=\"outlined\" />}\n />\n </Typography>\n </Box>\n </>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AAiCA,MAAM,YAAY,UAAW,CAAA;AAAA,EAC3B,SAAA,EAAW,EAAE,KAAA,EAAO,MAAO,EAAA;AAAA,EAC3B,QAAU,EAAA;AAAA,IACR,KAAO,EAAA,MAAA;AAAA,IACP,YAAc,EAAA,UAAA;AAAA,IACd,QAAU,EAAA,QAAA;AAAA,GACZ;AACF,CAAC,CAAA,CAAA;AAED,MAAM,0BAAA,GAA6B,WAAW,CAAW,MAAA,MAAA;AAAA,EACvD,KAAO,EAAA;AAAA,IACL,KAAO,EAAA,MAAA;AAAA,GACT;AAAA,EACA,IAAM,EAAA;AAAA,IACJ,KAAO,EAAA,KAAA;AAAA,GACT;AACF,CAAA,CAAE,EAAE,gBAAgB,CAAA,CAAA;AAEpB,MAAM,IAAO,mBAAA,KAAA,CAAA,aAA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, Table } from '@backstage/core-components';
3
3
  import { useApi } from '@backstage/core-plugin-api';
4
4
  import { techInsightsApiRef } from '../../api/TechInsightsApi.esm.js';
5
- import '@backstage/errors';
6
- import '@backstage/catalog-model';
5
+ import '@backstage-community/plugin-tech-insights-common/client';
7
6
  import '@material-ui/icons/CheckCircleOutline';
8
7
  import '@material-ui/icons/ErrorOutline';
9
- import 'qs';
10
8
  import useAsync from 'react-use/lib/useAsync';
11
9
  import { EntityRefLink } from '@backstage/plugin-catalog-react';
12
10
  import { ScorecardsList } from '../ScorecardsList/ScorecardsList.esm.js';
@@ -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 React, { 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 { Check, techInsightsApiRef } from '../../api';\nimport useAsync from 'react-use/lib/useAsync';\nimport { BulkCheckResponse } from '@backstage-community/plugin-tech-insights-common';\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';\n\nexport const ScorecardsPage = () => {\n const api = useApi(techInsightsApiRef);\n const [filterSelectedChecks, setFilterSelectedChecks] = useState<Check[]>([]);\n const [filterWithResults, setFilterWithResults] = useState<boolean>(true);\n const tableOptions: TableOptions = {\n exportAllData: true,\n exportMenu: [\n {\n label: 'Export CSV',\n exportFunc: (cols, datas) => exportCsv(cols, datas, 'tech-insights'),\n },\n ],\n };\n\n const { value, loading, error } = useAsync(async () => {\n const checks = await api.getAllChecks();\n const result = await api.runBulkChecks([], filterSelectedChecks);\n\n return {\n checks,\n result: filterWithResults\n ? result.filter(response => response.results.length > 0)\n : result,\n };\n }, [api, filterSelectedChecks, filterWithResults]);\n\n const tableColumns = useMemo(() => {\n const columns: TableColumn<BulkCheckResponse[0]>[] = [\n {\n field: 'entity',\n title: 'Entity',\n render: row => <EntityRefLink entityRef={row.entity} />,\n },\n {\n field: 'results',\n title: 'Results',\n render: row => <ScorecardsList checkResults={row.results} />,\n export: false,\n },\n ];\n\n (filterSelectedChecks.length === 0\n ? value?.checks || []\n : filterSelectedChecks\n ).forEach(check => {\n columns.push({\n field: check.id,\n title: check.name,\n customExport: row =>\n `${\n row.results.filter(\n result => result && result.check && result.check.id === check.id,\n )[0]?.result\n }`,\n hidden: true,\n export: true,\n });\n });\n\n return columns;\n }, [value, filterSelectedChecks]);\n\n if (error) {\n return <ErrorPanel error={error} />;\n }\n\n return (\n <Page themeId=\"tool\">\n <Header title=\"Tech insights\">\n <HeaderLabel label=\"Entities\" value={value?.result.length ?? 0} />\n <HeaderLabel label=\"Checks\" value={value?.checks.length ?? 0} />\n </Header>\n <Content>\n <Grid container>\n <Grid item style={{ width: '300px' }}>\n <Filters\n checksChanged={checks => setFilterSelectedChecks(checks)}\n withResultsChanged={withResults =>\n setFilterWithResults(withResults)\n }\n />\n </Grid>\n <Grid item xs>\n <Table\n columns={tableColumns}\n data={value?.result ?? []}\n isLoading={loading}\n options={tableOptions}\n />\n </Grid>\n </Grid>\n </Content>\n </Page>\n );\n};\n"],"names":["exportCsv"],"mappings":";;;;;;;;;;;;;;;;AAqCO,MAAM,iBAAiB,MAAM;AAClC,EAAM,MAAA,GAAA,GAA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AY,EAAA,EAAA,KAAA,EAAM,UAAS,KAAO,EAAA,KAAA,EAAO,OAAO,MAAU,IAAA,CAAA,EAAG,CAChE,CACA,kBAAA,KAAA,CAAA,aAAA,CAAC,+BACE,KAAA,CAAA,aAAA,CAAA,IAAA,EAAA,EAAK,WAAS,IACb,EAAA,kBAAA,KAAA,CAAA,aAAA,CAAC,QAAK,IAAI,EAAA,IAAA,EAAC,OAAO,EAAE,KAAA,EAAO,SACzB,EAAA,kBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,OAAA;AAAA,IAAA;AAAA,MACC,aAAA,EAAe,CAAU,MAAA,KAAA,uBAAA,CAAwB,MAAM,CAAA;AAAA,MACvD,kBAAA,EAAoB,CAClB,WAAA,KAAA,oBAAA,CAAqB,WAAW,CAAA;AAAA,KAAA;AAAA,GAGtC,CACA,kBAAA,KAAA,CAAA,aAAA,CAAC,QAAK,IAAI,EAAA,IAAA,EAAC,IAAE,IACX,EAAA,kBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,KAAA;AAAA,IAAA;AAAA,MACC,OAAS,EAAA,YAAA;AAAA,MACT,IAAA,EAAM,KAAO,EAAA,MAAA,IAAU,EAAC;AAAA,MACxB,SAAW,EAAA,OAAA;AAAA,MACX,OAAS,EAAA,YAAA;AAAA,KAAA;AAAA,GAEb,CACF,CACF,CACF,CAAA,CAAA;AAEJ;;;;"}
1
+ {"version":3,"file":"ScorecardsPage.esm.js","sources":["../../../src/components/ScorecardsPage/ScorecardsPage.tsx"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React, { 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 { Check, techInsightsApiRef } from '../../api';\nimport useAsync from 'react-use/lib/useAsync';\nimport { BulkCheckResponse } from '@backstage-community/plugin-tech-insights-common';\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';\n\nexport const ScorecardsPage = () => {\n const api = useApi(techInsightsApiRef);\n const [filterSelectedChecks, setFilterSelectedChecks] = useState<Check[]>([]);\n const [filterWithResults, setFilterWithResults] = useState<boolean>(true);\n const tableOptions: TableOptions = {\n exportAllData: true,\n exportMenu: [\n {\n label: 'Export CSV',\n exportFunc: (cols, datas) => exportCsv(cols, datas, 'tech-insights'),\n },\n ],\n };\n\n const { value, loading, error } = useAsync(async () => {\n const checks = await api.getAllChecks();\n const result = await api.runBulkChecks([], filterSelectedChecks);\n\n return {\n checks,\n result: filterWithResults\n ? result.filter(response => response.results.length > 0)\n : result,\n };\n }, [api, filterSelectedChecks, filterWithResults]);\n\n const tableColumns = useMemo(() => {\n const columns: TableColumn<BulkCheckResponse[0]>[] = [\n {\n field: 'entity',\n title: 'Entity',\n render: row => <EntityRefLink entityRef={row.entity} />,\n },\n {\n field: 'results',\n title: 'Results',\n render: row => <ScorecardsList checkResults={row.results} />,\n export: false,\n },\n ];\n\n (filterSelectedChecks.length === 0\n ? value?.checks || []\n : filterSelectedChecks\n ).forEach(check => {\n columns.push({\n field: check.id,\n title: check.name,\n customExport: row =>\n `${\n row.results.filter(\n result => result && result.check && result.check.id === check.id,\n )[0]?.result\n }`,\n hidden: true,\n export: true,\n });\n });\n\n return columns;\n }, [value, filterSelectedChecks]);\n\n if (error) {\n return <ErrorPanel error={error} />;\n }\n\n return (\n <Page themeId=\"tool\">\n <Header title=\"Tech insights\">\n <HeaderLabel label=\"Entities\" value={value?.result.length ?? 0} />\n <HeaderLabel label=\"Checks\" value={value?.checks.length ?? 0} />\n </Header>\n <Content>\n <Grid container>\n <Grid item style={{ width: '300px' }}>\n <Filters\n checksChanged={checks => setFilterSelectedChecks(checks)}\n withResultsChanged={withResults =>\n setFilterWithResults(withResults)\n }\n />\n </Grid>\n <Grid item xs>\n <Table\n columns={tableColumns}\n data={value?.result ?? []}\n isLoading={loading}\n options={tableOptions}\n />\n </Grid>\n </Grid>\n </Content>\n </Page>\n );\n};\n"],"names":["exportCsv"],"mappings":";;;;;;;;;;;;;;AAqCO,MAAM,iBAAiB,MAAM;AAClC,EAAM,MAAA,GAAA,GAAM,OAAO,kBAAkB,CAAA,CAAA;AACrC,EAAA,MAAM,CAAC,oBAAsB,EAAA,uBAAuB,CAAI,GAAA,QAAA,CAAkB,EAAE,CAAA,CAAA;AAC5E,EAAA,MAAM,CAAC,iBAAA,EAAmB,oBAAoB,CAAA,GAAI,SAAkB,IAAI,CAAA,CAAA;AACxE,EAAA,MAAM,YAA6B,GAAA;AAAA,IACjC,aAAe,EAAA,IAAA;AAAA,IACf,UAAY,EAAA;AAAA,MACV;AAAA,QACE,KAAO,EAAA,YAAA;AAAA,QACP,YAAY,CAAC,IAAA,EAAM,UAAUA,SAAU,CAAA,IAAA,EAAM,OAAO,eAAe,CAAA;AAAA,OACrE;AAAA,KACF;AAAA,GACF,CAAA;AAEA,EAAA,MAAM,EAAE,KAAO,EAAA,OAAA,EAAS,KAAM,EAAA,GAAI,SAAS,YAAY;AACrD,IAAM,MAAA,MAAA,GAAS,MAAM,GAAA,CAAI,YAAa,EAAA,CAAA;AACtC,IAAA,MAAM,SAAS,MAAM,GAAA,CAAI,aAAc,CAAA,IAAI,oBAAoB,CAAA,CAAA;AAE/D,IAAO,OAAA;AAAA,MACL,MAAA;AAAA,MACA,MAAA,EAAQ,oBACJ,MAAO,CAA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,OAAA;AAAA,MACX,OAAS,EAAA,YAAA;AAAA,KAAA;AAAA,GAEb,CACF,CACF,CACF,CAAA,CAAA;AAEJ;;;;"}
package/dist/index.d.ts CHANGED
@@ -1,12 +1,106 @@
1
1
  /// <reference types="react" />
2
+ import * as _material_ui_core from '@material-ui/core';
2
3
  import * as react from 'react';
3
- import react__default from 'react';
4
+ import react__default, { ComponentType, MouseEventHandler, ComponentProps, ReactNode } from 'react';
4
5
  import * as _backstage_community_plugin_tech_insights_common from '@backstage-community/plugin-tech-insights-common';
5
- import { CheckResult, BulkCheckResponse, FactSchema } from '@backstage-community/plugin-tech-insights-common';
6
+ import { CheckResult, BulkCheckResponse, FactSchema, CheckLink } from '@backstage-community/plugin-tech-insights-common';
7
+ import * as _backstage_catalog_model from '@backstage/catalog-model';
8
+ import { Entity, CompoundEntityRef } from '@backstage/catalog-model';
6
9
  import * as _backstage_core_plugin_api from '@backstage/core-plugin-api';
7
10
  import { DiscoveryApi, IdentityApi } from '@backstage/core-plugin-api';
8
11
  import { JsonValue } from '@backstage/types';
9
- import { CompoundEntityRef } from '@backstage/catalog-model';
12
+ import { Check as Check$1, TechInsightsClient as TechInsightsClient$1 } from '@backstage-community/plugin-tech-insights-common/client';
13
+
14
+ /**
15
+ * TechInsightsLinksMenu setMenu receiver.
16
+ *
17
+ * This object contains an {@link ResultLinksMenuInfo.open | open} function,
18
+ * which can be used to open the popup menu. It closes automatically on
19
+ * click-away.
20
+ *
21
+ * @public
22
+ */
23
+ type ResultLinksMenuInfo = {
24
+ /**
25
+ * Call this function to open the popup menu. The element argument should be
26
+ * an element which is used as an anchor for the menu - where to display it.
27
+ */
28
+ open: (element: Element) => void;
29
+ };
30
+
31
+ /**
32
+ * Defines a react component that is responsible for rendering a result of a given type.
33
+ *
34
+ * @public
35
+ */
36
+ type CheckResultRenderer = {
37
+ type: string;
38
+ component: (check: CheckResult) => react__default.ReactElement;
39
+ description?: (check: CheckResult) => string | react__default.ReactElement;
40
+ isFailed?: (check: CheckResult) => boolean;
41
+ };
42
+ /**
43
+ * Default renderer for json-rules-engine check results.
44
+ *
45
+ * @public
46
+ */
47
+ declare const jsonRulesEngineCheckResultRenderer: CheckResultRenderer;
48
+
49
+ /** @public */
50
+ type ResultCheckIconBaseComponent = ComponentType<{
51
+ onClick?: MouseEventHandler | undefined;
52
+ }>;
53
+ /**
54
+ * ResultCheckIcon props
55
+ *
56
+ * The only necessary prop is {@link ResultCheckIconProps.result}, but if
57
+ * {@link ResultCheckIconProps.entity} is provided, the popup menu with links
58
+ * will also include links specifically for this entity.
59
+ *
60
+ * @public
61
+ */
62
+ interface ResultCheckIconProps<C extends ResultCheckIconBaseComponent> {
63
+ /**
64
+ * The CheckResult object to create an icon for
65
+ */
66
+ result: CheckResult;
67
+ /**
68
+ * The entity for which this check result is created. This is optional, but if
69
+ * provided, entity-specific links will be added to the popup menu, if any.
70
+ */
71
+ entity?: Entity;
72
+ /**
73
+ * This can optionally be provided, with a small performance improvement, if
74
+ * it is already cashed upstream.
75
+ */
76
+ checkResultRenderer?: CheckResultRenderer;
77
+ /**
78
+ * Will disable the popup menu
79
+ */
80
+ disableLinksMenu?: boolean;
81
+ /**
82
+ * By default, the icon (and the parent `IconButton`) is wrapped inside a
83
+ * `ListItemSecondaryAction` which handles the `onClick` to open the popup
84
+ * menu.
85
+ *
86
+ * This can be changed by providing a custom component here.
87
+ *
88
+ * The {@link ResultCheckIconProps.componentProps} prop can be specified to
89
+ * add props to the wrapping component.
90
+ */
91
+ component?: C;
92
+ /**
93
+ * Props to provide to the wrapping component, which by default is a
94
+ * `ListItemSecondaryAction` but can be overridden using
95
+ * {@link ResultCheckIconProps.component}.
96
+ */
97
+ componentProps?: Omit<ComponentProps<C>, 'onClick'>;
98
+ /**
99
+ * Override the component used to display instead of a result icon, when no
100
+ * renderer was found for this check type.
101
+ */
102
+ missingRendererComponent?: ReactNode;
103
+ }
10
104
 
11
105
  /**
12
106
  * @public
@@ -20,7 +114,11 @@ declare const techInsightsPlugin: _backstage_core_plugin_api.BackstagePlugin<{
20
114
  declare const ScorecardInfo: (props: {
21
115
  checkResults: _backstage_community_plugin_tech_insights_common.CheckResult[];
22
116
  title: react.ReactNode;
117
+ entity: _backstage_catalog_model.Entity;
23
118
  description?: string | undefined;
119
+ /**
120
+ * @public
121
+ */
24
122
  noWarning?: boolean | undefined;
25
123
  expanded?: boolean | undefined;
26
124
  }) => react.JSX.Element;
@@ -29,6 +127,7 @@ declare const ScorecardInfo: (props: {
29
127
  */
30
128
  declare const ScorecardsList: (props: {
31
129
  checkResults: _backstage_community_plugin_tech_insights_common.CheckResult[];
130
+ entity?: _backstage_catalog_model.Entity | undefined;
32
131
  }) => react.JSX.Element;
33
132
  /**
34
133
  * @public
@@ -52,54 +151,31 @@ declare const EntityTechInsightsScorecardCard: (props: {
52
151
  * @public
53
152
  */
54
153
  declare const TechInsightsScorecardPage: () => react.JSX.Element;
154
+ /**
155
+ * @public
156
+ */
157
+ declare const TechInsightsCheckIcon: <C extends ResultCheckIconBaseComponent = typeof _material_ui_core.ListItemSecondaryAction>(props: ResultCheckIconProps<C>) => react.JSX.Element;
158
+ /**
159
+ * @public
160
+ */
161
+ declare const TechInsightsLinksMenu: (props: react.PropsWithChildren<{
162
+ result: _backstage_community_plugin_tech_insights_common.CheckResult;
163
+ entity?: _backstage_catalog_model.Entity | undefined;
164
+ setMenu(opener: ResultLinksMenuInfo | undefined): void;
165
+ }>) => react.JSX.Element | null;
55
166
 
56
167
  /**
57
168
  * Represents a single check defined on the TechInsights backend.
58
169
  *
59
170
  * @public
171
+ * @deprecated Import from \@backstage-community/plugin-tech-insights-common/client
60
172
  */
61
- type Check = {
62
- /**
63
- * Unique identifier of the check
64
- *
65
- * Used to identify which checks to use when running checks.
66
- */
67
- id: string;
68
- /**
69
- * Type identifier for the check.
70
- * Can be used to determine storage options, logical routing to correct FactChecker implementation
71
- * or to help frontend render correct component types based on this
72
- */
73
- type: string;
74
- /**
75
- * Human readable name of the check, may be displayed in the UI
76
- */
77
- name: string;
78
- /**
79
- * Human readable description of the check, may be displayed in the UI
80
- */
81
- description: string;
82
- /**
83
- * A collection of string referencing fact rows that a check will be run against.
84
- *
85
- * References the fact container, aka fact retriever itself which may or may not contain multiple individual facts and values
86
- */
87
- factIds: string[];
88
- /**
89
- * Metadata to be returned in case a check has been successfully evaluated
90
- * Can contain links, description texts or other actionable items
91
- */
92
- successMetadata?: Record<string, unknown>;
93
- /**
94
- * Metadata to be returned in case a check evaluation has ended in failure
95
- * Can contain links, description texts or other actionable items
96
- */
97
- failureMetadata?: Record<string, unknown>;
98
- };
173
+ type Check = Check$1;
99
174
  /**
100
175
  * Represents a Fact defined on the TechInsights backend.
101
176
  *
102
177
  * @public
178
+ * @deprecated Import from \@backstage-community/plugin-tech-insights-common/client
103
179
  */
104
180
  interface InsightFacts {
105
181
  [factId: string]: {
@@ -109,24 +185,6 @@ interface InsightFacts {
109
185
  };
110
186
  }
111
187
 
112
- /**
113
- * Defines a react component that is responsible for rendering a result of a given type.
114
- *
115
- * @public
116
- */
117
- type CheckResultRenderer = {
118
- type: string;
119
- component: (check: CheckResult) => react__default.ReactElement;
120
- description?: (check: CheckResult) => string | react__default.ReactElement;
121
- isFailed?: (check: CheckResult) => boolean;
122
- };
123
- /**
124
- * Default renderer for json-rules-engine check results.
125
- *
126
- * @public
127
- */
128
- declare const jsonRulesEngineCheckResultRenderer: CheckResultRenderer;
129
-
130
188
  /**
131
189
  * {@link @backstage/core-plugin-api#ApiRef} for the {@link TechInsightsApi}
132
190
  *
@@ -146,26 +204,26 @@ interface TechInsightsApi {
146
204
  runBulkChecks(entities: CompoundEntityRef[], checks?: Check[]): Promise<BulkCheckResponse>;
147
205
  getFacts(entity: CompoundEntityRef, facts: string[]): Promise<InsightFacts>;
148
206
  getFactSchemas(): Promise<FactSchema[]>;
207
+ getLinksForEntity(result: CheckResult, entity: Entity, options?: {
208
+ includeStaticLinks?: boolean;
209
+ }): CheckLink[];
149
210
  }
150
211
 
151
212
  /** @public */
152
- declare class TechInsightsClient implements TechInsightsApi {
153
- private readonly discoveryApi;
154
- private readonly identityApi;
213
+ declare class TechInsightsClient extends TechInsightsClient$1 implements TechInsightsApi {
155
214
  private readonly renderers?;
215
+ private readonly customGetEntityLinks;
156
216
  constructor(options: {
157
217
  discoveryApi: DiscoveryApi;
158
218
  identityApi: IdentityApi;
159
219
  renderers?: CheckResultRenderer[];
220
+ getEntityLinks?: (result: CheckResult, entity: Entity) => CheckLink[];
160
221
  });
161
- getFacts(entity: CompoundEntityRef, facts: string[]): Promise<InsightFacts>;
162
222
  getCheckResultRenderers(types: string[]): CheckResultRenderer[];
163
223
  isCheckResultFailed(check: CheckResult): boolean;
164
- getAllChecks(): Promise<Check[]>;
165
- getFactSchemas(): Promise<FactSchema[]>;
166
- runChecks(entityParams: CompoundEntityRef, checks?: string[]): Promise<CheckResult[]>;
167
- runBulkChecks(entities: CompoundEntityRef[], checks?: Check[]): Promise<BulkCheckResponse>;
168
- private api;
224
+ getLinksForEntity(result: CheckResult, entity: Entity, options?: {
225
+ includeStaticLinks?: boolean;
226
+ }): CheckLink[];
169
227
  }
170
228
 
171
229
  /**
@@ -175,4 +233,4 @@ declare const BooleanCheck: (props: {
175
233
  checkResult: CheckResult;
176
234
  }) => react__default.JSX.Element;
177
235
 
178
- export { BooleanCheck, type Check, type CheckResultRenderer, EntityTechInsightsScorecardCard, EntityTechInsightsScorecardContent, type InsightFacts, ScorecardInfo, ScorecardsList, type TechInsightsApi, TechInsightsClient, TechInsightsScorecardPage, jsonRulesEngineCheckResultRenderer, techInsightsApiRef, techInsightsPlugin };
236
+ export { BooleanCheck, type Check, type CheckResultRenderer, EntityTechInsightsScorecardCard, EntityTechInsightsScorecardContent, type InsightFacts, type ResultCheckIconBaseComponent, type ResultCheckIconProps, type ResultLinksMenuInfo, ScorecardInfo, ScorecardsList, type TechInsightsApi, TechInsightsCheckIcon, TechInsightsClient, TechInsightsLinksMenu, TechInsightsScorecardPage, jsonRulesEngineCheckResultRenderer, techInsightsApiRef, techInsightsPlugin };
package/dist/index.esm.js CHANGED
@@ -1,4 +1,4 @@
1
- export { EntityTechInsightsScorecardCard, EntityTechInsightsScorecardContent, ScorecardInfo, ScorecardsList, TechInsightsScorecardPage, techInsightsPlugin } from './plugin.esm.js';
1
+ export { EntityTechInsightsScorecardCard, EntityTechInsightsScorecardContent, ScorecardInfo, ScorecardsList, TechInsightsCheckIcon, TechInsightsLinksMenu, TechInsightsScorecardPage, techInsightsPlugin } from './plugin.esm.js';
2
2
  export { techInsightsApiRef } from './api/TechInsightsApi.esm.js';
3
3
  export { TechInsightsClient } from './api/TechInsightsClient.esm.js';
4
4
  export { BooleanCheck } from './components/BooleanCheck/BooleanCheck.esm.js';
@@ -51,6 +51,20 @@ const TechInsightsScorecardPage = techInsightsPlugin.provide(
51
51
  mountPoint: rootRouteRef
52
52
  })
53
53
  );
54
+ const TechInsightsCheckIcon = techInsightsPlugin.provide(
55
+ createRoutableExtension({
56
+ name: "TechInsightsCheckIcon",
57
+ component: () => import('./components/ResultCheckIcon/index.esm.js').then((m) => m.ResultCheckIcon),
58
+ mountPoint: rootRouteRef
59
+ })
60
+ );
61
+ const TechInsightsLinksMenu = techInsightsPlugin.provide(
62
+ createRoutableExtension({
63
+ name: "TechInsightsLinksMenu",
64
+ component: () => import('./components/ResultLinksMenu/index.esm.js').then((m) => m.ResultLinksMenu),
65
+ mountPoint: rootRouteRef
66
+ })
67
+ );
54
68
 
55
- export { EntityTechInsightsScorecardCard, EntityTechInsightsScorecardContent, ScorecardInfo, ScorecardsList, TechInsightsScorecardPage, techInsightsPlugin };
69
+ export { EntityTechInsightsScorecardCard, EntityTechInsightsScorecardContent, ScorecardInfo, ScorecardsList, TechInsightsCheckIcon, TechInsightsLinksMenu, TechInsightsScorecardPage, techInsightsPlugin };
56
70
  //# sourceMappingURL=plugin.esm.js.map
@@ -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 createRoutableExtension,\n createApiFactory,\n discoveryApiRef,\n identityApiRef,\n} from '@backstage/core-plugin-api';\nimport { rootRouteRef } from './routes';\nimport { techInsightsApiRef } from './api/TechInsightsApi';\nimport { TechInsightsClient } from './api/TechInsightsClient';\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 createRoutableExtension({\n name: 'ScorecardInfo',\n component: () =>\n import('./components/ScorecardsInfo').then(m => m.ScorecardInfo),\n mountPoint: rootRouteRef,\n }),\n);\n\n/**\n * @public\n */\nexport const ScorecardsList = techInsightsPlugin.provide(\n createRoutableExtension({\n name: 'ScorecardsList',\n component: () =>\n import('./components/ScorecardsList').then(m => m.ScorecardsList),\n mountPoint: rootRouteRef,\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"],"names":[],"mappings":";;;;;AA6BO,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,CAAA;AAAA,KACvD,CAAA;AAAA,GACH;AAAA,EACA,MAAQ,EAAA;AAAA,IACN,IAAM,EAAA,YAAA;AAAA,GACR;AACF,CAAC,EAAA;AAKM,MAAM,gBAAgB,kBAAmB,CAAA,OAAA;AAAA,EAC9C,uBAAwB,CAAA;AAAA,IACtB,IAAM,EAAA,eAAA;AAAA,IACN,SAAA,EAAW,MACT,OAAO,0CAA6B,EAAE,IAAK,CAAA,CAAA,CAAA,KAAK,EAAE,aAAa,CAAA;AAAA,IACjE,UAAY,EAAA,YAAA;AAAA,GACb,CAAA;AACH,EAAA;AAKO,MAAM,iBAAiB,kBAAmB,CAAA,OAAA;AAAA,EAC/C,uBAAwB,CAAA;AAAA,IACtB,IAAM,EAAA,gBAAA;AAAA,IACN,SAAA,EAAW,MACT,OAAO,0CAA6B,EAAE,IAAK,CAAA,CAAA,CAAA,KAAK,EAAE,cAAc,CAAA;AAAA,IAClE,UAAY,EAAA,YAAA;AAAA,GACb,CAAA;AACH,EAAA;AAKO,MAAM,qCAAqC,kBAAmB,CAAA,OAAA;AAAA,EACnE,uBAAwB,CAAA;AAAA,IACtB,IAAM,EAAA,oCAAA;AAAA,IACN,SAAA,EAAW,MACT,OAAO,6CAAgC,EAAE,IAAK,CAAA,CAAA,CAAA,KAAK,EAAE,iBAAiB,CAAA;AAAA,IACxE,UAAY,EAAA,YAAA;AAAA,GACb,CAAA;AACH,EAAA;AAKO,MAAM,kCAAkC,kBAAmB,CAAA,OAAA;AAAA,EAChE,uBAAwB,CAAA;AAAA,IACtB,IAAM,EAAA,iCAAA;AAAA,IACN,SAAA,EAAW,MACT,OAAO,0CAA6B,EAAE,IAAK,CAAA,CAAA,CAAA,KAAK,EAAE,cAAc,CAAA;AAAA,IAClE,UAAY,EAAA,YAAA;AAAA,GACb,CAAA;AACH,EAAA;AAKO,MAAM,4BAA4B,kBAAmB,CAAA,OAAA;AAAA,EAC1D,uBAAwB,CAAA;AAAA,IACtB,IAAM,EAAA,2BAAA;AAAA,IACN,SAAA,EAAW,MACT,OAAO,0CAA6B,EAAE,IAAK,CAAA,CAAA,CAAA,KAAK,EAAE,cAAc,CAAA;AAAA,IAClE,UAAY,EAAA,YAAA;AAAA,GACb,CAAA;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 createRoutableExtension,\n createApiFactory,\n discoveryApiRef,\n identityApiRef,\n} from '@backstage/core-plugin-api';\nimport { rootRouteRef } from './routes';\nimport { techInsightsApiRef } from './api/TechInsightsApi';\nimport { TechInsightsClient } from './api/TechInsightsClient';\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 createRoutableExtension({\n name: 'ScorecardInfo',\n component: () =>\n import('./components/ScorecardsInfo').then(m => m.ScorecardInfo),\n mountPoint: rootRouteRef,\n }),\n);\n\n/**\n * @public\n */\nexport const ScorecardsList = techInsightsPlugin.provide(\n createRoutableExtension({\n name: 'ScorecardsList',\n component: () =>\n import('./components/ScorecardsList').then(m => m.ScorecardsList),\n mountPoint: rootRouteRef,\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 */\nexport const TechInsightsCheckIcon = techInsightsPlugin.provide(\n createRoutableExtension({\n name: 'TechInsightsCheckIcon',\n component: () =>\n import('./components/ResultCheckIcon').then(m => m.ResultCheckIcon),\n mountPoint: rootRouteRef,\n }),\n);\n\n/**\n * @public\n */\nexport const TechInsightsLinksMenu = techInsightsPlugin.provide(\n createRoutableExtension({\n name: 'TechInsightsLinksMenu',\n component: () =>\n import('./components/ResultLinksMenu').then(m => m.ResultLinksMenu),\n mountPoint: rootRouteRef,\n }),\n);\n"],"names":[],"mappings":";;;;;AA6BO,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,CAAA;AAAA,KACvD,CAAA;AAAA,GACH;AAAA,EACA,MAAQ,EAAA;AAAA,IACN,IAAM,EAAA,YAAA;AAAA,GACR;AACF,CAAC,EAAA;AAKM,MAAM,gBAAgB,kBAAmB,CAAA,OAAA;AAAA,EAC9C,uBAAwB,CAAA;AAAA,IACtB,IAAM,EAAA,eAAA;AAAA,IACN,SAAA,EAAW,MACT,OAAO,0CAA6B,EAAE,IAAK,CAAA,CAAA,CAAA,KAAK,EAAE,aAAa,CAAA;AAAA,IACjE,UAAY,EAAA,YAAA;AAAA,GACb,CAAA;AACH,EAAA;AAKO,MAAM,iBAAiB,kBAAmB,CAAA,OAAA;AAAA,EAC/C,uBAAwB,CAAA;AAAA,IACtB,IAAM,EAAA,gBAAA;AAAA,IACN,SAAA,EAAW,MACT,OAAO,0CAA6B,EAAE,IAAK,CAAA,CAAA,CAAA,KAAK,EAAE,cAAc,CAAA;AAAA,IAClE,UAAY,EAAA,YAAA;AAAA,GACb,CAAA;AACH,EAAA;AAKO,MAAM,qCAAqC,kBAAmB,CAAA,OAAA;AAAA,EACnE,uBAAwB,CAAA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@
1
1
  {
2
2
  "name": "@backstage-community/plugin-tech-insights",
3
- "version": "0.3.33",
3
+ "version": "0.3.35",
4
4
  "backstage": {
5
5
  "role": "frontend-plugin",
6
6
  "pluginId": "tech-insights",
@@ -39,7 +39,7 @@
39
39
  "test": "backstage-cli package test"
40
40
  },
41
41
  "dependencies": {
42
- "@backstage-community/plugin-tech-insights-common": "^0.2.16",
42
+ "@backstage-community/plugin-tech-insights-common": "^0.2.18",
43
43
  "@backstage/catalog-model": "^1.6.0",
44
44
  "@backstage/core-components": "^0.14.10",
45
45
  "@backstage/core-plugin-api": "^1.9.3",
@@ -51,7 +51,6 @@
51
51
  "@material-ui/icons": "^4.9.1",
52
52
  "@material-ui/lab": "4.0.0-alpha.61",
53
53
  "@types/react": "^16.13.1 || ^17.0.0 || ^18.0.0",
54
- "qs": "^6.9.4",
55
54
  "react-use": "^17.2.4"
56
55
  },
57
56
  "devDependencies": {