@backstage-community/plugin-tech-insights 0.4.0 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/README.md +4 -115
  3. package/dist/components/ScorecardsCard/ScorecardsCard.esm.js +1 -4
  4. package/dist/components/ScorecardsCard/ScorecardsCard.esm.js.map +1 -1
  5. package/dist/components/ScorecardsContent/ScorecardContent.esm.js +1 -1
  6. package/dist/components/ScorecardsContent/ScorecardContent.esm.js.map +1 -1
  7. package/dist/components/ScorecardsInfo/ScorecardInfo.esm.js +1 -4
  8. package/dist/components/ScorecardsInfo/ScorecardInfo.esm.js.map +1 -1
  9. package/dist/components/ScorecardsList/ScorecardsList.esm.js +1 -5
  10. package/dist/components/ScorecardsList/ScorecardsList.esm.js.map +1 -1
  11. package/dist/components/ScorecardsPage/Filters.esm.js +1 -4
  12. package/dist/components/ScorecardsPage/Filters.esm.js.map +1 -1
  13. package/dist/components/ScorecardsPage/ScorecardsPage.esm.js +1 -4
  14. package/dist/components/ScorecardsPage/ScorecardsPage.esm.js.map +1 -1
  15. package/dist/index.d.ts +11 -171
  16. package/dist/index.esm.js +1 -4
  17. package/dist/index.esm.js.map +1 -1
  18. package/dist/plugin.esm.js +7 -4
  19. package/dist/plugin.esm.js.map +1 -1
  20. package/package.json +15 -11
  21. package/dist/api/TechInsightsApi.esm.js +0 -8
  22. package/dist/api/TechInsightsApi.esm.js.map +0 -1
  23. package/dist/api/TechInsightsClient.esm.js +0 -35
  24. package/dist/api/TechInsightsClient.esm.js.map +0 -1
  25. package/dist/components/BooleanCheck/BooleanCheck.esm.js +0 -11
  26. package/dist/components/BooleanCheck/BooleanCheck.esm.js.map +0 -1
  27. package/dist/components/CheckResultRenderer.esm.js +0 -11
  28. package/dist/components/CheckResultRenderer.esm.js.map +0 -1
  29. package/dist/components/ResultCheckIcon/ResultCheckIcon.esm.js +0 -45
  30. package/dist/components/ResultCheckIcon/ResultCheckIcon.esm.js.map +0 -1
  31. package/dist/components/ResultCheckIcon/index.esm.js +0 -2
  32. package/dist/components/ResultCheckIcon/index.esm.js.map +0 -1
  33. package/dist/components/ResultLinksMenu/ResultLinksMenu.esm.js +0 -66
  34. package/dist/components/ResultLinksMenu/ResultLinksMenu.esm.js.map +0 -1
  35. package/dist/components/ResultLinksMenu/index.esm.js +0 -2
  36. package/dist/components/ResultLinksMenu/index.esm.js.map +0 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,24 @@
1
1
  # @backstage-community/plugin-tech-insights
2
2
 
3
+ ## 0.5.0
4
+
5
+ ### Minor Changes
6
+
7
+ - e919e53: Backstage version bump to v1.35.1
8
+
9
+ ### Patch Changes
10
+
11
+ - f015469: Introducing a new tech insights react plugin for reusuable frontend utilities. All migrated components and APIs have been marked as deprecated. Please update your imports to come from `@backstage-community/plugin-tech-insights-react`
12
+
13
+ Package json files for each plugin have been updated to reflect the new plugin in the Backstage `pluginPackages` metadata.
14
+
15
+ - f015469: Several symbols have been migrated and marked deprecated. Please update all deprecated symbols to import from `@backstage-community/plugin-tech-insights-react` instead.
16
+ - Updated dependencies [f015469]
17
+ - Updated dependencies [e919e53]
18
+ - Updated dependencies [c107e0f]
19
+ - @backstage-community/plugin-tech-insights-common@0.5.0
20
+ - @backstage-community/plugin-tech-insights-react@1.1.0
21
+
3
22
  ## 0.4.0
4
23
 
5
24
  ### Minor Changes
package/README.md CHANGED
@@ -5,7 +5,6 @@ This plugin provides the UI for the `@backstage/tech-insights-backend` plugin, i
5
5
  Main areas covered by this plugin currently are:
6
6
 
7
7
  - Providing an overview for default boolean checks in a form of Scorecards.
8
-
9
8
  - Providing an option to render different custom components based on type of the checks running in the backend.
10
9
 
11
10
  ## Installation
@@ -17,7 +16,7 @@ Main areas covered by this plugin currently are:
17
16
  yarn --cwd packages/app add @backstage-community/plugin-tech-insights
18
17
  ```
19
18
 
20
- ### Add boolean checks overview (Scorecards) page to the EntityPage:
19
+ ### Add boolean checks overview (Scorecards) page to the EntityPage
21
20
 
22
21
  ```tsx
23
22
  // packages/app/src/components/catalog/EntityPage.tsx
@@ -59,7 +58,7 @@ You can pass an array `checksId` as a prop with the [Fact Retrievers ids](../tec
59
58
 
60
59
  You can also pass a `filter` function to both `EntityTechInsightsScorecardContent` and `EntityTechInsightsScorecardCard` which filters in/out check result after they have been fetched. This can be useful to filter by more logical conditions on fields like `id` or `name`, e.g. the first characters in a name.
61
60
 
62
- To only show failed checks, you can pass the boolan `onlyFailed` to these components.
61
+ To only show failed checks, you can pass the boolean `onlyFailed` to these components.
63
62
 
64
63
  If you want to show checks in the overview of an entity use `EntityTechInsightsScorecardCard`.
65
64
 
@@ -95,67 +94,7 @@ If you follow the [Backend Example](../tech-insights-backend#backend-example), o
95
94
 
96
95
  ![Boolean Scorecard Example](./docs/boolean-scorecard-example.png)
97
96
 
98
- ## Adding custom rendering components
99
-
100
- Default scorecard implementation displays only `json-rules-engine` check results. If you would like to support different types, you need to inject custom rendering components to the `TechInsightsClient` constructor.
101
-
102
- ```ts
103
- // packages/app/src/apis.ts
104
-
105
- export const apis: AnyApiFactory[] = [
106
- ...
107
- createApiFactory({
108
- api: techInsightsApiRef,
109
- deps: { discoveryApi: discoveryApiRef, identityApi: identityApiRef },
110
- factory: ({ discoveryApi, identityApi }) =>
111
- new TechInsightsClient({
112
- discoveryApi,
113
- identityApi,
114
- renderers: [
115
- jsonRulesEngineCheckResultRenderer, // default json-rules-engine renderer
116
- myCustomBooleanRenderer, // custom renderer
117
- ],
118
- }),
119
- }),
120
- ...
121
- ];
122
- ```
123
-
124
- ```tsx
125
- // packages/app/src/components/myCustomBooleanRenderer.tsx
126
-
127
- export const myCustomBooleanRenderer: CheckResultRenderer = {
128
- type: 'boolean',
129
- component: (checkResult: CheckResult) => (
130
- <BooleanCheck checkResult={checkResult} />
131
- ),
132
- };
133
- ```
134
-
135
- It's also possible to customize the description. Both strings and React components are accepted. As an example, you would like
136
- to display another information if the check has failed. In such cases, you could do something like the following:
137
-
138
- ```tsx
139
- // packages/app/src/components/myCustomBooleanRenderer.tsx
140
-
141
- export const myCustomBooleanRenderer: CheckResultRenderer = {
142
- type: 'boolean',
143
- component: (checkResult: CheckResult) => (
144
- <BooleanCheck checkResult={checkResult} />
145
- ),
146
- description: (checkResult: CheckResult) => (
147
- <>
148
- {
149
- checkResult.result
150
- ? checkResult.check.description // In case of success, return the same description
151
- : `The check has failed! ${checkResult.check.description}` // Add a prefix text if the check failed
152
- }
153
- </>
154
- ),
155
- };
156
- ```
157
-
158
- ### Add overview (Scorecards) page:
97
+ ### Add overview (Scorecards) page
159
98
 
160
99
  ![Scorecard Overview](./docs/scorecard-overview.png)
161
100
 
@@ -190,54 +129,4 @@ export const Root = ({ children }: PropsWithChildren<{}>) => (
190
129
 
191
130
  ## Custom views rendering tech-insights results
192
131
 
193
- 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.
194
-
195
- 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`.
196
-
197
- ### Render the check icon with a popup menu for links
198
-
199
- ```tsx
200
- import { TechInsightsCheckIcon } from '@backstage-community/plugin-tech-insights';
201
-
202
- export const MyComponent = () => {
203
- const entity = getEntitySomehow();
204
- const result = getCheckResultSomehow();
205
-
206
- return <TechInsightsCheckIcon result={result} entity={entity} />;
207
- };
208
- ```
209
-
210
- ### Render the popup menu for links
211
-
212
- You can render a custom component (like a button) which opens the popup menu with links.
213
-
214
- 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.
215
-
216
- ```tsx
217
- import {
218
- TechInsightsLinksMenu,
219
- ResultLinksMenuInfo,
220
- } from '@backstage-community/plugin-tech-insights';
221
-
222
- export const MyComponent = () => {
223
- const entity = getEntitySomehow();
224
- const result = getCheckResultSomehow();
225
-
226
- const [menu, setMenu] = useState<ResultLinksMenuInfo | undefined>();
227
-
228
- return (
229
- <>
230
- <Button
231
- title="Show links"
232
- disabled={!menu}
233
- onClick={event => menu?.open(event.currentTarget)}
234
- />
235
- <TechInsightsLinksMenu
236
- result={result}
237
- entity={entity}
238
- setMenu={setMenu}
239
- />
240
- </>
241
- );
242
- };
243
- ```
132
+ The `@backstage-community/plugin-tech-insights-react` package contains reusable frontend components for rendering tech-insights results, along with a reference implementation (techInsightsApiRef) for the tech-insights api. See the [README](../tech-insights-react/README.md) for more information.
@@ -3,10 +3,7 @@ import useAsync from 'react-use/esm/useAsync';
3
3
  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
- 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';
6
+ import { techInsightsApiRef } from '@backstage-community/plugin-tech-insights-react';
10
7
  import { useEntity } from '@backstage/plugin-catalog-react';
11
8
  import { getCompoundEntityRef } from '@backstage/catalog-model';
12
9
 
@@ -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';\nimport { Check } from '@backstage-community/plugin-tech-insights-common/client';\n\nexport const ScorecardsCard = (props: {\n title: string;\n description?: string;\n checksId?: string[];\n filter?: (check: Check) => boolean;\n onlyFailed?: boolean;\n expanded?: boolean;\n}) => {\n const {\n title,\n description,\n checksId,\n filter,\n onlyFailed,\n expanded = true,\n } = props;\n const api = useApi(techInsightsApiRef);\n const { entity } = useEntity();\n const { value, loading, error } = useAsync(\n async () => await api.runChecks(getCompoundEntityRef(entity), checksId),\n [api, entity, JSON.stringify(checksId)],\n );\n\n const filteredValues =\n !filter || !value ? value : value.filter(val => filter(val.check));\n\n const checkResultRenderers = useMemo(() => {\n if (!onlyFailed || !filteredValues) return {};\n\n const types = [...new Set(filteredValues.map(({ check }) => check.type))];\n const renderers = api.getCheckResultRenderers(types);\n return Object.fromEntries(\n renderers.map(renderer => [renderer.type, renderer]),\n );\n }, [api, filteredValues, onlyFailed]);\n\n if (loading) {\n return <Progress />;\n } else if (error) {\n return <ErrorPanel error={error} />;\n }\n\n const filteredValue = !onlyFailed\n ? filteredValues || []\n : (filteredValues || []).filter(val =>\n checkResultRenderers[val.check.type]?.isFailed?.(val),\n );\n\n return (\n <ScorecardInfo\n title={title}\n description={description}\n entity={entity}\n checkResults={filteredValue}\n noWarning={onlyFailed}\n expanded={expanded}\n />\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;AA0Ba,MAAA,cAAA,GAAiB,CAAC,KAOzB,KAAA;AACJ,EAAM,MAAA;AAAA,IACJ,KAAA;AAAA,IACA,WAAA;AAAA,IACA,QAAA;AAAA,IACA,MAAA;AAAA,IACA,UAAA;AAAA,IACA,QAAW,GAAA;AAAA,GACT,GAAA,KAAA;AACJ,EAAM,MAAA,GAAA,GAAM,O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AAA,cAAA,IAAkB,EACjB,GAAA,CAAA,cAAA,IAAkB,EAAI,EAAA,MAAA;AAAA,IAAO,SAC5B,oBAAqB,CAAA,GAAA,CAAI,MAAM,IAAI,CAAA,EAAG,WAAW,GAAG;AAAA,GACtD;AAEJ,EACE,uBAAA,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;AAAA;AAAA,GACF;AAEJ;;;;"}
1
+ {"version":3,"file":"ScorecardsCard.esm.js","sources":["../../../src/components/ScorecardsCard/ScorecardsCard.tsx"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport 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 '@backstage-community/plugin-tech-insights-react';\nimport { useEntity } from '@backstage/plugin-catalog-react';\nimport { getCompoundEntityRef } from '@backstage/catalog-model';\nimport { Check } from '@backstage-community/plugin-tech-insights-common';\n\nexport const ScorecardsCard = (props: {\n title: string;\n description?: string;\n checksId?: string[];\n filter?: (check: Check) => boolean;\n onlyFailed?: boolean;\n expanded?: boolean;\n}) => {\n const {\n title,\n description,\n checksId,\n filter,\n onlyFailed,\n expanded = true,\n } = props;\n const api = useApi(techInsightsApiRef);\n const { entity } = useEntity();\n const { value, loading, error } = useAsync(\n async () => await api.runChecks(getCompoundEntityRef(entity), checksId),\n [api, entity, JSON.stringify(checksId)],\n );\n\n const filteredValues =\n !filter || !value ? value : value.filter(val => filter(val.check));\n\n const checkResultRenderers = useMemo(() => {\n if (!onlyFailed || !filteredValues) return {};\n\n const types = [...new Set(filteredValues.map(({ check }) => check.type))];\n const renderers = api.getCheckResultRenderers(types);\n return Object.fromEntries(\n renderers.map(renderer => [renderer.type, renderer]),\n );\n }, [api, filteredValues, onlyFailed]);\n\n if (loading) {\n return <Progress />;\n } else if (error) {\n return <ErrorPanel error={error} />;\n }\n\n const filteredValue = !onlyFailed\n ? filteredValues || []\n : (filteredValues || []).filter(val =>\n checkResultRenderers[val.check.type]?.isFailed?.(val),\n );\n\n return (\n <ScorecardInfo\n title={title}\n description={description}\n entity={entity}\n checkResults={filteredValue}\n noWarning={onlyFailed}\n expanded={expanded}\n />\n );\n};\n"],"names":[],"mappings":";;;;;;;;;AA0Ba,MAAA,cAAA,GAAiB,CAAC,KAOzB,KAAA;AACJ,EAAM,MAAA;AAAA,IACJ,KAAA;AAAA,IACA,WAAA;AAAA,IACA,QAAA;AAAA,IACA,MAAA;AAAA,IACA,UAAA;AAAA,IACA,QAAW,GAAA;AAAA,GACT,GAAA,KAAA;AACJ,EAAM,MAAA,GAAA,GAAM,OAAO,kBAAkB,CAAA;AACrC,EAAM,MAAA,EAAE,MAAO,EAAA,GAAI,SAAU,EAAA;AAC7B,EAAA,MAAM,EAAE,KAAA,EAAO,OAAS,EAAA,KAAA,EAAU,GAAA,QAAA;AAAA,IAChC,YAAY,MAAM,GAAA,CAAI,UAAU,oBAAqB,CAAA,MAAM,GAAG,QAAQ,CAAA;AAAA,IACtE,CAAC,GAAK,EAAA,MAAA,EAAQ,IAAK,CAAA,SAAA,CAAU,QAAQ,CAAC;AAAA,GACxC;AAEA,EAAA,MAAM,cACJ,GAAA,CAAC,MAAU,IAAA,CAAC,KAAQ,GAAA,KAAA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 @@ import { Progress, Page, Content } from '@backstage/core-components';
4
4
  import { useApi } from '@backstage/core-plugin-api';
5
5
  import { ScorecardInfo } from '../ScorecardsInfo/ScorecardInfo.esm.js';
6
6
  import Alert from '@material-ui/lab/Alert';
7
- import { techInsightsApiRef } from '../../api/TechInsightsApi.esm.js';
7
+ import { techInsightsApiRef } from '@backstage-community/plugin-tech-insights-react';
8
8
  import { makeStyles } from '@material-ui/core/styles';
9
9
  import { useEntity } from '@backstage/plugin-catalog-react';
10
10
  import { getCompoundEntityRef } from '@backstage/catalog-model';
@@ -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';\nimport { Check } from '@backstage-community/plugin-tech-insights-common/client';\n\nconst useStyles = makeStyles(() => ({\n contentScorecards: {\n paddingLeft: 0,\n paddingRight: 0,\n },\n}));\n\nexport const ScorecardsContent = (props: {\n title: string;\n description?: string;\n checksId?: string[];\n filter?: (check: Check) => boolean;\n}) => {\n const { title, description, checksId, filter } = props;\n const classes = useStyles();\n const api = useApi(techInsightsApiRef);\n const { entity } = useEntity();\n const { namespace, kind, name } = getCompoundEntityRef(entity);\n const { value, loading, error } = useAsync(\n async () => await api.runChecks({ namespace, kind, name }, checksId),\n );\n\n const filteredValues =\n !filter || !value ? value : value.filter(val => filter(val.check));\n\n if (loading) {\n return <Progress />;\n } else if (error) {\n return <Alert severity=\"error\">{error.message}</Alert>;\n }\n\n return (\n <Page themeId=\"home\">\n <Content className={classes.contentScorecards}>\n <ScorecardInfo\n title={title}\n description={description}\n entity={entity}\n checkResults={filteredValues || []}\n />\n </Content>\n </Page>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;AA4BA,MAAM,SAAA,GAAY,WAAW,OAAO;AAAA,EAClC,iBAAmB,EAAA;AAAA,IACjB,WAAa,EAAA,CAAA;AAAA,IACb,YAAc,EAAA;AAAA;AAElB,CAAE,CAAA,CAAA;AAEW,MAAA,iBAAA,GAAoB,CAAC,KAK5B,KAAA;AACJ,EAAA,MAAM,EAAE,KAAA,EAAO,WAAa,EAAA,QAAA,EAAU,QAAW,GAAA,KAAA;AACjD,EAAA,MAAM,UAAU,SAAU,EAAA;AAC1B,EAAM,MAAA,GAAA,GAAM,OAAO,kBAAkB,CAAA;AACrC,EAAM,MAAA,EAAE,MAAO,EAAA,GAAI,SAAU,EAAA;AAC7B,EAAA,MAAM,EAAE,SAAW,EAAA,IAAA,EAAM,IAAK,EAAA,GAAI,qBAAqB,MAAM,CAAA;AAC7D,EAAA,MAAM,EAAE,KAAA,EAAO,OAAS,EAAA,KAAA,EAAU,GAAA,QAAA;AAAA,IAChC,YAAY,MAAM,GAAI,CAAA,SAAA,CAAU,EAAE,SAAW,EAAA,IAAA,EAAM,IAAK,EAAA,EAAG,QAAQ;AAAA,GACrE;AAEA,EAAA,MAAM,cACJ,GAAA,CAAC,MAAU,IAAA,CAAC,KAAQ,GAAA,KAAA,GAAQ,KAAM,CAAA,MAAA,CAAO,CAAO,GAAA,KAAA,MAAA,CAAO,GAAI,CAAA,KAAK,CAAC,CAAA;AAEnE,EAAA,IAAI,OAAS,EAAA;AACX,IAAA,2CAAQ,QAAS,EAAA,IAAA,CAAA;AAAA,aACR,KAAO,EAAA;AAChB,IAAA,uBAAQ,KAAA,CAAA,aAAA,CAAA,KAAA,EAAA,EAAM,QAAS,EAAA,OAAA,EAAA,EAAS,MAAM,OAAQ,CAAA;AAAA;AAGhD,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,kBAAkB;AAAC;AAAA,GAErC,CACF,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 '@backstage-community/plugin-tech-insights-react';\nimport { makeStyles } from '@material-ui/core/styles';\nimport { useEntity } from '@backstage/plugin-catalog-react';\nimport { getCompoundEntityRef } from '@backstage/catalog-model';\nimport { Check } from '@backstage-community/plugin-tech-insights-common';\n\nconst useStyles = makeStyles(() => ({\n contentScorecards: {\n paddingLeft: 0,\n paddingRight: 0,\n },\n}));\n\nexport const ScorecardsContent = (props: {\n title: string;\n description?: string;\n checksId?: string[];\n filter?: (check: Check) => boolean;\n}) => {\n const { title, description, checksId, filter } = props;\n const classes = useStyles();\n const api = useApi(techInsightsApiRef);\n const { entity } = useEntity();\n const { namespace, kind, name } = getCompoundEntityRef(entity);\n const { value, loading, error } = useAsync(\n async () => await api.runChecks({ namespace, kind, name }, checksId),\n );\n\n const filteredValues =\n !filter || !value ? value : value.filter(val => filter(val.check));\n\n if (loading) {\n return <Progress />;\n } else if (error) {\n return <Alert severity=\"error\">{error.message}</Alert>;\n }\n\n return (\n <Page themeId=\"home\">\n <Content className={classes.contentScorecards}>\n <ScorecardInfo\n title={title}\n description={description}\n entity={entity}\n checkResults={filteredValues || []}\n />\n </Content>\n </Page>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;AA4BA,MAAM,SAAA,GAAY,WAAW,OAAO;AAAA,EAClC,iBAAmB,EAAA;AAAA,IACjB,WAAa,EAAA,CAAA;AAAA,IACb,YAAc,EAAA;AAAA;AAElB,CAAE,CAAA,CAAA;AAEW,MAAA,iBAAA,GAAoB,CAAC,KAK5B,KAAA;AACJ,EAAA,MAAM,EAAE,KAAA,EAAO,WAAa,EAAA,QAAA,EAAU,QAAW,GAAA,KAAA;AACjD,EAAA,MAAM,UAAU,SAAU,EAAA;AAC1B,EAAM,MAAA,GAAA,GAAM,OAAO,kBAAkB,CAAA;AACrC,EAAM,MAAA,EAAE,MAAO,EAAA,GAAI,SAAU,EAAA;AAC7B,EAAA,MAAM,EAAE,SAAW,EAAA,IAAA,EAAM,IAAK,EAAA,GAAI,qBAAqB,MAAM,CAAA;AAC7D,EAAA,MAAM,EAAE,KAAA,EAAO,OAAS,EAAA,KAAA,EAAU,GAAA,QAAA;AAAA,IAChC,YAAY,MAAM,GAAI,CAAA,SAAA,CAAU,EAAE,SAAW,EAAA,IAAA,EAAM,IAAK,EAAA,EAAG,QAAQ;AAAA,GACrE;AAEA,EAAA,MAAM,cACJ,GAAA,CAAC,MAAU,IAAA,CAAC,KAAQ,GAAA,KAAA,GAAQ,KAAM,CAAA,MAAA,CAAO,CAAO,GAAA,KAAA,MAAA,CAAO,GAAI,CAAA,KAAK,CAAC,CAAA;AAEnE,EAAA,IAAI,OAAS,EAAA;AACX,IAAA,2CAAQ,QAAS,EAAA,IAAA,CAAA;AAAA,aACR,KAAO,EAAA;AAChB,IAAA,uBAAQ,KAAA,CAAA,aAAA,CAAA,KAAA,EAAA,EAAM,QAAS,EAAA,OAAA,EAAA,EAAS,MAAM,OAAQ,CAAA;AAAA;AAGhD,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,kBAAkB;AAAC;AAAA,GAErC,CACF,CAAA;AAEJ;;;;"}
@@ -9,11 +9,8 @@ import Accordion from '@material-ui/core/Accordion';
9
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
- import { techInsightsApiRef } from '../../api/TechInsightsApi.esm.js';
13
- import '@backstage-community/plugin-tech-insights-common/client';
14
- import '@material-ui/icons/CheckCircleOutline';
15
- import '@material-ui/icons/ErrorOutline';
16
12
  import { MarkdownContent } from '@backstage/core-components';
13
+ import { techInsightsApiRef } from '@backstage-community/plugin-tech-insights-react';
17
14
 
18
15
  const useStyles = makeStyles((theme) => ({
19
16
  subheader: {
@@ -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 { Entity } from '@backstage/catalog-model';\nimport { techInsightsApiRef } from '../../api';\nimport { MarkdownContent } from '@backstage/core-components';\n\nconst useStyles = makeStyles(theme => ({\n subheader: {\n paddingLeft: theme.spacing(0.5),\n },\n accordionHeader: {\n borderBottom: `1px solid ${theme.palette.border}`,\n },\n accordionHeaderContent: {\n margin: `${theme.spacing(2)}px 0 !important`,\n },\n}));\n\nconst infoCard = (\n title: React.ReactNode,\n description: string | undefined,\n classes: ReturnType<typeof useStyles>,\n element: React.ReactElement,\n expanded: boolean,\n summary?: string,\n) => (\n <Grid item xs={12}>\n <Accordion defaultExpanded={expanded}>\n <AccordionSummary\n expandIcon={<ExpandMoreIcon />}\n className={classes.accordionHeader}\n classes={{\n content: classes.accordionHeaderContent,\n }}\n >\n <Grid container justifyContent=\"space-between\" alignItems=\"center\">\n <Grid item>\n <Typography variant=\"h5\">{title}</Typography>\n </Grid>\n <Grid item>\n <Typography>{summary}</Typography>\n </Grid>\n </Grid>\n </AccordionSummary>\n <AccordionDetails>\n <Grid container>\n {description && (\n <Grid item xs={12}>\n <Typography\n className={classes.subheader}\n variant=\"body1\"\n gutterBottom\n >\n <MarkdownContent content={description} />\n </Typography>\n </Grid>\n )}\n <Grid item xs={12}>\n {element}\n </Grid>\n </Grid>\n </AccordionDetails>\n </Accordion>\n </Grid>\n);\n\nexport const ScorecardInfo = (props: {\n checkResults: CheckResult[];\n title: ReactNode;\n entity: Entity;\n description?: string;\n noWarning?: boolean;\n expanded?: boolean;\n}) => {\n const {\n checkResults,\n title,\n entity,\n description,\n noWarning,\n expanded = true,\n } = props;\n const classes = useStyles();\n const api = useApi(techInsightsApiRef);\n\n if (!checkResults.length) {\n if (noWarning) {\n return infoCard(\n title,\n description,\n classes,\n <Alert severity=\"info\">\n All checks passed, or no checks have been performed yet\n </Alert>,\n expanded,\n );\n }\n return infoCard(\n title,\n description,\n classes,\n <Alert severity=\"warning\">No checks have any data yet.</Alert>,\n expanded,\n );\n }\n\n return infoCard(\n title,\n description,\n classes,\n <ScorecardsList checkResults={checkResults} entity={entity} />,\n expanded,\n `${\n checkResults.filter(checkResult => !api.isCheckResultFailed(checkResult))\n .length\n }/${checkResults.length}`,\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAgCA,MAAM,SAAA,GAAY,WAAW,CAAU,KAAA,MAAA;AAAA,EACrC,SAAW,EAAA;AAAA,IACT,WAAA,EAAa,KAAM,CAAA,OAAA,CAAQ,GAAG;AAAA,GAChC;AAAA,EACA,eAAiB,EAAA;AAAA,IACf,YAAc,EAAA,CAAA,UAAA,EAAa,KAAM,CAAA,OAAA,CAAQ,MAAM,CAAA;AAAA,GACjD;AAAA,EACA,sBAAwB,EAAA;AAAA,IACtB,MAAQ,EAAA,CAAA,EAAG,KAAM,CAAA,OAAA,CAAQ,CAAC,CAAC,CAAA,eAAA;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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;AAAA,GACzB;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 { MarkdownContent } from '@backstage/core-components';\nimport { techInsightsApiRef } from '@backstage-community/plugin-tech-insights-react';\n\nconst useStyles = makeStyles(theme => ({\n subheader: {\n paddingLeft: theme.spacing(0.5),\n },\n accordionHeader: {\n borderBottom: `1px solid ${theme.palette.border}`,\n },\n accordionHeaderContent: {\n margin: `${theme.spacing(2)}px 0 !important`,\n },\n}));\n\nconst infoCard = (\n title: React.ReactNode,\n description: string | undefined,\n classes: ReturnType<typeof useStyles>,\n element: React.ReactElement,\n expanded: boolean,\n summary?: string,\n) => (\n <Grid item xs={12}>\n <Accordion defaultExpanded={expanded}>\n <AccordionSummary\n expandIcon={<ExpandMoreIcon />}\n className={classes.accordionHeader}\n classes={{\n content: classes.accordionHeaderContent,\n }}\n >\n <Grid container justifyContent=\"space-between\" alignItems=\"center\">\n <Grid item>\n <Typography variant=\"h5\">{title}</Typography>\n </Grid>\n <Grid item>\n <Typography>{summary}</Typography>\n </Grid>\n </Grid>\n </AccordionSummary>\n <AccordionDetails>\n <Grid container>\n {description && (\n <Grid item xs={12}>\n <Typography\n className={classes.subheader}\n variant=\"body1\"\n gutterBottom\n >\n <MarkdownContent content={description} />\n </Typography>\n </Grid>\n )}\n <Grid item xs={12}>\n {element}\n </Grid>\n </Grid>\n </AccordionDetails>\n </Accordion>\n </Grid>\n);\n\nexport const ScorecardInfo = (props: {\n checkResults: CheckResult[];\n title: ReactNode;\n entity: Entity;\n description?: string;\n noWarning?: boolean;\n expanded?: boolean;\n}) => {\n const {\n checkResults,\n title,\n entity,\n description,\n noWarning,\n expanded = true,\n } = props;\n const classes = useStyles();\n const api = useApi(techInsightsApiRef);\n\n if (!checkResults.length) {\n if (noWarning) {\n return infoCard(\n title,\n description,\n classes,\n <Alert severity=\"info\">\n All checks passed, or no checks have been performed yet\n </Alert>,\n expanded,\n );\n }\n return infoCard(\n title,\n description,\n classes,\n <Alert severity=\"warning\">No checks have any data yet.</Alert>,\n expanded,\n );\n }\n\n return infoCard(\n title,\n description,\n classes,\n <ScorecardsList checkResults={checkResults} entity={entity} />,\n expanded,\n `${\n checkResults.filter(checkResult => !api.isCheckResultFailed(checkResult))\n .length\n }/${checkResults.length}`,\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;AAgCA,MAAM,SAAA,GAAY,WAAW,CAAU,KAAA,MAAA;AAAA,EACrC,SAAW,EAAA;AAAA,IACT,WAAA,EAAa,KAAM,CAAA,OAAA,C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AA,EAAA,EAAM,QAAS,EAAA,SAAA,EAAA,EAAU,8BAA4B,CAAA;AAAA,MACtD;AAAA,KACF;AAAA;AAGF,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;AAAA,GACzB;AACF;;;;"}
@@ -5,12 +5,8 @@ import ListItem from '@material-ui/core/ListItem';
5
5
  import ListItemSecondaryAction from '@material-ui/core/ListItemSecondaryAction';
6
6
  import ListItemText from '@material-ui/core/ListItemText';
7
7
  import { makeStyles } from '@material-ui/core/styles';
8
- import { techInsightsApiRef } from '../../api/TechInsightsApi.esm.js';
9
- import '@backstage-community/plugin-tech-insights-common/client';
10
- import '@material-ui/icons/CheckCircleOutline';
11
- import '@material-ui/icons/ErrorOutline';
12
8
  import { MarkdownContent } from '@backstage/core-components';
13
- import { ResultCheckIcon } from '../ResultCheckIcon/ResultCheckIcon.esm.js';
9
+ import { techInsightsApiRef, ResultCheckIcon } from '@backstage-community/plugin-tech-insights-react';
14
10
 
15
11
  const useStyles = makeStyles((theme) => ({
16
12
  listItemText: {
@@ -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 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;AAAA;AAEnC,CAAE,CAAA,CAAA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AAAA,QACX;AAAA;AAAA,KAEJ,CAAA;AAAA,GAEH,CACH,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 ListItemSecondaryAction from '@material-ui/core/ListItemSecondaryAction';\nimport ListItemText from '@material-ui/core/ListItemText';\nimport { makeStyles } from '@material-ui/core/styles';\nimport { CheckResult } from '@backstage-community/plugin-tech-insights-common';\nimport { MarkdownContent } from '@backstage/core-components';\nimport { Entity } from '@backstage/catalog-model';\nimport {\n ResultCheckIcon,\n techInsightsApiRef,\n} from '@backstage-community/plugin-tech-insights-react';\n\nconst useStyles = makeStyles(theme => ({\n listItemText: {\n paddingRight: theme.spacing(0.5),\n },\n}));\n\nexport const ScorecardsList = (props: {\n checkResults: CheckResult[];\n entity?: Entity;\n}) => {\n const { checkResults, entity } = props;\n\n const classes = useStyles();\n const api = useApi(techInsightsApiRef);\n\n const types = [...new Set(checkResults.map(({ check }) => check.type))];\n const checkResultRenderers = api.getCheckResultRenderers(types);\n\n return (\n <List>\n {checkResults.map((result, index) => {\n const checkResultRenderer = checkResultRenderers.find(\n renderer => renderer.type === result.check.type,\n );\n\n const description = checkResultRenderer?.description;\n\n return (\n <ListItem key={result.check.id}>\n <ListItemText\n key={index}\n primary={result.check.name}\n secondary={\n description ? (\n description(result)\n ) : (\n <MarkdownContent content={result.check.description} />\n )\n }\n className={classes.listItemText}\n />\n <ResultCheckIcon\n result={result}\n entity={entity}\n component={ListItemSecondaryAction}\n checkResultRenderer={checkResultRenderer}\n />\n </ListItem>\n );\n })}\n </List>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;AA+BA,MAAM,SAAA,GAAY,WAAW,CAAU,KAAA,MAAA;AAAA,EACrC,YAAc,EAAA;AAAA,IACZ,YAAA,EAAc,KAAM,CAAA,OAAA,CAAQ,GAAG;AAAA;AAEnC,CAAE,CAAA,CAAA;AAEW,MAAA,cAAA,GAAiB,CAAC,KAGzB,KAAA;AACJ,EAAM,MAAA,EAAE,YAAc,EAAA,MAAA,EAAW,GAAA,KAAA;AAEjC,EAAA,MAAM,UAAU,SAAU,EAAA;AAC1B,EAAM,MAAA,GAAA,GAAM,OAAO,kBAAkB,CAAA;AAErC,EAAA,MAAM,KAAQ,GAAA,CAAC,GAAG,IAAI,IAAI,YAAa,CAAA,GAAA,CAAI,CAAC,EAAE,KAAM,EAAA,KAAM,KAAM,CAAA,IAAI,CAAC,CAAC,CAAA;AACtE,EAAM,MAAA,oBAAA,GAAuB,GAAI,CAAA,uBAAA,CAAwB,KAAK,CAAA;AAE9D,EAAA,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;AAAA,KAC7C;AAEA,IAAA,MAAM,cAAc,mBAAqB,EAAA,WAAA;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;AAAA;AAAA,KAErB,kBAAA,KAAA,CAAA,aAAA;AAAA,MAAC,eAAA;AAAA,MAAA;AAAA,QACC,MAAA;AAAA,QACA,MAAA;AAAA,QACA,SAAW,EAAA,uBAAA;AAAA,QACX;AAAA;AAAA,KAEJ,CAAA;AAAA,GAEH,CACH,CAAA;AAEJ;;;;"}
@@ -1,8 +1,4 @@
1
1
  import React from 'react';
2
- import { techInsightsApiRef } from '../../api/TechInsightsApi.esm.js';
3
- import '@backstage-community/plugin-tech-insights-common/client';
4
- import '@material-ui/icons/CheckCircleOutline';
5
- import '@material-ui/icons/ErrorOutline';
6
2
  import Typography from '@material-ui/core/Typography';
7
3
  import Autocomplete from '@material-ui/lab/Autocomplete';
8
4
  import ExpandMoreIcon from '@material-ui/icons/ExpandMore';
@@ -17,6 +13,7 @@ import Tooltip from '@material-ui/core/Tooltip';
17
13
  import { useApi } from '@backstage/core-plugin-api';
18
14
  import useAsync from 'react-use/lib/useAsync';
19
15
  import { ErrorPanel } from '@backstage/core-components';
16
+ import { techInsightsApiRef } from '@backstage-community/plugin-tech-insights-react';
20
17
 
21
18
  const useStyles = makeStyles({
22
19
  fullWidth: { width: "100%" },
@@ -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 { techInsightsApiRef } from '../../api';\nimport { Check } from '@backstage-community/plugin-tech-insights-common/client';\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":";;;;;;;;;;;;;;;;;;;;AAkCA,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;AAAA;AAEd,CAAC,CAAA;AAED,MAAM,0BAAA,GAA6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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 } from '@backstage-community/plugin-tech-insights-common';\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';\nimport { techInsightsApiRef } from '@backstage-community/plugin-tech-insights-react';\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":[],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AAA,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;AAAA;AAAA,GAErE,CACF,CACF,CAAA;AAEJ;;;;"}
@@ -1,16 +1,13 @@
1
1
  import React, { useState, useMemo } from 'react';
2
2
  import { ErrorPanel, Page, Header, HeaderLabel, Content, Table } from '@backstage/core-components';
3
3
  import { useApi } from '@backstage/core-plugin-api';
4
- import { techInsightsApiRef } from '../../api/TechInsightsApi.esm.js';
5
- import '@backstage-community/plugin-tech-insights-common/client';
6
- import '@material-ui/icons/CheckCircleOutline';
7
- import '@material-ui/icons/ErrorOutline';
8
4
  import useAsync from 'react-use/lib/useAsync';
9
5
  import { EntityRefLink } from '@backstage/plugin-catalog-react';
10
6
  import { ScorecardsList } from '../ScorecardsList/ScorecardsList.esm.js';
11
7
  import Grid from '@material-ui/core/Grid';
12
8
  import { Filters } from './Filters.esm.js';
13
9
  import { ExportCsv } from '@material-table/exporters';
10
+ import { techInsightsApiRef } from '@backstage-community/plugin-tech-insights-react';
14
11
 
15
12
  const ScorecardsPage = () => {
16
13
  const api = useApi(techInsightsApiRef);
@@ -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 { techInsightsApiRef } from '../../api';\nimport { Check } from '@backstage-community/plugin-tech-insights-common/client';\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":";;;;;;;;;;;;;;AAsCO,MAAM,iBAAiB,MAAM;AAClC,EAAM,MAAA,GAAA,GAAM,OAAO,kBAAkB,CAAA;AACrC,EAAA,MAAM,CAAC,oBAAsB,EAAA,uBAAuB,CAAI,GAAA,QAAA,CAAkB,EAAE,CAAA;AAC5E,EAAA,MAAM,CAAC,iBAAA,EAAmB,oBAAoB,CAAA,GAAI,SAAkB,IAAI,CAAA;AACxE,EAAA,MAAM,YAA6B,GAAA;AAAA,IACjC,aAAe,EAAA,IAAA;AAAA,IACf,UAAY,EAAA;AAAA,MACV;AAAA,QACE,KAAO,EAAA,YAAA;AAAA,QACP,YAAY,CAAC,IAAA,EAAM,UAAUA,SAAU,CAAA,IAAA,EAAM,OAAO,eAAe;AAAA;AACrE;AACF,GACF;AAEA,EAAA,MAAM,EAAE,KAAO,EAAA,OAAA,EAAS,KAAM,EAAA,GAAI,SAAS,YAAY;AACrD,IAAM,MAAA,MAAA,GAAS,MAAM,GAAA,CAAI,YAAa,EAAA;AACtC,IAAA,MAAM,SAAS,MAAM,GAAA,CAAI,aAAc,CAAA,IAAI,oBAAoB,CAAA;AAE/D,IAAO,OAAA;AAAA,MACL,MAAA;AAAA,MACA,MAAA,EAAQ,oBACJ,MAAO,CAAA,MAAA,CAAO,cAAY,QAAS,CAAA,OAAA,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/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 {\n Check,\n BulkCheckResponse,\n} from '@backstage-community/plugin-tech-insights-common';\nimport useAsync from 'react-use/lib/useAsync';\nimport { EntityRefLink } from '@backstage/plugin-catalog-react';\nimport { ScorecardsList } from '../ScorecardsList';\nimport Grid from '@material-ui/core/Grid';\nimport { Filters } from './Filters';\nimport { ExportCsv as exportCsv } from '@material-table/exporters';\nimport { techInsightsApiRef } from '@backstage-community/plugin-tech-insights-react';\n\nexport const ScorecardsPage = () => {\n const api = useApi(techInsightsApiRef);\n const [filterSelectedChecks, setFilterSelectedChecks] = useState<Check[]>([]);\n const [filterWithResults, setFilterWithResults] = useState<boolean>(true);\n const tableOptions: TableOptions = {\n exportAllData: true,\n exportMenu: [\n {\n label: 'Export CSV',\n exportFunc: (cols, datas) => exportCsv(cols, datas, 'tech-insights'),\n },\n ],\n };\n\n const { value, loading, error } = useAsync(async () => {\n const checks = await api.getAllChecks();\n const result = await api.runBulkChecks([], filterSelectedChecks);\n\n return {\n checks,\n result: filterWithResults\n ? result.filter(response => response.results.length > 0)\n : result,\n };\n }, [api, filterSelectedChecks, filterWithResults]);\n\n const tableColumns = useMemo(() => {\n const columns: TableColumn<BulkCheckResponse[0]>[] = [\n {\n field: 'entity',\n title: 'Entity',\n render: row => <EntityRefLink entityRef={row.entity} />,\n },\n {\n field: 'results',\n title: 'Results',\n render: row => <ScorecardsList checkResults={row.results} />,\n export: false,\n },\n ];\n\n (filterSelectedChecks.length === 0\n ? value?.checks || []\n : filterSelectedChecks\n ).forEach(check => {\n columns.push({\n field: check.id,\n title: check.name,\n customExport: row =>\n `${\n row.results.filter(\n result => result && result.check && result.check.id === check.id,\n )[0]?.result\n }`,\n hidden: true,\n export: true,\n });\n });\n\n return columns;\n }, [value, filterSelectedChecks]);\n\n if (error) {\n return <ErrorPanel error={error} />;\n }\n\n return (\n <Page themeId=\"tool\">\n <Header title=\"Tech insights\">\n <HeaderLabel label=\"Entities\" value={value?.result.length ?? 0} />\n <HeaderLabel label=\"Checks\" value={value?.checks.length ?? 0} />\n </Header>\n <Content>\n <Grid container>\n <Grid item style={{ width: '300px' }}>\n <Filters\n checksChanged={checks => setFilterSelectedChecks(checks)}\n withResultsChanged={withResults =>\n setFilterWithResults(withResults)\n }\n />\n </Grid>\n <Grid item xs>\n <Table\n columns={tableColumns}\n data={value?.result ?? []}\n isLoading={loading}\n options={tableOptions}\n />\n </Grid>\n </Grid>\n </Content>\n </Page>\n );\n};\n"],"names":["exportCsv"],"mappings":";;;;;;;;;;;AAwCO,MAAM,iBAAiB,MAAM;AAClC,EAAM,MAAA,GAAA,GAAM,OAAO,kBAAkB,CAAA;AACrC,EAAA,MAAM,CAAC,oBAAsB,EAAA,uBAAuB,CAAI,GAAA,QAAA,CAAkB,EAAE,CAAA;AAC5E,EAAA,MAAM,CAAC,iBAAA,EAAmB,oBAAoB,CAAA,GAAI,SAAkB,IAAI,CAAA;AACxE,EAAA,MAAM,YAA6B,GAAA;AAAA,IACjC,aAAe,EAAA,IAAA;AAAA,IACf,UAAY,EAAA;AAAA,MACV;AAAA,QACE,KAAO,EAAA,YAAA;AAAA,QACP,YAAY,CAAC,IAAA,EAAM,UAAUA,SAAU,CAAA,IAAA,EAAM,OAAO,eAAe;AAAA;AACrE;AACF,GACF;A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AAA,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;AAAA;AAAA,GAEb,CACF,CACF,CACF,CAAA;AAEJ;;;;"}
package/dist/index.d.ts CHANGED
@@ -1,104 +1,11 @@
1
1
  /// <reference types="react" />
2
+ import * as _backstage_community_plugin_tech_insights_react from '@backstage-community/plugin-tech-insights-react';
3
+ export { BooleanCheck, CheckResultRenderer, ResultCheckIconBaseComponentProps, ResultCheckIconProps, ResultLinksMenuInfo, TechInsightsApi, TechInsightsClient, jsonRulesEngineCheckResultRenderer, techInsightsApiRef } from '@backstage-community/plugin-tech-insights-react';
4
+ import * as _backstage_catalog_model_index from '@backstage/catalog-model/index';
2
5
  import * as react from 'react';
3
- import react__default, { PropsWithChildren, MouseEventHandler, ElementType, ReactNode } from 'react';
4
6
  import * as _backstage_community_plugin_tech_insights_common from '@backstage-community/plugin-tech-insights-common';
5
- import { CheckResult, BulkCheckResponse, FactSchema, CheckLink } from '@backstage-community/plugin-tech-insights-common';
6
- import { Entity, CompoundEntityRef } from '@backstage/catalog-model';
7
- import * as _backstage_community_plugin_tech_insights_common_client from '@backstage-community/plugin-tech-insights-common/client';
8
- import { Check as Check$1, InsightFacts as InsightFacts$1, TechInsightsClient as TechInsightsClient$1 } from '@backstage-community/plugin-tech-insights-common/client';
9
- import * as _backstage_catalog_model_index from '@backstage/catalog-model/index';
7
+ export { Check, InsightFacts } from '@backstage-community/plugin-tech-insights-common';
10
8
  import * as _backstage_core_plugin_api from '@backstage/core-plugin-api';
11
- import { DiscoveryApi, IdentityApi } from '@backstage/core-plugin-api';
12
- import { JsonValue } from '@backstage/types';
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 ResultCheckIconBaseComponentProps = PropsWithChildren<{
51
- onClick?: MouseEventHandler;
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<P extends ResultCheckIconBaseComponentProps> {
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
- * The icon is rendered with an `IconButton` which handles the onClick.
83
- * To wrap this in another component, handling the onClick, pass a component,
84
- * such as `ListItemSecondaryAction` which handles the `onClick` to open the
85
- * popup menu.
86
- *
87
- * The {@link ResultCheckIconProps.componentProps} prop can be specified to
88
- * add props to the wrapping component.
89
- */
90
- component?: ElementType<P>;
91
- /**
92
- * Props to provide to the wrapping component
93
- * {@link ResultCheckIconProps.component}.
94
- */
95
- componentProps?: Omit<P, 'onClick' | 'children'>;
96
- /**
97
- * Override the component used to display instead of a result icon, when no
98
- * renderer was found for this check type.
99
- */
100
- missingRendererComponent?: ReactNode;
101
- }
102
9
 
103
10
  /**
104
11
  * @public
@@ -131,7 +38,7 @@ declare const EntityTechInsightsScorecardContent: (props: {
131
38
  title: string;
132
39
  description?: string | undefined;
133
40
  checksId?: string[] | undefined;
134
- filter?: ((check: _backstage_community_plugin_tech_insights_common_client.Check) => boolean) | undefined;
41
+ filter?: ((check: _backstage_community_plugin_tech_insights_common.Check) => boolean) | undefined;
135
42
  }) => react.JSX.Element;
136
43
  /**
137
44
  * @public
@@ -140,7 +47,7 @@ declare const EntityTechInsightsScorecardCard: (props: {
140
47
  title: string;
141
48
  description?: string | undefined;
142
49
  checksId?: string[] | undefined;
143
- filter?: ((check: _backstage_community_plugin_tech_insights_common_client.Check) => boolean) | undefined;
50
+ filter?: ((check: _backstage_community_plugin_tech_insights_common.Check) => boolean) | undefined;
144
51
  onlyFailed?: boolean | undefined;
145
52
  expanded?: boolean | undefined;
146
53
  }) => react.JSX.Element;
@@ -150,84 +57,17 @@ declare const EntityTechInsightsScorecardCard: (props: {
150
57
  declare const TechInsightsScorecardPage: () => react.JSX.Element;
151
58
  /**
152
59
  * @public
60
+ * @deprecated Use `ResultCheckIcon` from `@backstage-community/plugin-tech-insights-react` instead
153
61
  */
154
- declare const TechInsightsCheckIcon: <P extends ResultCheckIconBaseComponentProps>(props: ResultCheckIconProps<P>) => react.JSX.Element;
62
+ declare const TechInsightsCheckIcon: <P extends _backstage_community_plugin_tech_insights_react.ResultCheckIconBaseComponentProps>(props: _backstage_community_plugin_tech_insights_react.ResultCheckIconProps<P>) => react.JSX.Element;
155
63
  /**
156
64
  * @public
65
+ * @deprecated Use `ResultLinksMenu` from `@backstage-community/plugin-tech-insights-react` instead
157
66
  */
158
67
  declare const TechInsightsLinksMenu: (props: react.PropsWithChildren<{
159
68
  result: _backstage_community_plugin_tech_insights_common.CheckResult;
160
69
  entity?: _backstage_catalog_model_index.Entity | undefined;
161
- setMenu(opener: ResultLinksMenuInfo | undefined): void;
70
+ setMenu(opener: _backstage_community_plugin_tech_insights_react.ResultLinksMenuInfo | undefined): void;
162
71
  }>) => react.JSX.Element | null;
163
72
 
164
- /**
165
- * {@link @backstage/core-plugin-api#ApiRef} for the {@link TechInsightsApi}
166
- *
167
- * @public
168
- */
169
- declare const techInsightsApiRef: _backstage_core_plugin_api.ApiRef<TechInsightsApi>;
170
- /**
171
- * API client interface for the Tech Insights plugin
172
- *
173
- * @public
174
- */
175
- interface TechInsightsApi {
176
- getCheckResultRenderers: (types: string[]) => CheckResultRenderer[];
177
- isCheckResultFailed: (check: CheckResult) => boolean;
178
- getAllChecks(): Promise<Check$1[]>;
179
- runChecks(entityParams: CompoundEntityRef, checks?: string[]): Promise<CheckResult[]>;
180
- runBulkChecks(entities: CompoundEntityRef[], checks?: Check$1[]): Promise<BulkCheckResponse>;
181
- getFacts(entity: CompoundEntityRef, facts: string[]): Promise<InsightFacts$1>;
182
- getFactSchemas(): Promise<FactSchema[]>;
183
- getLinksForEntity(result: CheckResult, entity: Entity, options?: {
184
- includeStaticLinks?: boolean;
185
- }): CheckLink[];
186
- }
187
-
188
- /** @public */
189
- declare class TechInsightsClient extends TechInsightsClient$1 implements TechInsightsApi {
190
- private readonly renderers?;
191
- private readonly customGetEntityLinks;
192
- constructor(options: {
193
- discoveryApi: DiscoveryApi;
194
- identityApi: IdentityApi;
195
- renderers?: CheckResultRenderer[];
196
- getEntityLinks?: (result: CheckResult, entity: Entity) => CheckLink[];
197
- });
198
- getCheckResultRenderers(types: string[]): CheckResultRenderer[];
199
- isCheckResultFailed(check: CheckResult): boolean;
200
- getLinksForEntity(result: CheckResult, entity: Entity, options?: {
201
- includeStaticLinks?: boolean;
202
- }): CheckLink[];
203
- }
204
-
205
- /**
206
- * Represents a single check defined on the TechInsights backend.
207
- *
208
- * @public
209
- * @deprecated Import from \@backstage-community/plugin-tech-insights-common/client
210
- */
211
- type Check = Check$1;
212
- /**
213
- * Represents a Fact defined on the TechInsights backend.
214
- *
215
- * @public
216
- * @deprecated Import from \@backstage-community/plugin-tech-insights-common/client
217
- */
218
- interface InsightFacts {
219
- [factId: string]: {
220
- timestamp: string;
221
- version: string;
222
- facts: Record<string, JsonValue>;
223
- };
224
- }
225
-
226
- /**
227
- * @public
228
- */
229
- declare const BooleanCheck: (props: {
230
- checkResult: CheckResult;
231
- }) => react__default.JSX.Element;
232
-
233
- 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 };
73
+ export { EntityTechInsightsScorecardCard, EntityTechInsightsScorecardContent, ScorecardInfo, ScorecardsList, TechInsightsCheckIcon, TechInsightsLinksMenu, TechInsightsScorecardPage, techInsightsPlugin };
package/dist/index.esm.js CHANGED
@@ -1,6 +1,3 @@
1
1
  export { EntityTechInsightsScorecardCard, EntityTechInsightsScorecardContent, ScorecardInfo, ScorecardsList, TechInsightsCheckIcon, TechInsightsLinksMenu, TechInsightsScorecardPage, techInsightsPlugin } from './plugin.esm.js';
2
- export { techInsightsApiRef } from './api/TechInsightsApi.esm.js';
3
- export { TechInsightsClient } from './api/TechInsightsClient.esm.js';
4
- export { BooleanCheck } from './components/BooleanCheck/BooleanCheck.esm.js';
5
- export { jsonRulesEngineCheckResultRenderer } from './components/CheckResultRenderer.esm.js';
2
+ export { BooleanCheck, TechInsightsClient, jsonRulesEngineCheckResultRenderer, techInsightsApiRef } from '@backstage-community/plugin-tech-insights-react';
6
3
  //# sourceMappingURL=index.esm.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;"}
1
+ {"version":3,"file":"index.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
@@ -1,7 +1,6 @@
1
1
  import { createPlugin, createApiFactory, discoveryApiRef, identityApiRef, createComponentExtension, createRoutableExtension } from '@backstage/core-plugin-api';
2
+ import { techInsightsApiRef, TechInsightsClient } from '@backstage-community/plugin-tech-insights-react';
2
3
  import { rootRouteRef } from './routes.esm.js';
3
- import { techInsightsApiRef } from './api/TechInsightsApi.esm.js';
4
- import { TechInsightsClient } from './api/TechInsightsClient.esm.js';
5
4
 
6
5
  const techInsightsPlugin = createPlugin({
7
6
  id: "tech-insights",
@@ -57,7 +56,9 @@ const TechInsightsCheckIcon = techInsightsPlugin.provide(
57
56
  createComponentExtension({
58
57
  name: "TechInsightsCheckIcon",
59
58
  component: {
60
- lazy: () => import('./components/ResultCheckIcon/index.esm.js').then((m) => m.ResultCheckIcon)
59
+ lazy: () => import('@backstage-community/plugin-tech-insights-react').then(
60
+ (m) => m.ResultCheckIcon
61
+ )
61
62
  }
62
63
  })
63
64
  );
@@ -65,7 +66,9 @@ const TechInsightsLinksMenu = techInsightsPlugin.provide(
65
66
  createComponentExtension({
66
67
  name: "TechInsightsLinksMenu",
67
68
  component: {
68
- lazy: () => import('./components/ResultLinksMenu/index.esm.js').then((m) => m.ResultLinksMenu)
69
+ lazy: () => import('@backstage-community/plugin-tech-insights-react').then(
70
+ (m) => m.ResultLinksMenu
71
+ )
69
72
  }
70
73
  })
71
74
  );
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.esm.js","sources":["../src/plugin.ts"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport {\n createPlugin,\n createComponentExtension,\n createRoutableExtension,\n createApiFactory,\n discoveryApiRef,\n identityApiRef,\n} from '@backstage/core-plugin-api';\nimport { 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;AAAA,KACvD;AAAA,GACH;AAAA,EACA,MAAQ,EAAA;AAAA,IACN,IAAM,EAAA;AAAA;AAEV,CAAC;AAKM,MAAM,gBAAgB,kBAAmB,CAAA,OAAA;AAAA,EAC9C,wBAAyB,CAAA;AAAA,IACvB,IAAM,EAAA,eAAA;AAAA,IACN,SAAW,EAAA;AAAA,MACT,IAAA,EAAM,MACJ,OAAO,0CAA6B,EAAE,IAAK,CAAA,CAAA,CAAA,KAAK,EAAE,aAAa;AAAA;AACnE,GACD;AACH;AAKO,MAAM,iBAAiB,kBAAmB,CAAA,OAAA;AAAA,EAC/C,wBAAyB,CAAA;AAAA,IACvB,IAAM,EAAA,gBAAA;AAA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CAA8B,EAAE,IAAK,CAAA,CAAA,CAAA,KAAK,EAAE,eAAe;AAAA;AACtE,GACD;AACH;;;;"}
1
+ {"version":3,"file":"plugin.esm.js","sources":["../src/plugin.ts"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport {\n createPlugin,\n createComponentExtension,\n createRoutableExtension,\n createApiFactory,\n discoveryApiRef,\n identityApiRef,\n} from '@backstage/core-plugin-api';\nimport {\n techInsightsApiRef,\n TechInsightsClient,\n} from '@backstage-community/plugin-tech-insights-react';\nimport { rootRouteRef } from './routes';\n\n/**\n * @public\n */\nexport const techInsightsPlugin = createPlugin({\n id: 'tech-insights',\n apis: [\n createApiFactory({\n api: techInsightsApiRef,\n deps: { discoveryApi: discoveryApiRef, identityApi: identityApiRef },\n factory: ({ discoveryApi, identityApi }) =>\n new TechInsightsClient({ discoveryApi, identityApi }),\n }),\n ],\n routes: {\n root: rootRouteRef,\n },\n});\n\n/**\n * @public\n */\nexport const ScorecardInfo = techInsightsPlugin.provide(\n createComponentExtension({\n name: 'ScorecardInfo',\n component: {\n lazy: () =>\n import('./components/ScorecardsInfo').then(m => m.ScorecardInfo),\n },\n }),\n);\n\n/**\n * @public\n */\nexport const ScorecardsList = techInsightsPlugin.provide(\n createComponentExtension({\n name: 'ScorecardsList',\n component: {\n lazy: () =>\n import('./components/ScorecardsList').then(m => m.ScorecardsList),\n },\n }),\n);\n\n/**\n * @public\n */\nexport const EntityTechInsightsScorecardContent = techInsightsPlugin.provide(\n createRoutableExtension({\n name: 'EntityTechInsightsScorecardContent',\n component: () =>\n import('./components/ScorecardsContent').then(m => m.ScorecardsContent),\n mountPoint: rootRouteRef,\n }),\n);\n\n/**\n * @public\n */\nexport const EntityTechInsightsScorecardCard = techInsightsPlugin.provide(\n createRoutableExtension({\n name: 'EntityTechInsightsScorecardCard',\n component: () =>\n import('./components/ScorecardsCard').then(m => m.ScorecardsCard),\n mountPoint: rootRouteRef,\n }),\n);\n\n/**\n * @public\n */\nexport const TechInsightsScorecardPage = techInsightsPlugin.provide(\n createRoutableExtension({\n name: 'TechInsightsScorecardPage',\n component: () =>\n import('./components/ScorecardsPage').then(m => m.ScorecardsPage),\n mountPoint: rootRouteRef,\n }),\n);\n\n/**\n * @public\n * @deprecated Use `ResultCheckIcon` from `@backstage-community/plugin-tech-insights-react` instead\n */\nexport const TechInsightsCheckIcon = techInsightsPlugin.provide(\n createComponentExtension({\n name: 'TechInsightsCheckIcon',\n component: {\n lazy: () =>\n import('@backstage-community/plugin-tech-insights-react').then(\n m => m.ResultCheckIcon,\n ),\n },\n }),\n);\n\n/**\n * @public\n * @deprecated Use `ResultLinksMenu` from `@backstage-community/plugin-tech-insights-react` instead\n */\nexport const TechInsightsLinksMenu = techInsightsPlugin.provide(\n createComponentExtension({\n name: 'TechInsightsLinksMenu',\n component: {\n lazy: () =>\n import('@backstage-community/plugin-tech-insights-react').then(\n m => m.ResultLinksMenu,\n ),\n },\n }),\n);\n"],"names":[],"mappings":";;;;AAgCO,MAAM,qBAAqB,YAAa,CAAA;AAAA,EAC7C,EAAI,EAAA,eAAA;AAAA,EACJ,IAAM,EAAA;AAAA,IACJ,gBAAiB,CAAA;AAAA,MACf,GAAK,EAAA,kBAAA;AAAA,MACL,IAAM,EAAA,EAAE,YAAc,EAAA,eAAA,EAAiB,aAAa,cAAe,EAAA;AAAA,MACnE,OAAA,EAAS,CAAC,EAAE,YAAc,EAAA,WAAA,EACxB,KAAA,IAAI,kBAAmB,CAAA,EAAE,YAAc,EAAA,WAAA,EAAa;AAAA,KACvD;AAAA,GACH;AAAA,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AACH;AAMO,MAAM,wBAAwB,kBAAmB,CAAA,OAAA;AAAA,EACtD,wBAAyB,CAAA;AAAA,IACvB,IAAM,EAAA,uBAAA;AAAA,IACN,SAAW,EAAA;AAAA,MACT,IAAM,EAAA,MACJ,OAAO,iDAAiD,CAAE,CAAA,IAAA;AAAA,QACxD,OAAK,CAAE,CAAA;AAAA;AACT;AACJ,GACD;AACH;AAMO,MAAM,wBAAwB,kBAAmB,CAAA,OAAA;AAAA,EACtD,wBAAyB,CAAA;AAAA,IACvB,IAAM,EAAA,uBAAA;AAAA,IACN,SAAW,EAAA;AAAA,MACT,IAAM,EAAA,MACJ,OAAO,iDAAiD,CAAE,CAAA,IAAA;AAAA,QACxD,OAAK,CAAE,CAAA;AAAA;AACT;AACJ,GACD;AACH;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@backstage-community/plugin-tech-insights",
3
- "version": "0.4.0",
3
+ "version": "0.5.0",
4
4
  "backstage": {
5
5
  "role": "frontend-plugin",
6
6
  "pluginId": "tech-insights",
@@ -8,7 +8,10 @@
8
8
  "@backstage-community/plugin-tech-insights",
9
9
  "@backstage-community/plugin-tech-insights-backend",
10
10
  "@backstage-community/plugin-tech-insights-common",
11
- "@backstage-community/plugin-tech-insights-node"
11
+ "@backstage-community/plugin-tech-insights-maturity",
12
+ "@backstage-community/plugin-tech-insights-maturity-common",
13
+ "@backstage-community/plugin-tech-insights-node",
14
+ "@backstage-community/plugin-tech-insights-react"
12
15
  ]
13
16
  },
14
17
  "publishConfig": {
@@ -39,13 +42,14 @@
39
42
  "test": "backstage-cli package test"
40
43
  },
41
44
  "dependencies": {
42
- "@backstage-community/plugin-tech-insights-common": "^0.4.0",
43
- "@backstage/catalog-model": "^1.7.2",
44
- "@backstage/core-components": "^0.16.2",
45
- "@backstage/core-plugin-api": "^1.10.2",
46
- "@backstage/errors": "^1.2.6",
47
- "@backstage/plugin-catalog-react": "^1.15.0",
48
- "@backstage/types": "^1.2.0",
45
+ "@backstage-community/plugin-tech-insights-common": "^0.5.0",
46
+ "@backstage-community/plugin-tech-insights-react": "^1.1.0",
47
+ "@backstage/catalog-model": "^1.7.3",
48
+ "@backstage/core-components": "^0.16.3",
49
+ "@backstage/core-plugin-api": "^1.10.3",
50
+ "@backstage/errors": "^1.2.7",
51
+ "@backstage/plugin-catalog-react": "^1.15.1",
52
+ "@backstage/types": "^1.2.1",
49
53
  "@material-table/exporters": "^1.2.19",
50
54
  "@material-ui/core": "^4.12.2",
51
55
  "@material-ui/icons": "^4.9.1",
@@ -54,8 +58,8 @@
54
58
  "react-use": "^17.2.4"
55
59
  },
56
60
  "devDependencies": {
57
- "@backstage/cli": "^0.29.4",
58
- "@backstage/dev-utils": "^1.1.5",
61
+ "@backstage/cli": "^0.29.6",
62
+ "@backstage/dev-utils": "^1.1.6",
59
63
  "@testing-library/dom": "^10.0.0",
60
64
  "@testing-library/jest-dom": "^6.0.0",
61
65
  "@testing-library/react": "^15.0.0",
@@ -1,8 +0,0 @@
1
- import { createApiRef } from '@backstage/core-plugin-api';
2
-
3
- const techInsightsApiRef = createApiRef({
4
- id: "plugin.techinsights.service"
5
- });
6
-
7
- export { techInsightsApiRef };
8
- //# sourceMappingURL=TechInsightsApi.esm.js.map
@@ -1 +0,0 @@
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 {\n Check,\n InsightFacts,\n} from '@backstage-community/plugin-tech-insights-common/client';\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":";;AAmCO,MAAM,qBAAqB,YAA8B,CAAA;AAAA,EAC9D,EAAI,EAAA;AACN,CAAC;;;;"}
@@ -1,35 +0,0 @@
1
- import { TechInsightsClient as TechInsightsClient$1 } from '@backstage-community/plugin-tech-insights-common/client';
2
- import { jsonRulesEngineCheckResultRenderer } from '../components/CheckResultRenderer.esm.js';
3
-
4
- class TechInsightsClient extends TechInsightsClient$1 {
5
- renderers;
6
- customGetEntityLinks;
7
- constructor(options) {
8
- super(options);
9
- this.renderers = options.renderers;
10
- this.customGetEntityLinks = options.getEntityLinks ?? (() => []);
11
- }
12
- getCheckResultRenderers(types) {
13
- const renderers = this.renderers ?? [jsonRulesEngineCheckResultRenderer];
14
- return renderers.filter((d) => types.includes(d.type));
15
- }
16
- isCheckResultFailed(check) {
17
- const checkResultRenderers = this.getCheckResultRenderers([
18
- check.check.type
19
- ]);
20
- if (checkResultRenderers[0] && checkResultRenderers[0].isFailed) {
21
- return checkResultRenderers[0].isFailed(check);
22
- }
23
- return true;
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
- }
32
- }
33
-
34
- export { TechInsightsClient };
35
- //# sourceMappingURL=TechInsightsClient.esm.js.map
@@ -1 +0,0 @@
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;AAAA,EACA,oBAAA;AAAA,EAKjB,YAAY,OAKT,EAAA;AACD,IAAA,KAAA,CAAM,OAAO,CAAA;AACb,IAAA,IAAA,CAAK,YAAY,OAAQ,CAAA,SAAA;AACzB,IAAA,IAAA,CAAK,oBAAuB,GAAA,OAAA,CAAQ,cAAmB,KAAA,MAAM,EAAC,CAAA;AAAA;AAChE,EAEA,wBAAwB,KAAwC,EAAA;AAC9D,IAAA,MAAM,SAAY,GAAA,IAAA,CAAK,SAAa,IAAA,CAAC,kCAAkC,CAAA;AACvE,IAAA,OAAO,UAAU,MAAO,CAAA,CAAA,CAAA,KAAK,MAAM,QAAS,CAAA,CAAA,CAAE,IAAI,CAAC,CAAA;AAAA;AACrD,EAEA,oBAAoB,KAAoB,EAAA;AACtC,IAAM,MAAA,oBAAA,GAAuB,KAAK,uBAAwB,CAAA;AAAA,MACxD,MAAM,KAAM,CAAA;AAAA,KACb,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;AAAA;AAE/C,IAAO,OAAA,IAAA;AAAA;AACT,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;AACtD,IAAA,IAAI,QAAQ,kBAAoB,EAAA;AAC9B,MAAA,KAAA,CAAM,KAAK,GAAI,MAAA,CAAO,KAAM,CAAA,KAAA,IAAS,EAAG,CAAA;AAAA;AAE1C,IAAO,OAAA,KAAA;AAAA;AAEX;;;;"}
@@ -1,11 +0,0 @@
1
- import React from 'react';
2
- import CheckCircleOutline from '@material-ui/icons/CheckCircleOutline';
3
- import ErrorOutlineIcon from '@material-ui/icons/ErrorOutline';
4
-
5
- const BooleanCheck = (props) => {
6
- return !!props.checkResult.result ? /* @__PURE__ */ React.createElement(CheckCircleOutline, { color: "primary" }) : /* @__PURE__ */ React.createElement(ErrorOutlineIcon, { color: "error" });
7
- };
8
- const isBooleanCheckFailed = (checkResult) => !checkResult.result;
9
-
10
- export { BooleanCheck, isBooleanCheckFailed };
11
- //# sourceMappingURL=BooleanCheck.esm.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"BooleanCheck.esm.js","sources":["../../../src/components/BooleanCheck/BooleanCheck.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 CheckCircleOutline from '@material-ui/icons/CheckCircleOutline';\nimport ErrorOutlineIcon from '@material-ui/icons/ErrorOutline';\nimport { CheckResult } from '@backstage-community/plugin-tech-insights-common';\n\n/**\n * @public\n */\nexport const BooleanCheck = (props: { checkResult: CheckResult }) => {\n return !!props.checkResult.result ? (\n <CheckCircleOutline color=\"primary\" />\n ) : (\n <ErrorOutlineIcon color=\"error\" />\n );\n};\n\n/**\n * @public\n */\nexport const isBooleanCheckFailed = (checkResult: CheckResult) =>\n !checkResult.result;\n"],"names":[],"mappings":";;;;AAwBa,MAAA,YAAA,GAAe,CAAC,KAAwC,KAAA;AACnE,EAAA,OAAO,CAAC,CAAC,KAAM,CAAA,WAAA,CAAY,MACzB,mBAAA,KAAA,CAAA,aAAA,CAAC,kBAAmB,EAAA,EAAA,KAAA,EAAM,SAAU,EAAA,CAAA,mBAEnC,KAAA,CAAA,aAAA,CAAA,gBAAA,EAAA,EAAiB,OAAM,OAAQ,EAAA,CAAA;AAEpC;AAKO,MAAM,oBAAuB,GAAA,CAAC,WACnC,KAAA,CAAC,WAAY,CAAA;;;;"}
@@ -1,11 +0,0 @@
1
- import React from 'react';
2
- import { BooleanCheck, isBooleanCheckFailed } from './BooleanCheck/BooleanCheck.esm.js';
3
-
4
- const jsonRulesEngineCheckResultRenderer = {
5
- type: "json-rules-engine",
6
- component: (checkResult) => /* @__PURE__ */ React.createElement(BooleanCheck, { checkResult }),
7
- isFailed: isBooleanCheckFailed
8
- };
9
-
10
- export { jsonRulesEngineCheckResultRenderer };
11
- //# sourceMappingURL=CheckResultRenderer.esm.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"CheckResultRenderer.esm.js","sources":["../../src/components/CheckResultRenderer.tsx"],"sourcesContent":["/*\n * Copyright 2022 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { CheckResult } from '@backstage-community/plugin-tech-insights-common';\nimport React from 'react';\nimport { BooleanCheck, isBooleanCheckFailed } from './BooleanCheck';\n\n/**\n * Defines a react component that is responsible for rendering a result of a given type.\n *\n * @public\n */\nexport type CheckResultRenderer = {\n type: string;\n component: (check: CheckResult) => React.ReactElement;\n description?: (check: CheckResult) => string | React.ReactElement;\n isFailed?: (check: CheckResult) => boolean;\n};\n\n/**\n * Default renderer for json-rules-engine check results.\n *\n * @public\n */\nexport const jsonRulesEngineCheckResultRenderer: CheckResultRenderer = {\n type: 'json-rules-engine',\n component: (checkResult: CheckResult) => (\n <BooleanCheck checkResult={checkResult} />\n ),\n isFailed: isBooleanCheckFailed,\n};\n"],"names":[],"mappings":";;;AAqCO,MAAM,kCAA0D,GAAA;AAAA,EACrE,IAAM,EAAA,mBAAA;AAAA,EACN,SAAW,EAAA,CAAC,WACV,qBAAA,KAAA,CAAA,aAAA,CAAC,gBAAa,WAA0B,EAAA,CAAA;AAAA,EAE1C,QAAU,EAAA;AACZ;;;;"}
@@ -1,45 +0,0 @@
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
@@ -1 +0,0 @@
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;AACH,EAAM,MAAA;AAAA,IACJ,MAAA;AAAA,IACA,MAAA;AAAA,IACA,gBAAA;AAAA,IACA,SAAA;AAAA,IACA,cAAA;AAAA,IACA,wBAA2B,mBAAA,KAAA,CAAA,aAAA,CAAC,KAAM,EAAA,EAAA,QAAA,EAAS,WAAQ,eAAa;AAAA,GAC9D,GAAA,KAAA;AAEJ,EAAM,MAAA,GAAA,GAAM,OAAO,kBAAkB,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;AAEpD,EAAA,MAAM,CAAC,IAAA,EAAM,OAAO,CAAA,GAAI,QAA0C,EAAA;AAElE,EAAM,MAAA,aAAA,GAAgB,m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[],"mappings":""}
@@ -1,66 +0,0 @@
1
- import React, { useMemo, 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
- import { stringifyEntityRef } from '@backstage/catalog-model';
10
-
11
- const ResultLinksMenu = (props) => {
12
- const { result, entity, setMenu } = props;
13
- const api = useApi(techInsightsApiRef);
14
- const links = useMemo(
15
- () => entity ? api.getLinksForEntity(result, entity, {
16
- includeStaticLinks: true
17
- }) : result.check.links ?? [],
18
- [api, result, entity]
19
- );
20
- const menuId = `menu-${result.check.id}-${entity ? stringifyEntityRef(entity) : "unknown"}`;
21
- const [anchorEl, setAnchorEl] = React.useState(
22
- void 0
23
- );
24
- useEffect(() => {
25
- if (links.length === 0) {
26
- setMenu(void 0);
27
- return;
28
- }
29
- setMenu({
30
- open: (elem) => {
31
- setAnchorEl(elem);
32
- }
33
- });
34
- }, [setMenu, links]);
35
- const handleClose = useCallback(() => {
36
- setAnchorEl(void 0);
37
- }, [setAnchorEl]);
38
- if (links.length === 0) {
39
- return null;
40
- }
41
- return /* @__PURE__ */ React.createElement(
42
- Menu,
43
- {
44
- id: menuId,
45
- anchorEl: anchorEl ?? null,
46
- keepMounted: true,
47
- open: Boolean(anchorEl),
48
- onClose: handleClose
49
- },
50
- links.map((link, i) => /* @__PURE__ */ React.createElement(
51
- MenuItem,
52
- {
53
- key: `${i}-${link.url}`,
54
- button: true,
55
- component: "a",
56
- href: link.url,
57
- target: link.url.startsWith("/") ? void 0 : "_blank",
58
- onClick: handleClose
59
- },
60
- link.title
61
- ))
62
- );
63
- };
64
-
65
- export { ResultLinksMenu };
66
- //# sourceMappingURL=ResultLinksMenu.esm.js.map
@@ -1 +0,0 @@
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 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, stringifyEntityRef } 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-${result.check.id}-${\n entity ? stringifyEntityRef(entity) : 'unknown'\n }`;\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":";;;;;;;;;;AA8Ca,MAAA,eAAA,GAAkB,CAC7B,KAKG,KAAA;AACH,EAAA,MAAM,EAAE,MAAA,EAAQ,MAAQ,EAAA,OAAA,EAAY,GAAA,KAAA;AAEpC,EAAM,MAAA,GAAA,GAAM,OAAO,kBAAkB,CAAA;AAErC,EAAA,MAAM,KAAQ,GAAA,OAAA;AAAA,IACZ,MACE,MAAA,GACI,GAAI,CAAA,iBAAA,CAAkB,QAAQ,MAAQ,EAAA;AAAA,MACpC,kBAAoB,EAAA;AAAA,KACrB,CAAA,GACD,MAAO,CAAA,KAAA,CAAM,SAAS,EAAC;AAAA,IAC7B,CAAC,GAAK,EAAA,MAAA,EAAQ,MAAM;AAAA,GACtB;AAEA,EAAM,MAAA,MAAA,GAAS,CAAQ,KAAA,EAAA,MAAA,CAAO,KAAM,CAAA,EAAE,IACpC,MAAS,GAAA,kBAAA,CAAmB,MAAM,CAAA,GAAI,SACxC,CAAA,CAAA;AAEA,EAAA,MAAM,CAAC,QAAA,EAAU,WAAW,CAAA,GAAI,KAAM,CAAA,QAAA;AAAA,IACpC,KAAA;AAAA,GACF;AAEA,EAAA,SAAA,CAAU,MAAM;AACd,IAAI,IAAA,KAAA,CAAM,WAAW,CAAG,EAAA;AACtB,MAAA,OAA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js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}