@backstage-community/plugin-tech-insights 0.3.27 → 0.3.28
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 +6 -0
- package/README.md +33 -0
- package/dist/esm/ScorecardInfo-DRy_gP7g.esm.js.map +1 -1
- package/dist/esm/index-Dprfu-4U.esm.js +139 -0
- package/dist/esm/index-Dprfu-4U.esm.js.map +1 -0
- package/dist/index.d.ts +6 -2
- package/dist/index.esm.js +8 -1
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -150,3 +150,36 @@ export const myCustomBooleanRenderer: CheckResultRenderer = {
|
|
|
150
150
|
),
|
|
151
151
|
};
|
|
152
152
|
```
|
|
153
|
+
|
|
154
|
+
### Add overview (Scorecards) page:
|
|
155
|
+
|
|
156
|
+

|
|
157
|
+
|
|
158
|
+
First make the Scorecard page available as route
|
|
159
|
+
|
|
160
|
+
```tsx
|
|
161
|
+
// packages/app/src/App.tsx
|
|
162
|
+
|
|
163
|
+
import { TechInsightsScorecardPage } from '@backstage/plugin-tech-insights';
|
|
164
|
+
|
|
165
|
+
const routes = (
|
|
166
|
+
<FlatRoutes>
|
|
167
|
+
...
|
|
168
|
+
<Route path="/tech-insights" element={<TechInsightsScorecardPage />} />
|
|
169
|
+
</FlatRoutes>
|
|
170
|
+
);
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
Then add it to the navigation menu
|
|
174
|
+
|
|
175
|
+
```tsx
|
|
176
|
+
// packages/app/src/components/Root/Root.tsx
|
|
177
|
+
|
|
178
|
+
import EmojiObjectsIcon from '@material-ui/icons/EmojiObjects';
|
|
179
|
+
|
|
180
|
+
export const Root = ({ children }: PropsWithChildren<{}>) => (
|
|
181
|
+
...
|
|
182
|
+
<SidebarItem icon={EmojiObjectsIcon} to="tech-insights" text="Tech insight" />
|
|
183
|
+
...
|
|
184
|
+
);
|
|
185
|
+
```
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ScorecardInfo-DRy_gP7g.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 from 'react';\nimport Grid from '@material-ui/core/Grid';\nimport Typography from '@material-ui/core/Typography';\nimport { makeStyles } from '@material-ui/core/styles';\nimport { InfoCard } from '@backstage/core-components';\nimport { CheckResult } from '@backstage-community/plugin-tech-insights-common';\nimport Alert from '@material-ui/lab/Alert';\nimport { ScorecardsList } from '../ScorecardsList';\n\nconst useStyles = makeStyles(theme => ({\n subheader: {\n fontWeight: 'bold',\n paddingLeft: theme.spacing(0.5),\n },\n}));\n\nconst infoCard = (\n title:
|
|
1
|
+
{"version":3,"file":"ScorecardInfo-DRy_gP7g.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 { InfoCard } from '@backstage/core-components';\nimport { CheckResult } from '@backstage-community/plugin-tech-insights-common';\nimport Alert from '@material-ui/lab/Alert';\nimport { ScorecardsList } from '../ScorecardsList';\n\nconst useStyles = makeStyles(theme => ({\n subheader: {\n fontWeight: 'bold',\n paddingLeft: theme.spacing(0.5),\n },\n}));\n\nconst infoCard = (\n title: ReactNode,\n description: string | undefined,\n className: string,\n element: JSX.Element,\n) => (\n <Grid item xs={12}>\n <InfoCard title={title}>\n {description && (\n <Typography className={className} variant=\"body1\" gutterBottom>\n {description}\n </Typography>\n )}\n <Grid item xs={12}>\n {element}\n </Grid>\n </InfoCard>\n </Grid>\n);\n\nexport const ScorecardInfo = (props: {\n checkResults: CheckResult[];\n title: ReactNode;\n description?: string;\n noWarning?: boolean;\n}) => {\n const { checkResults, title, description, noWarning } = props;\n const classes = useStyles();\n\n if (!checkResults.length) {\n if (noWarning) {\n return infoCard(\n title,\n description,\n classes.subheader,\n <Alert severity=\"info\">\n All checks passed, or no checks have been performed yet\n </Alert>,\n );\n }\n return infoCard(\n title,\n description,\n classes.subheader,\n <Alert severity=\"warning\">No checks have any data yet.</Alert>,\n );\n }\n\n return infoCard(\n title,\n description,\n classes.subheader,\n <ScorecardsList checkResults={checkResults} />,\n );\n};\n"],"names":[],"mappings":";;;;;;;;AAyBA,MAAM,SAAA,GAAY,WAAW,CAAU,KAAA,MAAA;AAAA,EACrC,SAAW,EAAA;AAAA,IACT,UAAY,EAAA,MAAA;AAAA,IACZ,WAAA,EAAa,KAAM,CAAA,OAAA,CAAQ,GAAG,CAAA;AAAA,GAChC;AACF,CAAE,CAAA,CAAA,CAAA;AAEF,MAAM,QAAW,GAAA,CACf,KACA,EAAA,WAAA,EACA,WACA,OAEA,qBAAA,KAAA,CAAA,aAAA,CAAC,IAAK,EAAA,EAAA,IAAA,EAAI,IAAC,EAAA,EAAA,EAAI,EACb,EAAA,kBAAA,KAAA,CAAA,aAAA,CAAC,YAAS,KACP,EAAA,EAAA,WAAA,oBACE,KAAA,CAAA,aAAA,CAAA,UAAA,EAAA,EAAW,SAAsB,EAAA,OAAA,EAAQ,OAAQ,EAAA,YAAA,EAAY,QAC3D,WACH,CAAA,kBAED,KAAA,CAAA,aAAA,CAAA,IAAA,EAAA,EAAK,MAAI,IAAC,EAAA,EAAA,EAAI,EACZ,EAAA,EAAA,OACH,CACF,CACF,CAAA,CAAA;AAGW,MAAA,aAAA,GAAgB,CAAC,KAKxB,KAAA;AACJ,EAAA,MAAM,EAAE,YAAA,EAAc,KAAO,EAAA,WAAA,EAAa,WAAc,GAAA,KAAA,CAAA;AACxD,EAAA,MAAM,UAAU,SAAU,EAAA,CAAA;AAE1B,EAAI,IAAA,CAAC,aAAa,MAAQ,EAAA;AACxB,IAAA,IAAI,SAAW,EAAA;AACb,MAAO,OAAA,QAAA;AAAA,QACL,KAAA;AAAA,QACA,WAAA;AAAA,QACA,OAAQ,CAAA,SAAA;AAAA,wBACP,KAAA,CAAA,aAAA,CAAA,KAAA,EAAA,EAAM,QAAS,EAAA,MAAA,EAAA,EAAO,yDAEvB,CAAA;AAAA,OACF,CAAA;AAAA,KACF;AACA,IAAO,OAAA,QAAA;AAAA,MACL,KAAA;AAAA,MACA,WAAA;AAAA,MACA,OAAQ,CAAA,SAAA;AAAA,sBACP,KAAA,CAAA,aAAA,CAAA,KAAA,EAAA,EAAM,QAAS,EAAA,SAAA,EAAA,EAAU,8BAA4B,CAAA;AAAA,KACxD,CAAA;AAAA,GACF;AAEA,EAAO,OAAA,QAAA;AAAA,IACL,KAAA;AAAA,IACA,WAAA;AAAA,IACA,OAAQ,CAAA,SAAA;AAAA,oBACR,KAAA,CAAA,aAAA,CAAC,kBAAe,YAA4B,EAAA,CAAA;AAAA,GAC9C,CAAA;AACF;;;;"}
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import { ErrorPanel, Page, Header, HeaderLabel, Content, Table } from '@backstage/core-components';
|
|
3
|
+
import { useApi } from '@backstage/core-plugin-api';
|
|
4
|
+
import { techInsightsApiRef } from '../index.esm.js';
|
|
5
|
+
import '@backstage/errors';
|
|
6
|
+
import '@backstage/catalog-model';
|
|
7
|
+
import '@material-ui/icons/CheckCircleOutline';
|
|
8
|
+
import '@material-ui/icons/ErrorOutline';
|
|
9
|
+
import 'qs';
|
|
10
|
+
import useAsync from 'react-use/lib/useAsync';
|
|
11
|
+
import { EntityRefLink } from '@backstage/plugin-catalog-react';
|
|
12
|
+
import { S as ScorecardsList } from './ScorecardsList-mU3LQTf9.esm.js';
|
|
13
|
+
import Grid from '@material-ui/core/Grid';
|
|
14
|
+
import Typography from '@material-ui/core/Typography';
|
|
15
|
+
import Autocomplete from '@material-ui/lab/Autocomplete';
|
|
16
|
+
import ExpandMoreIcon from '@material-ui/icons/ExpandMore';
|
|
17
|
+
import TextField from '@material-ui/core/TextField';
|
|
18
|
+
import Box from '@material-ui/core/Box';
|
|
19
|
+
import { makeStyles, withStyles } from '@material-ui/core/styles';
|
|
20
|
+
import FormControlLabel from '@material-ui/core/FormControlLabel';
|
|
21
|
+
import CheckBoxOutlineBlankIcon from '@material-ui/icons/CheckBoxOutlineBlank';
|
|
22
|
+
import CheckBoxIcon from '@material-ui/icons/CheckBox';
|
|
23
|
+
import Checkbox from '@material-ui/core/Checkbox';
|
|
24
|
+
import Tooltip from '@material-ui/core/Tooltip';
|
|
25
|
+
import '@material-ui/core/List';
|
|
26
|
+
import '@material-ui/core/ListItem';
|
|
27
|
+
import '@material-ui/core/ListItemText';
|
|
28
|
+
import '@material-ui/lab/Alert';
|
|
29
|
+
|
|
30
|
+
const useStyles = makeStyles({
|
|
31
|
+
fullWidth: { width: "100%" },
|
|
32
|
+
boxLabel: {
|
|
33
|
+
width: "100%",
|
|
34
|
+
textOverflow: "ellipsis",
|
|
35
|
+
overflow: "hidden"
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
const FixedWidthFormControlLabel = withStyles((_theme) => ({
|
|
39
|
+
label: {
|
|
40
|
+
width: "100%"
|
|
41
|
+
},
|
|
42
|
+
root: {
|
|
43
|
+
width: "90%"
|
|
44
|
+
}
|
|
45
|
+
}))(FormControlLabel);
|
|
46
|
+
const icon = /* @__PURE__ */ React.createElement(CheckBoxOutlineBlankIcon, { fontSize: "small" });
|
|
47
|
+
const checkedIcon = /* @__PURE__ */ React.createElement(CheckBoxIcon, { fontSize: "small" });
|
|
48
|
+
function RenderOptionLabel(props) {
|
|
49
|
+
const classes = useStyles();
|
|
50
|
+
const { check, isSelected } = props;
|
|
51
|
+
return /* @__PURE__ */ React.createElement(Box, { className: classes.fullWidth }, /* @__PURE__ */ React.createElement(
|
|
52
|
+
FixedWidthFormControlLabel,
|
|
53
|
+
{
|
|
54
|
+
className: classes.fullWidth,
|
|
55
|
+
control: /* @__PURE__ */ React.createElement(
|
|
56
|
+
Checkbox,
|
|
57
|
+
{
|
|
58
|
+
icon,
|
|
59
|
+
checkedIcon,
|
|
60
|
+
checked: isSelected
|
|
61
|
+
}
|
|
62
|
+
),
|
|
63
|
+
onClick: (event) => event.preventDefault(),
|
|
64
|
+
label: /* @__PURE__ */ React.createElement(Tooltip, { title: check.id }, /* @__PURE__ */ React.createElement(Box, { display: "flex", alignItems: "center" }, /* @__PURE__ */ React.createElement(Box, { className: classes.boxLabel }, /* @__PURE__ */ React.createElement(Typography, { noWrap: true }, check.name))))
|
|
65
|
+
}
|
|
66
|
+
));
|
|
67
|
+
}
|
|
68
|
+
const Filters = (props) => {
|
|
69
|
+
const { checksChanged } = props;
|
|
70
|
+
const api = useApi(techInsightsApiRef);
|
|
71
|
+
const { value, loading, error } = useAsync(async () => {
|
|
72
|
+
return api.getAllChecks();
|
|
73
|
+
}, [api]);
|
|
74
|
+
if (error) {
|
|
75
|
+
return /* @__PURE__ */ React.createElement(ErrorPanel, { error });
|
|
76
|
+
}
|
|
77
|
+
return /* @__PURE__ */ React.createElement(Box, { pb: 1, pt: 1 }, /* @__PURE__ */ React.createElement(Typography, { variant: "button", component: "label" }, "Checks", /* @__PURE__ */ React.createElement(
|
|
78
|
+
Autocomplete,
|
|
79
|
+
{
|
|
80
|
+
multiple: true,
|
|
81
|
+
disableCloseOnSelect: true,
|
|
82
|
+
options: value != null ? value : [],
|
|
83
|
+
loading,
|
|
84
|
+
getOptionLabel: (o) => o.name,
|
|
85
|
+
onChange: (_, changedChecks) => {
|
|
86
|
+
checksChanged(changedChecks);
|
|
87
|
+
},
|
|
88
|
+
filterOptions: (x) => x,
|
|
89
|
+
renderOption: (check, { selected }) => {
|
|
90
|
+
return /* @__PURE__ */ React.createElement(RenderOptionLabel, { check, isSelected: selected });
|
|
91
|
+
},
|
|
92
|
+
size: "small",
|
|
93
|
+
popupIcon: /* @__PURE__ */ React.createElement(ExpandMoreIcon, null),
|
|
94
|
+
renderInput: (params) => /* @__PURE__ */ React.createElement(TextField, { ...params, variant: "outlined" })
|
|
95
|
+
}
|
|
96
|
+
)));
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
const tableColumns = [
|
|
100
|
+
{
|
|
101
|
+
field: "entity",
|
|
102
|
+
title: "Entity",
|
|
103
|
+
render: (row) => /* @__PURE__ */ React.createElement(EntityRefLink, { entityRef: row.entity })
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
field: "results",
|
|
107
|
+
title: "Results",
|
|
108
|
+
render: (row) => /* @__PURE__ */ React.createElement(ScorecardsList, { checkResults: row.results })
|
|
109
|
+
}
|
|
110
|
+
];
|
|
111
|
+
const ScorecardsPage = () => {
|
|
112
|
+
var _a, _b, _c;
|
|
113
|
+
const api = useApi(techInsightsApiRef);
|
|
114
|
+
const [filterSelectedChecks, setFilterSelectedChecks] = useState([]);
|
|
115
|
+
const { value, loading, error } = useAsync(async () => {
|
|
116
|
+
const checks = await api.getAllChecks();
|
|
117
|
+
const result = await api.runBulkChecks([], filterSelectedChecks);
|
|
118
|
+
return { checks, result };
|
|
119
|
+
}, [api, filterSelectedChecks]);
|
|
120
|
+
if (error) {
|
|
121
|
+
return /* @__PURE__ */ React.createElement(ErrorPanel, { error });
|
|
122
|
+
}
|
|
123
|
+
return /* @__PURE__ */ React.createElement(Page, { themeId: "tool" }, /* @__PURE__ */ React.createElement(Header, { title: "Tech insights" }, /* @__PURE__ */ React.createElement(HeaderLabel, { label: "Entities", value: (_a = value == null ? void 0 : value.result.length) != null ? _a : 0 }), /* @__PURE__ */ React.createElement(HeaderLabel, { label: "Checks", value: (_b = value == null ? void 0 : value.checks.length) != null ? _b : 0 })), /* @__PURE__ */ React.createElement(Content, null, /* @__PURE__ */ React.createElement(Grid, { container: true }, /* @__PURE__ */ React.createElement(Grid, { item: true, style: { width: "300px" } }, /* @__PURE__ */ React.createElement(
|
|
124
|
+
Filters,
|
|
125
|
+
{
|
|
126
|
+
checksChanged: (checks) => setFilterSelectedChecks(checks)
|
|
127
|
+
}
|
|
128
|
+
)), /* @__PURE__ */ React.createElement(Grid, { item: true, xs: true }, /* @__PURE__ */ React.createElement(
|
|
129
|
+
Table,
|
|
130
|
+
{
|
|
131
|
+
columns: tableColumns,
|
|
132
|
+
data: (_c = value == null ? void 0 : value.result) != null ? _c : [],
|
|
133
|
+
isLoading: loading
|
|
134
|
+
}
|
|
135
|
+
)))));
|
|
136
|
+
};
|
|
137
|
+
|
|
138
|
+
export { ScorecardsPage };
|
|
139
|
+
//# sourceMappingURL=index-Dprfu-4U.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-Dprfu-4U.esm.js","sources":["../../src/components/ScorecardsPage/Filters.tsx","../../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 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\n/** public **/\nexport type FiltersProps = {\n checksChanged: (checks: Check[]) => void;\n};\n\nexport const Filters = (props: FiltersProps) => {\n const { checksChanged } = 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 <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 );\n};\n","/*\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, { useState } from 'react';\nimport {\n Content,\n ErrorPanel,\n Header,\n HeaderLabel,\n Page,\n TableColumn,\n Table,\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';\n\nconst tableColumns: 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 },\n];\n\nexport const ScorecardsPage = () => {\n const api = useApi(techInsightsApiRef);\n const [filterSelectedChecks, setFilterSelectedChecks] = useState<Check[]>([]);\n\n const { value, loading, error } = useAsync(async () => {\n const checks = await api.getAllChecks();\n const result = await api.runBulkChecks([], filterSelectedChecks);\n return { checks, result };\n }, [api, 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 />\n </Grid>\n <Grid item xs>\n <Table\n columns={tableColumns}\n data={value?.result ?? []}\n isLoading={loading}\n />\n </Grid>\n </Grid>\n </Content>\n </Page>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiCA,MAAM,YAAY,UAAW,CAAA;AAAA,EAC3B,SAAA,EAAW,EAAE,KAAA,EAAO,MAAO,EAAA;AAAA,EAC3B,QAAU,EAAA;AAAA,IACR,KAAO,EAAA,MAAA;AAAA,IACP,YAAc,EAAA,UAAA;AAAA,IACd,QAAU,EAAA,QAAA;AAAA,GACZ;AACF,CAAC,CAAA,CAAA;AAED,MAAM,0BAAA,GAA6B,WAAW,CAAW,MAAA,MAAA;AAAA,EACvD,KAAO,EAAA;AAAA,IACL,KAAO,EAAA,MAAA;AAAA,GACT;AAAA,EACA,IAAM,EAAA;AAAA,IACJ,KAAO,EAAA,KAAA;AAAA,GACT;AACF,CAAA,CAAE,EAAE,gBAAgB,CAAA,CAAA;AAEpB,MAAM,IAAO,mBAAA,KAAA,CAAA,aAAA,CAAC,wBAAyB,EAAA,EAAA,QAAA,EAAS,OAAQ,EAAA,CAA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<{
|
|
|
19
19
|
*/
|
|
20
20
|
declare const ScorecardInfo: (props: {
|
|
21
21
|
checkResults: _backstage_community_plugin_tech_insights_common.CheckResult[];
|
|
22
|
-
title:
|
|
22
|
+
title: react.ReactNode;
|
|
23
23
|
description?: string | undefined;
|
|
24
24
|
noWarning?: boolean | undefined;
|
|
25
25
|
}) => react.JSX.Element;
|
|
@@ -46,6 +46,10 @@ declare const EntityTechInsightsScorecardCard: (props: {
|
|
|
46
46
|
checksId?: string[] | undefined;
|
|
47
47
|
onlyFailed?: boolean | undefined;
|
|
48
48
|
}) => react.JSX.Element;
|
|
49
|
+
/**
|
|
50
|
+
* @public
|
|
51
|
+
*/
|
|
52
|
+
declare const TechInsightsScorecardPage: () => react.JSX.Element;
|
|
49
53
|
|
|
50
54
|
/**
|
|
51
55
|
* Represents a single check defined on the TechInsights backend.
|
|
@@ -167,4 +171,4 @@ declare const BooleanCheck: (props: {
|
|
|
167
171
|
checkResult: CheckResult;
|
|
168
172
|
}) => react__default.JSX.Element;
|
|
169
173
|
|
|
170
|
-
export { BooleanCheck, type Check, type CheckResultRenderer, EntityTechInsightsScorecardCard, EntityTechInsightsScorecardContent, type InsightFacts, ScorecardInfo, ScorecardsList, type TechInsightsApi, TechInsightsClient, jsonRulesEngineCheckResultRenderer, techInsightsApiRef, techInsightsPlugin };
|
|
174
|
+
export { BooleanCheck, type Check, type CheckResultRenderer, EntityTechInsightsScorecardCard, EntityTechInsightsScorecardContent, type InsightFacts, ScorecardInfo, ScorecardsList, type TechInsightsApi, TechInsightsClient, TechInsightsScorecardPage, jsonRulesEngineCheckResultRenderer, techInsightsApiRef, techInsightsPlugin };
|
package/dist/index.esm.js
CHANGED
|
@@ -145,6 +145,13 @@ const EntityTechInsightsScorecardCard = techInsightsPlugin.provide(
|
|
|
145
145
|
mountPoint: rootRouteRef
|
|
146
146
|
})
|
|
147
147
|
);
|
|
148
|
+
const TechInsightsScorecardPage = techInsightsPlugin.provide(
|
|
149
|
+
createRoutableExtension({
|
|
150
|
+
name: "TechInsightsScorecardPage",
|
|
151
|
+
component: () => import('./esm/index-Dprfu-4U.esm.js').then((m) => m.ScorecardsPage),
|
|
152
|
+
mountPoint: rootRouteRef
|
|
153
|
+
})
|
|
154
|
+
);
|
|
148
155
|
|
|
149
|
-
export { BooleanCheck, EntityTechInsightsScorecardCard, EntityTechInsightsScorecardContent, ScorecardInfo, ScorecardsList, TechInsightsClient, jsonRulesEngineCheckResultRenderer, techInsightsApiRef, techInsightsPlugin };
|
|
156
|
+
export { BooleanCheck, EntityTechInsightsScorecardCard, EntityTechInsightsScorecardContent, ScorecardInfo, ScorecardsList, TechInsightsClient, TechInsightsScorecardPage, jsonRulesEngineCheckResultRenderer, techInsightsApiRef, techInsightsPlugin };
|
|
150
157
|
//# sourceMappingURL=index.esm.js.map
|
package/dist/index.esm.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.esm.js","sources":["../src/routes.ts","../src/api/TechInsightsApi.ts","../src/components/BooleanCheck/BooleanCheck.tsx","../src/components/CheckResultRenderer.tsx","../src/api/TechInsightsClient.ts","../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 { createRouteRef } from '@backstage/core-plugin-api';\n\nexport const rootRouteRef = createRouteRef({\n id: 'tech-insights',\n});\n","/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { createApiRef } from '@backstage/core-plugin-api';\nimport {\n CheckResult,\n BulkCheckResponse,\n FactSchema,\n} from '@backstage-community/plugin-tech-insights-common';\nimport { Check, InsightFacts } from './types';\nimport { CheckResultRenderer } from '../components/CheckResultRenderer';\nimport { CompoundEntityRef } from '@backstage/catalog-model';\n\n/**\n * {@link @backstage/core-plugin-api#ApiRef} for the {@link TechInsightsApi}\n *\n * @public\n */\nexport const techInsightsApiRef = createApiRef<TechInsightsApi>({\n id: 'plugin.techinsights.service',\n});\n\n/**\n * API client interface for the Tech Insights plugin\n *\n * @public\n */\nexport interface TechInsightsApi {\n getCheckResultRenderers: (types: string[]) => CheckResultRenderer[];\n getAllChecks(): Promise<Check[]>;\n runChecks(\n entityParams: CompoundEntityRef,\n checks?: string[],\n ): Promise<CheckResult[]>;\n runBulkChecks(\n entities: CompoundEntityRef[],\n checks?: Check[],\n ): Promise<BulkCheckResponse>;\n getFacts(entity: CompoundEntityRef, facts: string[]): Promise<InsightFacts>;\n getFactSchemas(): Promise<FactSchema[]>;\n}\n","/*\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","/*\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","/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { TechInsightsApi } from './TechInsightsApi';\nimport {\n BulkCheckResponse,\n CheckResult,\n FactSchema,\n} from '@backstage-community/plugin-tech-insights-common';\nimport { Check, InsightFacts } from './types';\nimport { DiscoveryApi, IdentityApi } from '@backstage/core-plugin-api';\nimport { ResponseError } from '@backstage/errors';\nimport {\n CompoundEntityRef,\n stringifyEntityRef,\n} from '@backstage/catalog-model';\n\nimport {\n CheckResultRenderer,\n jsonRulesEngineCheckResultRenderer,\n} from '../components/CheckResultRenderer';\nimport qs from 'qs';\n\n/** @public */\nexport class TechInsightsClient implements TechInsightsApi {\n private readonly discoveryApi: DiscoveryApi;\n private readonly identityApi: IdentityApi;\n private readonly renderers?: CheckResultRenderer[];\n\n constructor(options: {\n discoveryApi: DiscoveryApi;\n identityApi: IdentityApi;\n renderers?: CheckResultRenderer[];\n }) {\n this.discoveryApi = options.discoveryApi;\n this.identityApi = options.identityApi;\n this.renderers = options.renderers;\n }\n\n async getFacts(\n entity: CompoundEntityRef,\n facts: string[],\n ): Promise<InsightFacts> {\n const query = qs.stringify({\n entity: stringifyEntityRef(entity),\n ids: facts,\n });\n return await this.api<InsightFacts>(`/facts/latest?${query}`);\n }\n\n getCheckResultRenderers(types: string[]): CheckResultRenderer[] {\n const renderers = this.renderers ?? [jsonRulesEngineCheckResultRenderer];\n return renderers.filter(d => types.includes(d.type));\n }\n\n async getAllChecks(): Promise<Check[]> {\n return this.api('/checks');\n }\n\n async getFactSchemas(): Promise<FactSchema[]> {\n return this.api('/fact-schemas');\n }\n\n async runChecks(\n entityParams: CompoundEntityRef,\n checks?: string[],\n ): Promise<CheckResult[]> {\n const { namespace, kind, name } = entityParams;\n const requestBody = { checks };\n return this.api(\n `/checks/run/${encodeURIComponent(namespace)}/${encodeURIComponent(\n kind,\n )}/${encodeURIComponent(name)}`,\n {\n method: 'POST',\n body: JSON.stringify(requestBody),\n },\n );\n }\n\n async runBulkChecks(\n entities: CompoundEntityRef[],\n checks?: Check[],\n ): Promise<BulkCheckResponse> {\n const checkIds = checks ? checks.map(check => check.id) : [];\n const requestBody = {\n entities,\n checks: checkIds.length > 0 ? checkIds : undefined,\n };\n return this.api('/checks/run', {\n method: 'POST',\n body: JSON.stringify(requestBody),\n });\n }\n\n private async api<T>(path: string, init?: RequestInit): Promise<T> {\n const url = await this.discoveryApi.getBaseUrl('tech-insights');\n const { token } = await this.identityApi.getCredentials();\n\n const headers: HeadersInit = new Headers(init?.headers);\n if (!headers.has('content-type'))\n headers.set('content-type', 'application/json');\n if (token && !headers.has('authorization')) {\n headers.set('authorization', `Bearer ${token}`);\n }\n\n const request = new Request(`${url}${path}`, {\n ...init,\n headers,\n });\n\n return fetch(request).then(async response => {\n if (!response.ok) {\n throw await ResponseError.fromResponse(response);\n }\n return response.json() as Promise<T>;\n });\n }\n}\n","/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport {\n createPlugin,\n createRoutableExtension,\n createApiFactory,\n discoveryApiRef,\n identityApiRef,\n} from '@backstage/core-plugin-api';\nimport { rootRouteRef } from './routes';\nimport { techInsightsApiRef } from './api/TechInsightsApi';\nimport { TechInsightsClient } from './api/TechInsightsClient';\n\n/**\n * @public\n */\nexport const techInsightsPlugin = createPlugin({\n id: 'tech-insights',\n apis: [\n createApiFactory({\n api: techInsightsApiRef,\n deps: { discoveryApi: discoveryApiRef, identityApi: identityApiRef },\n factory: ({ discoveryApi, identityApi }) =>\n new TechInsightsClient({ discoveryApi, identityApi }),\n }),\n ],\n routes: {\n root: rootRouteRef,\n },\n});\n\n/**\n * @public\n */\nexport const ScorecardInfo = techInsightsPlugin.provide(\n createRoutableExtension({\n name: 'ScorecardInfo',\n component: () =>\n import('./components/ScorecardsInfo').then(m => m.ScorecardInfo),\n mountPoint: rootRouteRef,\n }),\n);\n\n/**\n * @public\n */\nexport const ScorecardsList = techInsightsPlugin.provide(\n createRoutableExtension({\n name: 'ScorecardsList',\n component: () =>\n import('./components/ScorecardsList').then(m => m.ScorecardsList),\n mountPoint: rootRouteRef,\n }),\n);\n\n/**\n * @public\n */\nexport const EntityTechInsightsScorecardContent = techInsightsPlugin.provide(\n createRoutableExtension({\n name: 'EntityTechInsightsScorecardContent',\n component: () =>\n import('./components/ScorecardsContent').then(m => m.ScorecardsContent),\n mountPoint: rootRouteRef,\n }),\n);\n\n/**\n * @public\n */\nexport const EntityTechInsightsScorecardCard = techInsightsPlugin.provide(\n createRoutableExtension({\n name: 'EntityTechInsightsScorecardCard',\n component: () =>\n import('./components/ScorecardsCard').then(m => m.ScorecardsCard),\n mountPoint: rootRouteRef,\n }),\n);\n"],"names":[],"mappings":";;;;;;;;AAiBO,MAAM,eAAe,cAAe,CAAA;AAAA,EACzC,EAAI,EAAA,eAAA;AACN,CAAC,CAAA;;ACYM,MAAM,qBAAqB,YAA8B,CAAA;AAAA,EAC9D,EAAI,EAAA,6BAAA;AACN,CAAC;;ACTY,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,CAAA;AAEpC,EAAA;AAKO,MAAM,oBAAuB,GAAA,CAAC,WACnC,KAAA,CAAC,WAAY,CAAA,MAAA;;ACCR,MAAM,kCAA0D,GAAA;AAAA,EACrE,IAAM,EAAA,mBAAA;AAAA,EACN,SAAW,EAAA,CAAC,WACV,qBAAA,KAAA,CAAA,aAAA,CAAC,gBAAa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src/api/TechInsightsApi.ts","../src/components/BooleanCheck/BooleanCheck.tsx","../src/components/CheckResultRenderer.tsx","../src/api/TechInsightsClient.ts","../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 { createRouteRef } from '@backstage/core-plugin-api';\n\nexport const rootRouteRef = createRouteRef({\n id: 'tech-insights',\n});\n","/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { createApiRef } from '@backstage/core-plugin-api';\nimport {\n CheckResult,\n BulkCheckResponse,\n FactSchema,\n} from '@backstage-community/plugin-tech-insights-common';\nimport { Check, InsightFacts } from './types';\nimport { CheckResultRenderer } from '../components/CheckResultRenderer';\nimport { CompoundEntityRef } from '@backstage/catalog-model';\n\n/**\n * {@link @backstage/core-plugin-api#ApiRef} for the {@link TechInsightsApi}\n *\n * @public\n */\nexport const techInsightsApiRef = createApiRef<TechInsightsApi>({\n id: 'plugin.techinsights.service',\n});\n\n/**\n * API client interface for the Tech Insights plugin\n *\n * @public\n */\nexport interface TechInsightsApi {\n getCheckResultRenderers: (types: string[]) => CheckResultRenderer[];\n getAllChecks(): Promise<Check[]>;\n runChecks(\n entityParams: CompoundEntityRef,\n checks?: string[],\n ): Promise<CheckResult[]>;\n runBulkChecks(\n entities: CompoundEntityRef[],\n checks?: Check[],\n ): Promise<BulkCheckResponse>;\n getFacts(entity: CompoundEntityRef, facts: string[]): Promise<InsightFacts>;\n getFactSchemas(): Promise<FactSchema[]>;\n}\n","/*\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","/*\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","/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { TechInsightsApi } from './TechInsightsApi';\nimport {\n BulkCheckResponse,\n CheckResult,\n FactSchema,\n} from '@backstage-community/plugin-tech-insights-common';\nimport { Check, InsightFacts } from './types';\nimport { DiscoveryApi, IdentityApi } from '@backstage/core-plugin-api';\nimport { ResponseError } from '@backstage/errors';\nimport {\n CompoundEntityRef,\n stringifyEntityRef,\n} from '@backstage/catalog-model';\n\nimport {\n CheckResultRenderer,\n jsonRulesEngineCheckResultRenderer,\n} from '../components/CheckResultRenderer';\nimport qs from 'qs';\n\n/** @public */\nexport class TechInsightsClient implements TechInsightsApi {\n private readonly discoveryApi: DiscoveryApi;\n private readonly identityApi: IdentityApi;\n private readonly renderers?: CheckResultRenderer[];\n\n constructor(options: {\n discoveryApi: DiscoveryApi;\n identityApi: IdentityApi;\n renderers?: CheckResultRenderer[];\n }) {\n this.discoveryApi = options.discoveryApi;\n this.identityApi = options.identityApi;\n this.renderers = options.renderers;\n }\n\n async getFacts(\n entity: CompoundEntityRef,\n facts: string[],\n ): Promise<InsightFacts> {\n const query = qs.stringify({\n entity: stringifyEntityRef(entity),\n ids: facts,\n });\n return await this.api<InsightFacts>(`/facts/latest?${query}`);\n }\n\n getCheckResultRenderers(types: string[]): CheckResultRenderer[] {\n const renderers = this.renderers ?? [jsonRulesEngineCheckResultRenderer];\n return renderers.filter(d => types.includes(d.type));\n }\n\n async getAllChecks(): Promise<Check[]> {\n return this.api('/checks');\n }\n\n async getFactSchemas(): Promise<FactSchema[]> {\n return this.api('/fact-schemas');\n }\n\n async runChecks(\n entityParams: CompoundEntityRef,\n checks?: string[],\n ): Promise<CheckResult[]> {\n const { namespace, kind, name } = entityParams;\n const requestBody = { checks };\n return this.api(\n `/checks/run/${encodeURIComponent(namespace)}/${encodeURIComponent(\n kind,\n )}/${encodeURIComponent(name)}`,\n {\n method: 'POST',\n body: JSON.stringify(requestBody),\n },\n );\n }\n\n async runBulkChecks(\n entities: CompoundEntityRef[],\n checks?: Check[],\n ): Promise<BulkCheckResponse> {\n const checkIds = checks ? checks.map(check => check.id) : [];\n const requestBody = {\n entities,\n checks: checkIds.length > 0 ? checkIds : undefined,\n };\n return this.api('/checks/run', {\n method: 'POST',\n body: JSON.stringify(requestBody),\n });\n }\n\n private async api<T>(path: string, init?: RequestInit): Promise<T> {\n const url = await this.discoveryApi.getBaseUrl('tech-insights');\n const { token } = await this.identityApi.getCredentials();\n\n const headers: HeadersInit = new Headers(init?.headers);\n if (!headers.has('content-type'))\n headers.set('content-type', 'application/json');\n if (token && !headers.has('authorization')) {\n headers.set('authorization', `Bearer ${token}`);\n }\n\n const request = new Request(`${url}${path}`, {\n ...init,\n headers,\n });\n\n return fetch(request).then(async response => {\n if (!response.ok) {\n throw await ResponseError.fromResponse(response);\n }\n return response.json() as Promise<T>;\n });\n }\n}\n","/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport {\n createPlugin,\n createRoutableExtension,\n createApiFactory,\n discoveryApiRef,\n identityApiRef,\n} from '@backstage/core-plugin-api';\nimport { rootRouteRef } from './routes';\nimport { techInsightsApiRef } from './api/TechInsightsApi';\nimport { TechInsightsClient } from './api/TechInsightsClient';\n\n/**\n * @public\n */\nexport const techInsightsPlugin = createPlugin({\n id: 'tech-insights',\n apis: [\n createApiFactory({\n api: techInsightsApiRef,\n deps: { discoveryApi: discoveryApiRef, identityApi: identityApiRef },\n factory: ({ discoveryApi, identityApi }) =>\n new TechInsightsClient({ discoveryApi, identityApi }),\n }),\n ],\n routes: {\n root: rootRouteRef,\n },\n});\n\n/**\n * @public\n */\nexport const ScorecardInfo = techInsightsPlugin.provide(\n createRoutableExtension({\n name: 'ScorecardInfo',\n component: () =>\n import('./components/ScorecardsInfo').then(m => m.ScorecardInfo),\n mountPoint: rootRouteRef,\n }),\n);\n\n/**\n * @public\n */\nexport const ScorecardsList = techInsightsPlugin.provide(\n createRoutableExtension({\n name: 'ScorecardsList',\n component: () =>\n import('./components/ScorecardsList').then(m => m.ScorecardsList),\n mountPoint: rootRouteRef,\n }),\n);\n\n/**\n * @public\n */\nexport const EntityTechInsightsScorecardContent = techInsightsPlugin.provide(\n createRoutableExtension({\n name: 'EntityTechInsightsScorecardContent',\n component: () =>\n import('./components/ScorecardsContent').then(m => m.ScorecardsContent),\n mountPoint: rootRouteRef,\n }),\n);\n\n/**\n * @public\n */\nexport const EntityTechInsightsScorecardCard = techInsightsPlugin.provide(\n createRoutableExtension({\n name: 'EntityTechInsightsScorecardCard',\n component: () =>\n import('./components/ScorecardsCard').then(m => m.ScorecardsCard),\n mountPoint: rootRouteRef,\n }),\n);\n\n/**\n * @public\n */\nexport const TechInsightsScorecardPage = techInsightsPlugin.provide(\n createRoutableExtension({\n name: 'TechInsightsScorecardPage',\n component: () =>\n import('./components/ScorecardsPage').then(m => m.ScorecardsPage),\n mountPoint: rootRouteRef,\n }),\n);\n"],"names":[],"mappings":";;;;;;;;AAiBO,MAAM,eAAe,cAAe,CAAA;AAAA,EACzC,EAAI,EAAA,eAAA;AACN,CAAC,CAAA;;ACYM,MAAM,qBAAqB,YAA8B,CAAA;AAAA,EAC9D,EAAI,EAAA,6BAAA;AACN,CAAC;;ACTY,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,CAAA;AAEpC,EAAA;AAKO,MAAM,oBAAuB,GAAA,CAAC,WACnC,KAAA,CAAC,WAAY,CAAA,MAAA;;ACCR,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,oBAAA;AACZ;;;;;;;;ACNO,MAAM,kBAA8C,CAAA;AAAA,EAKzD,YAAY,OAIT,EAAA;AARH,IAAiB,aAAA,CAAA,IAAA,EAAA,cAAA,CAAA,CAAA;AACjB,IAAiB,aAAA,CAAA,IAAA,EAAA,aAAA,CAAA,CAAA;AACjB,IAAiB,aAAA,CAAA,IAAA,EAAA,WAAA,CAAA,CAAA;AAOf,IAAA,IAAA,CAAK,eAAe,OAAQ,CAAA,YAAA,CAAA;AAC5B,IAAA,IAAA,CAAK,cAAc,OAAQ,CAAA,WAAA,CAAA;AAC3B,IAAA,IAAA,CAAK,YAAY,OAA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