@backstage-community/plugin-tech-insights 0.3.34 → 0.3.36
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -0
- package/README.md +54 -0
- package/dist/api/TechInsightsApi.esm.js.map +1 -1
- package/dist/api/TechInsightsClient.esm.js +9 -0
- package/dist/api/TechInsightsClient.esm.js.map +1 -1
- package/dist/components/ResultCheckIcon/ResultCheckIcon.esm.js +45 -0
- package/dist/components/ResultCheckIcon/ResultCheckIcon.esm.js.map +1 -0
- package/dist/components/ResultCheckIcon/index.esm.js +2 -0
- package/dist/components/ResultCheckIcon/index.esm.js.map +1 -0
- package/dist/components/ResultLinksMenu/ResultLinksMenu.esm.js +65 -0
- package/dist/components/ResultLinksMenu/ResultLinksMenu.esm.js.map +1 -0
- package/dist/components/ResultLinksMenu/index.esm.js +2 -0
- package/dist/components/ResultLinksMenu/index.esm.js.map +1 -0
- package/dist/components/ScorecardsCard/ScorecardsCard.esm.js +1 -0
- package/dist/components/ScorecardsCard/ScorecardsCard.esm.js.map +1 -1
- package/dist/components/ScorecardsContent/ScorecardContent.esm.js +3 -1
- package/dist/components/ScorecardsContent/ScorecardContent.esm.js.map +1 -1
- package/dist/components/ScorecardsInfo/ScorecardInfo.esm.js +2 -1
- package/dist/components/ScorecardsInfo/ScorecardInfo.esm.js.map +1 -1
- package/dist/components/ScorecardsList/ScorecardsList.esm.js +15 -5
- package/dist/components/ScorecardsList/ScorecardsList.esm.js.map +1 -1
- package/dist/index.d.ts +116 -22
- package/dist/index.esm.js +1 -1
- package/dist/plugin.esm.js +26 -8
- package/dist/plugin.esm.js.map +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @backstage-community/plugin-tech-insights
|
|
2
2
|
|
|
3
|
+
## 0.3.36
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 42a2c31: Export component extensions instead of routable extensions when routes aren't required (or used). ResultCheckIcon can now wrap both React components and HTML elements for onClick handling of the popup menu with links.
|
|
8
|
+
|
|
9
|
+
## 0.3.35
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- 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).
|
|
14
|
+
- Updated dependencies [1d33996]
|
|
15
|
+
- @backstage-community/plugin-tech-insights-common@0.2.18
|
|
16
|
+
|
|
3
17
|
## 0.3.34
|
|
4
18
|
|
|
5
19
|
### 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":";;
|
|
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;;;;"}
|
|
@@ -3,9 +3,11 @@ import { jsonRulesEngineCheckResultRenderer } from '../components/CheckResultRen
|
|
|
3
3
|
|
|
4
4
|
class TechInsightsClient extends TechInsightsClient$1 {
|
|
5
5
|
renderers;
|
|
6
|
+
customGetEntityLinks;
|
|
6
7
|
constructor(options) {
|
|
7
8
|
super(options);
|
|
8
9
|
this.renderers = options.renderers;
|
|
10
|
+
this.customGetEntityLinks = options.getEntityLinks ?? (() => []);
|
|
9
11
|
}
|
|
10
12
|
getCheckResultRenderers(types) {
|
|
11
13
|
const renderers = this.renderers ?? [jsonRulesEngineCheckResultRenderer];
|
|
@@ -20,6 +22,13 @@ class TechInsightsClient extends TechInsightsClient$1 {
|
|
|
20
22
|
}
|
|
21
23
|
return true;
|
|
22
24
|
}
|
|
25
|
+
getLinksForEntity(result, entity, options = {}) {
|
|
26
|
+
const links = this.customGetEntityLinks(result, entity);
|
|
27
|
+
if (options.includeStaticLinks) {
|
|
28
|
+
links.push(...result.check.links ?? []);
|
|
29
|
+
}
|
|
30
|
+
return links;
|
|
31
|
+
}
|
|
23
32
|
}
|
|
24
33
|
|
|
25
34
|
export { TechInsightsClient };
|
|
@@ -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 { DiscoveryApi, IdentityApi } from '@backstage/core-plugin-api';\nimport { TechInsightsClient as TechInsightsClientBase } from '@backstage-community/plugin-tech-insights-common/client';\nimport {
|
|
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,45 @@
|
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import { useApi } from '@backstage/core-plugin-api';
|
|
3
|
+
import IconButton from '@material-ui/core/IconButton';
|
|
4
|
+
import Alert from '@material-ui/lab/Alert';
|
|
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
|
+
import { ResultLinksMenu } from '../ResultLinksMenu/ResultLinksMenu.esm.js';
|
|
10
|
+
|
|
11
|
+
const ResultCheckIcon = (props) => {
|
|
12
|
+
const {
|
|
13
|
+
result,
|
|
14
|
+
entity,
|
|
15
|
+
disableLinksMenu,
|
|
16
|
+
component,
|
|
17
|
+
componentProps,
|
|
18
|
+
missingRendererComponent = /* @__PURE__ */ React.createElement(Alert, { severity: "error" }, "Unknown type.")
|
|
19
|
+
} = props;
|
|
20
|
+
const api = useApi(techInsightsApiRef);
|
|
21
|
+
const checkResultRenderer = props.checkResultRenderer ?? api.getCheckResultRenderers([result.check.type])[0];
|
|
22
|
+
const [menu, setMenu] = useState();
|
|
23
|
+
const iconComponent = checkResultRenderer?.component(result);
|
|
24
|
+
const onClick = (event) => {
|
|
25
|
+
menu?.open(event.currentTarget);
|
|
26
|
+
};
|
|
27
|
+
const wrapActions = (inner) => {
|
|
28
|
+
if (!menu) {
|
|
29
|
+
if (component) {
|
|
30
|
+
const Component = component;
|
|
31
|
+
return /* @__PURE__ */ React.createElement(Component, { ...componentProps }, inner);
|
|
32
|
+
}
|
|
33
|
+
return inner;
|
|
34
|
+
}
|
|
35
|
+
if (component) {
|
|
36
|
+
const Component = component;
|
|
37
|
+
return /* @__PURE__ */ React.createElement(Component, { ...componentProps, onClick }, /* @__PURE__ */ React.createElement(IconButton, { edge: "end", "aria-label": "icon" }, inner));
|
|
38
|
+
}
|
|
39
|
+
return /* @__PURE__ */ React.createElement(IconButton, { edge: "end", "aria-label": "icon", onClick }, inner);
|
|
40
|
+
};
|
|
41
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, !disableLinksMenu && /* @__PURE__ */ React.createElement(ResultLinksMenu, { result, entity, setMenu }), wrapActions(iconComponent ?? missingRendererComponent));
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
export { ResultCheckIcon };
|
|
45
|
+
//# 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 ElementType,\n MouseEventHandler,\n PropsWithChildren,\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 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 ResultCheckIconBaseComponentProps = PropsWithChildren<{\n onClick?: MouseEventHandler;\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<\n P extends ResultCheckIconBaseComponentProps,\n> {\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 * The icon is rendered with an `IconButton` which handles the onClick.\n * To wrap this in another component, handling the onClick, pass a component,\n * such as `ListItemSecondaryAction` which handles the `onClick` to open the\n * popup menu.\n *\n * The {@link ResultCheckIconProps.componentProps} prop can be specified to\n * add props to the wrapping component.\n */\n component?: ElementType<P>;\n /**\n * Props to provide to the wrapping component\n * {@link ResultCheckIconProps.component}.\n */\n componentProps?: Omit<P, 'onClick' | 'children'>;\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 = <P extends ResultCheckIconBaseComponentProps>(\n props: ResultCheckIconProps<P>,\n) => {\n const {\n result,\n entity,\n disableLinksMenu,\n component,\n componentProps,\n missingRendererComponent = <Alert severity=\"error\">Unknown type.</Alert>,\n } = props;\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 onClick: MouseEventHandler = event => {\n menu?.open(event.currentTarget);\n };\n\n const wrapActions = (inner: React.ReactElement): ReactNode => {\n if (!menu) {\n if (component) {\n const Component =\n component as ElementType<ResultCheckIconBaseComponentProps>;\n return <Component {...componentProps}>{inner}</Component>;\n }\n return inner;\n }\n\n if (component) {\n const Component =\n component as ElementType<ResultCheckIconBaseComponentProps>;\n return (\n <Component {...componentProps} onClick={onClick}>\n <IconButton edge=\"end\" aria-label=\"icon\">\n {inner}\n </IconButton>\n </Component>\n );\n }\n return (\n <IconButton edge=\"end\" aria-label=\"icon\" onClick={onClick}>\n {inner}\n </IconButton>\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":";;;;;;;;;;AA4Fa,MAAA,eAAA,GAAkB,CAC7B,KACG,KAAA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AW,EAAA,EAAA,IAAA,EAAK,KAAM,EAAA,YAAA,EAAW,MAC/B,EAAA,EAAA,KACH,CACF,CAAA,CAAA;AAAA,KAEJ;AACA,IAAA,2CACG,UAAW,EAAA,EAAA,IAAA,EAAK,OAAM,YAAW,EAAA,MAAA,EAAO,WACtC,KACH,CAAA,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 @@
|
|
|
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,EAAA,MAAM,EAAE,MAAA,EAAQ,MAAQ,EAAA,OAAA,EAAY,GAAA,KAAA,CAAA;AAEpC,EAAM,MAAA,GAAA,GAAM,OAAO,kBAAkB,CAAA,CAAA;AAErC,EAAA,MAAM,KAAQ,GAAA,OAAA;AAAA,IACZ,MACE,MAAA,GACI,GAAI,CAAA,iBAAA,CAAkB,QAAQ,MAAQ,EAAA;AAAA,MACpC,kBAAoB,EAAA,IAAA;AAAA,KACrB,CAAA,GACD,MAAO,CAAA,KAAA,CAAM,SAAS,EAAC;AAAA,IAC7B,CAAC,GAAK,EAAA,MAAA,EAAQ,MAAM,CAAA;AAAA,GACtB,CAAA;AAEA,EAAM,MAAA,MAAA,GAAS,CAAQ,KAAA,EAAA,KAAA,EAAO,CAAA,CAAA,CAAA;AAE9B,EAAA,MAAM,CAAC,QAAA,EAAU,WAAW,CAAA,GAAI,KAAM,CAAA,QAAA;AAAA,IACpC,KAAA,CAAA;AAAA,GACF,CAAA;AAEA,EAAA,SAAA,CAAU,MAAM;AACd,IAAI,IAAA,KAAA,CAAM,WAAW,CAAG,EAAA;AACtB,MAAA,OAAA,CAAQ,KAAS,CAAA,CAAA,CAAA;AACjB,MAAA,OAAA;AAAA,KACF;AACA,IAAQ,OAAA,CAAA;AAAA,MACN,IAAA,EAAM,CAAC,IAAkB,KAAA;AACvB,QAAA,WAAA,CAAY,IAAI,CAAA,CAAA;AAAA,OAClB;AAAA,KACD,CAAA,CAAA;AAAA,GACA,EAAA,CAAC,OAAS,EAAA,KAAK,CAAC,CAAA,CAAA;AAEnB,EAAM,MAAA,WAAA,GAAc,YAAY,MAAM;AACpC,IAAA,WAAA,CAAY,KAAS,CAAA,CAAA,CAAA;AAAA,GACvB,EAAG,CAAC,WAAW,CAAC,CAAA,CAAA;AAEhB,EAAI,IAAA,KAAA,CAAM,WAAW,CAAG,EAAA;AACtB,IAAO,OAAA,IAAA,CAAA;AAAA,GACT;AAEA,EACE,uBAAA,KAAA,CAAA,aAAA;AAAA,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 @@
|
|
|
1
|
+
{"version":3,"file":"index.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -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;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AEA,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,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,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 {
|
|
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(
|
|
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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|
|
49
49
|
checkResults,
|
|
50
50
|
title,
|
|
51
|
+
entity,
|
|
51
52
|
description,
|
|
52
53
|
noWarning,
|
|
53
54
|
expanded = true
|
|
@@ -76,7 +77,7 @@ const ScorecardInfo = (props) => {
|
|
|
76
77
|
title,
|
|
77
78
|
description,
|
|
78
79
|
classes,
|
|
79
|
-
/* @__PURE__ */ React.createElement(ScorecardsList, { checkResults }),
|
|
80
|
+
/* @__PURE__ */ React.createElement(ScorecardsList, { checkResults, entity }),
|
|
80
81
|
expanded,
|
|
81
82
|
`${checkResults.filter((checkResult) => !api.isCheckResultFailed(checkResult)).length}/${checkResults.length}`
|
|
82
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":";;;;;;;;;;;;;;;;
|
|
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,CAAA,OAAA,CAAQ,MAAM,CAAA,CAAA;AAAA,GACjD;AAAA,EACA,sBAAwB,EAAA;AAAA,IACtB,MAAQ,EAAA,CAAA,EAAG,KAAM,CAAA,OAAA,CAAQ,CAA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AA,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;;;;"}
|
|
@@ -2,14 +2,15 @@ import React from 'react';
|
|
|
2
2
|
import { useApi } from '@backstage/core-plugin-api';
|
|
3
3
|
import List from '@material-ui/core/List';
|
|
4
4
|
import ListItem from '@material-ui/core/ListItem';
|
|
5
|
+
import ListItemSecondaryAction from '@material-ui/core/ListItemSecondaryAction';
|
|
5
6
|
import ListItemText from '@material-ui/core/ListItemText';
|
|
6
7
|
import { makeStyles } from '@material-ui/core/styles';
|
|
7
8
|
import { techInsightsApiRef } from '../../api/TechInsightsApi.esm.js';
|
|
8
9
|
import '@backstage-community/plugin-tech-insights-common/client';
|
|
9
10
|
import '@material-ui/icons/CheckCircleOutline';
|
|
10
11
|
import '@material-ui/icons/ErrorOutline';
|
|
11
|
-
import Alert from '@material-ui/lab/Alert';
|
|
12
12
|
import { MarkdownContent } from '@backstage/core-components';
|
|
13
|
+
import { ResultCheckIcon } from '../ResultCheckIcon/ResultCheckIcon.esm.js';
|
|
13
14
|
|
|
14
15
|
const useStyles = makeStyles((theme) => ({
|
|
15
16
|
listItemText: {
|
|
@@ -17,15 +18,16 @@ const useStyles = makeStyles((theme) => ({
|
|
|
17
18
|
}
|
|
18
19
|
}));
|
|
19
20
|
const ScorecardsList = (props) => {
|
|
20
|
-
const { checkResults } = props;
|
|
21
|
+
const { checkResults, entity } = props;
|
|
21
22
|
const classes = useStyles();
|
|
22
23
|
const api = useApi(techInsightsApiRef);
|
|
23
24
|
const types = [...new Set(checkResults.map(({ check }) => check.type))];
|
|
24
25
|
const checkResultRenderers = api.getCheckResultRenderers(types);
|
|
25
26
|
return /* @__PURE__ */ React.createElement(List, null, checkResults.map((result, index) => {
|
|
26
|
-
const
|
|
27
|
+
const checkResultRenderer = checkResultRenderers.find(
|
|
27
28
|
(renderer) => renderer.type === result.check.type
|
|
28
|
-
)
|
|
29
|
+
);
|
|
30
|
+
const description = checkResultRenderer?.description;
|
|
29
31
|
return /* @__PURE__ */ React.createElement(ListItem, { key: result.check.id }, /* @__PURE__ */ React.createElement(
|
|
30
32
|
ListItemText,
|
|
31
33
|
{
|
|
@@ -34,7 +36,15 @@ const ScorecardsList = (props) => {
|
|
|
34
36
|
secondary: description ? description(result) : /* @__PURE__ */ React.createElement(MarkdownContent, { content: result.check.description }),
|
|
35
37
|
className: classes.listItemText
|
|
36
38
|
}
|
|
37
|
-
),
|
|
39
|
+
), /* @__PURE__ */ React.createElement(
|
|
40
|
+
ResultCheckIcon,
|
|
41
|
+
{
|
|
42
|
+
result,
|
|
43
|
+
entity,
|
|
44
|
+
component: ListItemSecondaryAction,
|
|
45
|
+
checkResultRenderer
|
|
46
|
+
}
|
|
47
|
+
));
|
|
38
48
|
}));
|
|
39
49
|
};
|
|
40
50
|
|
|
@@ -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
|
|
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 ListItemSecondaryAction from '@material-ui/core/ListItemSecondaryAction';\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 component={ListItemSecondaryAction}\n checkResultRenderer={checkResultRenderer}\n />\n </ListItem>\n );\n })}\n </List>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;AA6BA,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,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,sBAAsB,oBAAqB,CAAA,IAAA;AAAA,MAC/C,CAAY,QAAA,KAAA,QAAA,CAAS,IAAS,KAAA,MAAA,CAAO,KAAM,CAAA,IAAA;AAAA,KAC7C,CAAA;AAEA,IAAA,MAAM,cAAc,mBAAqB,EAAA,WAAA,CAAA;AAEzC,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,KAErB,kBAAA,KAAA,CAAA,aAAA;AAAA,MAAC,eAAA;AAAA,MAAA;AAAA,QACC,MAAA;AAAA,QACA,MAAA;AAAA,QACA,SAAW,EAAA,uBAAA;AAAA,QACX,mBAAA;AAAA,OAAA;AAAA,KAEJ,CAAA,CAAA;AAAA,GAEH,CACH,CAAA,CAAA;AAEJ;;;;"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,13 +1,103 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import * as react from 'react';
|
|
3
|
-
import react__default from 'react';
|
|
3
|
+
import react__default, { PropsWithChildren, MouseEventHandler, ElementType, ReactNode } from 'react';
|
|
4
4
|
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';
|
|
5
|
+
import { CheckResult, BulkCheckResponse, FactSchema, CheckLink } from '@backstage-community/plugin-tech-insights-common';
|
|
6
|
+
import * as _backstage_catalog_model from '@backstage/catalog-model';
|
|
7
|
+
import { Entity, CompoundEntityRef } from '@backstage/catalog-model';
|
|
6
8
|
import * as _backstage_core_plugin_api from '@backstage/core-plugin-api';
|
|
7
9
|
import { DiscoveryApi, IdentityApi } from '@backstage/core-plugin-api';
|
|
8
10
|
import { JsonValue } from '@backstage/types';
|
|
9
11
|
import { Check as Check$1, TechInsightsClient as TechInsightsClient$1 } from '@backstage-community/plugin-tech-insights-common/client';
|
|
10
|
-
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* TechInsightsLinksMenu setMenu receiver.
|
|
15
|
+
*
|
|
16
|
+
* This object contains an {@link ResultLinksMenuInfo.open | open} function,
|
|
17
|
+
* which can be used to open the popup menu. It closes automatically on
|
|
18
|
+
* click-away.
|
|
19
|
+
*
|
|
20
|
+
* @public
|
|
21
|
+
*/
|
|
22
|
+
type ResultLinksMenuInfo = {
|
|
23
|
+
/**
|
|
24
|
+
* Call this function to open the popup menu. The element argument should be
|
|
25
|
+
* an element which is used as an anchor for the menu - where to display it.
|
|
26
|
+
*/
|
|
27
|
+
open: (element: Element) => void;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Defines a react component that is responsible for rendering a result of a given type.
|
|
32
|
+
*
|
|
33
|
+
* @public
|
|
34
|
+
*/
|
|
35
|
+
type CheckResultRenderer = {
|
|
36
|
+
type: string;
|
|
37
|
+
component: (check: CheckResult) => react__default.ReactElement;
|
|
38
|
+
description?: (check: CheckResult) => string | react__default.ReactElement;
|
|
39
|
+
isFailed?: (check: CheckResult) => boolean;
|
|
40
|
+
};
|
|
41
|
+
/**
|
|
42
|
+
* Default renderer for json-rules-engine check results.
|
|
43
|
+
*
|
|
44
|
+
* @public
|
|
45
|
+
*/
|
|
46
|
+
declare const jsonRulesEngineCheckResultRenderer: CheckResultRenderer;
|
|
47
|
+
|
|
48
|
+
/** @public */
|
|
49
|
+
type ResultCheckIconBaseComponentProps = PropsWithChildren<{
|
|
50
|
+
onClick?: MouseEventHandler;
|
|
51
|
+
}>;
|
|
52
|
+
/**
|
|
53
|
+
* ResultCheckIcon props
|
|
54
|
+
*
|
|
55
|
+
* The only necessary prop is {@link ResultCheckIconProps.result}, but if
|
|
56
|
+
* {@link ResultCheckIconProps.entity} is provided, the popup menu with links
|
|
57
|
+
* will also include links specifically for this entity.
|
|
58
|
+
*
|
|
59
|
+
* @public
|
|
60
|
+
*/
|
|
61
|
+
interface ResultCheckIconProps<P extends ResultCheckIconBaseComponentProps> {
|
|
62
|
+
/**
|
|
63
|
+
* The CheckResult object to create an icon for
|
|
64
|
+
*/
|
|
65
|
+
result: CheckResult;
|
|
66
|
+
/**
|
|
67
|
+
* The entity for which this check result is created. This is optional, but if
|
|
68
|
+
* provided, entity-specific links will be added to the popup menu, if any.
|
|
69
|
+
*/
|
|
70
|
+
entity?: Entity;
|
|
71
|
+
/**
|
|
72
|
+
* This can optionally be provided, with a small performance improvement, if
|
|
73
|
+
* it is already cashed upstream.
|
|
74
|
+
*/
|
|
75
|
+
checkResultRenderer?: CheckResultRenderer;
|
|
76
|
+
/**
|
|
77
|
+
* Will disable the popup menu
|
|
78
|
+
*/
|
|
79
|
+
disableLinksMenu?: boolean;
|
|
80
|
+
/**
|
|
81
|
+
* The icon is rendered with an `IconButton` which handles the onClick.
|
|
82
|
+
* To wrap this in another component, handling the onClick, pass a component,
|
|
83
|
+
* such as `ListItemSecondaryAction` which handles the `onClick` to open the
|
|
84
|
+
* popup menu.
|
|
85
|
+
*
|
|
86
|
+
* The {@link ResultCheckIconProps.componentProps} prop can be specified to
|
|
87
|
+
* add props to the wrapping component.
|
|
88
|
+
*/
|
|
89
|
+
component?: ElementType<P>;
|
|
90
|
+
/**
|
|
91
|
+
* Props to provide to the wrapping component
|
|
92
|
+
* {@link ResultCheckIconProps.component}.
|
|
93
|
+
*/
|
|
94
|
+
componentProps?: Omit<P, 'onClick' | 'children'>;
|
|
95
|
+
/**
|
|
96
|
+
* Override the component used to display instead of a result icon, when no
|
|
97
|
+
* renderer was found for this check type.
|
|
98
|
+
*/
|
|
99
|
+
missingRendererComponent?: ReactNode;
|
|
100
|
+
}
|
|
11
101
|
|
|
12
102
|
/**
|
|
13
103
|
* @public
|
|
@@ -21,6 +111,7 @@ declare const techInsightsPlugin: _backstage_core_plugin_api.BackstagePlugin<{
|
|
|
21
111
|
declare const ScorecardInfo: (props: {
|
|
22
112
|
checkResults: _backstage_community_plugin_tech_insights_common.CheckResult[];
|
|
23
113
|
title: react.ReactNode;
|
|
114
|
+
entity: _backstage_catalog_model.Entity;
|
|
24
115
|
description?: string | undefined;
|
|
25
116
|
noWarning?: boolean | undefined;
|
|
26
117
|
expanded?: boolean | undefined;
|
|
@@ -30,6 +121,7 @@ declare const ScorecardInfo: (props: {
|
|
|
30
121
|
*/
|
|
31
122
|
declare const ScorecardsList: (props: {
|
|
32
123
|
checkResults: _backstage_community_plugin_tech_insights_common.CheckResult[];
|
|
124
|
+
entity?: _backstage_catalog_model.Entity | undefined;
|
|
33
125
|
}) => react.JSX.Element;
|
|
34
126
|
/**
|
|
35
127
|
* @public
|
|
@@ -53,6 +145,18 @@ declare const EntityTechInsightsScorecardCard: (props: {
|
|
|
53
145
|
* @public
|
|
54
146
|
*/
|
|
55
147
|
declare const TechInsightsScorecardPage: () => react.JSX.Element;
|
|
148
|
+
/**
|
|
149
|
+
* @public
|
|
150
|
+
*/
|
|
151
|
+
declare const TechInsightsCheckIcon: <P extends ResultCheckIconBaseComponentProps>(props: ResultCheckIconProps<P>) => react.JSX.Element;
|
|
152
|
+
/**
|
|
153
|
+
* @public
|
|
154
|
+
*/
|
|
155
|
+
declare const TechInsightsLinksMenu: (props: react.PropsWithChildren<{
|
|
156
|
+
result: _backstage_community_plugin_tech_insights_common.CheckResult;
|
|
157
|
+
entity?: _backstage_catalog_model.Entity | undefined;
|
|
158
|
+
setMenu(opener: ResultLinksMenuInfo | undefined): void;
|
|
159
|
+
}>) => react.JSX.Element | null;
|
|
56
160
|
|
|
57
161
|
/**
|
|
58
162
|
* Represents a single check defined on the TechInsights backend.
|
|
@@ -75,24 +179,6 @@ interface InsightFacts {
|
|
|
75
179
|
};
|
|
76
180
|
}
|
|
77
181
|
|
|
78
|
-
/**
|
|
79
|
-
* Defines a react component that is responsible for rendering a result of a given type.
|
|
80
|
-
*
|
|
81
|
-
* @public
|
|
82
|
-
*/
|
|
83
|
-
type CheckResultRenderer = {
|
|
84
|
-
type: string;
|
|
85
|
-
component: (check: CheckResult) => react__default.ReactElement;
|
|
86
|
-
description?: (check: CheckResult) => string | react__default.ReactElement;
|
|
87
|
-
isFailed?: (check: CheckResult) => boolean;
|
|
88
|
-
};
|
|
89
|
-
/**
|
|
90
|
-
* Default renderer for json-rules-engine check results.
|
|
91
|
-
*
|
|
92
|
-
* @public
|
|
93
|
-
*/
|
|
94
|
-
declare const jsonRulesEngineCheckResultRenderer: CheckResultRenderer;
|
|
95
|
-
|
|
96
182
|
/**
|
|
97
183
|
* {@link @backstage/core-plugin-api#ApiRef} for the {@link TechInsightsApi}
|
|
98
184
|
*
|
|
@@ -112,18 +198,26 @@ interface TechInsightsApi {
|
|
|
112
198
|
runBulkChecks(entities: CompoundEntityRef[], checks?: Check[]): Promise<BulkCheckResponse>;
|
|
113
199
|
getFacts(entity: CompoundEntityRef, facts: string[]): Promise<InsightFacts>;
|
|
114
200
|
getFactSchemas(): Promise<FactSchema[]>;
|
|
201
|
+
getLinksForEntity(result: CheckResult, entity: Entity, options?: {
|
|
202
|
+
includeStaticLinks?: boolean;
|
|
203
|
+
}): CheckLink[];
|
|
115
204
|
}
|
|
116
205
|
|
|
117
206
|
/** @public */
|
|
118
207
|
declare class TechInsightsClient extends TechInsightsClient$1 implements TechInsightsApi {
|
|
119
208
|
private readonly renderers?;
|
|
209
|
+
private readonly customGetEntityLinks;
|
|
120
210
|
constructor(options: {
|
|
121
211
|
discoveryApi: DiscoveryApi;
|
|
122
212
|
identityApi: IdentityApi;
|
|
123
213
|
renderers?: CheckResultRenderer[];
|
|
214
|
+
getEntityLinks?: (result: CheckResult, entity: Entity) => CheckLink[];
|
|
124
215
|
});
|
|
125
216
|
getCheckResultRenderers(types: string[]): CheckResultRenderer[];
|
|
126
217
|
isCheckResultFailed(check: CheckResult): boolean;
|
|
218
|
+
getLinksForEntity(result: CheckResult, entity: Entity, options?: {
|
|
219
|
+
includeStaticLinks?: boolean;
|
|
220
|
+
}): CheckLink[];
|
|
127
221
|
}
|
|
128
222
|
|
|
129
223
|
/**
|
|
@@ -133,4 +227,4 @@ declare const BooleanCheck: (props: {
|
|
|
133
227
|
checkResult: CheckResult;
|
|
134
228
|
}) => react__default.JSX.Element;
|
|
135
229
|
|
|
136
|
-
export { BooleanCheck, type Check, type CheckResultRenderer, EntityTechInsightsScorecardCard, EntityTechInsightsScorecardContent, type InsightFacts, ScorecardInfo, ScorecardsList, type TechInsightsApi, TechInsightsClient, TechInsightsScorecardPage, jsonRulesEngineCheckResultRenderer, techInsightsApiRef, techInsightsPlugin };
|
|
230
|
+
export { BooleanCheck, type Check, type CheckResultRenderer, EntityTechInsightsScorecardCard, EntityTechInsightsScorecardContent, type InsightFacts, type ResultCheckIconBaseComponentProps, 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';
|
package/dist/plugin.esm.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createPlugin, createApiFactory, discoveryApiRef, identityApiRef, createRoutableExtension } from '@backstage/core-plugin-api';
|
|
1
|
+
import { createPlugin, createApiFactory, discoveryApiRef, identityApiRef, createComponentExtension, createRoutableExtension } from '@backstage/core-plugin-api';
|
|
2
2
|
import { rootRouteRef } from './routes.esm.js';
|
|
3
3
|
import { techInsightsApiRef } from './api/TechInsightsApi.esm.js';
|
|
4
4
|
import { TechInsightsClient } from './api/TechInsightsClient.esm.js';
|
|
@@ -17,17 +17,19 @@ const techInsightsPlugin = createPlugin({
|
|
|
17
17
|
}
|
|
18
18
|
});
|
|
19
19
|
const ScorecardInfo = techInsightsPlugin.provide(
|
|
20
|
-
|
|
20
|
+
createComponentExtension({
|
|
21
21
|
name: "ScorecardInfo",
|
|
22
|
-
component:
|
|
23
|
-
|
|
22
|
+
component: {
|
|
23
|
+
lazy: () => import('./components/ScorecardsInfo/index.esm.js').then((m) => m.ScorecardInfo)
|
|
24
|
+
}
|
|
24
25
|
})
|
|
25
26
|
);
|
|
26
27
|
const ScorecardsList = techInsightsPlugin.provide(
|
|
27
|
-
|
|
28
|
+
createComponentExtension({
|
|
28
29
|
name: "ScorecardsList",
|
|
29
|
-
component:
|
|
30
|
-
|
|
30
|
+
component: {
|
|
31
|
+
lazy: () => import('./components/ScorecardsList/index.esm.js').then((m) => m.ScorecardsList)
|
|
32
|
+
}
|
|
31
33
|
})
|
|
32
34
|
);
|
|
33
35
|
const EntityTechInsightsScorecardContent = techInsightsPlugin.provide(
|
|
@@ -51,6 +53,22 @@ const TechInsightsScorecardPage = techInsightsPlugin.provide(
|
|
|
51
53
|
mountPoint: rootRouteRef
|
|
52
54
|
})
|
|
53
55
|
);
|
|
56
|
+
const TechInsightsCheckIcon = techInsightsPlugin.provide(
|
|
57
|
+
createComponentExtension({
|
|
58
|
+
name: "TechInsightsCheckIcon",
|
|
59
|
+
component: {
|
|
60
|
+
lazy: () => import('./components/ResultCheckIcon/index.esm.js').then((m) => m.ResultCheckIcon)
|
|
61
|
+
}
|
|
62
|
+
})
|
|
63
|
+
);
|
|
64
|
+
const TechInsightsLinksMenu = techInsightsPlugin.provide(
|
|
65
|
+
createComponentExtension({
|
|
66
|
+
name: "TechInsightsLinksMenu",
|
|
67
|
+
component: {
|
|
68
|
+
lazy: () => import('./components/ResultLinksMenu/index.esm.js').then((m) => m.ResultLinksMenu)
|
|
69
|
+
}
|
|
70
|
+
})
|
|
71
|
+
);
|
|
54
72
|
|
|
55
|
-
export { EntityTechInsightsScorecardCard, EntityTechInsightsScorecardContent, ScorecardInfo, ScorecardsList, TechInsightsScorecardPage, techInsightsPlugin };
|
|
73
|
+
export { EntityTechInsightsScorecardCard, EntityTechInsightsScorecardContent, ScorecardInfo, ScorecardsList, TechInsightsCheckIcon, TechInsightsLinksMenu, TechInsightsScorecardPage, techInsightsPlugin };
|
|
56
74
|
//# sourceMappingURL=plugin.esm.js.map
|
package/dist/plugin.esm.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.esm.js","sources":["../src/plugin.ts"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport {\n createPlugin,\n 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
|
|
1
|
+
{"version":3,"file":"plugin.esm.js","sources":["../src/plugin.ts"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport {\n createPlugin,\n createComponentExtension,\n createRoutableExtension,\n createApiFactory,\n discoveryApiRef,\n identityApiRef,\n} from '@backstage/core-plugin-api';\nimport { 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 createComponentExtension({\n name: 'ScorecardInfo',\n component: {\n lazy: () =>\n import('./components/ScorecardsInfo').then(m => m.ScorecardInfo),\n },\n }),\n);\n\n/**\n * @public\n */\nexport const ScorecardsList = techInsightsPlugin.provide(\n createComponentExtension({\n name: 'ScorecardsList',\n component: {\n lazy: () =>\n import('./components/ScorecardsList').then(m => m.ScorecardsList),\n },\n }),\n);\n\n/**\n * @public\n */\nexport const EntityTechInsightsScorecardContent = techInsightsPlugin.provide(\n createRoutableExtension({\n name: 'EntityTechInsightsScorecardContent',\n component: () =>\n import('./components/ScorecardsContent').then(m => m.ScorecardsContent),\n mountPoint: rootRouteRef,\n }),\n);\n\n/**\n * @public\n */\nexport const EntityTechInsightsScorecardCard = techInsightsPlugin.provide(\n createRoutableExtension({\n name: 'EntityTechInsightsScorecardCard',\n component: () =>\n import('./components/ScorecardsCard').then(m => m.ScorecardsCard),\n mountPoint: rootRouteRef,\n }),\n);\n\n/**\n * @public\n */\nexport const TechInsightsScorecardPage = techInsightsPlugin.provide(\n createRoutableExtension({\n name: 'TechInsightsScorecardPage',\n component: () =>\n import('./components/ScorecardsPage').then(m => m.ScorecardsPage),\n mountPoint: rootRouteRef,\n }),\n);\n\n/**\n * @public\n */\nexport const TechInsightsCheckIcon = techInsightsPlugin.provide(\n createComponentExtension({\n name: 'TechInsightsCheckIcon',\n component: {\n lazy: () =>\n import('./components/ResultCheckIcon').then(m => m.ResultCheckIcon),\n },\n }),\n);\n\n/**\n * @public\n */\nexport const TechInsightsLinksMenu = techInsightsPlugin.provide(\n createComponentExtension({\n name: 'TechInsightsLinksMenu',\n component: {\n lazy: () =>\n import('./components/ResultLinksMenu').then(m => m.ResultLinksMenu),\n },\n }),\n);\n"],"names":[],"mappings":";;;;;AA8BO,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,k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AAA,GACb,CAAA;AACH,EAAA;AAKO,MAAM,wBAAwB,kBAAmB,CAAA,OAAA;AAAA,EACtD,wBAAyB,CAAA;AAAA,IACvB,IAAM,EAAA,uBAAA;AAAA,IACN,SAAW,EAAA;AAAA,MACT,IAAA,EAAM,MACJ,OAAO,2CAA8B,EAAE,IAAK,CAAA,CAAA,CAAA,KAAK,EAAE,eAAe,CAAA;AAAA,KACtE;AAAA,GACD,CAAA;AACH,EAAA;AAKO,MAAM,wBAAwB,kBAAmB,CAAA,OAAA;AAAA,EACtD,wBAAyB,CAAA;AAAA,IACvB,IAAM,EAAA,uBAAA;AAAA,IACN,SAAW,EAAA;AAAA,MACT,IAAA,EAAM,MACJ,OAAO,2CAA8B,EAAE,IAAK,CAAA,CAAA,CAAA,KAAK,EAAE,eAAe,CAAA;AAAA,KACtE;AAAA,GACD,CAAA;AACH;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@backstage-community/plugin-tech-insights",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.36",
|
|
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.
|
|
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",
|