@backstage-community/plugin-puppetdb 0.5.1 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/dist/components/ReportDetailsPage/ReportDetailsEventsTable.esm.js +17 -12
- package/dist/components/ReportDetailsPage/ReportDetailsEventsTable.esm.js.map +1 -1
- package/dist/components/ReportDetailsPage/ReportDetailsLogsTable.esm.js +11 -11
- package/dist/components/ReportDetailsPage/ReportDetailsLogsTable.esm.js.map +1 -1
- package/dist/components/ReportDetailsPage/ReportDetailsPage.esm.js +38 -25
- package/dist/components/ReportDetailsPage/ReportDetailsPage.esm.js.map +1 -1
- package/dist/components/ReportsPage/ReportsPage.esm.js +2 -2
- package/dist/components/ReportsPage/ReportsPage.esm.js.map +1 -1
- package/dist/components/ReportsPage/ReportsTable.esm.js +21 -13
- package/dist/components/ReportsPage/ReportsTable.esm.js.map +1 -1
- package/dist/components/Router.esm.js +12 -9
- package/dist/components/Router.esm.js.map +1 -1
- package/dist/components/StatusField/StatusField.esm.js +17 -5
- package/dist/components/StatusField/StatusField.esm.js.map +1 -1
- package/dist/index.d.ts +3 -5
- package/package.json +16 -9
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @backstage-community/plugin-puppetdb
|
|
2
2
|
|
|
3
|
+
## 0.7.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- fbc2f06: Backstage version bump to v1.39.0
|
|
8
|
+
|
|
9
|
+
## 0.6.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- 6818351: Backstage version bump to v1.38.1
|
|
14
|
+
|
|
3
15
|
## 0.5.1
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
1
2
|
import Typography from '@material-ui/core/Typography';
|
|
2
|
-
import React from 'react';
|
|
3
3
|
import { puppetDbApiRef } from '../../api/types.esm.js';
|
|
4
4
|
import '@backstage/errors';
|
|
5
5
|
import { ResponseErrorPanel, Table } from '@backstage/core-components';
|
|
@@ -23,7 +23,7 @@ const ReportDetailsEventsTable = (props) => {
|
|
|
23
23
|
return puppetDbApi.getPuppetDbReportEvents(hash);
|
|
24
24
|
}, [puppetDbApi, hash]);
|
|
25
25
|
if (error) {
|
|
26
|
-
return /* @__PURE__ */
|
|
26
|
+
return /* @__PURE__ */ jsx(ResponseErrorPanel, { error });
|
|
27
27
|
}
|
|
28
28
|
const columns = [
|
|
29
29
|
{
|
|
@@ -31,47 +31,52 @@ const ReportDetailsEventsTable = (props) => {
|
|
|
31
31
|
field: "run_start_time",
|
|
32
32
|
align: "center",
|
|
33
33
|
width: "300px",
|
|
34
|
-
render: (rowData) => /* @__PURE__ */
|
|
34
|
+
render: (rowData) => /* @__PURE__ */ jsx(Typography, { noWrap: true, children: new Date(Date.parse(rowData.run_start_time)).toLocaleString() })
|
|
35
35
|
},
|
|
36
36
|
{
|
|
37
37
|
title: "Run End Time",
|
|
38
38
|
field: "run_end_time",
|
|
39
39
|
align: "center",
|
|
40
40
|
width: "300px",
|
|
41
|
-
render: (rowData) => /* @__PURE__ */
|
|
41
|
+
render: (rowData) => /* @__PURE__ */ jsx(Typography, { noWrap: true, children: new Date(Date.parse(rowData.run_end_time)).toLocaleString() })
|
|
42
42
|
},
|
|
43
43
|
{
|
|
44
44
|
title: "Containing Class",
|
|
45
45
|
field: "containing_class",
|
|
46
|
-
render: (rowData) => /* @__PURE__ */
|
|
46
|
+
render: (rowData) => /* @__PURE__ */ jsx(Typography, { noWrap: true, title: rowData.file || "", children: rowData.containing_class })
|
|
47
47
|
},
|
|
48
48
|
{
|
|
49
49
|
title: "Resource",
|
|
50
50
|
field: "resource_title",
|
|
51
|
-
render: (rowData) => /* @__PURE__ */
|
|
51
|
+
render: (rowData) => /* @__PURE__ */ jsxs(Typography, { noWrap: true, children: [
|
|
52
|
+
rowData.resource_type,
|
|
53
|
+
"[",
|
|
54
|
+
rowData.resource_title,
|
|
55
|
+
"]"
|
|
56
|
+
] })
|
|
52
57
|
},
|
|
53
58
|
{
|
|
54
59
|
title: "Property",
|
|
55
60
|
field: "property",
|
|
56
|
-
render: (rowData) => /* @__PURE__ */
|
|
61
|
+
render: (rowData) => /* @__PURE__ */ jsx(Typography, { noWrap: true, children: rowData.property })
|
|
57
62
|
},
|
|
58
63
|
{
|
|
59
64
|
title: "Old Value",
|
|
60
65
|
field: "old_value",
|
|
61
|
-
render: (rowData) => /* @__PURE__ */
|
|
66
|
+
render: (rowData) => /* @__PURE__ */ jsx(Typography, { noWrap: true, children: rowData.old_value })
|
|
62
67
|
},
|
|
63
68
|
{
|
|
64
69
|
title: "New Value",
|
|
65
70
|
field: "new_value",
|
|
66
|
-
render: (rowData) => /* @__PURE__ */
|
|
71
|
+
render: (rowData) => /* @__PURE__ */ jsx(Typography, { noWrap: true, children: rowData.new_value })
|
|
67
72
|
},
|
|
68
73
|
{
|
|
69
74
|
title: "Status",
|
|
70
75
|
field: "status",
|
|
71
|
-
render: (rowData) => /* @__PURE__ */
|
|
76
|
+
render: (rowData) => /* @__PURE__ */ jsx(StatusField, { status: rowData.status })
|
|
72
77
|
}
|
|
73
78
|
];
|
|
74
|
-
return /* @__PURE__ */
|
|
79
|
+
return /* @__PURE__ */ jsx(
|
|
75
80
|
Table,
|
|
76
81
|
{
|
|
77
82
|
options: {
|
|
@@ -85,7 +90,7 @@ const ReportDetailsEventsTable = (props) => {
|
|
|
85
90
|
pageSize: 10,
|
|
86
91
|
pageSizeOptions: [10]
|
|
87
92
|
},
|
|
88
|
-
emptyContent: /* @__PURE__ */
|
|
93
|
+
emptyContent: /* @__PURE__ */ jsx(Typography, { color: "textSecondary", className: classes.empty, children: "No events" }),
|
|
89
94
|
title: "Latest events",
|
|
90
95
|
columns,
|
|
91
96
|
data: value || [],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ReportDetailsEventsTable.esm.js","sources":["../../../src/components/ReportDetailsPage/ReportDetailsEventsTable.tsx"],"sourcesContent":["/*\n * Copyright 2022 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport Typography from '@material-ui/core/Typography';\nimport
|
|
1
|
+
{"version":3,"file":"ReportDetailsEventsTable.esm.js","sources":["../../../src/components/ReportDetailsPage/ReportDetailsEventsTable.tsx"],"sourcesContent":["/*\n * Copyright 2022 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport Typography from '@material-ui/core/Typography';\nimport { puppetDbApiRef, PuppetDbReportEvent } from '../../api';\nimport {\n ResponseErrorPanel,\n Table,\n TableColumn,\n} from '@backstage/core-components';\nimport useAsync from 'react-use/esm/useAsync';\nimport { useApi } from '@backstage/core-plugin-api';\nimport { makeStyles } from '@material-ui/core/styles';\nimport { StatusField } from '../StatusField';\n\ntype ReportEventsTableProps = {\n hash: string;\n};\n\nconst useStyles = makeStyles(theme => ({\n empty: {\n padding: theme.spacing(2),\n display: 'flex',\n justifyContent: 'center',\n },\n}));\n\n/**\n * Component for displaying PuppetDB report events.\n *\n * @public\n */\nexport const ReportDetailsEventsTable = (props: ReportEventsTableProps) => {\n const { hash } = props;\n const puppetDbApi = useApi(puppetDbApiRef);\n const classes = useStyles();\n const { value, loading, error } = useAsync(async () => {\n return puppetDbApi.getPuppetDbReportEvents(hash);\n }, [puppetDbApi, hash]);\n\n if (error) {\n return <ResponseErrorPanel error={error} />;\n }\n\n const columns: TableColumn<PuppetDbReportEvent>[] = [\n {\n title: 'Run Start Time',\n field: 'run_start_time',\n align: 'center',\n width: '300px',\n render: rowData => (\n <Typography noWrap>\n {new Date(Date.parse(rowData.run_start_time)).toLocaleString()}\n </Typography>\n ),\n },\n {\n title: 'Run End Time',\n field: 'run_end_time',\n align: 'center',\n width: '300px',\n render: rowData => (\n <Typography noWrap>\n {new Date(Date.parse(rowData.run_end_time)).toLocaleString()}\n </Typography>\n ),\n },\n {\n title: 'Containing Class',\n field: 'containing_class',\n render: rowData => (\n <Typography noWrap title={rowData.file || ''}>\n {rowData.containing_class}\n </Typography>\n ),\n },\n {\n title: 'Resource',\n field: 'resource_title',\n render: rowData => (\n <Typography noWrap>\n {rowData.resource_type}[{rowData.resource_title}]\n </Typography>\n ),\n },\n {\n title: 'Property',\n field: 'property',\n render: rowData => <Typography noWrap>{rowData.property}</Typography>,\n },\n {\n title: 'Old Value',\n field: 'old_value',\n render: rowData => <Typography noWrap>{rowData.old_value}</Typography>,\n },\n {\n title: 'New Value',\n field: 'new_value',\n render: rowData => <Typography noWrap>{rowData.new_value}</Typography>,\n },\n {\n title: 'Status',\n field: 'status',\n render: rowData => <StatusField status={rowData.status} />,\n },\n ];\n\n return (\n <Table\n options={{\n sorting: true,\n actionsColumnIndex: -1,\n loadingType: 'linear',\n padding: 'dense',\n showEmptyDataSourceMessage: !loading,\n showTitle: true,\n toolbar: true,\n pageSize: 10,\n pageSizeOptions: [10],\n }}\n emptyContent={\n <Typography color=\"textSecondary\" className={classes.empty}>\n No events\n </Typography>\n }\n title=\"Latest events\"\n columns={columns}\n data={value || []}\n isLoading={loading}\n />\n );\n};\n"],"names":[],"mappings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EAAA;AAAA,KAC3D;AAAA,IACA;AAAA,MACE,KAAO,EAAA,QAAA;AAAA,MACP,KAAO,EAAA,QAAA;AAAA,MACP,QAAQ,CAAW,OAAA,qBAAA,GAAA,CAAC,WAAY,EAAA,EAAA,MAAA,EAAQ,QAAQ,MAAQ,EAAA;AAAA;AAC1D,GACF;AAEA,EACE,uBAAA,GAAA;AAAA,IAAC,KAAA;AAAA,IAAA;AAAA,MACC,OAAS,EAAA;AAAA,QACP,OAAS,EAAA,IAAA;AAAA,QACT,kBAAoB,EAAA,CAAA,CAAA;AAAA,QACpB,WAAa,EAAA,QAAA;AAAA,QACb,OAAS,EAAA,OAAA;AAAA,QACT,4BAA4B,CAAC,OAAA;AAAA,QAC7B,SAAW,EAAA,IAAA;AAAA,QACX,OAAS,EAAA,IAAA;AAAA,QACT,QAAU,EAAA,EAAA;AAAA,QACV,eAAA,EAAiB,CAAC,EAAE;AAAA,OACtB;AAAA,MACA,YAAA,sBACG,UAAW,EAAA,EAAA,KAAA,EAAM,iBAAgB,SAAW,EAAA,OAAA,CAAQ,OAAO,QAE5D,EAAA,WAAA,EAAA,CAAA;AAAA,MAEF,KAAM,EAAA,eAAA;AAAA,MACN,OAAA;AAAA,MACA,IAAA,EAAM,SAAS,EAAC;AAAA,MAChB,SAAW,EAAA;AAAA;AAAA,GACb;AAEJ;;;;"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
1
2
|
import Typography from '@material-ui/core/Typography';
|
|
2
|
-
import React from 'react';
|
|
3
3
|
import { puppetDbApiRef } from '../../api/types.esm.js';
|
|
4
4
|
import '@backstage/errors';
|
|
5
5
|
import { ResponseErrorPanel, Table } from '@backstage/core-components';
|
|
@@ -31,7 +31,7 @@ const ReportDetailsLogsTable = (props) => {
|
|
|
31
31
|
return puppetDbApi.getPuppetDbReportLogs(hash);
|
|
32
32
|
}, [puppetDbApi, hash]);
|
|
33
33
|
if (error) {
|
|
34
|
-
return /* @__PURE__ */
|
|
34
|
+
return /* @__PURE__ */ jsx(ResponseErrorPanel, { error });
|
|
35
35
|
}
|
|
36
36
|
const columns = [
|
|
37
37
|
{
|
|
@@ -39,13 +39,13 @@ const ReportDetailsLogsTable = (props) => {
|
|
|
39
39
|
field: "level",
|
|
40
40
|
align: "center",
|
|
41
41
|
width: "100px",
|
|
42
|
-
render: (rowData) => /* @__PURE__ */
|
|
42
|
+
render: (rowData) => /* @__PURE__ */ jsx(
|
|
43
43
|
Typography,
|
|
44
44
|
{
|
|
45
45
|
noWrap: true,
|
|
46
|
-
className: rowData.level === "warning" && classes.level_warning || rowData.level === "error" && classes.level_error || classes.level_notice
|
|
47
|
-
|
|
48
|
-
|
|
46
|
+
className: rowData.level === "warning" && classes.level_warning || rowData.level === "error" && classes.level_error || classes.level_notice,
|
|
47
|
+
children: rowData.level.toLocaleUpperCase("en-US")
|
|
48
|
+
}
|
|
49
49
|
)
|
|
50
50
|
},
|
|
51
51
|
{
|
|
@@ -53,20 +53,20 @@ const ReportDetailsLogsTable = (props) => {
|
|
|
53
53
|
field: "time",
|
|
54
54
|
align: "center",
|
|
55
55
|
width: "300px",
|
|
56
|
-
render: (rowData) => /* @__PURE__ */
|
|
56
|
+
render: (rowData) => /* @__PURE__ */ jsx(Typography, { noWrap: true, children: new Date(Date.parse(rowData.time)).toLocaleString() })
|
|
57
57
|
},
|
|
58
58
|
{
|
|
59
59
|
title: "Source",
|
|
60
60
|
field: "source",
|
|
61
|
-
render: (rowData) => /* @__PURE__ */
|
|
61
|
+
render: (rowData) => /* @__PURE__ */ jsx(Typography, { noWrap: true, children: rowData.source })
|
|
62
62
|
},
|
|
63
63
|
{
|
|
64
64
|
title: "Message",
|
|
65
65
|
field: "message",
|
|
66
|
-
render: (rowData) => /* @__PURE__ */
|
|
66
|
+
render: (rowData) => /* @__PURE__ */ jsx(Typography, { noWrap: true, children: rowData.message })
|
|
67
67
|
}
|
|
68
68
|
];
|
|
69
|
-
return /* @__PURE__ */
|
|
69
|
+
return /* @__PURE__ */ jsx(
|
|
70
70
|
Table,
|
|
71
71
|
{
|
|
72
72
|
options: {
|
|
@@ -80,7 +80,7 @@ const ReportDetailsLogsTable = (props) => {
|
|
|
80
80
|
pageSize: 10,
|
|
81
81
|
pageSizeOptions: [10]
|
|
82
82
|
},
|
|
83
|
-
emptyContent: /* @__PURE__ */
|
|
83
|
+
emptyContent: /* @__PURE__ */ jsx(Typography, { color: "textSecondary", className: classes.empty, children: "No logs" }),
|
|
84
84
|
title: "Latest logs",
|
|
85
85
|
columns,
|
|
86
86
|
data: value || [],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ReportDetailsLogsTable.esm.js","sources":["../../../src/components/ReportDetailsPage/ReportDetailsLogsTable.tsx"],"sourcesContent":["/*\n * Copyright 2022 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport Typography from '@material-ui/core/Typography';\nimport
|
|
1
|
+
{"version":3,"file":"ReportDetailsLogsTable.esm.js","sources":["../../../src/components/ReportDetailsPage/ReportDetailsLogsTable.tsx"],"sourcesContent":["/*\n * Copyright 2022 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport Typography from '@material-ui/core/Typography';\nimport { puppetDbApiRef, PuppetDbReportLog } from '../../api';\nimport {\n ResponseErrorPanel,\n Table,\n TableColumn,\n} from '@backstage/core-components';\nimport useAsync from 'react-use/esm/useAsync';\nimport { useApi } from '@backstage/core-plugin-api';\nimport { makeStyles } from '@material-ui/core/styles';\n\ntype ReportLogsTableProps = {\n hash: string;\n};\n\nconst useStyles = makeStyles(theme => ({\n empty: {\n padding: theme.spacing(2),\n display: 'flex',\n justifyContent: 'center',\n },\n level_error: {\n color: theme.palette.error.light,\n },\n level_warning: {\n color: theme.palette.warning.light,\n },\n level_notice: {\n color: theme.palette.info.light,\n },\n}));\n\n/**\n * Component for displaying PuppetDB report logs.\n *\n * @public\n */\nexport const ReportDetailsLogsTable = (props: ReportLogsTableProps) => {\n const { hash } = props;\n const puppetDbApi = useApi(puppetDbApiRef);\n const classes = useStyles();\n const { value, loading, error } = useAsync(async () => {\n return puppetDbApi.getPuppetDbReportLogs(hash);\n }, [puppetDbApi, hash]);\n\n if (error) {\n return <ResponseErrorPanel error={error} />;\n }\n\n const columns: TableColumn<PuppetDbReportLog>[] = [\n {\n title: 'Level',\n field: 'level',\n align: 'center',\n width: '100px',\n render: rowData => (\n <Typography\n noWrap\n className={\n (rowData.level === 'warning' && classes.level_warning) ||\n (rowData.level === 'error' && classes.level_error) ||\n classes.level_notice\n }\n >\n {rowData.level.toLocaleUpperCase('en-US')}\n </Typography>\n ),\n },\n {\n title: 'Timestamp',\n field: 'time',\n align: 'center',\n width: '300px',\n render: rowData => (\n <Typography noWrap>\n {new Date(Date.parse(rowData.time)).toLocaleString()}\n </Typography>\n ),\n },\n {\n title: 'Source',\n field: 'source',\n render: rowData => <Typography noWrap>{rowData.source}</Typography>,\n },\n {\n title: 'Message',\n field: 'message',\n render: rowData => <Typography noWrap>{rowData.message}</Typography>,\n },\n ];\n\n return (\n <Table\n options={{\n sorting: true,\n actionsColumnIndex: -1,\n loadingType: 'linear',\n padding: 'dense',\n showEmptyDataSourceMessage: !loading,\n showTitle: true,\n toolbar: true,\n pageSize: 10,\n pageSizeOptions: [10],\n }}\n emptyContent={\n <Typography color=\"textSecondary\" className={classes.empty}>\n No logs\n </Typography>\n }\n title=\"Latest logs\"\n columns={columns}\n data={value || []}\n isLoading={loading}\n />\n );\n};\n"],"names":[],"mappings":";;;;;;;;;AA+BA,MAAM,SAAA,GAAY,WAAW,CAAU,KAAA,MAAA;AAAA,EACrC,KAAO,EAAA;AAAA,IACL,OAAA,EAAS,KAAM,CAAA,OAAA,CAAQ,CAAC,CAAA;AAAA,IACxB,OAAS,EAAA,MAAA;AAAA,IACT,cAAgB,EAAA;AAAA,GAClB;AAAA,EACA,WAAa,EAAA;AAAA,IACX,KAAA,EAAO,KAAM,CAAA,OAAA,CAAQ,KAAM,CAAA;AAAA,GAC7B;AAAA,EACA,aAAe,EAAA;AAAA,IACb,KAAA,EAAO,KAAM,CAAA,OAAA,CAAQ,OAAQ,CAAA;AAAA,GAC/B;AAAA,EACA,YAAc,EAAA;AAAA,IACZ,KAAA,EAAO,KAAM,CAAA,OAAA,CAAQ,IAAK,CAAA;AAAA;AAE9B,CAAE,CAAA,CAAA;AAOW,MAAA,sBAAA,GAAyB,CAAC,KAAgC,KAAA;AACrE,EAAM,MAAA,EAAE,MAAS,GAAA,KAAA;AACjB,EAAM,MAAA,WAAA,GAAc,OAAO,cAAc,CAAA;AACzC,EAAA,MAAM,UAAU,SAAU,EAAA;AAC1B,EAAA,MAAM,EAAE,KAAO,EAAA,OAAA,EAAS,KAAM,EAAA,GAAI,SAAS,YAAY;AACrD,IAAO,OAAA,WAAA,CAAY,sBAAsB,IAAI,CAAA;AAAA,GAC5C,EAAA,CAAC,WAAa,EAAA,IAAI,CAAC,CAAA;AAEtB,EAAA,IAAI,KAAO,EAAA;AACT,IAAO,uBAAA,GAAA,CAAC,sBAAmB,KAAc,EAAA,CAAA;AAAA;AAG3C,EAAA,MAAM,OAA4C,GAAA;AAAA,IAChD;AAAA,MACE,KAAO,EAAA,OAAA;AAAA,MACP,KAAO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A;AAAA,QACT,kBAAoB,EAAA,CAAA,CAAA;AAAA,QACpB,WAAa,EAAA,QAAA;AAAA,QACb,OAAS,EAAA,OAAA;AAAA,QACT,4BAA4B,CAAC,OAAA;AAAA,QAC7B,SAAW,EAAA,IAAA;AAAA,QACX,OAAS,EAAA,IAAA;AAAA,QACT,QAAU,EAAA,EAAA;AAAA,QACV,eAAA,EAAiB,CAAC,EAAE;AAAA,OACtB;AAAA,MACA,YAAA,sBACG,UAAW,EAAA,EAAA,KAAA,EAAM,iBAAgB,SAAW,EAAA,OAAA,CAAQ,OAAO,QAE5D,EAAA,SAAA,EAAA,CAAA;AAAA,MAEF,KAAM,EAAA,aAAA;AAAA,MACN,OAAA;AAAA,MACA,IAAA,EAAM,SAAS,EAAC;AAAA,MAChB,SAAW,EAAA;AAAA;AAAA,GACb;AAEJ;;;;"}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
1
2
|
import { useParams, Link as Link$1 } from 'react-router-dom';
|
|
2
3
|
import { Breadcrumbs, Link } from '@backstage/core-components';
|
|
3
4
|
import { makeStyles } from '@material-ui/core/styles';
|
|
4
5
|
import { useRouteRef } from '@backstage/core-plugin-api';
|
|
5
6
|
import { puppetDbRouteRef } from '../../routes.esm.js';
|
|
6
|
-
import
|
|
7
|
+
import { useState } from 'react';
|
|
7
8
|
import Card from '@material-ui/core/Card';
|
|
8
9
|
import CardContent from '@material-ui/core/CardContent';
|
|
9
10
|
import Tab from '@material-ui/core/Tab';
|
|
@@ -42,31 +43,43 @@ const ReportDetailsPage = () => {
|
|
|
42
43
|
{ id: "logs", label: "Logs" }
|
|
43
44
|
];
|
|
44
45
|
const safeTabIndex = tabIndex > tabs.length - 1 ? 0 : tabIndex;
|
|
45
|
-
return /* @__PURE__ */
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
Tabs,
|
|
46
|
+
return /* @__PURE__ */ jsxs("div", { children: [
|
|
47
|
+
/* @__PURE__ */ jsxs(Breadcrumbs, { "aria-label": "breadcrumb", children: [
|
|
48
|
+
/* @__PURE__ */ jsx(Link, { component: Link$1, to: reportsRouteLink(), children: "PuppetDB Reports" }),
|
|
49
|
+
/* @__PURE__ */ jsx(Typography, { noWrap: true, children: hash })
|
|
50
|
+
] }),
|
|
51
|
+
/* @__PURE__ */ jsx(
|
|
52
|
+
Card,
|
|
53
53
|
{
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
54
|
+
style: { position: "relative", overflow: "visible" },
|
|
55
|
+
className: classes.cards,
|
|
56
|
+
children: /* @__PURE__ */ jsxs(CardContent, { children: [
|
|
57
|
+
/* @__PURE__ */ jsx(
|
|
58
|
+
Tabs,
|
|
59
|
+
{
|
|
60
|
+
indicatorColor: "primary",
|
|
61
|
+
onChange: (_, index) => setTabIndex(index),
|
|
62
|
+
value: safeTabIndex,
|
|
63
|
+
children: tabs.map((tab, index) => /* @__PURE__ */ jsx(
|
|
64
|
+
Tab,
|
|
65
|
+
{
|
|
66
|
+
className: classes.default,
|
|
67
|
+
label: tab.label,
|
|
68
|
+
value: index,
|
|
69
|
+
classes: { selected: classes.selected }
|
|
70
|
+
},
|
|
71
|
+
tab.id
|
|
72
|
+
))
|
|
73
|
+
}
|
|
74
|
+
),
|
|
75
|
+
/* @__PURE__ */ jsxs(Box, { ml: 2, pt: 2, my: 1, display: "flex", flexDirection: "column", children: [
|
|
76
|
+
safeTabIndex === 0 && /* @__PURE__ */ jsx(ReportDetailsEventsTable, { hash }),
|
|
77
|
+
safeTabIndex === 1 && /* @__PURE__ */ jsx(ReportDetailsLogsTable, { hash })
|
|
78
|
+
] })
|
|
79
|
+
] })
|
|
80
|
+
}
|
|
81
|
+
)
|
|
82
|
+
] });
|
|
70
83
|
};
|
|
71
84
|
|
|
72
85
|
export { ReportDetailsPage };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ReportDetailsPage.esm.js","sources":["../../../src/components/ReportDetailsPage/ReportDetailsPage.tsx"],"sourcesContent":["/*\n * Copyright 2020 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 { Link as RouterLink, useParams } from 'react-router-dom';\nimport { Breadcrumbs, Link } from '@backstage/core-components';\nimport { makeStyles } from '@material-ui/core/styles';\nimport { useRouteRef } from '@backstage/core-plugin-api';\nimport { puppetDbRouteRef } from '../../routes';\nimport
|
|
1
|
+
{"version":3,"file":"ReportDetailsPage.esm.js","sources":["../../../src/components/ReportDetailsPage/ReportDetailsPage.tsx"],"sourcesContent":["/*\n * Copyright 2020 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 { Link as RouterLink, useParams } from 'react-router-dom';\nimport { Breadcrumbs, Link } from '@backstage/core-components';\nimport { makeStyles } from '@material-ui/core/styles';\nimport { useRouteRef } from '@backstage/core-plugin-api';\nimport { puppetDbRouteRef } from '../../routes';\nimport { useState } from 'react';\nimport Card from '@material-ui/core/Card';\nimport CardContent from '@material-ui/core/CardContent';\nimport Tab from '@material-ui/core/Tab';\nimport Box from '@material-ui/core/Box';\nimport Typography from '@material-ui/core/Typography';\nimport Tabs from '@material-ui/core/Tabs';\nimport { ReportDetailsEventsTable } from './ReportDetailsEventsTable';\nimport { ReportDetailsLogsTable } from './ReportDetailsLogsTable';\n\nconst useStyles = makeStyles(theme => ({\n cards: {\n marginTop: theme.spacing(2),\n },\n tabs: {\n borderBottom: `1px solid ${theme.palette.textVerySubtle}`,\n backgroundColor: theme.palette.background.default,\n padding: theme.spacing(0, 4),\n },\n default: {\n padding: theme.spacing(2),\n fontWeight: theme.typography.fontWeightBold,\n color: theme.palette.text.secondary,\n textTransform: 'uppercase',\n },\n selected: {\n color: theme.palette.text.primary,\n },\n}));\n\n/**\n * Component for displaying the details of a PuppetDB report.\n *\n * @public\n */\nexport const ReportDetailsPage = () => {\n const { hash = '' } = useParams();\n const classes = useStyles();\n const [tabIndex, setTabIndex] = useState(0);\n const reportsRouteLink = useRouteRef(puppetDbRouteRef);\n const tabs = [\n { id: 'events', label: 'Events' },\n { id: 'logs', label: 'Logs' },\n ];\n const safeTabIndex = tabIndex > tabs.length - 1 ? 0 : tabIndex;\n\n return (\n <div>\n <Breadcrumbs aria-label=\"breadcrumb\">\n <Link component={RouterLink} to={reportsRouteLink()}>\n PuppetDB Reports\n </Link>\n <Typography noWrap>{hash}</Typography>\n </Breadcrumbs>\n <Card\n style={{ position: 'relative', overflow: 'visible' }}\n className={classes.cards}\n >\n <CardContent>\n <Tabs\n indicatorColor=\"primary\"\n onChange={(_, index) => setTabIndex(index)}\n value={safeTabIndex}\n >\n {tabs.map((tab, index) => (\n <Tab\n className={classes.default}\n label={tab.label}\n key={tab.id}\n value={index}\n classes={{ selected: classes.selected }}\n />\n ))}\n </Tabs>\n <Box ml={2} pt={2} my={1} display=\"flex\" flexDirection=\"column\">\n {safeTabIndex === 0 && <ReportDetailsEventsTable hash={hash} />}\n {safeT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AA,WACH;AAAA,0BACA,IAAA,CAAC,GAAI,EAAA,EAAA,EAAA,EAAI,CAAG,EAAA,EAAA,EAAI,CAAG,EAAA,EAAA,EAAI,CAAG,EAAA,OAAA,EAAQ,MAAO,EAAA,aAAA,EAAc,QACpD,EAAA,QAAA,EAAA;AAAA,YAAiB,YAAA,KAAA,CAAA,oBAAM,GAAA,CAAA,wBAAA,EAAA,EAAyB,IAAY,EAAA,CAAA;AAAA,YAC5D,YAAiB,KAAA,CAAA,oBAAM,GAAA,CAAA,sBAAA,EAAA,EAAuB,IAAY,EAAA;AAAA,WAC7D,EAAA;AAAA,SACF,EAAA;AAAA;AAAA;AACF,GACF,EAAA,CAAA;AAEJ;;;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
2
|
import { ReportsTable } from './ReportsTable.esm.js';
|
|
3
3
|
import { Page, Content } from '@backstage/core-components';
|
|
4
4
|
import { useEntity } from '@backstage/plugin-catalog-react';
|
|
@@ -7,7 +7,7 @@ import { ANNOTATION_PUPPET_CERTNAME } from '../../constants.esm.js';
|
|
|
7
7
|
const ReportsPage = () => {
|
|
8
8
|
const { entity } = useEntity();
|
|
9
9
|
const certName = entity?.metadata?.annotations?.[ANNOTATION_PUPPET_CERTNAME] ?? "";
|
|
10
|
-
return /* @__PURE__ */
|
|
10
|
+
return /* @__PURE__ */ jsx(Page, { themeId: "tool", children: /* @__PURE__ */ jsx(Content, { children: /* @__PURE__ */ jsx(ReportsTable, { certName }) }) });
|
|
11
11
|
};
|
|
12
12
|
|
|
13
13
|
export { ReportsPage };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ReportsPage.esm.js","sources":["../../../src/components/ReportsPage/ReportsPage.tsx"],"sourcesContent":["/*\n * Copyright 2020 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
|
|
1
|
+
{"version":3,"file":"ReportsPage.esm.js","sources":["../../../src/components/ReportsPage/ReportsPage.tsx"],"sourcesContent":["/*\n * Copyright 2020 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 { ReportsTable } from './ReportsTable';\nimport { Page, Content } from '@backstage/core-components';\nimport { useEntity } from '@backstage/plugin-catalog-react';\nimport { ANNOTATION_PUPPET_CERTNAME } from '../../constants';\n\n/**\n * Component to display PuppetDB reports page.\n *\n * @public\n */\nexport const ReportsPage = () => {\n const { entity } = useEntity();\n const certName =\n entity?.metadata?.annotations?.[ANNOTATION_PUPPET_CERTNAME] ?? '';\n\n return (\n <Page themeId=\"tool\">\n <Content>\n <ReportsTable certName={certName} />\n </Content>\n </Page>\n );\n};\n"],"names":[],"mappings":";;;;;;AAyBO,MAAM,cAAc,MAAM;AAC/B,EAAM,MAAA,EAAE,MAAO,EAAA,GAAI,SAAU,EAAA;AAC7B,EAAA,MAAM,QACJ,GAAA,MAAA,EAAQ,QAAU,EAAA,WAAA,GAAc,0BAA0B,CAAK,IAAA,EAAA;AAEjE,EACE,uBAAA,GAAA,CAAC,IAAK,EAAA,EAAA,OAAA,EAAQ,MACZ,EAAA,QAAA,kBAAA,GAAA,CAAC,WACC,QAAC,kBAAA,GAAA,CAAA,YAAA,EAAA,EAAa,QAAoB,EAAA,CAAA,EACpC,CACF,EAAA,CAAA;AAEJ;;;;"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
1
2
|
import { puppetDbApiRef } from '../../api/types.esm.js';
|
|
2
3
|
import '@backstage/errors';
|
|
3
4
|
import useAsync from 'react-use/esm/useAsync';
|
|
4
|
-
import React from 'react';
|
|
5
5
|
import { ResponseErrorPanel, Table, Link } from '@backstage/core-components';
|
|
6
6
|
import { useApi, useRouteRef } from '@backstage/core-plugin-api';
|
|
7
7
|
import { makeStyles } from '@material-ui/core/styles';
|
|
@@ -26,19 +26,19 @@ const ReportsTable = (props) => {
|
|
|
26
26
|
return puppetDbApi.getPuppetDbNodeReports(certName);
|
|
27
27
|
}, [puppetDbApi, certName]);
|
|
28
28
|
if (error) {
|
|
29
|
-
return /* @__PURE__ */
|
|
29
|
+
return /* @__PURE__ */ jsx(ResponseErrorPanel, { error });
|
|
30
30
|
}
|
|
31
31
|
const columns = [
|
|
32
32
|
{
|
|
33
33
|
title: "Configuration Version",
|
|
34
34
|
field: "configuration_version",
|
|
35
|
-
render: (rowData) => /* @__PURE__ */
|
|
35
|
+
render: (rowData) => /* @__PURE__ */ jsx(
|
|
36
36
|
Link,
|
|
37
37
|
{
|
|
38
38
|
component: Link$1,
|
|
39
|
-
to: reportsRouteLink({ hash: rowData.hash })
|
|
40
|
-
|
|
41
|
-
|
|
39
|
+
to: reportsRouteLink({ hash: rowData.hash }),
|
|
40
|
+
children: rowData.configuration_version !== "" ? /* @__PURE__ */ jsx(Typography, { noWrap: true, children: rowData.configuration_version }) : /* @__PURE__ */ jsx(Typography, { noWrap: true, children: /* @__PURE__ */ jsx("em", { children: "(N/A)" }) })
|
|
41
|
+
}
|
|
42
42
|
)
|
|
43
43
|
},
|
|
44
44
|
{
|
|
@@ -46,14 +46,14 @@ const ReportsTable = (props) => {
|
|
|
46
46
|
field: "start_time",
|
|
47
47
|
align: "center",
|
|
48
48
|
width: "300px",
|
|
49
|
-
render: (rowData) => /* @__PURE__ */
|
|
49
|
+
render: (rowData) => /* @__PURE__ */ jsx(Typography, { noWrap: true, children: new Date(Date.parse(rowData.start_time)).toLocaleString() })
|
|
50
50
|
},
|
|
51
51
|
{
|
|
52
52
|
title: "End Time",
|
|
53
53
|
field: "end_time",
|
|
54
54
|
align: "center",
|
|
55
55
|
width: "300px",
|
|
56
|
-
render: (rowData) => /* @__PURE__ */
|
|
56
|
+
render: (rowData) => /* @__PURE__ */ jsx(Typography, { noWrap: true, children: new Date(Date.parse(rowData.end_time)).toLocaleString() })
|
|
57
57
|
},
|
|
58
58
|
{
|
|
59
59
|
title: "Run Duration",
|
|
@@ -63,7 +63,15 @@ const ReportsTable = (props) => {
|
|
|
63
63
|
const start_date = new Date(Date.parse(rowData.start_time));
|
|
64
64
|
const end_date = new Date(Date.parse(rowData.end_time));
|
|
65
65
|
const duration = new Date(end_date.getTime() - start_date.getTime());
|
|
66
|
-
return /* @__PURE__ */
|
|
66
|
+
return /* @__PURE__ */ jsxs(Typography, { noWrap: true, children: [
|
|
67
|
+
duration.getUTCHours().toString().padStart(2, "0"),
|
|
68
|
+
":",
|
|
69
|
+
duration.getUTCMinutes().toString().padStart(2, "0"),
|
|
70
|
+
":",
|
|
71
|
+
duration.getUTCSeconds().toString().padStart(2, "0"),
|
|
72
|
+
".",
|
|
73
|
+
duration.getUTCMilliseconds().toString().padStart(4, "0")
|
|
74
|
+
] });
|
|
67
75
|
}
|
|
68
76
|
},
|
|
69
77
|
{
|
|
@@ -74,16 +82,16 @@ const ReportsTable = (props) => {
|
|
|
74
82
|
title: "Mode",
|
|
75
83
|
field: "noop",
|
|
76
84
|
align: "center",
|
|
77
|
-
render: (rowData) => rowData.noop ? /* @__PURE__ */
|
|
85
|
+
render: (rowData) => rowData.noop ? /* @__PURE__ */ jsx(Typography, { children: "NOOP" }) : /* @__PURE__ */ jsx(Typography, { children: "NO-NOOP" })
|
|
78
86
|
},
|
|
79
87
|
{
|
|
80
88
|
title: "Status",
|
|
81
89
|
field: "status",
|
|
82
90
|
align: "center",
|
|
83
|
-
render: (rowData) => /* @__PURE__ */
|
|
91
|
+
render: (rowData) => /* @__PURE__ */ jsx(StatusField, { status: rowData.status })
|
|
84
92
|
}
|
|
85
93
|
];
|
|
86
|
-
return /* @__PURE__ */
|
|
94
|
+
return /* @__PURE__ */ jsx(
|
|
87
95
|
Table,
|
|
88
96
|
{
|
|
89
97
|
options: {
|
|
@@ -97,7 +105,7 @@ const ReportsTable = (props) => {
|
|
|
97
105
|
pageSize: 10,
|
|
98
106
|
pageSizeOptions: [10]
|
|
99
107
|
},
|
|
100
|
-
emptyContent: /* @__PURE__ */
|
|
108
|
+
emptyContent: /* @__PURE__ */ jsx(Typography, { color: "textSecondary", className: classes.empty, children: "No reports" }),
|
|
101
109
|
title: `Latest PuppetDB reports from node ${certName}`,
|
|
102
110
|
columns,
|
|
103
111
|
data: value || [],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ReportsTable.esm.js","sources":["../../../src/components/ReportsPage/ReportsTable.tsx"],"sourcesContent":["/*\n * Copyright 2022 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { puppetDbApiRef, PuppetDbReport } from '../../api';\nimport useAsync from 'react-use/esm/useAsync';\nimport
|
|
1
|
+
{"version":3,"file":"ReportsTable.esm.js","sources":["../../../src/components/ReportsPage/ReportsTable.tsx"],"sourcesContent":["/*\n * Copyright 2022 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { puppetDbApiRef, PuppetDbReport } from '../../api';\nimport useAsync from 'react-use/esm/useAsync';\nimport {\n Link,\n ResponseErrorPanel,\n Table,\n TableColumn,\n} from '@backstage/core-components';\nimport { useApi, useRouteRef } from '@backstage/core-plugin-api';\nimport { makeStyles } from '@material-ui/core/styles';\nimport Typography from '@material-ui/core/Typography';\nimport { Link as RouterLink } from 'react-router-dom';\nimport { puppetDbReportRouteRef } from '../../routes';\nimport { StatusField } from '../StatusField';\n\ntype ReportsTableProps = {\n certName: string;\n};\n\nconst useStyles = makeStyles(theme => ({\n empty: {\n padding: theme.spacing(2),\n display: 'flex',\n justifyContent: 'center',\n },\n}));\n\n/**\n * Component for displaying a table of PuppetDB reports for a given node.\n *\n * @public\n */\nexport const ReportsTable = (props: ReportsTableProps) => {\n const { certName } = props;\n const puppetDbApi = useApi(puppetDbApiRef);\n const reportsRouteLink = useRouteRef(puppetDbReportRouteRef);\n const classes = useStyles();\n\n const { value, loading, error } = useAsync(async () => {\n return puppetDbApi.getPuppetDbNodeReports(certName);\n }, [puppetDbApi, certName]);\n\n if (error) {\n return <ResponseErrorPanel error={error} />;\n }\n\n const columns: TableColumn<PuppetDbReport>[] = [\n {\n title: 'Configuration Version',\n field: 'configuration_version',\n render: rowData => (\n <Link\n component={RouterLink}\n to={reportsRouteLink({ hash: rowData.hash! })}\n >\n {rowData.configuration_version !== '' ? (\n <Typography noWrap>{rowData.configuration_version}</Typography>\n ) : (\n <Typography noWrap>\n <em>(N/A)</em>\n </Typography>\n )}\n </Link>\n ),\n },\n {\n title: 'Start Time',\n field: 'start_time',\n align: 'center',\n width: '300px',\n render: rowData => (\n <Typography noWrap>\n {new Date(Date.parse(rowData.start_time)).toLocaleString()}\n </Typography>\n ),\n },\n {\n title: 'End Time',\n field: 'end_time',\n align: 'center',\n width: '300px',\n render: rowData => (\n <Typography noWrap>\n {new Date(Date.parse(rowData.end_time)).toLocaleString()}\n </Typography>\n ),\n },\n {\n title: 'Run Duration',\n align: 'center',\n width: '400px',\n render: rowData => {\n const start_date = new Date(Date.parse(rowData.start_time));\n const end_date = new Date(Date.parse(rowData.end_time));\n const duration = new Date(end_date.getTime() - start_date.getTime());\n return (\n <Typography noWrap>\n {duration.getUTCHours().toString().padStart(2, '0')}:\n {duration.getUTCMinutes().toString().padStart(2, '0')}:\n {duration.getUTCSeconds().toString().padStart(2, '0')}.\n {duration.getUTCMilliseconds().toString().padStart(4, '0')}\n </Typography>\n );\n },\n },\n {\n title: 'Environment',\n field: 'environment',\n },\n {\n title: 'Mode',\n field: 'noop',\n align: 'center',\n render: rowData =>\n rowData.noop ? (\n <Typography>NOOP</Typography>\n ) : (\n <Typography>NO-NOOP</Typography>\n ),\n },\n {\n title: 'Status',\n field: 'status',\n align: 'center',\n render: rowData => <StatusField status={rowData.status} />,\n },\n ];\n\n return (\n <Table\n options={{\n sorting: true,\n actionsColumnIndex: -1,\n loadingType: 'linear',\n padding: 'dense',\n showEmptyDataSourceMessage: !loading,\n showTitle: true,\n toolbar: true,\n pageSize: 10,\n pageSizeOptions: [10],\n }}\n emptyContent={\n <Typography color=\"textSecondary\" className={classes.empty}>\n No reports\n </Typography>\n }\n title={`Latest PuppetDB reports from node ${certName}`}\n columns={columns}\n data={value || []}\n isLoading={loading}\n />\n );\n};\n"],"names":["RouterLink"],"mappings":";;;;;;;;;;;;AAkCA,MAAM,SAAA,GAAY,WAAW,CAAU,KAAA,MAAA;AAAA,EACrC,KAAO,EAAA;AAAA,IACL,OAAA,EAAS,KAAM,CAAA,OAAA,CAAQ,CAAC,CAAA;AAAA,IACxB,OAAS,EAAA,MAAA;AAAA,IACT,cAAgB,EAAA;AAAA;AAEpB,CAAE,CAAA,CA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AA,CAAA;AAAA,MAEF,KAAA,EAAO,qCAAqC,QAAQ,CAAA,CAAA;AAAA,MACpD,OAAA;AAAA,MACA,IAAA,EAAM,SAAS,EAAC;AAAA,MAChB,SAAW,EAAA;AAAA;AAAA,GACb;AAEJ;;;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
2
|
import { Routes, Route } from 'react-router-dom';
|
|
3
3
|
import { puppetDbReportRouteRef } from '../routes.esm.js';
|
|
4
4
|
import { ANNOTATION_PUPPET_CERTNAME } from '../constants.esm.js';
|
|
@@ -13,15 +13,18 @@ const isPuppetDbAvailable = (entity) => Boolean(entity.metadata.annotations?.[AN
|
|
|
13
13
|
const Router = () => {
|
|
14
14
|
const { entity } = useEntity();
|
|
15
15
|
if (!isPuppetDbAvailable(entity)) {
|
|
16
|
-
return /* @__PURE__ */
|
|
16
|
+
return /* @__PURE__ */ jsx(MissingAnnotationEmptyState, { annotation: ANNOTATION_PUPPET_CERTNAME });
|
|
17
17
|
}
|
|
18
|
-
return /* @__PURE__ */
|
|
19
|
-
Route,
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
18
|
+
return /* @__PURE__ */ jsxs(Routes, { children: [
|
|
19
|
+
/* @__PURE__ */ jsx(Route, { path: "/", element: /* @__PURE__ */ jsx(ReportsPage, {}) }),
|
|
20
|
+
/* @__PURE__ */ jsx(
|
|
21
|
+
Route,
|
|
22
|
+
{
|
|
23
|
+
path: `${puppetDbReportRouteRef.path}`,
|
|
24
|
+
element: /* @__PURE__ */ jsx(ReportDetailsPage, {})
|
|
25
|
+
}
|
|
26
|
+
)
|
|
27
|
+
] });
|
|
25
28
|
};
|
|
26
29
|
|
|
27
30
|
export { Router, isPuppetDbAvailable };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Router.esm.js","sources":["../../src/components/Router.tsx"],"sourcesContent":["/*\n * Copyright 2020 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
|
|
1
|
+
{"version":3,"file":"Router.esm.js","sources":["../../src/components/Router.tsx"],"sourcesContent":["/*\n * Copyright 2020 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 { Routes, Route } from 'react-router-dom';\nimport { puppetDbReportRouteRef } from '../routes';\nimport { ANNOTATION_PUPPET_CERTNAME } from '../constants';\nimport { Entity } from '@backstage/catalog-model';\nimport {\n useEntity,\n MissingAnnotationEmptyState,\n} from '@backstage/plugin-catalog-react';\nimport { ReportsPage } from './ReportsPage';\nimport { ReportDetailsPage } from './ReportDetailsPage';\n\n/**\n * Checks if the entity has a puppet certname annotation.\n * @param entity - The entity to check for the puppet certname annotation.\n *\n * @public\n */\nexport const isPuppetDbAvailable = (entity: Entity) =>\n Boolean(entity.metadata.annotations?.[ANNOTATION_PUPPET_CERTNAME]);\n\n/** @public */\nexport const Router = () => {\n const { entity } = useEntity();\n\n if (!isPuppetDbAvailable(entity)) {\n return (\n <MissingAnnotationEmptyState annotation={ANNOTATION_PUPPET_CERTNAME} />\n );\n }\n\n return (\n <Routes>\n <Route path=\"/\" element={<ReportsPage />} />\n <Route\n path={`${puppetDbReportRouteRef.path}`}\n element={<ReportDetailsPage />}\n />\n </Routes>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;AAiCa,MAAA,mBAAA,GAAsB,CAAC,MAClC,KAAA,OAAA,CAAQ,OAAO,QAAS,CAAA,WAAA,GAAc,0BAA0B,CAAC;AAG5D,MAAM,SAAS,MAAM;AAC1B,EAAM,MAAA,EAAE,MAAO,EAAA,GAAI,SAAU,EAAA;AAE7B,EAAI,IAAA,CAAC,mBAAoB,CAAA,MAAM,CAAG,EAAA;AAChC,IACE,uBAAA,GAAA,CAAC,2BAA4B,EAAA,EAAA,UAAA,EAAY,0BAA4B,EAAA,CAAA;AAAA;AAIzE,EAAA,4BACG,MACC,EAAA,EAAA,QAAA,EAAA;AAAA,oBAAA,GAAA,CAAC,SAAM,IAAK,EAAA,GAAA,EAAI,OAAS,kBAAA,GAAA,CAAC,eAAY,CAAI,EAAA,CAAA;AAAA,oBAC1C,GAAA;AAAA,MAAC,KAAA;AAAA,MAAA;AAAA,QACC,IAAA,EAAM,CAAG,EAAA,sBAAA,CAAuB,IAAI,CAAA,CAAA;AAAA,QACpC,OAAA,sBAAU,iBAAkB,EAAA,EAAA;AAAA;AAAA;AAC9B,GACF,EAAA,CAAA;AAEJ;;;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
2
2
|
import { StatusOK, StatusPending, StatusRunning, StatusError } from '@backstage/core-components';
|
|
3
3
|
|
|
4
4
|
const StatusField = (props) => {
|
|
@@ -6,13 +6,25 @@ const StatusField = (props) => {
|
|
|
6
6
|
const statusUC = status.toLocaleUpperCase("en-US");
|
|
7
7
|
switch (status) {
|
|
8
8
|
case "failed":
|
|
9
|
-
return /* @__PURE__ */
|
|
9
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
10
|
+
/* @__PURE__ */ jsx(StatusError, {}),
|
|
11
|
+
statusUC
|
|
12
|
+
] });
|
|
10
13
|
case "changed":
|
|
11
|
-
return /* @__PURE__ */
|
|
14
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
15
|
+
/* @__PURE__ */ jsx(StatusRunning, {}),
|
|
16
|
+
statusUC
|
|
17
|
+
] });
|
|
12
18
|
case "unchanged":
|
|
13
|
-
return /* @__PURE__ */
|
|
19
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
20
|
+
/* @__PURE__ */ jsx(StatusPending, {}),
|
|
21
|
+
statusUC
|
|
22
|
+
] });
|
|
14
23
|
default:
|
|
15
|
-
return /* @__PURE__ */
|
|
24
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
25
|
+
/* @__PURE__ */ jsx(StatusOK, {}),
|
|
26
|
+
statusUC
|
|
27
|
+
] });
|
|
16
28
|
}
|
|
17
29
|
};
|
|
18
30
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StatusField.esm.js","sources":["../../../src/components/StatusField/StatusField.tsx"],"sourcesContent":["/*\n * Copyright 2020 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
|
|
1
|
+
{"version":3,"file":"StatusField.esm.js","sources":["../../../src/components/StatusField/StatusField.tsx"],"sourcesContent":["/*\n * Copyright 2020 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 {\n StatusPending,\n StatusRunning,\n StatusOK,\n StatusError,\n} from '@backstage/core-components';\n\ntype StatusCellProps = {\n status: string;\n};\n\n/**\n * Component to display status field for Puppet reports and events.\n *\n * @public\n */\nexport const StatusField = (props: StatusCellProps) => {\n const { status } = props;\n\n const statusUC = status.toLocaleUpperCase('en-US');\n switch (status) {\n case 'failed':\n return (\n <>\n <StatusError />\n {statusUC}\n </>\n );\n case 'changed':\n return (\n <>\n <StatusRunning />\n {statusUC}\n </>\n );\n case 'unchanged':\n return (\n <>\n <StatusPending />\n {statusUC}\n </>\n );\n default:\n return (\n <>\n <StatusOK />\n {statusUC}\n </>\n );\n }\n};\n"],"names":[],"mappings":";;;AAgCa,MAAA,WAAA,GAAc,CAAC,KAA2B,KAAA;AACrD,EAAM,MAAA,EAAE,QAAW,GAAA,KAAA;AAEnB,EAAM,MAAA,QAAA,GAAW,MAAO,CAAA,iBAAA,CAAkB,OAAO,CAAA;AACjD,EAAA,QAAQ,MAAQ;AAAA,IACd,KAAK,QAAA;AACH,MAAA,uBAEI,IAAA,CAAA,QAAA,EAAA,EAAA,QAAA,EAAA;AAAA,wBAAA,GAAA,CAAC,WAAY,EAAA,EAAA,CAAA;AAAA,QACZ;AAAA,OACH,EAAA,CAAA;AAAA,IAEJ,KAAK,SAAA;AACH,MAAA,uBAEI,IAAA,CAAA,QAAA,EAAA,EAAA,QAAA,EAAA;AAAA,wBAAA,GAAA,CAAC,aAAc,EAAA,EAAA,CAAA;AAAA,QACd;AAAA,OACH,EAAA,CAAA;AAAA,IAEJ,KAAK,WAAA;AACH,MAAA,uBAEI,IAAA,CAAA,QAAA,EAAA,EAAA,QAAA,EAAA;AAAA,wBAAA,GAAA,CAAC,aAAc,EAAA,EAAA,CAAA;AAAA,QACd;AAAA,OACH,EAAA,CAAA;AAAA,IAEJ;AACE,MAAA,uBAEI,IAAA,CAAA,QAAA,EAAA,EAAA,QAAA,EAAA;AAAA,wBAAA,GAAA,CAAC,QAAS,EAAA,EAAA,CAAA;AAAA,QACT;AAAA,OACH,EAAA,CAAA;AAAA;AAGR;;;;"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
import * as react from 'react';
|
|
3
|
-
import react__default from 'react';
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
4
2
|
import * as _backstage_core_plugin_api from '@backstage/core-plugin-api';
|
|
5
3
|
import { Entity } from '@backstage/catalog-model';
|
|
6
4
|
|
|
@@ -15,7 +13,7 @@ declare const puppetdbPlugin: _backstage_core_plugin_api.BackstagePlugin<{}, {},
|
|
|
15
13
|
*
|
|
16
14
|
* @public
|
|
17
15
|
*/
|
|
18
|
-
declare const PuppetDbPage: () =>
|
|
16
|
+
declare const PuppetDbPage: () => react_jsx_runtime.JSX.Element;
|
|
19
17
|
|
|
20
18
|
/**
|
|
21
19
|
* Checks if the entity has a puppet certname annotation.
|
|
@@ -25,7 +23,7 @@ declare const PuppetDbPage: () => react.JSX.Element;
|
|
|
25
23
|
*/
|
|
26
24
|
declare const isPuppetDbAvailable: (entity: Entity) => boolean;
|
|
27
25
|
/** @public */
|
|
28
|
-
declare const Router: () =>
|
|
26
|
+
declare const Router: () => react_jsx_runtime.JSX.Element;
|
|
29
27
|
|
|
30
28
|
/** @public */
|
|
31
29
|
declare const puppetDbRouteRef: _backstage_core_plugin_api.RouteRef<undefined>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@backstage-community/plugin-puppetdb",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"description": "Backstage plugin to visualize resource information and Puppet facts from PuppetDB.",
|
|
5
5
|
"backstage": {
|
|
6
6
|
"role": "frontend-plugin",
|
|
@@ -42,20 +42,20 @@
|
|
|
42
42
|
"test": "backstage-cli package test"
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"@backstage/catalog-model": "^1.7.
|
|
46
|
-
"@backstage/core-components": "^0.17.
|
|
47
|
-
"@backstage/core-plugin-api": "^1.10.
|
|
45
|
+
"@backstage/catalog-model": "^1.7.4",
|
|
46
|
+
"@backstage/core-components": "^0.17.2",
|
|
47
|
+
"@backstage/core-plugin-api": "^1.10.7",
|
|
48
48
|
"@backstage/errors": "^1.2.7",
|
|
49
|
-
"@backstage/plugin-catalog-react": "^1.
|
|
49
|
+
"@backstage/plugin-catalog-react": "^1.18.0",
|
|
50
50
|
"@material-ui/core": "^4.12.2",
|
|
51
51
|
"@types/react": "^16.13.1 || ^17.0.0 || ^18.0.0",
|
|
52
52
|
"react-use": "^17.2.4"
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
55
|
-
"@backstage/cli": "^0.
|
|
56
|
-
"@backstage/core-app-api": "^1.
|
|
57
|
-
"@backstage/dev-utils": "^1.1.
|
|
58
|
-
"@backstage/test-utils": "^1.7.
|
|
55
|
+
"@backstage/cli": "^0.32.1",
|
|
56
|
+
"@backstage/core-app-api": "^1.17.0",
|
|
57
|
+
"@backstage/dev-utils": "^1.1.10",
|
|
58
|
+
"@backstage/test-utils": "^1.7.8",
|
|
59
59
|
"@testing-library/dom": "^10.0.0",
|
|
60
60
|
"@testing-library/jest-dom": "^6.0.0",
|
|
61
61
|
"@testing-library/react": "^15.0.0",
|
|
@@ -70,5 +70,12 @@
|
|
|
70
70
|
"react-dom": "^16.13.1 || ^17.0.0 || ^18.0.0",
|
|
71
71
|
"react-router-dom": "6.0.0-beta.0 || ^6.3.0"
|
|
72
72
|
},
|
|
73
|
+
"typesVersions": {
|
|
74
|
+
"*": {
|
|
75
|
+
"package.json": [
|
|
76
|
+
"package.json"
|
|
77
|
+
]
|
|
78
|
+
}
|
|
79
|
+
},
|
|
73
80
|
"module": "./dist/index.esm.js"
|
|
74
81
|
}
|