@backstage-community/plugin-tekton 3.22.2 → 3.25.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 +23 -0
- package/dist/components/Charts/PipelineBars.esm.js +33 -29
- package/dist/components/Charts/PipelineBars.esm.js.map +1 -1
- package/dist/components/Icons/CriticalRiskIcon.esm.js +8 -6
- package/dist/components/Icons/CriticalRiskIcon.esm.js.map +1 -1
- package/dist/components/Icons/EqualsIcon.esm.js +8 -6
- package/dist/components/Icons/EqualsIcon.esm.js.map +1 -1
- package/dist/components/Icons/LinkToSbomIcon.esm.js +5 -5
- package/dist/components/Icons/LinkToSbomIcon.esm.js.map +1 -1
- package/dist/components/Icons/OutputIcon.esm.js +6 -8
- package/dist/components/Icons/OutputIcon.esm.js.map +1 -1
- package/dist/components/Icons/SignedBadge.esm.js +3 -3
- package/dist/components/Icons/SignedBadge.esm.js.map +1 -1
- package/dist/components/Icons/ViewLogsIcon.esm.js +6 -8
- package/dist/components/Icons/ViewLogsIcon.esm.js.map +1 -1
- package/dist/components/PipelineRunList/PipelineRunColumnHeader.esm.js +43 -41
- package/dist/components/PipelineRunList/PipelineRunColumnHeader.esm.js.map +1 -1
- package/dist/components/PipelineRunList/PipelineRunList.esm.js +92 -68
- package/dist/components/PipelineRunList/PipelineRunList.esm.js.map +1 -1
- package/dist/components/PipelineRunList/PipelineRunListSearchBar.esm.js +13 -10
- package/dist/components/PipelineRunList/PipelineRunListSearchBar.esm.js.map +1 -1
- package/dist/components/PipelineRunList/PipelineRunOutput.esm.js +17 -11
- package/dist/components/PipelineRunList/PipelineRunOutput.esm.js.map +1 -1
- package/dist/components/PipelineRunList/PipelineRunRow.esm.js +39 -24
- package/dist/components/PipelineRunList/PipelineRunRow.esm.js.map +1 -1
- package/dist/components/PipelineRunList/PipelineRunRowActions.esm.js +88 -76
- package/dist/components/PipelineRunList/PipelineRunRowActions.esm.js.map +1 -1
- package/dist/components/PipelineRunList/PipelineRunSBOMLink.esm.js +4 -4
- package/dist/components/PipelineRunList/PipelineRunSBOMLink.esm.js.map +1 -1
- package/dist/components/PipelineRunList/PipelineRunTableBody.esm.js +9 -8
- package/dist/components/PipelineRunList/PipelineRunTableBody.esm.js.map +1 -1
- package/dist/components/PipelineRunList/PipelineRunTaskStatus.esm.js +2 -2
- package/dist/components/PipelineRunList/PipelineRunTaskStatus.esm.js.map +1 -1
- package/dist/components/PipelineRunList/PipelineRunVulnerabilities.esm.js +90 -20
- package/dist/components/PipelineRunList/PipelineRunVulnerabilities.esm.js.map +1 -1
- package/dist/components/PipelineRunList/PipelineTableHeader.esm.js +26 -19
- package/dist/components/PipelineRunList/PipelineTableHeader.esm.js.map +1 -1
- package/dist/components/PipelineRunList/PlrStatus.esm.js +2 -2
- package/dist/components/PipelineRunList/PlrStatus.esm.js.map +1 -1
- package/dist/components/PipelineRunList/ResourceBadge.esm.js +6 -2
- package/dist/components/PipelineRunList/ResourceBadge.esm.js.map +1 -1
- package/dist/components/PipelineRunLogs/PipelineRunLogDialog.esm.js +52 -40
- package/dist/components/PipelineRunLogs/PipelineRunLogDialog.esm.js.map +1 -1
- package/dist/components/PipelineRunLogs/PipelineRunLogDownloader.esm.js +31 -23
- package/dist/components/PipelineRunLogs/PipelineRunLogDownloader.esm.js.map +1 -1
- package/dist/components/PipelineRunLogs/PipelineRunLogViewer.esm.js +46 -24
- package/dist/components/PipelineRunLogs/PipelineRunLogViewer.esm.js.map +1 -1
- package/dist/components/PipelineRunLogs/PipelineRunLogs.esm.js +30 -20
- package/dist/components/PipelineRunLogs/PipelineRunLogs.esm.js.map +1 -1
- package/dist/components/PipelineRunLogs/PodLogsDownloadLink.esm.js +15 -9
- package/dist/components/PipelineRunLogs/PodLogsDownloadLink.esm.js.map +1 -1
- package/dist/components/PipelineRunLogs/TaskStatusStepper.esm.js +43 -36
- package/dist/components/PipelineRunLogs/TaskStatusStepper.esm.js.map +1 -1
- package/dist/components/PipelineRunOutput/PipelineRunOutputDialog.esm.js +32 -22
- package/dist/components/PipelineRunOutput/PipelineRunOutputDialog.esm.js.map +1 -1
- package/dist/components/Router.esm.js +2 -2
- package/dist/components/Router.esm.js.map +1 -1
- package/dist/components/Tekton/TektonCIComponent.esm.js +5 -4
- package/dist/components/Tekton/TektonCIComponent.esm.js.map +1 -1
- package/dist/components/common/ClusterSelector.esm.js +17 -13
- package/dist/components/common/ClusterSelector.esm.js.map +1 -1
- package/dist/components/common/ErrorPanel.esm.js +25 -17
- package/dist/components/common/ErrorPanel.esm.js.map +1 -1
- package/dist/components/common/PermissionAlert.esm.js +8 -2
- package/dist/components/common/PermissionAlert.esm.js.map +1 -1
- package/dist/components/common/StatusSelector.esm.js +19 -12
- package/dist/components/common/StatusSelector.esm.js.map +1 -1
- package/dist/components/common/TableExpandCollapse.esm.js +26 -21
- package/dist/components/common/TableExpandCollapse.esm.js.map +1 -1
- package/dist/components/pipeline-topology/PipelineLayout.esm.js +14 -13
- package/dist/components/pipeline-topology/PipelineLayout.esm.js.map +1 -1
- package/dist/components/pipeline-topology/PipelineRunVisualization.esm.js +2 -2
- package/dist/components/pipeline-topology/PipelineRunVisualization.esm.js.map +1 -1
- package/dist/components/pipeline-topology/PipelineTaskNode.esm.js +63 -59
- package/dist/components/pipeline-topology/PipelineTaskNode.esm.js.map +1 -1
- package/dist/components/pipeline-topology/PipelineVisualization.esm.js +9 -6
- package/dist/components/pipeline-topology/PipelineVisualization.esm.js.map +1 -1
- package/dist/components/pipeline-topology/PipelineVisualizationStepList.esm.js +28 -19
- package/dist/components/pipeline-topology/PipelineVisualizationStepList.esm.js.map +1 -1
- package/dist/components/pipeline-topology/PipelineVisualizationView.esm.js +11 -7
- package/dist/components/pipeline-topology/PipelineVisualizationView.esm.js.map +1 -1
- package/dist/components/pipeline-topology/TaskGroupEdge.esm.js +2 -2
- package/dist/components/pipeline-topology/TaskGroupEdge.esm.js.map +1 -1
- package/dist/components/pipeline-topology/pipelineComponentFactory.esm.js.map +1 -1
- package/dist/hooks/TektonResourcesContext.esm.js +12 -10
- package/dist/hooks/TektonResourcesContext.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/usePipelineRunScanResults.esm.js +2 -2
- package/dist/hooks/usePipelineRunScanResults.esm.js.map +1 -1
- package/dist/hooks/usePodLogsOfPipelineRun.esm.js +31 -50
- package/dist/hooks/usePodLogsOfPipelineRun.esm.js.map +1 -1
- package/dist/hooks/useTektonObjectsResponse.esm.js +11 -11
- package/dist/hooks/useTektonObjectsResponse.esm.js.map +1 -1
- package/dist/index.d.ts +50 -4
- package/dist/index.esm.js +1 -0
- package/dist/index.esm.js.map +1 -1
- package/dist/translation.esm.js +81 -0
- package/dist/translation.esm.js.map +1 -0
- package/package.json +19 -18
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
2
2
|
import { makeStyles, TableHead, TableRow, TableCell, TableSortLabel } from '@material-ui/core';
|
|
3
|
-
import {
|
|
3
|
+
import { getPipelineRunColumnHeader } from './PipelineRunColumnHeader.esm.js';
|
|
4
|
+
import { useTranslationRef } from '@backstage/core-plugin-api/alpha';
|
|
5
|
+
import { tektonTranslationRef } from '../../translation.esm.js';
|
|
4
6
|
|
|
5
7
|
const useStyles = makeStyles((theme) => ({
|
|
6
8
|
header: {
|
|
@@ -23,30 +25,35 @@ const EnhancedTableHead = ({
|
|
|
23
25
|
onRequestSort(event, property, id);
|
|
24
26
|
};
|
|
25
27
|
const classes = useStyles();
|
|
26
|
-
|
|
27
|
-
|
|
28
|
+
const { t } = useTranslationRef(tektonTranslationRef);
|
|
29
|
+
const pipelineRunColumnHeader = getPipelineRunColumnHeader(t);
|
|
30
|
+
return /* @__PURE__ */ jsx(TableHead, { children: /* @__PURE__ */ jsx(TableRow, { children: pipelineRunColumnHeader.map((headCell) => {
|
|
31
|
+
return /* @__PURE__ */ jsx(
|
|
28
32
|
TableCell,
|
|
29
33
|
{
|
|
30
34
|
className: classes.header,
|
|
31
|
-
key: headCell.id,
|
|
32
35
|
align: "left",
|
|
33
36
|
padding: "normal",
|
|
34
|
-
sortDirection: orderBy === headCell.field ? headCell.defaultSort : false
|
|
37
|
+
sortDirection: orderBy === headCell.field ? headCell.defaultSort : false,
|
|
38
|
+
children: headCell.field ? /* @__PURE__ */ jsx(
|
|
39
|
+
TableSortLabel,
|
|
40
|
+
{
|
|
41
|
+
active: orderBy === headCell.field && orderById === headCell.id,
|
|
42
|
+
direction: order,
|
|
43
|
+
onClick: createSortHandler(
|
|
44
|
+
headCell.field,
|
|
45
|
+
headCell.id
|
|
46
|
+
),
|
|
47
|
+
children: headCell.title
|
|
48
|
+
}
|
|
49
|
+
) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
50
|
+
" ",
|
|
51
|
+
headCell.title
|
|
52
|
+
] })
|
|
35
53
|
},
|
|
36
|
-
headCell.
|
|
37
|
-
TableSortLabel,
|
|
38
|
-
{
|
|
39
|
-
active: orderBy === headCell.field && orderById === headCell.id,
|
|
40
|
-
direction: order,
|
|
41
|
-
onClick: createSortHandler(
|
|
42
|
-
headCell.field,
|
|
43
|
-
headCell.id
|
|
44
|
-
)
|
|
45
|
-
},
|
|
46
|
-
headCell.title
|
|
47
|
-
) : /* @__PURE__ */ React.createElement(React.Fragment, null, " ", headCell.title)
|
|
54
|
+
headCell.id
|
|
48
55
|
);
|
|
49
|
-
})));
|
|
56
|
+
}) }) });
|
|
50
57
|
};
|
|
51
58
|
|
|
52
59
|
export { EnhancedTableHead };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PipelineTableHeader.esm.js","sources":["../../../src/components/PipelineRunList/PipelineTableHeader.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":"PipelineTableHeader.esm.js","sources":["../../../src/components/PipelineRunList/PipelineTableHeader.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 { MouseEvent } from 'react';\n\nimport {\n makeStyles,\n TableCell,\n TableHead,\n TableRow,\n TableSortLabel,\n} from '@material-ui/core';\n\nimport { Order } from '../../types/types';\nimport { getPipelineRunColumnHeader } from './PipelineRunColumnHeader';\nimport { useTranslationRef } from '@backstage/core-plugin-api/alpha';\nimport { tektonTranslationRef } from '../../translation';\n\ntype EnhancedTableProps = {\n onRequestSort: (\n event: MouseEvent<unknown>,\n property: string,\n id: string,\n ) => void;\n order: Order;\n orderBy: string;\n orderById: string;\n};\n\nconst useStyles = makeStyles(theme => ({\n header: {\n padding: theme.spacing(1, 2, 1, 2.5),\n borderTop: `1px solid ${theme.palette.grey.A100}`,\n borderBottom: `1px solid ${theme.palette.grey.A100}`,\n // withStyles hasn't a generic overload for theme\n fontWeight: 'bold',\n position: 'static',\n wordBreak: 'normal',\n },\n}));\n\nexport const EnhancedTableHead = ({\n order,\n orderBy,\n orderById,\n onRequestSort,\n}: EnhancedTableProps) => {\n const createSortHandler =\n (property: string, id: string) => (event: MouseEvent<unknown>) => {\n onRequestSort(event, property, id);\n };\n const classes = useStyles();\n const { t } = useTranslationRef(tektonTranslationRef);\n const pipelineRunColumnHeader = getPipelineRunColumnHeader(t);\n\n return (\n <TableHead>\n <TableRow>\n {pipelineRunColumnHeader.map(headCell => {\n return (\n <TableCell\n className={classes.header}\n key={headCell.id as string}\n align=\"left\"\n padding=\"normal\"\n sortDirection={\n orderBy === headCell.field ? headCell.defaultSort : false\n }\n >\n {headCell.field ? (\n <TableSortLabel\n active={\n orderBy === headCell.field && orderById === headCell.id\n }\n direction={order}\n onClick={createSortHandler(\n headCell.field as string,\n headCell.id as string,\n )}\n >\n {headCell.title}\n </TableSortLabel>\n ) : (\n <> {headCell.title}</>\n )}\n </TableCell>\n );\n })}\n </TableRow>\n </TableHead>\n );\n};\n"],"names":[],"mappings":";;;;;;AAyCA,MAAM,SAAA,GAAY,WAAW,CAAU,KAAA,MAAA;AAAA,EACrC,MAAQ,EAAA;AAAA,IACN,SAAS,KAAM,CAAA,OAAA,CAAQ,CAAG,EAAA,CAAA,EAAG,GAAG,GAAG,CAAA;AAAA,IACnC,SAAW,EAAA,CAAA,UAAA,EAAa,KAAM,CAAA,OAAA,CAAQ,KAAK,IAAI,CAAA,CAAA;AAAA,IAC/C,YAAc,EAAA,CAAA,UAAA,EAAa,KAAM,CAAA,OAAA,CAAQ,KAAK,IAAI,CAAA,CAAA;AAAA;AAAA,IAElD,UAAY,EAAA,MAAA;AAAA,IACZ,QAAU,EAAA,QAAA;AAAA,IACV,SAAW,EAAA;AAAA;AAEf,CAAE,CAAA,CAAA;AAEK,MAAM,oBAAoB,CAAC;AAAA,EAChC,KAAA;AAAA,EACA,OAAA;AAAA,EACA,SAAA;AAAA,EACA;AACF,CAA0B,KAAA;AACxB,EAAA,MAAM,iBACJ,GAAA,CAAC,QAAkB,EAAA,EAAA,KAAe,CAAC,KAA+B,KAAA;AAChE,IAAc,aAAA,CAAA,KAAA,EAAO,UAAU,EAAE,CAAA;AAAA,GACnC;AACF,EAAA,MAAM,UAAU,SAAU,EAAA;AAC1B,EAAA,MAAM,EAAE,CAAA,EAAM,GAAA,iBAAA,CAAkB,oBAAoB,CAAA;AACpD,EAAM,MAAA,uBAAA,GAA0B,2BAA2B,CAAC,CAAA;AAE5D,EAAA,2BACG,SACC,EAAA,EAAA,QAAA,kBAAA,GAAA,CAAC,QACE,EAAA,EAAA,QAAA,EAAA,uBAAA,CAAwB,IAAI,CAAY,QAAA,KAAA;AACvC,IACE,uBAAA,GAAA;AAAA,MAAC,SAAA;AAAA,MAAA;AAAA,QACC,WAAW,OAAQ,CAAA,MAAA;AAAA,QAEnB,KAAM,EAAA,MAAA;AAAA,QACN,OAAQ,EAAA,QAAA;AAAA,QACR,aACE,EAAA,OAAA,KAAY,QAAS,CAAA,KAAA,GAAQ,SAAS,WAAc,GAAA,KAAA;AAAA,QAGrD,mBAAS,KACR,mBAAA,GAAA;AAAA,UAAC,cAAA;AAAA,UAAA;AAAA,YACC,MACE,EAAA,OAAA,KAAY,QAAS,CAAA,KAAA,IAAS,cAAc,QAAS,CAAA,EAAA;AAAA,YAEvD,SAAW,EAAA,KAAA;AAAA,YACX,OAAS,EAAA,iBAAA;AAAA,cACP,QAAS,CAAA,KAAA;AAAA,cACT,QAAS,CAAA;AAAA,aACX;AAAA,YAEC,QAAS,EAAA,QAAA,CAAA;AAAA;AAAA,4BAGV,IAAA,CAAA,QAAA,EAAA,EAAA,QAAA,EAAA;AAAA,UAAA,GAAA;AAAA,UAAE,QAAS,CAAA;AAAA,SAAM,EAAA;AAAA,OAAA;AAAA,MArBhB,QAAS,CAAA;AAAA,KAuBhB;AAAA,GAEH,GACH,CACF,EAAA,CAAA;AAEJ;;;;"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
2
|
import { pipelineRunFilterReducer, Status } from '@janus-idp/shared-react';
|
|
3
3
|
import './PlrStatus.css.esm.js';
|
|
4
4
|
|
|
5
5
|
const PlrStatus = ({ obj }) => {
|
|
6
6
|
const plrStatus = pipelineRunFilterReducer(obj);
|
|
7
|
-
return /* @__PURE__ */
|
|
7
|
+
return /* @__PURE__ */ jsx(Status, { status: plrStatus, className: "bs-tkn-plrstatus" });
|
|
8
8
|
};
|
|
9
9
|
|
|
10
10
|
export { PlrStatus as default };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PlrStatus.esm.js","sources":["../../../src/components/PipelineRunList/PlrStatus.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":"PlrStatus.esm.js","sources":["../../../src/components/PipelineRunList/PlrStatus.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 pipelineRunFilterReducer,\n PipelineRunKind,\n Status,\n} from '@janus-idp/shared-react';\n\nimport './PlrStatus.css';\n\ntype PlrStatusProps = { obj: PipelineRunKind };\n\nconst PlrStatus = ({ obj }: PlrStatusProps) => {\n const plrStatus = pipelineRunFilterReducer(obj);\n return <Status status={plrStatus} className=\"bs-tkn-plrstatus\" />;\n};\n\nexport default PlrStatus;\n"],"names":[],"mappings":";;;;AAyBA,MAAM,SAAY,GAAA,CAAC,EAAE,GAAA,EAA0B,KAAA;AAC7C,EAAM,MAAA,SAAA,GAAY,yBAAyB,GAAG,CAAA;AAC9C,EAAA,uBAAQ,GAAA,CAAA,MAAA,EAAA,EAAO,MAAQ,EAAA,SAAA,EAAW,WAAU,kBAAmB,EAAA,CAAA;AACjE;;;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
2
|
import { Split, SplitItem } from '@patternfly/react-core';
|
|
3
3
|
import './ResourceBadge.css.esm.js';
|
|
4
4
|
|
|
@@ -8,7 +8,11 @@ const ResourceBadge = ({
|
|
|
8
8
|
name,
|
|
9
9
|
suffix
|
|
10
10
|
}) => {
|
|
11
|
-
return /* @__PURE__ */
|
|
11
|
+
return /* @__PURE__ */ jsxs(Split, { className: "bs-tkn-pipeline-visualization__label", children: [
|
|
12
|
+
/* @__PURE__ */ jsx(SplitItem, { style: { marginRight: "var(--pf-t--global--spacer--sm)" }, children: /* @__PURE__ */ jsx("span", { className: "badge", style: { backgroundColor: color }, children: abbr }) }),
|
|
13
|
+
/* @__PURE__ */ jsx(SplitItem, { children: /* @__PURE__ */ jsx("span", { children: name }) }),
|
|
14
|
+
suffix ? /* @__PURE__ */ jsx(SplitItem, { style: { marginLeft: "var(--pf-t--global--spacer--sm)" }, children: suffix }) : null
|
|
15
|
+
] });
|
|
12
16
|
};
|
|
13
17
|
|
|
14
18
|
export { ResourceBadge as default };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ResourceBadge.esm.js","sources":["../../../src/components/PipelineRunList/ResourceBadge.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":"ResourceBadge.esm.js","sources":["../../../src/components/PipelineRunList/ResourceBadge.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 { ReactNode } from 'react';\n\nimport { Split, SplitItem } from '@patternfly/react-core';\n\nimport './ResourceBadge.css';\n\nconst ResourceBadge = ({\n color,\n abbr,\n name,\n suffix,\n}: {\n color: string;\n abbr: string;\n name: string;\n suffix?: ReactNode;\n}) => {\n return (\n <Split className=\"bs-tkn-pipeline-visualization__label\">\n <SplitItem style={{ marginRight: 'var(--pf-t--global--spacer--sm)' }}>\n <span className=\"badge\" style={{ backgroundColor: color }}>\n {abbr}\n </span>\n </SplitItem>\n <SplitItem>\n <span>{name}</span>\n </SplitItem>\n {suffix ? (\n <SplitItem style={{ marginLeft: 'var(--pf-t--global--spacer--sm)' }}>\n {suffix}\n </SplitItem>\n ) : null}\n </Split>\n );\n};\n\nexport default ResourceBadge;\n"],"names":[],"mappings":";;;;AAqBA,MAAM,gBAAgB,CAAC;AAAA,EACrB,KAAA;AAAA,EACA,IAAA;AAAA,EACA,IAAA;AAAA,EACA;AACF,CAKM,KAAA;AACJ,EACE,uBAAA,IAAA,CAAC,KAAM,EAAA,EAAA,SAAA,EAAU,sCACf,EAAA,QAAA,EAAA;AAAA,oBAAA,GAAA,CAAC,aAAU,KAAO,EAAA,EAAE,WAAa,EAAA,iCAAA,IAC/B,QAAC,kBAAA,GAAA,CAAA,MAAA,EAAA,EAAK,SAAU,EAAA,OAAA,EAAQ,OAAO,EAAE,eAAA,EAAiB,KAAM,EAAA,EACrD,gBACH,CACF,EAAA,CAAA;AAAA,oBACC,GAAA,CAAA,SAAA,EAAA,EACC,QAAC,kBAAA,GAAA,CAAA,MAAA,EAAA,EAAM,gBAAK,CACd,EAAA,CAAA;AAAA,IACC,MAAA,uBACE,SAAU,EAAA,EAAA,KAAA,EAAO,EAAE,UAAY,EAAA,iCAAA,EAC7B,EAAA,QAAA,EAAA,MAAA,EACH,CACE,GAAA;AAAA,GACN,EAAA,CAAA;AAEJ;;;;"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { memo, useState, useEffect } from 'react';
|
|
2
3
|
import { ErrorBoundary } from '@backstage/core-components';
|
|
3
4
|
import { makeStyles, Dialog, DialogTitle, Box, IconButton, DialogContent, createStyles } from '@material-ui/core';
|
|
4
5
|
import CloseIcon from '@mui/icons-material/Close';
|
|
@@ -6,6 +7,8 @@ import { tektonGroupColor } from '../../types/types.esm.js';
|
|
|
6
7
|
import ResourceBadge from '../PipelineRunList/ResourceBadge.esm.js';
|
|
7
8
|
import PipelineRunLogDownloader from './PipelineRunLogDownloader.esm.js';
|
|
8
9
|
import { PipelineRunLogs } from './PipelineRunLogs.esm.js';
|
|
10
|
+
import { useTranslationRef } from '@backstage/core-plugin-api/alpha';
|
|
11
|
+
import { tektonTranslationRef } from '../../translation.esm.js';
|
|
9
12
|
|
|
10
13
|
const useStyles = makeStyles(
|
|
11
14
|
(theme) => createStyles({
|
|
@@ -32,57 +35,66 @@ const PipelineRunLogDialog = ({
|
|
|
32
35
|
forSBOM
|
|
33
36
|
}) => {
|
|
34
37
|
const classes = useStyles();
|
|
35
|
-
const [task, setTask] =
|
|
36
|
-
|
|
38
|
+
const [task, setTask] = useState(activeTask);
|
|
39
|
+
const { t } = useTranslationRef(tektonTranslationRef);
|
|
40
|
+
useEffect(() => {
|
|
37
41
|
if (forSBOM && activeTask) {
|
|
38
42
|
setTask(activeTask);
|
|
39
43
|
}
|
|
40
44
|
}, [forSBOM, activeTask]);
|
|
41
|
-
return /* @__PURE__ */
|
|
45
|
+
return /* @__PURE__ */ jsxs(
|
|
42
46
|
Dialog,
|
|
43
47
|
{
|
|
44
48
|
"data-testid": "pipelinerun-logs-dialog",
|
|
45
49
|
maxWidth: "xl",
|
|
46
50
|
fullWidth: true,
|
|
47
51
|
open,
|
|
48
|
-
onClose: closeDialog
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
52
|
+
onClose: closeDialog,
|
|
53
|
+
children: [
|
|
54
|
+
/* @__PURE__ */ jsx(DialogTitle, { id: "pipelinerun-logs", title: t("pipelineRunLogs.title"), children: /* @__PURE__ */ jsxs(Box, { className: classes.titleContainer, children: [
|
|
55
|
+
/* @__PURE__ */ jsx(
|
|
56
|
+
ResourceBadge,
|
|
57
|
+
{
|
|
58
|
+
color: tektonGroupColor,
|
|
59
|
+
abbr: "PLR",
|
|
60
|
+
name: pipelineRun?.metadata?.name ?? ""
|
|
61
|
+
}
|
|
62
|
+
),
|
|
63
|
+
/* @__PURE__ */ jsx(
|
|
64
|
+
IconButton,
|
|
65
|
+
{
|
|
66
|
+
"aria-label": "close",
|
|
67
|
+
className: classes.closeButton,
|
|
68
|
+
onClick: closeDialog,
|
|
69
|
+
children: /* @__PURE__ */ jsx(CloseIcon, {})
|
|
70
|
+
}
|
|
71
|
+
)
|
|
72
|
+
] }) }),
|
|
73
|
+
/* @__PURE__ */ jsx(DialogContent, { children: /* @__PURE__ */ jsxs(ErrorBoundary, { children: [
|
|
74
|
+
/* @__PURE__ */ jsx(
|
|
75
|
+
PipelineRunLogDownloader,
|
|
76
|
+
{
|
|
77
|
+
pods,
|
|
78
|
+
activeTask: task,
|
|
79
|
+
pipelineRun
|
|
80
|
+
}
|
|
81
|
+
),
|
|
82
|
+
/* @__PURE__ */ jsx(
|
|
83
|
+
PipelineRunLogs,
|
|
84
|
+
{
|
|
85
|
+
pipelineRun,
|
|
86
|
+
taskRuns,
|
|
87
|
+
pods,
|
|
88
|
+
activeTask: task,
|
|
89
|
+
setActiveTask: setTask
|
|
90
|
+
}
|
|
91
|
+
)
|
|
92
|
+
] }) })
|
|
93
|
+
]
|
|
94
|
+
}
|
|
83
95
|
);
|
|
84
96
|
};
|
|
85
|
-
var PipelineRunLogDialog$1 =
|
|
97
|
+
var PipelineRunLogDialog$1 = memo(PipelineRunLogDialog);
|
|
86
98
|
|
|
87
99
|
export { PipelineRunLogDialog$1 as default };
|
|
88
100
|
//# sourceMappingURL=PipelineRunLogDialog.esm.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PipelineRunLogDialog.esm.js","sources":["../../../src/components/PipelineRunLogs/PipelineRunLogDialog.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":"PipelineRunLogDialog.esm.js","sources":["../../../src/components/PipelineRunLogs/PipelineRunLogDialog.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 { useState, useEffect, memo } from 'react';\n\nimport { ErrorBoundary } from '@backstage/core-components';\n\nimport { V1Pod } from '@kubernetes/client-node';\nimport {\n Box,\n createStyles,\n Dialog,\n DialogContent,\n DialogTitle,\n IconButton,\n makeStyles,\n Theme,\n} from '@material-ui/core';\nimport CloseIcon from '@mui/icons-material/Close';\n\nimport { PipelineRunKind, TaskRunKind } from '@janus-idp/shared-react';\n\nimport { tektonGroupColor } from '../../types/types';\nimport ResourceBadge from '../PipelineRunList/ResourceBadge';\nimport PipelineRunLogDownloader from './PipelineRunLogDownloader';\nimport PipelineRunLogs from './PipelineRunLogs';\nimport { useTranslationRef } from '@backstage/core-plugin-api/alpha';\nimport { tektonTranslationRef } from '../../translation';\n\nconst useStyles = makeStyles((theme: Theme) =>\n createStyles({\n titleContainer: {\n display: 'flex',\n alignItems: 'center',\n gap: theme.spacing(1),\n },\n closeButton: {\n position: 'absolute',\n right: theme.spacing(1),\n top: theme.spacing(1),\n color: theme.palette.grey[500],\n },\n }),\n);\n\ntype PipelineRunLogDialogProps = {\n open: boolean;\n closeDialog: () => void;\n pipelineRun: PipelineRunKind;\n taskRuns: TaskRunKind[];\n pods: V1Pod[];\n activeTask?: string;\n forSBOM?: boolean;\n};\nconst PipelineRunLogDialog = ({\n open,\n closeDialog,\n pipelineRun,\n pods,\n taskRuns,\n activeTask,\n forSBOM,\n}: PipelineRunLogDialogProps) => {\n const classes = useStyles();\n\n const [task, setTask] = useState(activeTask);\n const { t } = useTranslationRef(tektonTranslationRef);\n\n useEffect(() => {\n // If we trigger this dialog for the SBOM task, update the current active task.\n if (forSBOM && activeTask) {\n setTask(activeTask);\n }\n }, [forSBOM, activeTask]);\n\n return (\n <Dialog\n data-testid=\"pipelinerun-logs-dialog\"\n maxWidth=\"xl\"\n fullWidth\n open={open}\n onClose={closeDialog}\n >\n <DialogTitle id=\"pipelinerun-logs\" title={t('pipelineRunLogs.title')}>\n <Box className={classes.titleContainer}>\n <ResourceBadge\n color={tektonGroupColor}\n abbr=\"PLR\"\n name={pipelineRun?.metadata?.name ?? ''}\n />\n <IconButton\n aria-label=\"close\"\n className={classes.closeButton}\n onClick={closeDialog}\n >\n <CloseIcon />\n </IconButton>\n </Box>\n </DialogTitle>\n <DialogContent>\n <ErrorBoundary>\n <PipelineRunLogDownloader\n pods={pods}\n activeTask={task}\n pipelineRun={pipelineRun}\n />\n <PipelineRunLogs\n pipelineRun={pipelineRun}\n taskRuns={taskRuns}\n pods={pods}\n activeTask={task}\n setActiveTask={setTask}\n />\n </ErrorBoundary>\n </DialogContent>\n </Dialog>\n );\n};\n\nexport default memo(PipelineRunLogDialog);\n"],"names":[],"mappings":";;;;;;;;;;;;AAyCA,MAAM,SAAY,GAAA,UAAA;AAAA,EAAW,CAAC,UAC5B,YAAa,CAAA;AAAA,IACX,cAAgB,EAAA;AAAA,MACd,OAAS,EAAA,MAAA;AAAA,MACT,UAAY,EAAA,QAAA;AAAA,MACZ,GAAA,EAAK,KAAM,CAAA,OAAA,CAAQ,CAAC;AAAA,KACtB;AAAA,IACA,WAAa,EAAA;AAAA,MACX,QAAU,EAAA,UAAA;AAAA,MACV,KAAA,EAAO,KAAM,CAAA,OAAA,CAAQ,CAAC,CAAA;AAAA,MACtB,GAAA,EAAK,KAAM,CAAA,OAAA,CAAQ,CAAC,CAAA;AAAA,MACpB,KAAO,EAAA,KAAA,CAAM,OAAQ,CAAA,IAAA,CAAK,GAAG;AAAA;AAC/B,GACD;AACH,CAAA;AAWA,MAAM,uBAAuB,CAAC;AAAA,EAC5B,IAAA;AAAA,EACA,WAAA;AAAA,EACA,WAAA;AAAA,EACA,IAAA;AAAA,EACA,QAAA;AAAA,EACA,UAAA;AAAA,EACA;AACF,CAAiC,KAAA;AAC/B,EAAA,MAAM,UAAU,SAAU,EAAA;AAE1B,EAAA,MAAM,CAAC,IAAA,EAAM,OAAO,CAAA,GAAI,SAAS,UAAU,CAAA;AAC3C,EAAA,MAAM,EAAE,CAAA,EAAM,GAAA,iBAAA,CAAkB,oBAAoB,CAAA;AAEpD,EAAA,SAAA,CAAU,MAAM;AAEd,IAAA,IAAI,WAAW,UAAY,EAAA;AACzB,MAAA,OAAA,CAAQ,UAAU,CAAA;AAAA;AACpB,GACC,EAAA,CAAC,OAAS,EAAA,UAAU,CAAC,CAAA;AAExB,EACE,uBAAA,IAAA;AAAA,IAAC,MAAA;AAAA,IAAA;AAAA,MACC,aAAY,EAAA,yBAAA;AAAA,MACZ,QAAS,EAAA,IAAA;AAAA,MACT,SAAS,EAAA,IAAA;AAAA,MACT,IAAA;AAAA,MACA,OAAS,EAAA,WAAA;AAAA,MAET,QAAA,EAAA;AAAA,wBAAC,GAAA,CAAA,WAAA,EAAA,EAAY,EAAG,EAAA,kBAAA,EAAmB,KAAO,EAAA,CAAA,CAAE,uBAAuB,CAAA,EACjE,QAAC,kBAAA,IAAA,CAAA,GAAA,EAAA,EAAI,SAAW,EAAA,OAAA,CAAQ,cACtB,EAAA,QAAA,EAAA;AAAA,0BAAA,GAAA;AAAA,YAAC,aAAA;AAAA,YAAA;AAAA,cACC,KAAO,EAAA,gBAAA;AAAA,cACP,IAAK,EAAA,KAAA;AAAA,cACL,IAAA,EAAM,WAAa,EAAA,QAAA,EAAU,IAAQ,IAAA;AAAA;AAAA,WACvC;AAAA,0BACA,GAAA;AAAA,YAAC,UAAA;AAAA,YAAA;AAAA,cACC,YAAW,EAAA,OAAA;AAAA,cACX,WAAW,OAAQ,CAAA,WAAA;AAAA,cACnB,OAAS,EAAA,WAAA;AAAA,cAET,8BAAC,SAAU,EAAA,EAAA;AAAA;AAAA;AACb,SAAA,EACF,CACF,EAAA,CAAA;AAAA,wBACA,GAAA,CAAC,aACC,EAAA,EAAA,QAAA,kBAAA,IAAA,CAAC,aACC,EAAA,EAAA,QAAA,EAAA;AAAA,0BAAA,GAAA;AAAA,YAAC,wBAAA;AAAA,YAAA;AAAA,cACC,IAAA;AAAA,cACA,UAAY,EAAA,IAAA;AAAA,cACZ;AAAA;AAAA,WACF;AAAA,0BACA,GAAA;AAAA,YAAC,eAAA;AAAA,YAAA;AAAA,cACC,WAAA;AAAA,cACA,QAAA;AAAA,cACA,IAAA;AAAA,cACA,UAAY,EAAA,IAAA;AAAA,cACZ,aAAe,EAAA;AAAA;AAAA;AACjB,SAAA,EACF,CACF,EAAA;AAAA;AAAA;AAAA,GACF;AAEJ,CAAA;AAEA,6BAAe,KAAK,oBAAoB,CAAA;;;;"}
|
|
@@ -1,45 +1,53 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { useMemo } from 'react';
|
|
2
3
|
import { Flex, FlexItem } from '@patternfly/react-core';
|
|
3
4
|
import { TEKTON_PIPELINE_RUN, TEKTON_PIPELINE_TASKRUN, TEKTON_PIPELINE_TASK } from '../../consts/tekton-const.esm.js';
|
|
4
5
|
import PodLogsDownloadLink from './PodLogsDownloadLink.esm.js';
|
|
6
|
+
import { useTranslationRef } from '@backstage/core-plugin-api/alpha';
|
|
7
|
+
import { tektonTranslationRef } from '../../translation.esm.js';
|
|
5
8
|
|
|
6
9
|
const PipelineRunLogDownloader = ({ pods, pipelineRun, activeTask }) => {
|
|
7
10
|
const filteredPods = pods?.filter(
|
|
8
11
|
(p) => p?.metadata?.labels?.[TEKTON_PIPELINE_RUN] === pipelineRun?.metadata?.name
|
|
9
12
|
);
|
|
10
|
-
const sortedPods =
|
|
13
|
+
const sortedPods = useMemo(
|
|
11
14
|
() => Array.from(filteredPods)?.sort(
|
|
12
15
|
(a, b) => new Date(a?.status?.startTime).getTime() - new Date(b?.status?.startTime).getTime()
|
|
13
16
|
),
|
|
14
17
|
[filteredPods]
|
|
15
18
|
);
|
|
19
|
+
const { t } = useTranslationRef(tektonTranslationRef);
|
|
16
20
|
const activeTaskPod = sortedPods.find(
|
|
17
21
|
(sp) => sp.metadata?.labels?.[TEKTON_PIPELINE_TASKRUN] === activeTask
|
|
18
22
|
) ?? sortedPods[sortedPods.length - 1];
|
|
19
|
-
return sortedPods.length > 0 ? /* @__PURE__ */
|
|
23
|
+
return sortedPods.length > 0 ? /* @__PURE__ */ jsxs(
|
|
20
24
|
Flex,
|
|
21
25
|
{
|
|
22
26
|
"data-testid": "pipelinerun-logs-downloader",
|
|
23
|
-
justifyContent: { default: "justifyContentFlexEnd" }
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
27
|
+
justifyContent: { default: "justifyContentFlexEnd" },
|
|
28
|
+
children: [
|
|
29
|
+
/* @__PURE__ */ jsx(FlexItem, { children: /* @__PURE__ */ jsx(
|
|
30
|
+
PodLogsDownloadLink,
|
|
31
|
+
{
|
|
32
|
+
"data-testid": "download-task-logs",
|
|
33
|
+
pods: activeTaskPod ? [activeTaskPod] : [],
|
|
34
|
+
fileName: `${activeTaskPod?.metadata?.labels?.[TEKTON_PIPELINE_TASK] ?? "task"}.log`,
|
|
35
|
+
downloadTitle: t("pipelineRunLogs.downloader.downloadTaskLogs")
|
|
36
|
+
}
|
|
37
|
+
) }),
|
|
38
|
+
/* @__PURE__ */ jsx(FlexItem, { children: /* @__PURE__ */ jsx(
|
|
39
|
+
PodLogsDownloadLink,
|
|
40
|
+
{
|
|
41
|
+
"data-testid": "download-pipelinerun-logs",
|
|
42
|
+
pods: sortedPods,
|
|
43
|
+
fileName: `${pipelineRun?.metadata?.name ?? "pipelinerun"}.log`,
|
|
44
|
+
downloadTitle: t(
|
|
45
|
+
"pipelineRunLogs.downloader.downloadPipelineRunLogs"
|
|
46
|
+
)
|
|
47
|
+
}
|
|
48
|
+
) })
|
|
49
|
+
]
|
|
50
|
+
}
|
|
43
51
|
) : null;
|
|
44
52
|
};
|
|
45
53
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PipelineRunLogDownloader.esm.js","sources":["../../../src/components/PipelineRunLogs/PipelineRunLogDownloader.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":"PipelineRunLogDownloader.esm.js","sources":["../../../src/components/PipelineRunLogs/PipelineRunLogDownloader.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 { useMemo } from 'react';\n\nimport { V1Pod } from '@kubernetes/client-node';\nimport { Flex, FlexItem } from '@patternfly/react-core';\n\nimport { PipelineRunKind } from '@janus-idp/shared-react';\n\nimport {\n TEKTON_PIPELINE_RUN,\n TEKTON_PIPELINE_TASK,\n TEKTON_PIPELINE_TASKRUN,\n} from '../../consts/tekton-const';\nimport PodLogsDownloadLink from './PodLogsDownloadLink';\nimport { useTranslationRef } from '@backstage/core-plugin-api/alpha';\nimport { tektonTranslationRef } from '../../translation';\n\nconst PipelineRunLogDownloader: FC<{\n pods: V1Pod[];\n pipelineRun: PipelineRunKind;\n activeTask: string | undefined;\n}> = ({ pods, pipelineRun, activeTask }) => {\n const filteredPods: V1Pod[] = pods?.filter(\n (p: V1Pod) =>\n p?.metadata?.labels?.[TEKTON_PIPELINE_RUN] ===\n pipelineRun?.metadata?.name,\n );\n\n const sortedPods: V1Pod[] = useMemo(\n () =>\n Array.from(filteredPods)?.sort(\n (a: V1Pod, b: V1Pod) =>\n new Date(a?.status?.startTime as Date).getTime() -\n new Date(b?.status?.startTime as Date).getTime(),\n ),\n [filteredPods],\n );\n const { t } = useTranslationRef(tektonTranslationRef);\n\n const activeTaskPod: V1Pod =\n sortedPods.find(\n (sp: V1Pod) =>\n sp.metadata?.labels?.[TEKTON_PIPELINE_TASKRUN] === activeTask,\n ) ?? sortedPods[sortedPods.length - 1];\n\n return sortedPods.length > 0 ? (\n <Flex\n data-testid=\"pipelinerun-logs-downloader\"\n justifyContent={{ default: 'justifyContentFlexEnd' }}\n >\n <FlexItem>\n <PodLogsDownloadLink\n data-testid=\"download-task-logs\"\n pods={activeTaskPod ? [activeTaskPod] : []}\n fileName={`${\n activeTaskPod?.metadata?.labels?.[TEKTON_PIPELINE_TASK] ?? 'task'\n }.log`}\n downloadTitle={t('pipelineRunLogs.downloader.downloadTaskLogs')}\n />\n </FlexItem>\n <FlexItem>\n <PodLogsDownloadLink\n data-testid=\"download-pipelinerun-logs\"\n pods={sortedPods}\n fileName={`${pipelineRun?.metadata?.name ?? 'pipelinerun'}.log`}\n downloadTitle={t(\n 'pipelineRunLogs.downloader.downloadPipelineRunLogs',\n )}\n />\n </FlexItem>\n </Flex>\n ) : null;\n};\nexport default PipelineRunLogDownloader;\n"],"names":[],"mappings":";;;;;;;;AAiCA,MAAM,2BAID,CAAC,EAAE,IAAM,EAAA,WAAA,EAAa,YAAiB,KAAA;AAC1C,EAAA,MAAM,eAAwB,IAAM,EAAA,MAAA;AAAA,IAClC,CAAC,MACC,CAAG,EAAA,QAAA,EAAU,SAAS,mBAAmB,CAAA,KACzC,aAAa,QAAU,EAAA;AAAA,GAC3B;AAEA,EAAA,MAAM,UAAsB,GAAA,OAAA;AAAA,IAC1B,MACE,KAAA,CAAM,IAAK,CAAA,YAAY,CAAG,EAAA,IAAA;AAAA,MACxB,CAAC,CAAU,EAAA,CAAA,KACT,IAAI,IAAA,CAAK,GAAG,MAAQ,EAAA,SAAiB,CAAE,CAAA,OAAA,KACvC,IAAI,IAAA,CAAK,GAAG,MAAQ,EAAA,SAAiB,EAAE,OAAQ;AAAA,KACnD;AAAA,IACF,CAAC,YAAY;AAAA,GACf;AACA,EAAA,MAAM,EAAE,CAAA,EAAM,GAAA,iBAAA,CAAkB,oBAAoB,CAAA;AAEpD,EAAA,MAAM,gBACJ,UAAW,CAAA,IAAA;AAAA,IACT,CAAC,EACC,KAAA,EAAA,CAAG,QAAU,EAAA,MAAA,GAAS,uBAAuB,CAAM,KAAA;AAAA,GAClD,IAAA,UAAA,CAAW,UAAW,CAAA,MAAA,GAAS,CAAC,CAAA;AAEvC,EAAO,OAAA,UAAA,CAAW,SAAS,CACzB,mBAAA,IAAA;AAAA,IAAC,IAAA;AAAA,IAAA;AAAA,MACC,aAAY,EAAA,6BAAA;AAAA,MACZ,cAAA,EAAgB,EAAE,OAAA,EAAS,uBAAwB,EAAA;AAAA,MAEnD,QAAA,EAAA;AAAA,wBAAA,GAAA,CAAC,QACC,EAAA,EAAA,QAAA,kBAAA,GAAA;AAAA,UAAC,mBAAA;AAAA,UAAA;AAAA,YACC,aAAY,EAAA,oBAAA;AAAA,YACZ,IAAM,EAAA,aAAA,GAAgB,CAAC,aAAa,IAAI,EAAC;AAAA,YACzC,UAAU,CACR,EAAA,aAAA,EAAe,UAAU,MAAS,GAAA,oBAAoB,KAAK,MAC7D,CAAA,IAAA,CAAA;AAAA,YACA,aAAA,EAAe,EAAE,6CAA6C;AAAA;AAAA,SAElE,EAAA,CAAA;AAAA,4BACC,QACC,EAAA,EAAA,QAAA,kBAAA,GAAA;AAAA,UAAC,mBAAA;AAAA,UAAA;AAAA,YACC,aAAY,EAAA,2BAAA;AAAA,YACZ,IAAM,EAAA,UAAA;AAAA,YACN,QAAU,EAAA,CAAA,EAAG,WAAa,EAAA,QAAA,EAAU,QAAQ,aAAa,CAAA,IAAA,CAAA;AAAA,YACzD,aAAe,EAAA,CAAA;AAAA,cACb;AAAA;AACF;AAAA,SAEJ,EAAA;AAAA;AAAA;AAAA,GAEA,GAAA,IAAA;AACN;;;;"}
|
|
@@ -1,13 +1,17 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
2
2
|
import { DismissableBanner, LogViewer } from '@backstage/core-components';
|
|
3
3
|
import { Paper } from '@material-ui/core';
|
|
4
4
|
import { Skeleton } from '@material-ui/lab';
|
|
5
|
+
import { QueryClientProvider, QueryClient } from '@tanstack/react-query';
|
|
5
6
|
import { usePodLogsOfPipelineRun } from '../../hooks/usePodLogsOfPipelineRun.esm.js';
|
|
7
|
+
import { useTranslationRef } from '@backstage/core-plugin-api/alpha';
|
|
8
|
+
import { tektonTranslationRef } from '../../translation.esm.js';
|
|
6
9
|
|
|
7
10
|
const PipelineRunLogViewer = ({ pod }) => {
|
|
8
11
|
const { value, error, loading } = usePodLogsOfPipelineRun({
|
|
9
12
|
pod
|
|
10
13
|
});
|
|
14
|
+
const { t } = useTranslationRef(tektonTranslationRef);
|
|
11
15
|
const containersList = pod?.spec?.containers || [];
|
|
12
16
|
let text = "";
|
|
13
17
|
text = containersList.reduce(
|
|
@@ -22,32 +26,50 @@ ${value[idx].text}`
|
|
|
22
26
|
},
|
|
23
27
|
""
|
|
24
28
|
);
|
|
25
|
-
return /* @__PURE__ */
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
message: error?.message,
|
|
29
|
-
variant: "error",
|
|
30
|
-
fixed: false,
|
|
31
|
-
id: "pod-logs"
|
|
32
|
-
}
|
|
33
|
-
), /* @__PURE__ */ React__default.createElement(
|
|
34
|
-
Paper,
|
|
35
|
-
{
|
|
36
|
-
elevation: 1,
|
|
37
|
-
style: { height: "100%", width: "100%", minHeight: "30rem" }
|
|
38
|
-
},
|
|
39
|
-
loading && /* @__PURE__ */ React__default.createElement(
|
|
40
|
-
Skeleton,
|
|
29
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
30
|
+
error && /* @__PURE__ */ jsx(
|
|
31
|
+
DismissableBanner,
|
|
41
32
|
{
|
|
42
|
-
|
|
43
|
-
variant: "
|
|
44
|
-
|
|
45
|
-
|
|
33
|
+
message: error?.message,
|
|
34
|
+
variant: "error",
|
|
35
|
+
fixed: false,
|
|
36
|
+
id: "pod-logs"
|
|
46
37
|
}
|
|
47
38
|
),
|
|
48
|
-
|
|
49
|
-
|
|
39
|
+
/* @__PURE__ */ jsxs(
|
|
40
|
+
Paper,
|
|
41
|
+
{
|
|
42
|
+
elevation: 1,
|
|
43
|
+
style: { height: "100%", width: "100%", minHeight: "30rem" },
|
|
44
|
+
children: [
|
|
45
|
+
loading && /* @__PURE__ */ jsx(
|
|
46
|
+
Skeleton,
|
|
47
|
+
{
|
|
48
|
+
"data-testid": "logs-skeleton",
|
|
49
|
+
variant: "rect",
|
|
50
|
+
width: "100%",
|
|
51
|
+
height: "100%"
|
|
52
|
+
}
|
|
53
|
+
),
|
|
54
|
+
pod && !loading && /* @__PURE__ */ jsx(LogViewer, { text: text || t("pipelineRunLogs.noLogs") })
|
|
55
|
+
]
|
|
56
|
+
}
|
|
57
|
+
)
|
|
58
|
+
] });
|
|
59
|
+
};
|
|
60
|
+
const queryClient = new QueryClient({
|
|
61
|
+
defaultOptions: {
|
|
62
|
+
queries: {
|
|
63
|
+
retry: 5,
|
|
64
|
+
refetchOnWindowFocus: false
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
const PipelineRunLogViewerWithQueryClient = ({
|
|
69
|
+
pod
|
|
70
|
+
}) => {
|
|
71
|
+
return /* @__PURE__ */ jsx(QueryClientProvider, { client: queryClient, children: /* @__PURE__ */ jsx(PipelineRunLogViewer, { pod }) });
|
|
50
72
|
};
|
|
51
73
|
|
|
52
|
-
export { PipelineRunLogViewer };
|
|
74
|
+
export { PipelineRunLogViewerWithQueryClient as PipelineRunLogViewer };
|
|
53
75
|
//# sourceMappingURL=PipelineRunLogViewer.esm.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PipelineRunLogViewer.esm.js","sources":["../../../src/components/PipelineRunLogs/PipelineRunLogViewer.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":"PipelineRunLogViewer.esm.js","sources":["../../../src/components/PipelineRunLogs/PipelineRunLogViewer.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 { DismissableBanner, LogViewer } from '@backstage/core-components';\nimport { V1Container, V1Pod } from '@kubernetes/client-node';\nimport { Paper } from '@material-ui/core';\nimport { Skeleton } from '@material-ui/lab';\nimport { QueryClient, QueryClientProvider } from '@tanstack/react-query';\nimport { usePodLogsOfPipelineRun } from '../../hooks/usePodLogsOfPipelineRun';\nimport { useTranslationRef } from '@backstage/core-plugin-api/alpha';\nimport { tektonTranslationRef } from '../../translation';\n\ntype PipelineRunLogViewerProps = { pod: V1Pod };\n\nconst PipelineRunLogViewer = ({ pod }: PipelineRunLogViewerProps) => {\n const { value, error, loading } = usePodLogsOfPipelineRun({\n pod,\n });\n const { t } = useTranslationRef(tektonTranslationRef);\n\n const containersList = pod?.spec?.containers || [];\n let text = '';\n\n text = containersList.reduce(\n (acc: string, container: V1Container, idx: number) => {\n if (container?.name && value?.[idx]?.text) {\n return acc\n .concat(\n `${container.name.toLocaleUpperCase('en-US')}\\n${value[idx].text}`,\n )\n .concat(idx === containersList.length - 1 ? '' : '\\n');\n }\n return acc;\n },\n '',\n );\n\n return (\n <>\n {error && (\n <DismissableBanner\n message={error?.message}\n variant=\"error\"\n fixed={false}\n id=\"pod-logs\"\n />\n )}\n <Paper\n elevation={1}\n style={{ height: '100%', width: '100%', minHeight: '30rem' }}\n >\n {loading && (\n <Skeleton\n data-testid=\"logs-skeleton\"\n variant=\"rect\"\n width=\"100%\"\n height=\"100%\"\n />\n )}\n {pod && !loading && (\n <LogViewer text={text || t('pipelineRunLogs.noLogs')} />\n )}\n </Paper>\n </>\n );\n};\n\nconst queryClient = new QueryClient({\n defaultOptions: {\n queries: {\n retry: 5,\n refetchOnWindowFocus: false,\n },\n },\n});\n\nconst PipelineRunLogViewerWithQueryClient = ({\n pod,\n}: PipelineRunLogViewerProps) => {\n return (\n <QueryClientProvider client={queryClient}>\n <PipelineRunLogViewer pod={pod} />\n </QueryClientProvider>\n );\n};\n\nexport { PipelineRunLogViewerWithQueryClient as PipelineRunLogViewer };\n"],"names":[],"mappings":";;;;;;;;;AA0BA,MAAM,oBAAuB,GAAA,CAAC,EAAE,GAAA,EAAqC,KAAA;AACnE,EAAA,MAAM,EAAE,KAAA,EAAO,KAAO,EAAA,OAAA,KAAY,uBAAwB,CAAA;AAAA,IACxD;AAAA,GACD,CAAA;AACD,EAAA,MAAM,EAAE,CAAA,EAAM,GAAA,iBAAA,CAAkB,oBAAoB,CAAA;AAEpD,EAAA,MAAM,cAAiB,GAAA,GAAA,EAAK,IAAM,EAAA,UAAA,IAAc,EAAC;AACjD,EAAA,IAAI,IAAO,GAAA,EAAA;AAEX,EAAA,IAAA,GAAO,cAAe,CAAA,MAAA;AAAA,IACpB,CAAC,GAAa,EAAA,SAAA,EAAwB,GAAgB,KAAA;AACpD,MAAA,IAAI,SAAW,EAAA,IAAA,IAAQ,KAAQ,GAAA,GAAG,GAAG,IAAM,EAAA;AACzC,QAAA,OAAO,GACJ,CAAA,MAAA;AAAA,UACC,CAAG,EAAA,SAAA,CAAU,IAAK,CAAA,iBAAA,CAAkB,OAAO,CAAC;AAAA,EAAK,KAAA,CAAM,GAAG,CAAA,CAAE,IAAI,CAAA;AAAA,UAEjE,MAAO,CAAA,GAAA,KAAQ,eAAe,MAAS,GAAA,CAAA,GAAI,KAAK,IAAI,CAAA;AAAA;AAEzD,MAAO,OAAA,GAAA;AAAA,KACT;AAAA,IACA;AAAA,GACF;AAEA,EAAA,uBAEK,IAAA,CAAA,QAAA,EAAA,EAAA,QAAA,EAAA;AAAA,IACC,KAAA,oBAAA,GAAA;AAAA,MAAC,iBAAA;AAAA,MAAA;AAAA,QACC,SAAS,KAAO,EAAA,OAAA;AAAA,QAChB,OAAQ,EAAA,OAAA;AAAA,QACR,KAAO,EAAA,KAAA;AAAA,QACP,EAAG,EAAA;AAAA;AAAA,KACL;AAAA,oBAEF,IAAA;AAAA,MAAC,KAAA;AAAA,MAAA;AAAA,QACC,SAAW,EAAA,CAAA;AAAA,QACX,OAAO,EAAE,MAAA,EAAQ,QAAQ,KAAO,EAAA,MAAA,EAAQ,WAAW,OAAQ,EAAA;AAAA,QAE1D,QAAA,EAAA;AAAA,UACC,OAAA,oBAAA,GAAA;AAAA,YAAC,QAAA;AAAA,YAAA;AAAA,cACC,aAAY,EAAA,eAAA;AAAA,cACZ,OAAQ,EAAA,MAAA;AAAA,cACR,KAAM,EAAA,MAAA;AAAA,cACN,MAAO,EAAA;AAAA;AAAA,WACT;AAAA,UAED,GAAA,IAAO,CAAC,OACP,oBAAA,GAAA,CAAC,aAAU,IAAM,EAAA,IAAA,IAAQ,CAAE,CAAA,wBAAwB,CAAG,EAAA;AAAA;AAAA;AAAA;AAE1D,GACF,EAAA,CAAA;AAEJ,CAAA;AAEA,MAAM,WAAA,GAAc,IAAI,WAAY,CAAA;AAAA,EAClC,cAAgB,EAAA;AAAA,IACd,OAAS,EAAA;AAAA,MACP,KAAO,EAAA,CAAA;AAAA,MACP,oBAAsB,EAAA;AAAA;AACxB;AAEJ,CAAC,CAAA;AAED,MAAM,sCAAsC,CAAC;AAAA,EAC3C;AACF,CAAiC,KAAA;AAC/B,EAAA,2BACG,mBAAoB,EAAA,EAAA,MAAA,EAAQ,aAC3B,QAAC,kBAAA,GAAA,CAAA,oBAAA,EAAA,EAAqB,KAAU,CAClC,EAAA,CAAA;AAEJ;;;;"}
|
|
@@ -1,11 +1,14 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { useState, useEffect, useMemo } from 'react';
|
|
2
3
|
import { Progress, LogViewer } from '@backstage/core-components';
|
|
3
4
|
import { Paper } from '@material-ui/core';
|
|
4
5
|
import Grid from '@material-ui/core/Grid';
|
|
5
6
|
import { getTaskRunsForPipelineRun, pipelineRunFilterReducer } from '@janus-idp/shared-react';
|
|
6
7
|
import { getSortedTaskRuns, getActiveTaskRun } from '../../utils/taskRun-utils.esm.js';
|
|
7
|
-
import { PipelineRunLogViewer } from './PipelineRunLogViewer.esm.js';
|
|
8
|
+
import { PipelineRunLogViewer as PipelineRunLogViewerWithQueryClient } from './PipelineRunLogViewer.esm.js';
|
|
8
9
|
import { TaskStatusStepper } from './TaskStatusStepper.esm.js';
|
|
10
|
+
import { useTranslationRef } from '@backstage/core-plugin-api/alpha';
|
|
11
|
+
import { tektonTranslationRef } from '../../translation.esm.js';
|
|
9
12
|
|
|
10
13
|
const PipelineRunLogs = ({
|
|
11
14
|
pipelineRun,
|
|
@@ -26,8 +29,9 @@ const PipelineRunLogs = ({
|
|
|
26
29
|
{}
|
|
27
30
|
);
|
|
28
31
|
const completed = pipelineRunFilterReducer(pipelineRun);
|
|
29
|
-
const [lastActiveStepId, setLastActiveStepId] =
|
|
30
|
-
|
|
32
|
+
const [lastActiveStepId, setLastActiveStepId] = useState("");
|
|
33
|
+
const { t } = useTranslationRef(tektonTranslationRef);
|
|
34
|
+
useEffect(() => {
|
|
31
35
|
const mostRecentFailedOrActiveStep = sortedTaskRuns.find(
|
|
32
36
|
(tr) => ["Failed", "Running"].includes(tr.status)
|
|
33
37
|
);
|
|
@@ -42,27 +46,33 @@ const PipelineRunLogs = ({
|
|
|
42
46
|
const currentStepId = activeTask || lastActiveStepId;
|
|
43
47
|
const activeItem = getActiveTaskRun(sortedTaskRuns, currentStepId);
|
|
44
48
|
const podName = activeItem && taskRunFromYaml?.[currentStepId]?.status?.podName;
|
|
45
|
-
const podData =
|
|
49
|
+
const podData = useMemo(
|
|
46
50
|
() => pods.find((pod) => {
|
|
47
51
|
return pod?.metadata?.name === podName;
|
|
48
52
|
}),
|
|
49
53
|
[pods, podName]
|
|
50
54
|
);
|
|
51
|
-
return /* @__PURE__ */
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
{
|
|
61
|
-
|
|
62
|
-
style: { height: "
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
55
|
+
return /* @__PURE__ */ jsxs(Grid, { container: true, children: [
|
|
56
|
+
/* @__PURE__ */ jsx(Grid, { item: true, xs: 3, children: /* @__PURE__ */ jsx(Paper, { children: /* @__PURE__ */ jsx(
|
|
57
|
+
TaskStatusStepper,
|
|
58
|
+
{
|
|
59
|
+
steps: sortedTaskRuns,
|
|
60
|
+
currentStepId,
|
|
61
|
+
onUserStepChange: setActiveTask
|
|
62
|
+
}
|
|
63
|
+
) }) }),
|
|
64
|
+
/* @__PURE__ */ jsxs(Grid, { item: true, xs: 9, children: [
|
|
65
|
+
!currentStepId && /* @__PURE__ */ jsx(Progress, {}),
|
|
66
|
+
/* @__PURE__ */ jsx("div", { style: { height: "80vh" }, children: !podData ? /* @__PURE__ */ jsx(
|
|
67
|
+
Paper,
|
|
68
|
+
{
|
|
69
|
+
elevation: 1,
|
|
70
|
+
style: { height: "100%", width: "100%", minHeight: "30rem" },
|
|
71
|
+
children: /* @__PURE__ */ jsx(LogViewer, { text: t("pipelineRunLogs.noLogs") })
|
|
72
|
+
}
|
|
73
|
+
) : /* @__PURE__ */ jsx(PipelineRunLogViewerWithQueryClient, { pod: podData }) })
|
|
74
|
+
] })
|
|
75
|
+
] });
|
|
66
76
|
};
|
|
67
77
|
|
|
68
78
|
export { PipelineRunLogs, PipelineRunLogs as default };
|