@backstage-community/plugin-multi-source-security-viewer 0.2.3 → 0.3.2
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 +23 -0
- package/README.md +1 -0
- package/dist/components/DialogLauncher/DialogLauncher.esm.js +17 -11
- package/dist/components/DialogLauncher/DialogLauncher.esm.js.map +1 -1
- package/dist/components/EmptyState/EmptyState.esm.js +12 -9
- package/dist/components/EmptyState/EmptyState.esm.js.map +1 -1
- package/dist/components/EmptyState/EmptyStateNoData.esm.js +2 -2
- package/dist/components/EmptyState/EmptyStateNoData.esm.js.map +1 -1
- package/dist/components/EmptyState/EmptyStateNoMatch.esm.js +2 -2
- package/dist/components/EmptyState/EmptyStateNoMatch.esm.js.map +1 -1
- package/dist/components/EmptyState/EmptyStateSpinner.esm.js +7 -6
- package/dist/components/EmptyState/EmptyStateSpinner.esm.js.map +1 -1
- package/dist/components/Icons/CriticalIcon.esm.js +5 -5
- package/dist/components/Icons/CriticalIcon.esm.js.map +1 -1
- package/dist/components/Icons/EqualsIcon.esm.js +5 -5
- package/dist/components/Icons/EqualsIcon.esm.js.map +1 -1
- package/dist/components/Icons/IconWithValue.esm.js +7 -2
- package/dist/components/Icons/IconWithValue.esm.js.map +1 -1
- package/dist/components/Icons/LogsIcon.esm.js +6 -8
- package/dist/components/Icons/LogsIcon.esm.js.map +1 -1
- package/dist/components/Icons/OutputIcon.esm.js +5 -5
- package/dist/components/Icons/OutputIcon.esm.js.map +1 -1
- package/dist/components/Icons/SBOMLink.esm.js +6 -8
- package/dist/components/Icons/SBOMLink.esm.js.map +1 -1
- package/dist/components/PermissionAlert/PermissionAlert.esm.js +5 -2
- package/dist/components/PermissionAlert/PermissionAlert.esm.js.map +1 -1
- package/dist/components/PipelineRunList/PipelineRunList.esm.js +34 -30
- package/dist/components/PipelineRunList/PipelineRunList.esm.js.map +1 -1
- package/dist/components/PipelineRunList/PipelineRunOutput.esm.js +5 -4
- package/dist/components/PipelineRunList/PipelineRunOutput.esm.js.map +1 -1
- package/dist/components/PipelineRunList/PipelineRunSBOMLink.esm.js +31 -29
- package/dist/components/PipelineRunList/PipelineRunSBOMLink.esm.js.map +1 -1
- package/dist/components/PipelineRunList/PipelineRunTable.esm.js +12 -6
- package/dist/components/PipelineRunList/PipelineRunTable.esm.js.map +1 -1
- package/dist/components/PipelineRunList/PipelineRunTableBody.esm.js +2 -2
- package/dist/components/PipelineRunList/PipelineRunTableBody.esm.js.map +1 -1
- package/dist/components/PipelineRunList/PipelineRunTableColumns.esm.js +4 -3
- package/dist/components/PipelineRunList/PipelineRunTableColumns.esm.js.map +1 -1
- package/dist/components/PipelineRunList/PipelineRunTablePagination.esm.js +98 -86
- package/dist/components/PipelineRunList/PipelineRunTablePagination.esm.js.map +1 -1
- package/dist/components/PipelineRunList/PipelineRunTableRow.esm.js +44 -34
- package/dist/components/PipelineRunList/PipelineRunTableRow.esm.js.map +1 -1
- package/dist/components/PipelineRunList/PipelineRunTableRowActions.esm.js +64 -56
- package/dist/components/PipelineRunList/PipelineRunTableRowActions.esm.js.map +1 -1
- package/dist/components/PipelineRunList/PipelineRunToolbar.esm.js +41 -34
- package/dist/components/PipelineRunList/PipelineRunToolbar.esm.js.map +1 -1
- package/dist/components/PipelineRunLogs/PipelineRunLogs.esm.js +21 -21
- package/dist/components/PipelineRunLogs/PipelineRunLogs.esm.js.map +1 -1
- package/dist/components/PipelineRunLogs/PipelineRunLogsDownloader.esm.js +38 -27
- package/dist/components/PipelineRunLogs/PipelineRunLogsDownloader.esm.js.map +1 -1
- package/dist/components/PipelineRunLogs/PipelineRunStepViewer.esm.js +7 -6
- package/dist/components/PipelineRunLogs/PipelineRunStepViewer.esm.js.map +1 -1
- package/dist/components/PipelineRunLogs/PipelineRunStepper.esm.js +7 -6
- package/dist/components/PipelineRunLogs/PipelineRunStepper.esm.js.map +1 -1
- package/dist/components/Router.esm.js +36 -32
- package/dist/components/Router.esm.js.map +1 -1
- package/dist/components/SecurityViewer/SecurityViewerGithubActionsDetail.esm.js +2 -2
- package/dist/components/SecurityViewer/SecurityViewerGithubActionsDetail.esm.js.map +1 -1
- package/dist/components/SecurityViewer/SecurityViewerJenkinsDetail.esm.js +2 -2
- package/dist/components/SecurityViewer/SecurityViewerJenkinsDetail.esm.js.map +1 -1
- package/dist/components/SecurityViewer/SecurityViewerMultiCIPipelines.esm.js +24 -16
- package/dist/components/SecurityViewer/SecurityViewerMultiCIPipelines.esm.js.map +1 -1
- package/dist/components/SecurityViewer/SecurityViewerPipelineDetailList.esm.js +6 -5
- package/dist/components/SecurityViewer/SecurityViewerPipelineDetailList.esm.js.map +1 -1
- package/dist/components/SecurityViewer/SecurityViewerPipelineSummaryList.esm.js +6 -5
- package/dist/components/SecurityViewer/SecurityViewerPipelineSummaryList.esm.js.map +1 -1
- package/dist/components/SecurityViewer/SecurityViewerTabbedMultiCISummaryList.esm.js +13 -9
- package/dist/components/SecurityViewer/SecurityViewerTabbedMultiCISummaryList.esm.js.map +1 -1
- package/dist/hooks/useDarkTheme.esm.js +2 -2
- package/dist/hooks/useDarkTheme.esm.js.map +1 -1
- package/dist/hooks/usePipelineDetail.esm.js +2 -2
- package/dist/hooks/usePipelineDetail.esm.js.map +1 -1
- package/dist/hooks/usePipelineSummary.esm.js +2 -2
- package/dist/hooks/usePipelineSummary.esm.js.map +1 -1
- package/dist/index.d.ts +2 -3
- package/dist/plugin.esm.js +1 -1
- package/dist/plugin.esm.js.map +1 -1
- package/package.json +14 -14
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
|
+
import { useState, useRef, useMemo, useEffect, Fragment } from 'react';
|
|
2
3
|
import { debounce } from 'lodash';
|
|
3
4
|
import { PipelineRunTable } from './PipelineRunTable.esm.js';
|
|
4
5
|
import { PipelineRunToolbar } from './PipelineRunToolbar.esm.js';
|
|
@@ -11,11 +12,11 @@ const PipelineRunList = ({
|
|
|
11
12
|
error,
|
|
12
13
|
onUpdatePagination
|
|
13
14
|
}) => {
|
|
14
|
-
const [namefilter, setNameFilter] =
|
|
15
|
-
const [page, setPage] =
|
|
16
|
-
const [rowsPerPage, setRowsPerPage] =
|
|
17
|
-
const [count, setCount] =
|
|
18
|
-
const searchInputRef =
|
|
15
|
+
const [namefilter, setNameFilter] = useState("");
|
|
16
|
+
const [page, setPage] = useState(0);
|
|
17
|
+
const [rowsPerPage, setRowsPerPage] = useState(5);
|
|
18
|
+
const [count, setCount] = useState(0);
|
|
19
|
+
const searchInputRef = useRef(null);
|
|
19
20
|
const handleChangePage = (newPage) => {
|
|
20
21
|
setPage(newPage);
|
|
21
22
|
onUpdatePagination(newPage, rowsPerPage);
|
|
@@ -25,7 +26,7 @@ const PipelineRunList = ({
|
|
|
25
26
|
setPage(0);
|
|
26
27
|
onUpdatePagination(0, page * rows + rows);
|
|
27
28
|
};
|
|
28
|
-
const filteredData =
|
|
29
|
+
const filteredData = useMemo(() => {
|
|
29
30
|
return data?.filter(
|
|
30
31
|
(row) => row?.id?.toString().toLocaleLowerCase().includes(namefilter)
|
|
31
32
|
);
|
|
@@ -39,33 +40,36 @@ const PipelineRunList = ({
|
|
|
39
40
|
searchInputRef.current.value = "";
|
|
40
41
|
}
|
|
41
42
|
};
|
|
42
|
-
|
|
43
|
+
useEffect(() => {
|
|
43
44
|
if (!loading) {
|
|
44
45
|
setCount((prev) => totalCount > 0 ? totalCount : prev);
|
|
45
46
|
}
|
|
46
47
|
}, [loading, totalCount]);
|
|
47
|
-
return /* @__PURE__ */
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
{
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
48
|
+
return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs(Box, { children: [
|
|
49
|
+
/* @__PURE__ */ jsx(Box, { children: /* @__PURE__ */ jsx(
|
|
50
|
+
PipelineRunToolbar,
|
|
51
|
+
{
|
|
52
|
+
onSearch,
|
|
53
|
+
searchInputRef,
|
|
54
|
+
totalCount: totalCount > 0 ? totalCount : count,
|
|
55
|
+
page,
|
|
56
|
+
rowSize: [5, 10, 20],
|
|
57
|
+
rowsPerPage,
|
|
58
|
+
handleChangePage,
|
|
59
|
+
handleChangeRowsPerPage
|
|
60
|
+
}
|
|
61
|
+
) }),
|
|
62
|
+
/* @__PURE__ */ jsx(Box, { children: /* @__PURE__ */ jsx(
|
|
63
|
+
PipelineRunTable,
|
|
64
|
+
{
|
|
65
|
+
data: filteredData ?? [],
|
|
66
|
+
filterInput: namefilter,
|
|
67
|
+
filterClearAction,
|
|
68
|
+
isLoading: loading,
|
|
69
|
+
error
|
|
70
|
+
}
|
|
71
|
+
) })
|
|
72
|
+
] }) });
|
|
69
73
|
};
|
|
70
74
|
|
|
71
75
|
export { PipelineRunList };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PipelineRunList.esm.js","sources":["../../../src/components/PipelineRunList/PipelineRunList.tsx"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport
|
|
1
|
+
{"version":3,"file":"PipelineRunList.esm.js","sources":["../../../src/components/PipelineRunList/PipelineRunList.tsx"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport type { FC } from 'react';\n\nimport { useState, useRef, useMemo, useEffect, Fragment } from 'react';\nimport { debounce } from 'lodash';\nimport { PipelineRunTable } from './PipelineRunTable';\nimport { PipelineRunToolbar } from './PipelineRunToolbar';\nimport { Box } from '@material-ui/core';\nimport { PipelineRunResult } from '../../models/pipelineRunResult';\n\ntype PipelineRunListProps = {\n data: PipelineRunResult[] | null;\n totalCount: number;\n loading: boolean;\n error: Error | null;\n onUpdatePagination: (start: number, end: number) => void;\n};\n\nexport const PipelineRunList: FC<PipelineRunListProps> = ({\n data,\n totalCount,\n loading,\n error,\n onUpdatePagination,\n}) => {\n const [namefilter, setNameFilter] = useState('');\n const [page, setPage] = useState(0);\n const [rowsPerPage, setRowsPerPage] = useState(5);\n const [count, setCount] = useState(0);\n const searchInputRef = useRef<HTMLInputElement | null>(null);\n\n const handleChangePage = (newPage: number) => {\n setPage(newPage);\n onUpdatePagination(newPage, rowsPerPage);\n };\n\n const handleChangeRowsPerPage = (rows: number) => {\n setRowsPerPage(rows);\n setPage(0); // Set to zero when changing the number of rows\n onUpdatePagination(0, page * rows + rows);\n };\n\n const filteredData = useMemo(() => {\n return data?.filter((row: PipelineRunResult) =>\n row?.id?.toString().toLocaleLowerCase().includes(namefilter),\n );\n }, [data, namefilter]);\n\n const onSearch = debounce((n: string) => {\n setNameFilter(n);\n });\n\n const filterClearAction = () => {\n onSearch('');\n if (searchInputRef.current) {\n searchInputRef.current.value = '';\n }\n };\n\n useEffect(() => {\n if (!loading) {\n // Keep count while fetching paginated data\n setCount(prev => (totalCount > 0 ? totalCount : prev));\n }\n }, [loading, totalCount]);\n\n return (\n <Fragment>\n <Box>\n <Box>\n <PipelineRunToolbar\n onSearch={onSearch}\n searchInputRef={searchInputRef}\n totalCount={totalCount > 0 ? totalCount : count} // Initial count\n page={page}\n rowSize={[5, 10, 20]}\n rowsPerPage={rowsPerPage}\n handleChangePage={handleChangePage}\n handleChangeRowsPerPage={handleChangeRowsPerPage}\n />\n </Box>\n <Box>\n <PipelineRunTable\n data={filteredData ?? []}\n filterInput={namefilter}\n filterClearAction={filterClearAction}\n isLoading={loading}\n error={error}\n />\n </Box>\n </Box>\n </Fragment>\n );\n};\n"],"names":[],"mappings":";;;;;;;AAgCO,MAAM,kBAA4C,CAAC;AAAA,EACxD,IAAA;AAAA,EACA,UAAA;AAAA,EACA,OAAA;AAAA,EACA,KAAA;AAAA,EACA;AACF,CAAM,KAAA;AACJ,EAAA,MAAM,CAAC,UAAA,EAAY,aAAa,CAAA,GAAI,SAAS,EAAE,CAAA;AAC/C,EAAA,MAAM,CAAC,IAAA,EAAM,OAAO,CAAA,GAAI,SAAS,CAAC,CAAA;AAClC,EAAA,MAAM,CAAC,WAAA,EAAa,cAAc,CAAA,GAAI,SAAS,CAAC,CAAA;AAChD,EAAA,MAAM,CAAC,KAAA,EAAO,QAAQ,CAAA,GAAI,SAAS,CAAC,CAAA;AACpC,EAAM,MAAA,cAAA,GAAiB,OAAgC,IAAI,CAAA;AAE3D,EAAM,MAAA,gBAAA,GAAmB,CAAC,OAAoB,KAAA;AAC5C,IAAA,OAAA,CAAQ,OAAO,CAAA;AACf,IAAA,kBAAA,CAAmB,SAAS,WAAW,CAAA;AAAA,GACzC;AAEA,EAAM,MAAA,uBAAA,GAA0B,CAAC,IAAiB,KAAA;AAChD,IAAA,cAAA,CAAe,IAAI,CAAA;AACnB,IAAA,OAAA,CAAQ,CAAC,CAAA;AACT,IAAmB,kBAAA,CAAA,CAAA,EAAG,IAAO,GAAA,IAAA,GAAO,IAAI,CAAA;AAAA,GAC1C;AAEA,EAAM,MAAA,Y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AA,MAAC,gBAAA;AAAA,MAAA;AAAA,QACC,IAAA,EAAM,gBAAgB,EAAC;AAAA,QACvB,WAAa,EAAA,UAAA;AAAA,QACb,iBAAA;AAAA,QACA,SAAW,EAAA,OAAA;AAAA,QACX;AAAA;AAAA,KAEJ,EAAA;AAAA,GAAA,EACF,CACF,EAAA,CAAA;AAEJ;;;;"}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { memo, Fragment } from 'react';
|
|
2
3
|
import { Output } from '@aonic-ui/pipelines';
|
|
3
4
|
import { Box } from '@material-ui/core';
|
|
4
5
|
import { ErrorBoundary } from '@backstage/core-components';
|
|
5
6
|
|
|
6
7
|
const PipelineRunOutput = ({ pr }) => {
|
|
7
|
-
return /* @__PURE__ */
|
|
8
|
+
return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(Box, { "data-testid": "dialog-output", children: /* @__PURE__ */ jsx(ErrorBoundary, { children: /* @__PURE__ */ jsx(
|
|
8
9
|
Output,
|
|
9
10
|
{
|
|
10
11
|
pipelineRunName: pr.id,
|
|
@@ -15,9 +16,9 @@ const PipelineRunOutput = ({ pr }) => {
|
|
|
15
16
|
acsDeploymentCheckResults: pr.acsDeploymentCheckResults,
|
|
16
17
|
results: []
|
|
17
18
|
}
|
|
18
|
-
))));
|
|
19
|
+
) }) }) });
|
|
19
20
|
};
|
|
20
|
-
var PipelineRunOutput$1 =
|
|
21
|
+
var PipelineRunOutput$1 = memo(PipelineRunOutput);
|
|
21
22
|
|
|
22
23
|
export { PipelineRunOutput$1 as default };
|
|
23
24
|
//# sourceMappingURL=PipelineRunOutput.esm.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PipelineRunOutput.esm.js","sources":["../../../src/components/PipelineRunList/PipelineRunOutput.tsx"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport
|
|
1
|
+
{"version":3,"file":"PipelineRunOutput.esm.js","sources":["../../../src/components/PipelineRunList/PipelineRunOutput.tsx"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport type { FC } from 'react';\n\nimport { memo, Fragment } from 'react';\nimport { Output } from '@aonic-ui/pipelines';\nimport { PipelineRunResult } from '../../models/pipelineRunResult';\nimport { Box } from '@material-ui/core';\nimport { ErrorBoundary } from '@backstage/core-components';\n\ntype PipelineRunOutputProps = {\n pr: PipelineRunResult;\n};\n\nconst PipelineRunOutput: FC<PipelineRunOutputProps> = ({ pr }) => {\n return (\n <Fragment>\n <Box data-testid=\"dialog-output\">\n <ErrorBoundary>\n <Output\n pipelineRunName={pr.id}\n pipelineRunStatus={pr.status}\n enterpriseContractPolicies={pr.enterpriseContractPolicies}\n acsImageScanResult={pr.acsImageScanResult}\n acsImageCheckResults={pr.acsImageCheckResults}\n acsDeploymentCheckResults={pr.acsDeploymentCheckResults}\n results={[]}\n />\n </ErrorBoundary>\n </Box>\n </Fragment>\n );\n};\n\nexport default memo(PipelineRunOutput);\n"],"names":[],"mappings":";;;;;;AA2BA,MAAM,iBAAgD,GAAA,CAAC,EAAE,EAAA,EAAS,KAAA;AAChE,EAAA,2BACG,QACC,EAAA,EAAA,QAAA,kBAAA,GAAA,CAAC,OAAI,aAAY,EAAA,eAAA,EACf,8BAAC,aACC,EAAA,EAAA,QAAA,kBAAA,GAAA;AAAA,IAAC,MAAA;AAAA,IAAA;AAAA,MACC,iBAAiB,EAAG,CAAA,EAAA;AAAA,MACpB,mBAAmB,EAAG,CAAA,MAAA;AAAA,MACtB,4BAA4B,EAAG,CAAA,0BAAA;AAAA,MAC/B,oBAAoB,EAAG,CAAA,kBAAA;AAAA,MACvB,sBAAsB,EAAG,CAAA,oBAAA;AAAA,MACzB,2BAA2B,EAAG,CAAA,yBAAA;AAAA,MAC9B,SAAS;AAAC;AAAA,GACZ,EACF,GACF,CACF,EAAA,CAAA;AAEJ,CAAA;AAEA,0BAAe,KAAK,iBAAiB,CAAA;;;;"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { useState, useMemo, Fragment } from 'react';
|
|
2
3
|
import { makeStyles, Box, IconButton } from '@material-ui/core';
|
|
3
4
|
import { Link } from 'react-router-dom';
|
|
4
5
|
import { DialogLauncher } from '../DialogLauncher/DialogLauncher.esm.js';
|
|
@@ -12,39 +13,40 @@ const useStyles = makeStyles(() => ({
|
|
|
12
13
|
padding: 0
|
|
13
14
|
}
|
|
14
15
|
}));
|
|
15
|
-
const PipelineRunSBOMLink = ({
|
|
16
|
-
pr
|
|
17
|
-
}) => {
|
|
16
|
+
const PipelineRunSBOMLink = ({ pr }) => {
|
|
18
17
|
const classes = useStyles();
|
|
19
|
-
const [openSBOMLogs, setOpenSBOMLogs] =
|
|
20
|
-
const step =
|
|
18
|
+
const [openSBOMLogs, setOpenSBOMLogs] = useState(false);
|
|
19
|
+
const step = useMemo(
|
|
21
20
|
() => pr.steps.findIndex((s) => s.name === "show-sbom-rhdh"),
|
|
22
21
|
[pr.steps]
|
|
23
22
|
);
|
|
24
|
-
return /* @__PURE__ */
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
23
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
24
|
+
/* @__PURE__ */ jsx(
|
|
25
|
+
DialogLauncher,
|
|
26
|
+
{
|
|
27
|
+
title: pr.id,
|
|
28
|
+
open: openSBOMLogs,
|
|
29
|
+
onClose: () => setOpenSBOMLogs(false),
|
|
30
|
+
component: PipelineRunLogs,
|
|
31
|
+
componentProps: {
|
|
32
|
+
step,
|
|
33
|
+
pr
|
|
34
|
+
},
|
|
35
|
+
fullWidth: true,
|
|
36
|
+
maxWidth: "xl"
|
|
35
37
|
},
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
)
|
|
38
|
+
`${pr.id}-logs`
|
|
39
|
+
),
|
|
40
|
+
/* @__PURE__ */ jsx(Tooltip, { title: "Link to SBOM", arrow: true, children: /* @__PURE__ */ jsx(Box, { children: /* @__PURE__ */ jsx(
|
|
41
|
+
IconButton,
|
|
42
|
+
{
|
|
43
|
+
className: classes.icon,
|
|
44
|
+
disabled: pr.isBuild ? step === -1 : !pr.tpaLink,
|
|
45
|
+
onClick: pr.isBuild ? () => setOpenSBOMLogs(true) : void 0,
|
|
46
|
+
children: pr.isBuild ? /* @__PURE__ */ jsx(SBOMLinkIcon, { disabled: step === -1 }) : /* @__PURE__ */ jsx(Link, { className: classes.icon, to: pr.tpaLink, target: "_blank", children: /* @__PURE__ */ jsx(SBOMLinkIcon, { disabled: !pr.tpaLink }) })
|
|
47
|
+
}
|
|
48
|
+
) }) })
|
|
49
|
+
] });
|
|
48
50
|
};
|
|
49
51
|
|
|
50
52
|
export { PipelineRunSBOMLink };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PipelineRunSBOMLink.esm.js","sources":["../../../src/components/PipelineRunList/PipelineRunSBOMLink.tsx"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport
|
|
1
|
+
{"version":3,"file":"PipelineRunSBOMLink.esm.js","sources":["../../../src/components/PipelineRunList/PipelineRunSBOMLink.tsx"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { FC } from 'react';\n\nimport { useState, useMemo, Fragment } from 'react';\nimport { IconButton, makeStyles, Box } from '@material-ui/core';\nimport { Link } from 'react-router-dom';\nimport { DialogLauncher } from '../DialogLauncher/DialogLauncher';\nimport { PipelineRunResult } from '../../models/pipelineRunResult';\nimport { PipelineRunLogs } from '../PipelineRunLogs/PipelineRunLogs';\nimport Tooltip from '@mui/material/Tooltip';\nimport { SBOMLinkIcon } from '../Icons/SBOMLink';\n\nconst useStyles = makeStyles(() => ({\n icon: {\n cursor: 'pointer',\n padding: 0,\n },\n}));\n\ninterface PipelineRunSBOMLinkProps {\n pr: PipelineRunResult;\n}\n\nexport const PipelineRunSBOMLink: FC<PipelineRunSBOMLinkProps> = ({ pr }) => {\n const classes = useStyles();\n const [openSBOMLogs, setOpenSBOMLogs] = useState(false);\n const step = useMemo(\n () => pr.steps.findIndex(s => s.name === 'show-sbom-rhdh'),\n [pr.steps],\n );\n\n return (\n <Fragment>\n <DialogLauncher\n key={`${pr.id}-logs`}\n title={pr.id}\n open={openSBOMLogs}\n onClose={() => setOpenSBOMLogs(false)}\n component={PipelineRunLogs}\n componentProps={{\n step,\n pr,\n }}\n fullWidth\n maxWidth=\"xl\"\n />\n <Tooltip title=\"Link to SBOM\" arrow>\n <Box>\n <IconButton\n className={classes.icon}\n disabled={pr.isBuild ? step === -1 : !pr.tpaLink}\n onClick={pr.isBuild ? () => setOpenSBOMLogs(true) : undefined}\n >\n {pr.isBuild ? (\n <SBOMLinkIcon disabled={step === -1} />\n ) : (\n <Link className={classes.icon} to={pr.tpaLink} target=\"_blank\">\n <SBOMLinkIcon disabled={!pr.tpaLink} />\n </Link>\n )}\n </IconButton>\n </Box>\n </Tooltip>\n </Fragment>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;AA2BA,MAAM,SAAA,GAAY,WAAW,OAAO;AAAA,EAClC,IAAM,EAAA;AAAA,IACJ,MAAQ,EAAA,SAAA;AAAA,IACR,OAAS,EAAA;AAAA;AAEb,CAAE,CAAA,CAAA;AAMK,MAAM,mBAAoD,GAAA,CAAC,EAAE,EAAA,EAAS,KAAA;AAC3E,EAAA,MAAM,UAAU,SAAU,EAAA;AAC1B,EAAA,MAAM,CAAC,YAAA,EAAc,eAAe,CAAA,GAAI,SAAS,KAAK,CAAA;AACtD,EAAA,MAAM,IAAO,GAAA,OAAA;AAAA,IACX,MAAM,EAAG,CAAA,KAAA,CAAM,UAAU,CAAK,CAAA,KAAA,CAAA,CAAE,SAAS,gBAAgB,CAAA;AAAA,IACzD,CAAC,GAAG,KAAK;AAAA,GACX;AAEA,EAAA,4BACG,QACC,EAAA,EAAA,QAAA,EAAA;AAAA,oBAAA,GAAA;AAAA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
import { PipelineRunTableColumns } from './PipelineRunTableColumns.esm.js';
|
|
3
3
|
import { PipelineRunTableBody } from './PipelineRunTableBody.esm.js';
|
|
4
4
|
import { EmptyStateSpinner } from '../EmptyState/EmptyStateSpinner.esm.js';
|
|
@@ -14,18 +14,24 @@ const PipelineRunTable = ({
|
|
|
14
14
|
error
|
|
15
15
|
}) => {
|
|
16
16
|
if (error) {
|
|
17
|
-
return /* @__PURE__ */
|
|
17
|
+
return /* @__PURE__ */ jsxs("div", { children: [
|
|
18
|
+
"Error: ",
|
|
19
|
+
error.message
|
|
20
|
+
] });
|
|
18
21
|
}
|
|
19
22
|
if (isLoading) {
|
|
20
|
-
return /* @__PURE__ */
|
|
23
|
+
return /* @__PURE__ */ jsx(EmptyStateSpinner, {});
|
|
21
24
|
}
|
|
22
25
|
if (data?.length === 0 && filterInput) {
|
|
23
|
-
return /* @__PURE__ */
|
|
26
|
+
return /* @__PURE__ */ jsx(EmptyStateNoMatchFound, { actionFn: filterClearAction });
|
|
24
27
|
}
|
|
25
28
|
if (data?.length === 0) {
|
|
26
|
-
return /* @__PURE__ */
|
|
29
|
+
return /* @__PURE__ */ jsx(EmptyStateNoData, {});
|
|
27
30
|
}
|
|
28
|
-
return /* @__PURE__ */
|
|
31
|
+
return /* @__PURE__ */ jsxs(Table, { children: [
|
|
32
|
+
/* @__PURE__ */ jsx(PipelineRunTableColumns, {}),
|
|
33
|
+
/* @__PURE__ */ jsx(PipelineRunTableBody, { data })
|
|
34
|
+
] });
|
|
29
35
|
};
|
|
30
36
|
|
|
31
37
|
export { PipelineRunTable };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PipelineRunTable.esm.js","sources":["../../../src/components/PipelineRunList/PipelineRunTable.tsx"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport
|
|
1
|
+
{"version":3,"file":"PipelineRunTable.esm.js","sources":["../../../src/components/PipelineRunList/PipelineRunTable.tsx"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { PipelineRunTableColumns } from './PipelineRunTableColumns';\nimport { PipelineRunTableBody } from './PipelineRunTableBody';\nimport { EmptyStateSpinner } from '../EmptyState/EmptyStateSpinner';\nimport { EmptyStateNoData } from '../EmptyState/EmptyStateNoData';\nimport { Table } from '@material-ui/core';\nimport { PipelineRunResult } from '../../models/pipelineRunResult';\nimport { EmptyStateNoMatchFound } from '../EmptyState/EmptyStateNoMatch';\n\ntype PipelineRunTableProps = {\n data: PipelineRunResult[] | null;\n filterInput: string;\n filterClearAction: () => void;\n isLoading: boolean;\n error: Error | null;\n};\n\nexport const PipelineRunTable = ({\n data,\n filterInput,\n filterClearAction,\n isLoading,\n error,\n}: PipelineRunTableProps) => {\n if (error) {\n return <div>Error: {error.message}</div>;\n }\n\n if (isLoading) {\n return <EmptyStateSpinner />;\n }\n\n if (data?.length === 0 && filterInput) {\n return <EmptyStateNoMatchFound actionFn={filterClearAction} />;\n }\n\n if (data?.length === 0) {\n return <EmptyStateNoData />;\n }\n\n return (\n <Table>\n <PipelineRunTableColumns />\n <PipelineRunTableBody data={data} />\n </Table>\n );\n};\n"],"names":[],"mappings":";;;;;;;;AA+BO,MAAM,mBAAmB,CAAC;AAAA,EAC/B,IAAA;AAAA,EACA,WAAA;AAAA,EACA,iBAAA;AAAA,EACA,SAAA;AAAA,EACA;AACF,CAA6B,KAAA;AAC3B,EAAA,IAAI,KAAO,EAAA;AACT,IAAA,4BAAQ,KAAI,EAAA,EAAA,QAAA,EAAA;AAAA,MAAA,SAAA;AAAA,MAAQ,KAAM,CAAA;AAAA,KAAQ,EAAA,CAAA;AAAA;AAGpC,EAAA,IAAI,SAAW,EAAA;AACb,IAAA,2BAAQ,iBAAkB,EAAA,EAAA,CAAA;AAAA;AAG5B,EAAI,IAAA,IAAA,EAAM,MAAW,KAAA,CAAA,IAAK,WAAa,EAAA;AACrC,IAAO,uBAAA,GAAA,CAAC,sBAAuB,EAAA,EAAA,QAAA,EAAU,iBAAmB,EAAA,CAAA;AAAA;AAG9D,EAAI,IAAA,IAAA,EAAM,WAAW,CAAG,EAAA;AACtB,IAAA,2BAAQ,gBAAiB,EAAA,EAAA,CAAA;AAAA;AAG3B,EAAA,4BACG,KACC,EAAA,EAAA,QAAA,EAAA;AAAA,oBAAA,GAAA,CAAC,uBAAwB,EAAA,EAAA,CAAA;AAAA,oBACzB,GAAA,CAAC,wBAAqB,IAAY,EAAA;AAAA,GACpC,EAAA,CAAA;AAEJ;;;;"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
2
|
import { TableBody } from '@material-ui/core';
|
|
3
3
|
import { PipelineRunTableRow } from './PipelineRunTableRow.esm.js';
|
|
4
4
|
|
|
5
5
|
const PipelineRunTableBody = ({
|
|
6
6
|
data
|
|
7
7
|
}) => {
|
|
8
|
-
return /* @__PURE__ */
|
|
8
|
+
return /* @__PURE__ */ jsx(TableBody, { children: (data ?? []).map((row, index) => /* @__PURE__ */ jsx(PipelineRunTableRow, { index, pr: row }, index)) });
|
|
9
9
|
};
|
|
10
10
|
|
|
11
11
|
export { PipelineRunTableBody };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PipelineRunTableBody.esm.js","sources":["../../../src/components/PipelineRunList/PipelineRunTableBody.tsx"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport
|
|
1
|
+
{"version":3,"file":"PipelineRunTableBody.esm.js","sources":["../../../src/components/PipelineRunList/PipelineRunTableBody.tsx"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport type { FC } from 'react';\nimport { TableBody } from '@material-ui/core';\nimport { PipelineRunTableRow } from './PipelineRunTableRow';\nimport { PipelineRunResult } from '../../models/pipelineRunResult';\n\ntype PipelineRunTableRowsProps = {\n data: PipelineRunResult[] | null;\n};\n\nexport const PipelineRunTableBody: FC<PipelineRunTableRowsProps> = ({\n data,\n}) => {\n return (\n <TableBody>\n {(data ?? []).map((row, index) => (\n <PipelineRunTableRow key={index} index={index} pr={row} />\n ))}\n </TableBody>\n );\n};\n"],"names":[],"mappings":";;;;AAwBO,MAAM,uBAAsD,CAAC;AAAA,EAClE;AACF,CAAM,KAAA;AACJ,EAAA,2BACG,SACG,EAAA,EAAA,QAAA,EAAA,CAAA,IAAA,IAAQ,EAAC,EAAG,IAAI,CAAC,GAAA,EAAK,KACtB,qBAAA,GAAA,CAAC,uBAAgC,KAAc,EAAA,EAAA,EAAI,GAAzB,EAAA,EAAA,KAA8B,CACzD,CACH,EAAA,CAAA;AAEJ;;;;"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { Fragment, createElement } from 'react';
|
|
1
3
|
import { makeStyles, TableHead, TableRow, TableCell } from '@material-ui/core';
|
|
2
|
-
import React from 'react';
|
|
3
4
|
|
|
4
5
|
const columns = {
|
|
5
6
|
pipelineRunId: {
|
|
@@ -35,7 +36,7 @@ const useStyles = makeStyles((theme) => ({
|
|
|
35
36
|
}));
|
|
36
37
|
const PipelineRunTableColumns = () => {
|
|
37
38
|
const classes = useStyles();
|
|
38
|
-
return /* @__PURE__ */
|
|
39
|
+
return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(TableHead, { children: /* @__PURE__ */ jsx(TableRow, { children: Object.entries(columns).map(([key, value]) => /* @__PURE__ */ createElement(
|
|
39
40
|
TableCell,
|
|
40
41
|
{
|
|
41
42
|
className: classes.columnHeader,
|
|
@@ -43,7 +44,7 @@ const PipelineRunTableColumns = () => {
|
|
|
43
44
|
key
|
|
44
45
|
},
|
|
45
46
|
value.name
|
|
46
|
-
)))));
|
|
47
|
+
)) }) }) });
|
|
47
48
|
};
|
|
48
49
|
|
|
49
50
|
export { PipelineRunTableColumns };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PipelineRunTableColumns.esm.js","sources":["../../../src/components/PipelineRunList/PipelineRunTableColumns.tsx"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport {\n TableCell,\n TableHead,\n TableRow,\n makeStyles,\n Theme,\n} from '@material-ui/core';\nimport
|
|
1
|
+
{"version":3,"file":"PipelineRunTableColumns.esm.js","sources":["../../../src/components/PipelineRunList/PipelineRunTableColumns.tsx"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport {\n TableCell,\n TableHead,\n TableRow,\n makeStyles,\n Theme,\n} from '@material-ui/core';\nimport { Fragment } from 'react';\n\ntype PipelineRunTableColumn = Record<\n string,\n { name: string; props?: Record<string, any> }\n>;\n\nconst columns: PipelineRunTableColumn = {\n pipelineRunId: {\n name: 'Pipeline Run ID',\n },\n type: {\n name: 'Type',\n },\n critical: {\n name: 'Critical',\n },\n important: {\n name: 'Important',\n },\n moderate: {\n name: 'Moderate',\n },\n low: {\n name: 'Low',\n },\n sbom: {\n name: 'SBOM',\n },\n actions: {\n name: 'Actions',\n },\n};\n\nconst useStyles = makeStyles((theme: Theme) => ({\n columnHeader: {\n fontWeight: 'bold',\n color: theme.palette.grey[600],\n },\n}));\n\nexport const PipelineRunTableColumns = () => {\n const classes = useStyles();\n\n return (\n <Fragment>\n <TableHead>\n <TableRow>\n {Object.entries(columns).map(([key, value]) => (\n <TableCell\n className={classes.columnHeader}\n {...value.props}\n key={key}\n >\n {value.name}\n </TableCell>\n ))}\n </TableRow>\n </TableHead>\n </Fragment>\n );\n};\n"],"names":[],"mappings":";;;;A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1
|
-
import
|
|
1
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
|
+
import { useState, useMemo, useEffect, Fragment } from 'react';
|
|
2
3
|
import { makeStyles, Box, Select, MenuItem, IconButton, TextField, Typography } from '@material-ui/core';
|
|
3
4
|
import { FirstPage, NavigateBefore, NavigateNext, LastPage } from '@mui/icons-material';
|
|
4
5
|
|
|
@@ -20,24 +21,21 @@ const PipelineRunTablePagination = ({
|
|
|
20
21
|
handleChangeRowsPerPage
|
|
21
22
|
}) => {
|
|
22
23
|
const classes = useStyles();
|
|
23
|
-
const [pageInput, setPageInput] =
|
|
24
|
+
const [pageInput, setPageInput] = useState("1");
|
|
24
25
|
const handleRowsChange = (event) => {
|
|
25
26
|
handleChangeRowsPerPage(parseInt(event.target.value, 10));
|
|
26
27
|
};
|
|
27
|
-
const totalPages =
|
|
28
|
+
const totalPages = useMemo(
|
|
28
29
|
() => Math.ceil(count / rowsPerPage),
|
|
29
30
|
[count, rowsPerPage]
|
|
30
31
|
);
|
|
31
|
-
const previousPage =
|
|
32
|
-
const nextPage =
|
|
33
|
-
const firstPage =
|
|
34
|
-
const lastPage =
|
|
35
|
-
const isFirstPage =
|
|
36
|
-
const isLastPage =
|
|
37
|
-
|
|
38
|
-
[totalPages, page]
|
|
39
|
-
);
|
|
40
|
-
const selectItemText = React.useMemo(() => {
|
|
32
|
+
const previousPage = useMemo(() => page - 1, [page]);
|
|
33
|
+
const nextPage = useMemo(() => page + 1, [page]);
|
|
34
|
+
const firstPage = useMemo(() => 0, []);
|
|
35
|
+
const lastPage = useMemo(() => totalPages - 1, [totalPages]);
|
|
36
|
+
const isFirstPage = useMemo(() => page === 0, [page]);
|
|
37
|
+
const isLastPage = useMemo(() => page === totalPages - 1, [totalPages, page]);
|
|
38
|
+
const selectItemText = useMemo(() => {
|
|
41
39
|
return `${page === 0 ? 1 : page * rowsPerPage + 1} - ${rowsPerPage * (page + 1) > count ? count : rowsPerPage * (page + 1)} of ${count}`;
|
|
42
40
|
}, [count, page, rowsPerPage]);
|
|
43
41
|
const handleInputChange = (value) => {
|
|
@@ -47,83 +45,97 @@ const PipelineRunTablePagination = ({
|
|
|
47
45
|
}
|
|
48
46
|
setPageInput(isNaN(newPage) ? "" : newPage.toString());
|
|
49
47
|
};
|
|
50
|
-
|
|
48
|
+
useEffect(() => {
|
|
51
49
|
setPageInput((page + 1).toString());
|
|
52
50
|
}, [page]);
|
|
53
|
-
return /* @__PURE__ */
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
51
|
+
return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs(Box, { className: classes.actionsBox, "data-testid": "pipeline-run-pagination", children: [
|
|
52
|
+
/* @__PURE__ */ jsx(
|
|
53
|
+
Select,
|
|
54
|
+
{
|
|
55
|
+
variant: "standard",
|
|
56
|
+
renderValue: () => selectItemText,
|
|
57
|
+
value: rowsPerPage,
|
|
58
|
+
"aria-label": "rows per page",
|
|
59
|
+
"data-testid": "rows-per-page",
|
|
60
|
+
autoWidth: true,
|
|
61
|
+
disableUnderline: true,
|
|
62
|
+
displayEmpty: true,
|
|
63
|
+
onChange: handleRowsChange,
|
|
64
|
+
inputProps: {
|
|
65
|
+
style: { minWidth: 0, padding: 0 }
|
|
66
|
+
},
|
|
67
|
+
children: rowSize.map((size) => /* @__PURE__ */ jsxs(MenuItem, { value: size, children: [
|
|
68
|
+
size,
|
|
69
|
+
" per page"
|
|
70
|
+
] }, size))
|
|
67
71
|
}
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
},
|
|
79
|
-
/* @__PURE__ */ React.createElement(FirstPage, null)
|
|
80
|
-
), /* @__PURE__ */ React.createElement(
|
|
81
|
-
IconButton,
|
|
82
|
-
{
|
|
83
|
-
onClick: () => handleChangePage(previousPage),
|
|
84
|
-
disabled: isFirstPage,
|
|
85
|
-
"aria-label": "previous page",
|
|
86
|
-
"data-testid": "previous-page",
|
|
87
|
-
size: "small"
|
|
88
|
-
},
|
|
89
|
-
/* @__PURE__ */ React.createElement(NavigateBefore, null)
|
|
90
|
-
), /* @__PURE__ */ React.createElement(
|
|
91
|
-
TextField,
|
|
92
|
-
{
|
|
93
|
-
size: "small",
|
|
94
|
-
value: pageInput,
|
|
95
|
-
variant: "outlined",
|
|
96
|
-
"aria-label": "page number",
|
|
97
|
-
"aria-describedby": "page-number",
|
|
98
|
-
id: "page-number-input",
|
|
99
|
-
"data-testid": "page-number",
|
|
100
|
-
style: { marginRight: "0.5rem" },
|
|
101
|
-
onChange: (e) => handleInputChange(e.target.value),
|
|
102
|
-
inputProps: {
|
|
103
|
-
style: { textAlign: "center", width: "2rem" }
|
|
72
|
+
),
|
|
73
|
+
/* @__PURE__ */ jsx(
|
|
74
|
+
IconButton,
|
|
75
|
+
{
|
|
76
|
+
onClick: () => handleChangePage(firstPage),
|
|
77
|
+
disabled: isFirstPage,
|
|
78
|
+
"aria-label": "first page",
|
|
79
|
+
"data-testid": "first-page",
|
|
80
|
+
size: "small",
|
|
81
|
+
children: /* @__PURE__ */ jsx(FirstPage, {})
|
|
104
82
|
}
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
83
|
+
),
|
|
84
|
+
/* @__PURE__ */ jsx(
|
|
85
|
+
IconButton,
|
|
86
|
+
{
|
|
87
|
+
onClick: () => handleChangePage(previousPage),
|
|
88
|
+
disabled: isFirstPage,
|
|
89
|
+
"aria-label": "previous page",
|
|
90
|
+
"data-testid": "previous-page",
|
|
91
|
+
size: "small",
|
|
92
|
+
children: /* @__PURE__ */ jsx(NavigateBefore, {})
|
|
93
|
+
}
|
|
94
|
+
),
|
|
95
|
+
/* @__PURE__ */ jsx(
|
|
96
|
+
TextField,
|
|
97
|
+
{
|
|
98
|
+
size: "small",
|
|
99
|
+
value: pageInput,
|
|
100
|
+
variant: "outlined",
|
|
101
|
+
"aria-label": "page number",
|
|
102
|
+
"aria-describedby": "page-number",
|
|
103
|
+
id: "page-number-input",
|
|
104
|
+
"data-testid": "page-number",
|
|
105
|
+
style: { marginRight: "0.5rem" },
|
|
106
|
+
onChange: (e) => handleInputChange(e.target.value),
|
|
107
|
+
inputProps: {
|
|
108
|
+
style: { textAlign: "center", width: "2rem" }
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
),
|
|
112
|
+
/* @__PURE__ */ jsxs(Typography, { variant: "body2", style: { fontSize: "1rem" }, children: [
|
|
113
|
+
"of ",
|
|
114
|
+
totalPages
|
|
115
|
+
] }),
|
|
116
|
+
/* @__PURE__ */ jsx(
|
|
117
|
+
IconButton,
|
|
118
|
+
{
|
|
119
|
+
onClick: () => handleChangePage(nextPage),
|
|
120
|
+
disabled: isLastPage,
|
|
121
|
+
"aria-label": "next page",
|
|
122
|
+
"data-testid": "next-page",
|
|
123
|
+
size: "small",
|
|
124
|
+
children: /* @__PURE__ */ jsx(NavigateNext, {})
|
|
125
|
+
}
|
|
126
|
+
),
|
|
127
|
+
/* @__PURE__ */ jsx(
|
|
128
|
+
IconButton,
|
|
129
|
+
{
|
|
130
|
+
onClick: () => handleChangePage(lastPage),
|
|
131
|
+
disabled: isLastPage,
|
|
132
|
+
"aria-label": "last page",
|
|
133
|
+
"data-testid": "last-page",
|
|
134
|
+
size: "small",
|
|
135
|
+
children: /* @__PURE__ */ jsx(LastPage, {})
|
|
136
|
+
}
|
|
137
|
+
)
|
|
138
|
+
] }) });
|
|
127
139
|
};
|
|
128
140
|
|
|
129
141
|
export { PipelineRunTablePagination };
|