@backstage-community/plugin-tech-insights 0.3.33 → 0.3.34
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -0
- package/dist/api/TechInsightsClient.esm.js +3 -65
- package/dist/api/TechInsightsClient.esm.js.map +1 -1
- package/dist/components/ScorecardsCard/ScorecardsCard.esm.js +2 -3
- package/dist/components/ScorecardsCard/ScorecardsCard.esm.js.map +1 -1
- package/dist/components/ScorecardsInfo/ScorecardInfo.esm.js +1 -3
- package/dist/components/ScorecardsInfo/ScorecardInfo.esm.js.map +1 -1
- package/dist/components/ScorecardsList/ScorecardsList.esm.js +1 -3
- package/dist/components/ScorecardsList/ScorecardsList.esm.js.map +1 -1
- package/dist/components/ScorecardsPage/Filters.esm.js +1 -3
- package/dist/components/ScorecardsPage/Filters.esm.js.map +1 -1
- package/dist/components/ScorecardsPage/ScorecardsPage.esm.js +1 -3
- package/dist/components/ScorecardsPage/ScorecardsPage.esm.js.map +1 -1
- package/dist/index.d.ts +5 -47
- package/package.json +2 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# @backstage-community/plugin-tech-insights
|
|
2
2
|
|
|
3
|
+
## 0.3.34
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- a84eb44: Move client to common package and allow to use backend auth system
|
|
8
|
+
- Updated dependencies [a84eb44]
|
|
9
|
+
- @backstage-community/plugin-tech-insights-common@0.2.17
|
|
10
|
+
|
|
3
11
|
## 0.3.33
|
|
4
12
|
|
|
5
13
|
### Patch Changes
|
|
@@ -1,24 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { stringifyEntityRef } from '@backstage/catalog-model';
|
|
1
|
+
import { TechInsightsClient as TechInsightsClient$1 } from '@backstage-community/plugin-tech-insights-common/client';
|
|
3
2
|
import { jsonRulesEngineCheckResultRenderer } from '../components/CheckResultRenderer.esm.js';
|
|
4
|
-
import qs from 'qs';
|
|
5
3
|
|
|
6
|
-
class TechInsightsClient {
|
|
7
|
-
discoveryApi;
|
|
8
|
-
identityApi;
|
|
4
|
+
class TechInsightsClient extends TechInsightsClient$1 {
|
|
9
5
|
renderers;
|
|
10
6
|
constructor(options) {
|
|
11
|
-
|
|
12
|
-
this.identityApi = options.identityApi;
|
|
7
|
+
super(options);
|
|
13
8
|
this.renderers = options.renderers;
|
|
14
9
|
}
|
|
15
|
-
async getFacts(entity, facts) {
|
|
16
|
-
const query = qs.stringify({
|
|
17
|
-
entity: stringifyEntityRef(entity),
|
|
18
|
-
ids: facts
|
|
19
|
-
});
|
|
20
|
-
return await this.api(`/facts/latest?${query}`);
|
|
21
|
-
}
|
|
22
10
|
getCheckResultRenderers(types) {
|
|
23
11
|
const renderers = this.renderers ?? [jsonRulesEngineCheckResultRenderer];
|
|
24
12
|
return renderers.filter((d) => types.includes(d.type));
|
|
@@ -32,56 +20,6 @@ class TechInsightsClient {
|
|
|
32
20
|
}
|
|
33
21
|
return true;
|
|
34
22
|
}
|
|
35
|
-
async getAllChecks() {
|
|
36
|
-
return this.api("/checks");
|
|
37
|
-
}
|
|
38
|
-
async getFactSchemas() {
|
|
39
|
-
return this.api("/fact-schemas");
|
|
40
|
-
}
|
|
41
|
-
async runChecks(entityParams, checks) {
|
|
42
|
-
const { namespace, kind, name } = entityParams;
|
|
43
|
-
const requestBody = { checks };
|
|
44
|
-
return this.api(
|
|
45
|
-
`/checks/run/${encodeURIComponent(namespace)}/${encodeURIComponent(
|
|
46
|
-
kind
|
|
47
|
-
)}/${encodeURIComponent(name)}`,
|
|
48
|
-
{
|
|
49
|
-
method: "POST",
|
|
50
|
-
body: JSON.stringify(requestBody)
|
|
51
|
-
}
|
|
52
|
-
);
|
|
53
|
-
}
|
|
54
|
-
async runBulkChecks(entities, checks) {
|
|
55
|
-
const checkIds = checks ? checks.map((check) => check.id) : [];
|
|
56
|
-
const requestBody = {
|
|
57
|
-
entities,
|
|
58
|
-
checks: checkIds.length > 0 ? checkIds : void 0
|
|
59
|
-
};
|
|
60
|
-
return this.api("/checks/run", {
|
|
61
|
-
method: "POST",
|
|
62
|
-
body: JSON.stringify(requestBody)
|
|
63
|
-
});
|
|
64
|
-
}
|
|
65
|
-
async api(path, init) {
|
|
66
|
-
const url = await this.discoveryApi.getBaseUrl("tech-insights");
|
|
67
|
-
const { token } = await this.identityApi.getCredentials();
|
|
68
|
-
const headers = new Headers(init?.headers);
|
|
69
|
-
if (!headers.has("content-type"))
|
|
70
|
-
headers.set("content-type", "application/json");
|
|
71
|
-
if (token && !headers.has("authorization")) {
|
|
72
|
-
headers.set("authorization", `Bearer ${token}`);
|
|
73
|
-
}
|
|
74
|
-
const request = new Request(`${url}${path}`, {
|
|
75
|
-
...init,
|
|
76
|
-
headers
|
|
77
|
-
});
|
|
78
|
-
return fetch(request).then(async (response) => {
|
|
79
|
-
if (!response.ok) {
|
|
80
|
-
throw await ResponseError.fromResponse(response);
|
|
81
|
-
}
|
|
82
|
-
return response.json();
|
|
83
|
-
});
|
|
84
|
-
}
|
|
85
23
|
}
|
|
86
24
|
|
|
87
25
|
export { TechInsightsClient };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TechInsightsClient.esm.js","sources":["../../src/api/TechInsightsClient.ts"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { TechInsightsApi } from './TechInsightsApi';\nimport {
|
|
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 { CheckResult } from '@backstage-community/plugin-tech-insights-common';\n\nimport {\n CheckResultRenderer,\n jsonRulesEngineCheckResultRenderer,\n} from '../components/CheckResultRenderer';\n\n/** @public */\nexport class TechInsightsClient\n extends TechInsightsClientBase\n implements TechInsightsApi\n{\n private readonly renderers?: CheckResultRenderer[];\n\n constructor(options: {\n discoveryApi: DiscoveryApi;\n identityApi: IdentityApi;\n renderers?: CheckResultRenderer[];\n }) {\n super(options);\n this.renderers = options.renderers;\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"],"names":["TechInsightsClientBase"],"mappings":";;;AA2BO,MAAM,2BACHA,oBAEV,CAAA;AAAA,EACmB,SAAA,CAAA;AAAA,EAEjB,YAAY,OAIT,EAAA;AACD,IAAA,KAAA,CAAM,OAAO,CAAA,CAAA;AACb,IAAA,IAAA,CAAK,YAAY,OAAQ,CAAA,SAAA,CAAA;AAAA,GAC3B;AAAA,EAEA,wBAAwB,KAAwC,EAAA;AAC9D,IAAA,MAAM,SAAY,GAAA,IAAA,CAAK,SAAa,IAAA,CAAC,kCAAkC,CAAA,CAAA;AACvE,IAAA,OAAO,UAAU,MAAO,CAAA,CAAA,CAAA,KAAK,MAAM,QAAS,CAAA,CAAA,CAAE,IAAI,CAAC,CAAA,CAAA;AAAA,GACrD;AAAA,EAEA,oBAAoB,KAAoB,EAAA;AACtC,IAAM,MAAA,oBAAA,GAAuB,KAAK,uBAAwB,CAAA;AAAA,MACxD,MAAM,KAAM,CAAA,IAAA;AAAA,KACb,CAAA,CAAA;AACD,IAAA,IAAI,qBAAqB,CAAC,CAAA,IAAK,oBAAqB,CAAA,CAAC,EAAE,QAAU,EAAA;AAC/D,MAAA,OAAO,oBAAqB,CAAA,CAAC,CAAE,CAAA,QAAA,CAAS,KAAK,CAAA,CAAA;AAAA,KAC/C;AACA,IAAO,OAAA,IAAA,CAAA;AAAA,GACT;AACF;;;;"}
|
|
@@ -4,12 +4,11 @@ import { Progress, ErrorPanel } from '@backstage/core-components';
|
|
|
4
4
|
import { useApi } from '@backstage/core-plugin-api';
|
|
5
5
|
import { ScorecardInfo } from '../ScorecardsInfo/ScorecardInfo.esm.js';
|
|
6
6
|
import { techInsightsApiRef } from '../../api/TechInsightsApi.esm.js';
|
|
7
|
-
import '@backstage/
|
|
8
|
-
import { getCompoundEntityRef } from '@backstage/catalog-model';
|
|
7
|
+
import '@backstage-community/plugin-tech-insights-common/client';
|
|
9
8
|
import '@material-ui/icons/CheckCircleOutline';
|
|
10
9
|
import '@material-ui/icons/ErrorOutline';
|
|
11
|
-
import 'qs';
|
|
12
10
|
import { useEntity } from '@backstage/plugin-catalog-react';
|
|
11
|
+
import { getCompoundEntityRef } from '@backstage/catalog-model';
|
|
13
12
|
|
|
14
13
|
const ScorecardsCard = (props) => {
|
|
15
14
|
const { title, description, checksId, onlyFailed, expanded = true } = props;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ScorecardsCard.esm.js","sources":["../../../src/components/ScorecardsCard/ScorecardsCard.tsx"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React, { useMemo } from 'react';\nimport useAsync from 'react-use/esm/useAsync';\nimport { ErrorPanel, Progress } from '@backstage/core-components';\nimport { useApi } from '@backstage/core-plugin-api';\nimport { ScorecardInfo } from '../ScorecardsInfo';\nimport { techInsightsApiRef } from '../../api';\nimport { useEntity } from '@backstage/plugin-catalog-react';\nimport { getCompoundEntityRef } from '@backstage/catalog-model';\n\nexport const ScorecardsCard = (props: {\n title: string;\n description?: string;\n checksId?: string[];\n onlyFailed?: boolean;\n expanded?: boolean;\n}) => {\n const { title, description, checksId, onlyFailed, expanded = true } = props;\n const api = useApi(techInsightsApiRef);\n const { entity } = useEntity();\n const { value, loading, error } = useAsync(\n async () => await api.runChecks(getCompoundEntityRef(entity), checksId),\n [api, entity, JSON.stringify(checksId)],\n );\n\n const checkResultRenderers = useMemo(() => {\n if (!onlyFailed || !value) return {};\n\n const types = [...new Set(value.map(({ check }) => check.type))];\n const renderers = api.getCheckResultRenderers(types);\n return Object.fromEntries(\n renderers.map(renderer => [renderer.type, renderer]),\n );\n }, [api, value, onlyFailed]);\n\n if (loading) {\n return <Progress />;\n } else if (error) {\n return <ErrorPanel error={error} />;\n }\n\n const filteredValue = !onlyFailed\n ? value || []\n : (value || []).filter(val =>\n checkResultRenderers[val.check.type]?.isFailed?.(val),\n );\n\n return (\n <ScorecardInfo\n title={title}\n description={description}\n checkResults={filteredValue}\n noWarning={onlyFailed}\n expanded={expanded}\n />\n );\n};\n"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ScorecardsCard.esm.js","sources":["../../../src/components/ScorecardsCard/ScorecardsCard.tsx"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React, { useMemo } from 'react';\nimport useAsync from 'react-use/esm/useAsync';\nimport { ErrorPanel, Progress } from '@backstage/core-components';\nimport { useApi } from '@backstage/core-plugin-api';\nimport { ScorecardInfo } from '../ScorecardsInfo';\nimport { techInsightsApiRef } from '../../api';\nimport { useEntity } from '@backstage/plugin-catalog-react';\nimport { getCompoundEntityRef } from '@backstage/catalog-model';\n\nexport const ScorecardsCard = (props: {\n title: string;\n description?: string;\n checksId?: string[];\n onlyFailed?: boolean;\n expanded?: boolean;\n}) => {\n const { title, description, checksId, onlyFailed, expanded = true } = props;\n const api = useApi(techInsightsApiRef);\n const { entity } = useEntity();\n const { value, loading, error } = useAsync(\n async () => await api.runChecks(getCompoundEntityRef(entity), checksId),\n [api, entity, JSON.stringify(checksId)],\n );\n\n const checkResultRenderers = useMemo(() => {\n if (!onlyFailed || !value) return {};\n\n const types = [...new Set(value.map(({ check }) => check.type))];\n const renderers = api.getCheckResultRenderers(types);\n return Object.fromEntries(\n renderers.map(renderer => [renderer.type, renderer]),\n );\n }, [api, value, onlyFailed]);\n\n if (loading) {\n return <Progress />;\n } else if (error) {\n return <ErrorPanel error={error} />;\n }\n\n const filteredValue = !onlyFailed\n ? value || []\n : (value || []).filter(val =>\n checkResultRenderers[val.check.type]?.isFailed?.(val),\n );\n\n return (\n <ScorecardInfo\n title={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,QAAS,EAAA,IAAA,CAAA,CAAA;AAAA,aACR,KAAO,EAAA;AAChB,IAAO,uBAAA,KAAA,CAAA,aAAA,CAAC,cAAW,KAAc,EAAA,CAAA,CAAA;AAAA,GACnC;AAEA,EAAM,MAAA,aAAA,GAAgB,CAAC,UACnB,GAAA,KAAA,IAAS,EACR,GAAA,CAAA,KAAA,IAAS,EAAI,EAAA,MAAA;AAAA,IAAO,SACnB,oBAAqB,CAAA,GAAA,CAAI,MAAM,IAAI,CAAA,EAAG,WAAW,GAAG,CAAA;AAAA,GACtD,CAAA;AAEJ,EACE,uBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,aAAA;AAAA,IAAA;AAAA,MACC,KAAA;AAAA,MACA,WAAA;AAAA,MACA,YAAc,EAAA,aAAA;AAAA,MACd,SAAW,EAAA,UAAA;AAAA,MACX,QAAA;AAAA,KAAA;AAAA,GACF,CAAA;AAEJ;;;;"}
|
|
@@ -10,11 +10,9 @@ import AccordionDetails from '@material-ui/core/AccordionDetails';
|
|
|
10
10
|
import AccordionSummary from '@material-ui/core/AccordionSummary';
|
|
11
11
|
import { useApi } from '@backstage/core-plugin-api';
|
|
12
12
|
import { techInsightsApiRef } from '../../api/TechInsightsApi.esm.js';
|
|
13
|
-
import '@backstage/
|
|
14
|
-
import '@backstage/catalog-model';
|
|
13
|
+
import '@backstage-community/plugin-tech-insights-common/client';
|
|
15
14
|
import '@material-ui/icons/CheckCircleOutline';
|
|
16
15
|
import '@material-ui/icons/ErrorOutline';
|
|
17
|
-
import 'qs';
|
|
18
16
|
|
|
19
17
|
const useStyles = makeStyles((theme) => ({
|
|
20
18
|
subheader: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ScorecardInfo.esm.js","sources":["../../../src/components/ScorecardsInfo/ScorecardInfo.tsx"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React, { ReactNode } from 'react';\nimport Grid from '@material-ui/core/Grid';\nimport Typography from '@material-ui/core/Typography';\nimport { makeStyles } from '@material-ui/core/styles';\nimport { CheckResult } from '@backstage-community/plugin-tech-insights-common';\nimport Alert from '@material-ui/lab/Alert';\nimport { ScorecardsList } from '../ScorecardsList';\nimport ExpandMoreIcon from '@material-ui/icons/ExpandMore';\nimport Accordion from '@material-ui/core/Accordion';\nimport AccordionDetails from '@material-ui/core/AccordionDetails';\nimport AccordionSummary from '@material-ui/core/AccordionSummary';\nimport { useApi } from '@backstage/core-plugin-api';\nimport { techInsightsApiRef } from '../../api';\n\nconst useStyles = makeStyles(theme => ({\n subheader: {\n paddingLeft: theme.spacing(0.5),\n },\n accordionHeader: {\n borderBottom: `1px solid ${theme.palette.border}`,\n },\n accordionHeaderContent: {\n margin: `${theme.spacing(2)}px 0 !important`,\n },\n}));\n\nconst infoCard = (\n title: React.ReactNode,\n description: string | undefined,\n classes: ReturnType<typeof useStyles>,\n element: React.ReactElement,\n expanded: boolean,\n summary?: string,\n) => (\n <Grid item xs={12}>\n <Accordion defaultExpanded={expanded}>\n <AccordionSummary\n expandIcon={<ExpandMoreIcon />}\n className={classes.accordionHeader}\n classes={{\n content: classes.accordionHeaderContent,\n }}\n >\n <Grid container justifyContent=\"space-between\" alignItems=\"center\">\n <Grid item>\n <Typography variant=\"h5\">{title}</Typography>\n </Grid>\n <Grid item>\n <Typography>{summary}</Typography>\n </Grid>\n </Grid>\n </AccordionSummary>\n <AccordionDetails>\n <Grid container>\n {description && (\n <Grid item xs={12}>\n <Typography\n className={classes.subheader}\n variant=\"body1\"\n gutterBottom\n >\n {description}\n </Typography>\n </Grid>\n )}\n <Grid item xs={12}>\n {element}\n </Grid>\n </Grid>\n </AccordionDetails>\n </Accordion>\n </Grid>\n);\n\nexport const ScorecardInfo = (props: {\n checkResults: CheckResult[];\n title: ReactNode;\n description?: string;\n noWarning?: boolean;\n expanded?: boolean;\n}) => {\n const {\n checkResults,\n title,\n description,\n noWarning,\n expanded = true,\n } = props;\n const classes = useStyles();\n const api = useApi(techInsightsApiRef);\n\n if (!checkResults.length) {\n if (noWarning) {\n return infoCard(\n title,\n description,\n classes,\n <Alert severity=\"info\">\n All checks passed, or no checks have been performed yet\n </Alert>,\n expanded,\n );\n }\n return infoCard(\n title,\n description,\n classes,\n <Alert severity=\"warning\">No checks have any data yet.</Alert>,\n expanded,\n );\n }\n\n return infoCard(\n title,\n description,\n classes,\n <ScorecardsList checkResults={checkResults} />,\n expanded,\n `${\n checkResults.filter(checkResult => !api.isCheckResultFailed(checkResult))\n .length\n }/${checkResults.length}`,\n );\n};\n"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ScorecardInfo.esm.js","sources":["../../../src/components/ScorecardsInfo/ScorecardInfo.tsx"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React, { ReactNode } from 'react';\nimport Grid from '@material-ui/core/Grid';\nimport Typography from '@material-ui/core/Typography';\nimport { makeStyles } from '@material-ui/core/styles';\nimport { CheckResult } from '@backstage-community/plugin-tech-insights-common';\nimport Alert from '@material-ui/lab/Alert';\nimport { ScorecardsList } from '../ScorecardsList';\nimport ExpandMoreIcon from '@material-ui/icons/ExpandMore';\nimport Accordion from '@material-ui/core/Accordion';\nimport AccordionDetails from '@material-ui/core/AccordionDetails';\nimport AccordionSummary from '@material-ui/core/AccordionSummary';\nimport { useApi } from '@backstage/core-plugin-api';\nimport { techInsightsApiRef } from '../../api';\n\nconst useStyles = makeStyles(theme => ({\n subheader: {\n paddingLeft: theme.spacing(0.5),\n },\n accordionHeader: {\n borderBottom: `1px solid ${theme.palette.border}`,\n },\n accordionHeaderContent: {\n margin: `${theme.spacing(2)}px 0 !important`,\n },\n}));\n\nconst infoCard = (\n title: React.ReactNode,\n description: string | undefined,\n classes: ReturnType<typeof useStyles>,\n element: React.ReactElement,\n expanded: boolean,\n summary?: string,\n) => (\n <Grid item xs={12}>\n <Accordion defaultExpanded={expanded}>\n <AccordionSummary\n expandIcon={<ExpandMoreIcon />}\n className={classes.accordionHeader}\n classes={{\n content: classes.accordionHeaderContent,\n }}\n >\n <Grid container justifyContent=\"space-between\" alignItems=\"center\">\n <Grid item>\n <Typography variant=\"h5\">{title}</Typography>\n </Grid>\n <Grid item>\n <Typography>{summary}</Typography>\n </Grid>\n </Grid>\n </AccordionSummary>\n <AccordionDetails>\n <Grid container>\n {description && (\n <Grid item xs={12}>\n <Typography\n className={classes.subheader}\n variant=\"body1\"\n gutterBottom\n >\n {description}\n </Typography>\n </Grid>\n )}\n <Grid item xs={12}>\n {element}\n </Grid>\n </Grid>\n </AccordionDetails>\n </Accordion>\n </Grid>\n);\n\nexport const ScorecardInfo = (props: {\n checkResults: CheckResult[];\n title: ReactNode;\n description?: string;\n noWarning?: boolean;\n expanded?: boolean;\n}) => {\n const {\n checkResults,\n title,\n description,\n noWarning,\n expanded = true,\n } = props;\n const classes = useStyles();\n const api = useApi(techInsightsApiRef);\n\n if (!checkResults.length) {\n if (noWarning) {\n return infoCard(\n title,\n description,\n classes,\n <Alert severity=\"info\">\n All checks passed, or no checks have been performed yet\n </Alert>,\n expanded,\n );\n }\n return infoCard(\n title,\n description,\n classes,\n <Alert severity=\"warning\">No checks have any data yet.</Alert>,\n expanded,\n );\n }\n\n return infoCard(\n title,\n description,\n classes,\n <ScorecardsList checkResults={checkResults} />,\n expanded,\n `${\n checkResults.filter(checkResult => !api.isCheckResultFailed(checkResult))\n .length\n }/${checkResults.length}`,\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;AA8BA,MAAM,SAAA,GAAY,WAAW,CAAU,KAAA,MAAA;AAAA,EACrC,SAAW,EAAA;AAAA,IACT,WAAA,EAAa,KAAM,CAAA,OAAA,CAAQ,GAAG,CAAA;AAAA,GAChC;AAAA,EACA,eAAiB,EAAA;AAAA,IACf,YAAc,EAAA,CAAA,UAAA,EAAa,KAAM,CAAA,OAAA,CAAQ,MAAM,CAAA,CAAA;AAAA,GACjD;AAAA,EACA,sBAAwB,EAAA;AAAA,IACtB,MAAQ,EAAA,CAAA,EAAG,KAAM,CAAA,OAAA,CAAQ,CAAC,CAAC,CAAA,eAAA,CAAA;AAAA,GAC7B;AACF,CAAE,CAAA,CAAA,CAAA;AAEF,MAAM,WAAW,CACf,KAAA,EACA,WACA,EAAA,OAAA,EACA,SACA,QACA,EAAA,OAAA,qBAEC,KAAA,CAAA,aAAA,CAAA,IAAA,EAAA,EAAK,MAAI,IAAC,EAAA,EAAA,EAAI,sBACZ,KAAA,CAAA,aAAA,CAAA,SAAA,EAAA,EAAU,iBAAiB,QAC1B,EAAA,kBAAA,KAAA,CAAA,aAAA;AAAA,EAAC,gBAAA;AAAA,EAAA;AAAA,IACC,UAAA,sCAAa,cAAe,EAAA,IAAA,CAAA;AAAA,IAC5B,WAAW,OAAQ,CAAA,eAAA;AAAA,IACnB,OAAS,EAAA;AAAA,MACP,SAAS,OAAQ,CAAA,sBAAA;AAAA,KACnB;AAAA,GAAA;AAAA,kBAEA,KAAA,CAAA,aAAA,CAAC,IAAK,EAAA,EAAA,SAAA,EAAS,IAAC,EAAA,cAAA,EAAe,eAAgB,EAAA,UAAA,EAAW,QACxD,EAAA,kBAAA,KAAA,CAAA,aAAA,CAAC,IAAK,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OAAA,QAAA;AAAA,QACL,KAAA;AAAA,QACA,WAAA;AAAA,QACA,OAAA;AAAA,wBACC,KAAA,CAAA,aAAA,CAAA,KAAA,EAAA,EAAM,QAAS,EAAA,MAAA,EAAA,EAAO,yDAEvB,CAAA;AAAA,QACA,QAAA;AAAA,OACF,CAAA;AAAA,KACF;AACA,IAAO,OAAA,QAAA;AAAA,MACL,KAAA;AAAA,MACA,WAAA;AAAA,MACA,OAAA;AAAA,sBACC,KAAA,CAAA,aAAA,CAAA,KAAA,EAAA,EAAM,QAAS,EAAA,SAAA,EAAA,EAAU,8BAA4B,CAAA;AAAA,MACtD,QAAA;AAAA,KACF,CAAA;AAAA,GACF;AAEA,EAAO,OAAA,QAAA;AAAA,IACL,KAAA;AAAA,IACA,WAAA;AAAA,IACA,OAAA;AAAA,oBACA,KAAA,CAAA,aAAA,CAAC,kBAAe,YAA4B,EAAA,CAAA;AAAA,IAC5C,QAAA;AAAA,IACA,CACE,EAAA,YAAA,CAAa,MAAO,CAAA,CAAA,WAAA,KAAe,CAAC,GAAA,CAAI,mBAAoB,CAAA,WAAW,CAAC,CAAA,CACrE,MACL,CAAA,CAAA,EAAI,aAAa,MAAM,CAAA,CAAA;AAAA,GACzB,CAAA;AACF;;;;"}
|
|
@@ -5,11 +5,9 @@ import ListItem from '@material-ui/core/ListItem';
|
|
|
5
5
|
import ListItemText from '@material-ui/core/ListItemText';
|
|
6
6
|
import { makeStyles } from '@material-ui/core/styles';
|
|
7
7
|
import { techInsightsApiRef } from '../../api/TechInsightsApi.esm.js';
|
|
8
|
-
import '@backstage/
|
|
9
|
-
import '@backstage/catalog-model';
|
|
8
|
+
import '@backstage-community/plugin-tech-insights-common/client';
|
|
10
9
|
import '@material-ui/icons/CheckCircleOutline';
|
|
11
10
|
import '@material-ui/icons/ErrorOutline';
|
|
12
|
-
import 'qs';
|
|
13
11
|
import Alert from '@material-ui/lab/Alert';
|
|
14
12
|
import { MarkdownContent } from '@backstage/core-components';
|
|
15
13
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ScorecardsList.esm.js","sources":["../../../src/components/ScorecardsList/ScorecardsList.tsx"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React from 'react';\nimport { useApi } from '@backstage/core-plugin-api';\nimport List from '@material-ui/core/List';\nimport ListItem from '@material-ui/core/ListItem';\nimport ListItemText from '@material-ui/core/ListItemText';\nimport { makeStyles } from '@material-ui/core/styles';\nimport { techInsightsApiRef } from '../../api';\nimport { CheckResult } from '@backstage-community/plugin-tech-insights-common';\nimport Alert from '@material-ui/lab/Alert';\nimport { MarkdownContent } from '@backstage/core-components';\n\nconst useStyles = makeStyles(theme => ({\n listItemText: {\n paddingRight: theme.spacing(0.5),\n },\n}));\n\nexport const ScorecardsList = (props: { checkResults: CheckResult[] }) => {\n const { checkResults } = props;\n const classes = useStyles();\n const api = useApi(techInsightsApiRef);\n\n const types = [...new Set(checkResults.map(({ check }) => check.type))];\n const checkResultRenderers = api.getCheckResultRenderers(types);\n\n return (\n <List>\n {checkResults.map((result, index) => {\n const description = checkResultRenderers.find(\n renderer => renderer.type === result.check.type,\n )?.description;\n\n return (\n <ListItem key={result.check.id}>\n <ListItemText\n key={index}\n primary={result.check.name}\n secondary={\n description ? (\n description(result)\n ) : (\n <MarkdownContent content={result.check.description} />\n )\n }\n className={classes.listItemText}\n />\n {checkResultRenderers\n .find(({ type }) => type === result.check.type)\n ?.component(result) ?? (\n <Alert severity=\"error\">Unknown type.</Alert>\n )}\n </ListItem>\n );\n })}\n </List>\n );\n};\n"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ScorecardsList.esm.js","sources":["../../../src/components/ScorecardsList/ScorecardsList.tsx"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React from 'react';\nimport { useApi } from '@backstage/core-plugin-api';\nimport List from '@material-ui/core/List';\nimport ListItem from '@material-ui/core/ListItem';\nimport ListItemText from '@material-ui/core/ListItemText';\nimport { makeStyles } from '@material-ui/core/styles';\nimport { techInsightsApiRef } from '../../api';\nimport { CheckResult } from '@backstage-community/plugin-tech-insights-common';\nimport Alert from '@material-ui/lab/Alert';\nimport { MarkdownContent } from '@backstage/core-components';\n\nconst useStyles = makeStyles(theme => ({\n listItemText: {\n paddingRight: theme.spacing(0.5),\n },\n}));\n\nexport const ScorecardsList = (props: { checkResults: CheckResult[] }) => {\n const { checkResults } = props;\n const classes = useStyles();\n const api = useApi(techInsightsApiRef);\n\n const types = [...new Set(checkResults.map(({ check }) => check.type))];\n const checkResultRenderers = api.getCheckResultRenderers(types);\n\n return (\n <List>\n {checkResults.map((result, index) => {\n const description = checkResultRenderers.find(\n renderer => renderer.type === result.check.type,\n )?.description;\n\n return (\n <ListItem key={result.check.id}>\n <ListItemText\n key={index}\n primary={result.check.name}\n secondary={\n description ? (\n description(result)\n ) : (\n <MarkdownContent content={result.check.description} />\n )\n }\n className={classes.listItemText}\n />\n {checkResultRenderers\n .find(({ type }) => type === result.check.type)\n ?.component(result) ?? (\n <Alert severity=\"error\">Unknown type.</Alert>\n )}\n </ListItem>\n );\n })}\n </List>\n );\n};\n"],"names":[],"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EAAA,CAAA;AAAA,QAGxD,WAAW,OAAQ,CAAA,YAAA;AAAA,OAAA;AAAA,KACrB,EACC,qBACE,IAAK,CAAA,CAAC,EAAE,IAAK,EAAA,KAAM,SAAS,MAAO,CAAA,KAAA,CAAM,IAAI,CAC5C,EAAA,SAAA,CAAU,MAAM,CAClB,oBAAA,KAAA,CAAA,aAAA,CAAC,SAAM,QAAS,EAAA,OAAA,EAAA,EAAQ,eAAa,CAEzC,CAAA,CAAA;AAAA,GAEH,CACH,CAAA,CAAA;AAEJ;;;;"}
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { techInsightsApiRef } from '../../api/TechInsightsApi.esm.js';
|
|
3
|
-
import '@backstage/
|
|
4
|
-
import '@backstage/catalog-model';
|
|
3
|
+
import '@backstage-community/plugin-tech-insights-common/client';
|
|
5
4
|
import '@material-ui/icons/CheckCircleOutline';
|
|
6
5
|
import '@material-ui/icons/ErrorOutline';
|
|
7
|
-
import 'qs';
|
|
8
6
|
import Typography from '@material-ui/core/Typography';
|
|
9
7
|
import Autocomplete from '@material-ui/lab/Autocomplete';
|
|
10
8
|
import ExpandMoreIcon from '@material-ui/icons/ExpandMore';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Filters.esm.js","sources":["../../../src/components/ScorecardsPage/Filters.tsx"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React from 'react';\nimport { Check, techInsightsApiRef } from '../../api';\nimport Typography from '@material-ui/core/Typography';\nimport Autocomplete from '@material-ui/lab/Autocomplete';\nimport ExpandMoreIcon from '@material-ui/icons/ExpandMore';\nimport TextField from '@material-ui/core/TextField';\nimport Box from '@material-ui/core/Box';\nimport { makeStyles, withStyles } from '@material-ui/core/styles';\nimport FormControlLabel from '@material-ui/core/FormControlLabel';\nimport CheckBoxOutlineBlankIcon from '@material-ui/icons/CheckBoxOutlineBlank';\nimport CheckBoxIcon from '@material-ui/icons/CheckBox';\nimport Checkbox from '@material-ui/core/Checkbox';\nimport Tooltip from '@material-ui/core/Tooltip';\nimport { useApi } from '@backstage/core-plugin-api';\nimport useAsync from 'react-use/lib/useAsync';\nimport { ErrorPanel } from '@backstage/core-components';\n\nconst useStyles = makeStyles({\n fullWidth: { width: '100%' },\n boxLabel: {\n width: '100%',\n textOverflow: 'ellipsis',\n overflow: 'hidden',\n },\n});\n\nconst FixedWidthFormControlLabel = withStyles(_theme => ({\n label: {\n width: '100%',\n },\n root: {\n width: '90%',\n },\n}))(FormControlLabel);\n\nconst icon = <CheckBoxOutlineBlankIcon fontSize=\"small\" />;\nconst checkedIcon = <CheckBoxIcon fontSize=\"small\" />;\n\nfunction RenderOptionLabel(props: { check: Check; isSelected: boolean }) {\n const classes = useStyles();\n const { check, isSelected } = props;\n return (\n <Box className={classes.fullWidth}>\n <FixedWidthFormControlLabel\n className={classes.fullWidth}\n control={\n <Checkbox\n icon={icon}\n checkedIcon={checkedIcon}\n checked={isSelected}\n />\n }\n onClick={event => event.preventDefault()}\n label={\n <Tooltip title={check.id}>\n <Box display=\"flex\" alignItems=\"center\">\n <Box className={classes.boxLabel}>\n <Typography noWrap>{check.name}</Typography>\n </Box>\n </Box>\n </Tooltip>\n }\n />\n </Box>\n );\n}\n\nconst withResultsOptions = [\n { label: 'Yes', value: true },\n { label: 'No', value: false },\n];\n\n/** public **/\nexport type FiltersProps = {\n checksChanged: (checks: Check[]) => void;\n withResultsChanged: (withResults: boolean) => void;\n};\n\nexport const Filters = (props: FiltersProps) => {\n const { checksChanged, withResultsChanged } = props;\n const api = useApi(techInsightsApiRef);\n\n const { value, loading, error } = useAsync(async () => {\n return api.getAllChecks();\n }, [api]);\n\n if (error) {\n return <ErrorPanel error={error} />;\n }\n\n return (\n <>\n <Box pb={1} pt={1}>\n <Typography variant=\"button\" component=\"label\">\n Checks\n <Autocomplete\n multiple\n disableCloseOnSelect\n options={value ?? []}\n loading={loading}\n getOptionLabel={o => o.name}\n onChange={(_: object, changedChecks) => {\n checksChanged(changedChecks);\n }}\n filterOptions={x => x}\n renderOption={(check, { selected }) => {\n return <RenderOptionLabel check={check} isSelected={selected} />;\n }}\n size=\"small\"\n popupIcon={<ExpandMoreIcon />}\n renderInput={params => <TextField {...params} variant=\"outlined\" />}\n />\n </Typography>\n </Box>\n <Box pb={1} pt={1}>\n <Typography variant=\"button\" component=\"label\">\n Only with results\n <Autocomplete\n defaultValue={withResultsOptions[0]}\n options={withResultsOptions}\n getOptionLabel={o => o.label}\n onChange={(_: object, selectedItem) => {\n if (selectedItem) {\n withResultsChanged(selectedItem.value);\n }\n }}\n disableClearable\n size=\"small\"\n popupIcon={<ExpandMoreIcon />}\n renderInput={params => <TextField {...params} variant=\"outlined\" />}\n />\n </Typography>\n </Box>\n </>\n );\n};\n"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Filters.esm.js","sources":["../../../src/components/ScorecardsPage/Filters.tsx"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React from 'react';\nimport { Check, techInsightsApiRef } from '../../api';\nimport Typography from '@material-ui/core/Typography';\nimport Autocomplete from '@material-ui/lab/Autocomplete';\nimport ExpandMoreIcon from '@material-ui/icons/ExpandMore';\nimport TextField from '@material-ui/core/TextField';\nimport Box from '@material-ui/core/Box';\nimport { makeStyles, withStyles } from '@material-ui/core/styles';\nimport FormControlLabel from '@material-ui/core/FormControlLabel';\nimport CheckBoxOutlineBlankIcon from '@material-ui/icons/CheckBoxOutlineBlank';\nimport CheckBoxIcon from '@material-ui/icons/CheckBox';\nimport Checkbox from '@material-ui/core/Checkbox';\nimport Tooltip from '@material-ui/core/Tooltip';\nimport { useApi } from '@backstage/core-plugin-api';\nimport useAsync from 'react-use/lib/useAsync';\nimport { ErrorPanel } from '@backstage/core-components';\n\nconst useStyles = makeStyles({\n fullWidth: { width: '100%' },\n boxLabel: {\n width: '100%',\n textOverflow: 'ellipsis',\n overflow: 'hidden',\n },\n});\n\nconst FixedWidthFormControlLabel = withStyles(_theme => ({\n label: {\n width: '100%',\n },\n root: {\n width: '90%',\n },\n}))(FormControlLabel);\n\nconst icon = <CheckBoxOutlineBlankIcon fontSize=\"small\" />;\nconst checkedIcon = <CheckBoxIcon fontSize=\"small\" />;\n\nfunction RenderOptionLabel(props: { check: Check; isSelected: boolean }) {\n const classes = useStyles();\n const { check, isSelected } = props;\n return (\n <Box className={classes.fullWidth}>\n <FixedWidthFormControlLabel\n className={classes.fullWidth}\n control={\n <Checkbox\n icon={icon}\n checkedIcon={checkedIcon}\n checked={isSelected}\n />\n }\n onClick={event => event.preventDefault()}\n label={\n <Tooltip title={check.id}>\n <Box display=\"flex\" alignItems=\"center\">\n <Box className={classes.boxLabel}>\n <Typography noWrap>{check.name}</Typography>\n </Box>\n </Box>\n </Tooltip>\n }\n />\n </Box>\n );\n}\n\nconst withResultsOptions = [\n { label: 'Yes', value: true },\n { label: 'No', value: false },\n];\n\n/** public **/\nexport type FiltersProps = {\n checksChanged: (checks: Check[]) => void;\n withResultsChanged: (withResults: boolean) => void;\n};\n\nexport const Filters = (props: FiltersProps) => {\n const { checksChanged, withResultsChanged } = props;\n const api = useApi(techInsightsApiRef);\n\n const { value, loading, error } = useAsync(async () => {\n return api.getAllChecks();\n }, [api]);\n\n if (error) {\n return <ErrorPanel error={error} />;\n }\n\n return (\n <>\n <Box pb={1} pt={1}>\n <Typography variant=\"button\" component=\"label\">\n Checks\n <Autocomplete\n multiple\n disableCloseOnSelect\n options={value ?? []}\n loading={loading}\n getOptionLabel={o => o.name}\n onChange={(_: object, changedChecks) => {\n checksChanged(changedChecks);\n }}\n filterOptions={x => x}\n renderOption={(check, { selected }) => {\n return <RenderOptionLabel check={check} isSelected={selected} />;\n }}\n size=\"small\"\n popupIcon={<ExpandMoreIcon />}\n renderInput={params => <TextField {...params} variant=\"outlined\" />}\n />\n </Typography>\n </Box>\n <Box pb={1} pt={1}>\n <Typography variant=\"button\" component=\"label\">\n Only with results\n <Autocomplete\n defaultValue={withResultsOptions[0]}\n options={withResultsOptions}\n getOptionLabel={o => o.label}\n onChange={(_: object, selectedItem) => {\n if (selectedItem) {\n withResultsChanged(selectedItem.value);\n }\n }}\n disableClearable\n size=\"small\"\n popupIcon={<ExpandMoreIcon />}\n renderInput={params => <TextField {...params} variant=\"outlined\" />}\n />\n </Typography>\n </Box>\n </>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AAiCA,MAAM,YAAY,UAAW,CAAA;AAAA,EAC3B,SAAA,EAAW,EAAE,KAAA,EAAO,MAAO,EAAA;AAAA,EAC3B,QAAU,EAAA;AAAA,IACR,KAAO,EAAA,MAAA;AAAA,IACP,YAAc,EAAA,UAAA;AAAA,IACd,QAAU,EAAA,QAAA;AAAA,GACZ;AACF,CAAC,CAAA,CAAA;AAED,MAAM,0BAAA,GAA6B,WAAW,CAAW,MAAA,MAAA;AAAA,EACvD,KAAO,EAAA;AAAA,IACL,KAAO,EAAA,MAAA;AAAA,GACT;AAAA,EACA,IAAM,EAAA;AAAA,IACJ,KAAO,EAAA,KAAA;AAAA,GACT;AACF,CAAA,CAAE,EAAE,gBAAgB,CAAA,CAAA;AAEpB,M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
|
|
|
2
2
|
import { ErrorPanel, Page, Header, HeaderLabel, Content, Table } from '@backstage/core-components';
|
|
3
3
|
import { useApi } from '@backstage/core-plugin-api';
|
|
4
4
|
import { techInsightsApiRef } from '../../api/TechInsightsApi.esm.js';
|
|
5
|
-
import '@backstage/
|
|
6
|
-
import '@backstage/catalog-model';
|
|
5
|
+
import '@backstage-community/plugin-tech-insights-common/client';
|
|
7
6
|
import '@material-ui/icons/CheckCircleOutline';
|
|
8
7
|
import '@material-ui/icons/ErrorOutline';
|
|
9
|
-
import 'qs';
|
|
10
8
|
import useAsync from 'react-use/lib/useAsync';
|
|
11
9
|
import { EntityRefLink } from '@backstage/plugin-catalog-react';
|
|
12
10
|
import { ScorecardsList } from '../ScorecardsList/ScorecardsList.esm.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ScorecardsPage.esm.js","sources":["../../../src/components/ScorecardsPage/ScorecardsPage.tsx"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React, { useMemo, useState } from 'react';\nimport {\n Content,\n ErrorPanel,\n Header,\n HeaderLabel,\n Page,\n TableColumn,\n Table,\n TableOptions,\n} from '@backstage/core-components';\nimport { useApi } from '@backstage/core-plugin-api';\nimport { Check, techInsightsApiRef } from '../../api';\nimport useAsync from 'react-use/lib/useAsync';\nimport { BulkCheckResponse } from '@backstage-community/plugin-tech-insights-common';\nimport { EntityRefLink } from '@backstage/plugin-catalog-react';\nimport { ScorecardsList } from '../ScorecardsList';\nimport Grid from '@material-ui/core/Grid';\nimport { Filters } from './Filters';\nimport { ExportCsv as exportCsv } from '@material-table/exporters';\n\nexport const ScorecardsPage = () => {\n const api = useApi(techInsightsApiRef);\n const [filterSelectedChecks, setFilterSelectedChecks] = useState<Check[]>([]);\n const [filterWithResults, setFilterWithResults] = useState<boolean>(true);\n const tableOptions: TableOptions = {\n exportAllData: true,\n exportMenu: [\n {\n label: 'Export CSV',\n exportFunc: (cols, datas) => exportCsv(cols, datas, 'tech-insights'),\n },\n ],\n };\n\n const { value, loading, error } = useAsync(async () => {\n const checks = await api.getAllChecks();\n const result = await api.runBulkChecks([], filterSelectedChecks);\n\n return {\n checks,\n result: filterWithResults\n ? result.filter(response => response.results.length > 0)\n : result,\n };\n }, [api, filterSelectedChecks, filterWithResults]);\n\n const tableColumns = useMemo(() => {\n const columns: TableColumn<BulkCheckResponse[0]>[] = [\n {\n field: 'entity',\n title: 'Entity',\n render: row => <EntityRefLink entityRef={row.entity} />,\n },\n {\n field: 'results',\n title: 'Results',\n render: row => <ScorecardsList checkResults={row.results} />,\n export: false,\n },\n ];\n\n (filterSelectedChecks.length === 0\n ? value?.checks || []\n : filterSelectedChecks\n ).forEach(check => {\n columns.push({\n field: check.id,\n title: check.name,\n customExport: row =>\n `${\n row.results.filter(\n result => result && result.check && result.check.id === check.id,\n )[0]?.result\n }`,\n hidden: true,\n export: true,\n });\n });\n\n return columns;\n }, [value, filterSelectedChecks]);\n\n if (error) {\n return <ErrorPanel error={error} />;\n }\n\n return (\n <Page themeId=\"tool\">\n <Header title=\"Tech insights\">\n <HeaderLabel label=\"Entities\" value={value?.result.length ?? 0} />\n <HeaderLabel label=\"Checks\" value={value?.checks.length ?? 0} />\n </Header>\n <Content>\n <Grid container>\n <Grid item style={{ width: '300px' }}>\n <Filters\n checksChanged={checks => setFilterSelectedChecks(checks)}\n withResultsChanged={withResults =>\n setFilterWithResults(withResults)\n }\n />\n </Grid>\n <Grid item xs>\n <Table\n columns={tableColumns}\n data={value?.result ?? []}\n isLoading={loading}\n options={tableOptions}\n />\n </Grid>\n </Grid>\n </Content>\n </Page>\n );\n};\n"],"names":["exportCsv"],"mappings":"
|
|
1
|
+
{"version":3,"file":"ScorecardsPage.esm.js","sources":["../../../src/components/ScorecardsPage/ScorecardsPage.tsx"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React, { useMemo, useState } from 'react';\nimport {\n Content,\n ErrorPanel,\n Header,\n HeaderLabel,\n Page,\n TableColumn,\n Table,\n TableOptions,\n} from '@backstage/core-components';\nimport { useApi } from '@backstage/core-plugin-api';\nimport { Check, techInsightsApiRef } from '../../api';\nimport useAsync from 'react-use/lib/useAsync';\nimport { BulkCheckResponse } from '@backstage-community/plugin-tech-insights-common';\nimport { EntityRefLink } from '@backstage/plugin-catalog-react';\nimport { ScorecardsList } from '../ScorecardsList';\nimport Grid from '@material-ui/core/Grid';\nimport { Filters } from './Filters';\nimport { ExportCsv as exportCsv } from '@material-table/exporters';\n\nexport const ScorecardsPage = () => {\n const api = useApi(techInsightsApiRef);\n const [filterSelectedChecks, setFilterSelectedChecks] = useState<Check[]>([]);\n const [filterWithResults, setFilterWithResults] = useState<boolean>(true);\n const tableOptions: TableOptions = {\n exportAllData: true,\n exportMenu: [\n {\n label: 'Export CSV',\n exportFunc: (cols, datas) => exportCsv(cols, datas, 'tech-insights'),\n },\n ],\n };\n\n const { value, loading, error } = useAsync(async () => {\n const checks = await api.getAllChecks();\n const result = await api.runBulkChecks([], filterSelectedChecks);\n\n return {\n checks,\n result: filterWithResults\n ? result.filter(response => response.results.length > 0)\n : result,\n };\n }, [api, filterSelectedChecks, filterWithResults]);\n\n const tableColumns = useMemo(() => {\n const columns: TableColumn<BulkCheckResponse[0]>[] = [\n {\n field: 'entity',\n title: 'Entity',\n render: row => <EntityRefLink entityRef={row.entity} />,\n },\n {\n field: 'results',\n title: 'Results',\n render: row => <ScorecardsList checkResults={row.results} />,\n export: false,\n },\n ];\n\n (filterSelectedChecks.length === 0\n ? value?.checks || []\n : filterSelectedChecks\n ).forEach(check => {\n columns.push({\n field: check.id,\n title: check.name,\n customExport: row =>\n `${\n row.results.filter(\n result => result && result.check && result.check.id === check.id,\n )[0]?.result\n }`,\n hidden: true,\n export: true,\n });\n });\n\n return columns;\n }, [value, filterSelectedChecks]);\n\n if (error) {\n return <ErrorPanel error={error} />;\n }\n\n return (\n <Page themeId=\"tool\">\n <Header title=\"Tech insights\">\n <HeaderLabel label=\"Entities\" value={value?.result.length ?? 0} />\n <HeaderLabel label=\"Checks\" value={value?.checks.length ?? 0} />\n </Header>\n <Content>\n <Grid container>\n <Grid item style={{ width: '300px' }}>\n <Filters\n checksChanged={checks => setFilterSelectedChecks(checks)}\n withResultsChanged={withResults =>\n setFilterWithResults(withResults)\n }\n />\n </Grid>\n <Grid item xs>\n <Table\n columns={tableColumns}\n data={value?.result ?? []}\n isLoading={loading}\n options={tableOptions}\n />\n </Grid>\n </Grid>\n </Content>\n </Page>\n );\n};\n"],"names":["exportCsv"],"mappings":";;;;;;;;;;;;;;AAqCO,MAAM,iBAAiB,MAAM;AAClC,EAAM,MAAA,GAAA,GAAM,OAAO,kBAAkB,CAAA,CAAA;AACrC,EAAA,MAAM,CAAC,oBAAsB,EAAA,uBAAuB,CAAI,GAAA,QAAA,CAAkB,EAAE,CAAA,CAAA;AAC5E,EAAA,MAAM,CAAC,iBAAA,EAAmB,oBAAoB,CAAA,GAAI,SAAkB,IAAI,CAAA,CAAA;AACxE,EAAA,MAAM,YAA6B,GAAA;AAAA,IACjC,aAAe,EAAA,IAAA;AAAA,IACf,UAAY,EAAA;AAAA,MACV;AAAA,QACE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A,aAAA;AAAA,IAAC,OAAA;AAAA,IAAA;AAAA,MACC,aAAA,EAAe,CAAU,MAAA,KAAA,uBAAA,CAAwB,MAAM,CAAA;AAAA,MACvD,kBAAA,EAAoB,CAClB,WAAA,KAAA,oBAAA,CAAqB,WAAW,CAAA;AAAA,KAAA;AAAA,GAGtC,CACA,kBAAA,KAAA,CAAA,aAAA,CAAC,QAAK,IAAI,EAAA,IAAA,EAAC,IAAE,IACX,EAAA,kBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,KAAA;AAAA,IAAA;AAAA,MACC,OAAS,EAAA,YAAA;AAAA,MACT,IAAA,EAAM,KAAO,EAAA,MAAA,IAAU,EAAC;AAAA,MACxB,SAAW,EAAA,OAAA;AAAA,MACX,OAAS,EAAA,YAAA;AAAA,KAAA;AAAA,GAEb,CACF,CACF,CACF,CAAA,CAAA;AAEJ;;;;"}
|
package/dist/index.d.ts
CHANGED
|
@@ -6,6 +6,7 @@ import { CheckResult, BulkCheckResponse, FactSchema } from '@backstage-community
|
|
|
6
6
|
import * as _backstage_core_plugin_api from '@backstage/core-plugin-api';
|
|
7
7
|
import { DiscoveryApi, IdentityApi } from '@backstage/core-plugin-api';
|
|
8
8
|
import { JsonValue } from '@backstage/types';
|
|
9
|
+
import { Check as Check$1, TechInsightsClient as TechInsightsClient$1 } from '@backstage-community/plugin-tech-insights-common/client';
|
|
9
10
|
import { CompoundEntityRef } from '@backstage/catalog-model';
|
|
10
11
|
|
|
11
12
|
/**
|
|
@@ -57,49 +58,14 @@ declare const TechInsightsScorecardPage: () => react.JSX.Element;
|
|
|
57
58
|
* Represents a single check defined on the TechInsights backend.
|
|
58
59
|
*
|
|
59
60
|
* @public
|
|
61
|
+
* @deprecated Import from \@backstage-community/plugin-tech-insights-common/client
|
|
60
62
|
*/
|
|
61
|
-
type Check =
|
|
62
|
-
/**
|
|
63
|
-
* Unique identifier of the check
|
|
64
|
-
*
|
|
65
|
-
* Used to identify which checks to use when running checks.
|
|
66
|
-
*/
|
|
67
|
-
id: string;
|
|
68
|
-
/**
|
|
69
|
-
* Type identifier for the check.
|
|
70
|
-
* Can be used to determine storage options, logical routing to correct FactChecker implementation
|
|
71
|
-
* or to help frontend render correct component types based on this
|
|
72
|
-
*/
|
|
73
|
-
type: string;
|
|
74
|
-
/**
|
|
75
|
-
* Human readable name of the check, may be displayed in the UI
|
|
76
|
-
*/
|
|
77
|
-
name: string;
|
|
78
|
-
/**
|
|
79
|
-
* Human readable description of the check, may be displayed in the UI
|
|
80
|
-
*/
|
|
81
|
-
description: string;
|
|
82
|
-
/**
|
|
83
|
-
* A collection of string referencing fact rows that a check will be run against.
|
|
84
|
-
*
|
|
85
|
-
* References the fact container, aka fact retriever itself which may or may not contain multiple individual facts and values
|
|
86
|
-
*/
|
|
87
|
-
factIds: string[];
|
|
88
|
-
/**
|
|
89
|
-
* Metadata to be returned in case a check has been successfully evaluated
|
|
90
|
-
* Can contain links, description texts or other actionable items
|
|
91
|
-
*/
|
|
92
|
-
successMetadata?: Record<string, unknown>;
|
|
93
|
-
/**
|
|
94
|
-
* Metadata to be returned in case a check evaluation has ended in failure
|
|
95
|
-
* Can contain links, description texts or other actionable items
|
|
96
|
-
*/
|
|
97
|
-
failureMetadata?: Record<string, unknown>;
|
|
98
|
-
};
|
|
63
|
+
type Check = Check$1;
|
|
99
64
|
/**
|
|
100
65
|
* Represents a Fact defined on the TechInsights backend.
|
|
101
66
|
*
|
|
102
67
|
* @public
|
|
68
|
+
* @deprecated Import from \@backstage-community/plugin-tech-insights-common/client
|
|
103
69
|
*/
|
|
104
70
|
interface InsightFacts {
|
|
105
71
|
[factId: string]: {
|
|
@@ -149,23 +115,15 @@ interface TechInsightsApi {
|
|
|
149
115
|
}
|
|
150
116
|
|
|
151
117
|
/** @public */
|
|
152
|
-
declare class TechInsightsClient implements TechInsightsApi {
|
|
153
|
-
private readonly discoveryApi;
|
|
154
|
-
private readonly identityApi;
|
|
118
|
+
declare class TechInsightsClient extends TechInsightsClient$1 implements TechInsightsApi {
|
|
155
119
|
private readonly renderers?;
|
|
156
120
|
constructor(options: {
|
|
157
121
|
discoveryApi: DiscoveryApi;
|
|
158
122
|
identityApi: IdentityApi;
|
|
159
123
|
renderers?: CheckResultRenderer[];
|
|
160
124
|
});
|
|
161
|
-
getFacts(entity: CompoundEntityRef, facts: string[]): Promise<InsightFacts>;
|
|
162
125
|
getCheckResultRenderers(types: string[]): CheckResultRenderer[];
|
|
163
126
|
isCheckResultFailed(check: CheckResult): boolean;
|
|
164
|
-
getAllChecks(): Promise<Check[]>;
|
|
165
|
-
getFactSchemas(): Promise<FactSchema[]>;
|
|
166
|
-
runChecks(entityParams: CompoundEntityRef, checks?: string[]): Promise<CheckResult[]>;
|
|
167
|
-
runBulkChecks(entities: CompoundEntityRef[], checks?: Check[]): Promise<BulkCheckResponse>;
|
|
168
|
-
private api;
|
|
169
127
|
}
|
|
170
128
|
|
|
171
129
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@backstage-community/plugin-tech-insights",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.34",
|
|
4
4
|
"backstage": {
|
|
5
5
|
"role": "frontend-plugin",
|
|
6
6
|
"pluginId": "tech-insights",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"test": "backstage-cli package test"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@backstage-community/plugin-tech-insights-common": "^0.2.
|
|
42
|
+
"@backstage-community/plugin-tech-insights-common": "^0.2.17",
|
|
43
43
|
"@backstage/catalog-model": "^1.6.0",
|
|
44
44
|
"@backstage/core-components": "^0.14.10",
|
|
45
45
|
"@backstage/core-plugin-api": "^1.9.3",
|
|
@@ -51,7 +51,6 @@
|
|
|
51
51
|
"@material-ui/icons": "^4.9.1",
|
|
52
52
|
"@material-ui/lab": "4.0.0-alpha.61",
|
|
53
53
|
"@types/react": "^16.13.1 || ^17.0.0 || ^18.0.0",
|
|
54
|
-
"qs": "^6.9.4",
|
|
55
54
|
"react-use": "^17.2.4"
|
|
56
55
|
},
|
|
57
56
|
"devDependencies": {
|