@backstage-community/plugin-tekton 3.23.0 → 3.25.1
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 +32 -24
- package/dist/components/PipelineRunLogs/PipelineRunLogViewer.esm.js.map +1 -1
- package/dist/components/PipelineRunLogs/PipelineRunLogs.esm.js +29 -19
- 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 +4 -2
- 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 -19
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PipelineRunLogs.esm.js","sources":["../../../src/components/PipelineRunLogs/PipelineRunLogs.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":"PipelineRunLogs.esm.js","sources":["../../../src/components/PipelineRunLogs/PipelineRunLogs.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, useMemo } from 'react';\n\nimport { LogViewer, Progress } from '@backstage/core-components';\n\nimport { V1Pod } from '@kubernetes/client-node';\nimport { Paper } from '@material-ui/core';\nimport Grid from '@material-ui/core/Grid';\n\nimport {\n getTaskRunsForPipelineRun,\n pipelineRunFilterReducer,\n PipelineRunKind,\n TaskRunKind,\n} from '@janus-idp/shared-react';\n\nimport { getActiveTaskRun, getSortedTaskRuns } from '../../utils/taskRun-utils';\nimport { PipelineRunLogViewer } from './PipelineRunLogViewer';\nimport { TaskStatusStepper } from './TaskStatusStepper';\nimport { useTranslationRef } from '@backstage/core-plugin-api/alpha';\nimport { tektonTranslationRef } from '../../translation';\n\ntype PipelineRunLogsProps = {\n pipelineRun: PipelineRunKind;\n taskRuns: TaskRunKind[];\n pods: V1Pod[];\n activeTask?: string;\n setActiveTask: (t: string) => void;\n};\nexport const PipelineRunLogs = ({\n pipelineRun,\n taskRuns,\n pods,\n activeTask,\n setActiveTask,\n}: PipelineRunLogsProps) => {\n const PLRTaskRuns = getTaskRunsForPipelineRun(pipelineRun, taskRuns);\n const sortedTaskRuns = getSortedTaskRuns(PLRTaskRuns);\n const taskRunFromYaml = PLRTaskRuns?.reduce(\n (acc: { [value: string]: TaskRunKind }, value) => {\n if (value?.metadata?.name) {\n acc[value.metadata.name] = value;\n }\n return acc;\n },\n {},\n );\n\n const completed = pipelineRunFilterReducer(pipelineRun);\n const [lastActiveStepId, setLastActiveStepId] = useState<string>('');\n const { t } = useTranslationRef(tektonTranslationRef);\n\n useEffect(() => {\n const mostRecentFailedOrActiveStep = sortedTaskRuns.find(tr =>\n ['Failed', 'Running'].includes(tr.status),\n );\n\n if (completed && !mostRecentFailedOrActiveStep && !activeTask) {\n setLastActiveStepId(sortedTaskRuns[sortedTaskRuns.length - 1]?.id);\n return;\n }\n\n setLastActiveStepId(\n !activeTask ? (mostRecentFailedOrActiveStep?.id as string) : '',\n );\n }, [sortedTaskRuns, completed, activeTask]);\n\n const currentStepId = activeTask || lastActiveStepId;\n const activeItem = getActiveTaskRun(sortedTaskRuns, currentStepId);\n const podName =\n activeItem && taskRunFromYaml?.[currentStepId]?.status?.podName;\n const podData = useMemo(\n () =>\n pods.find(pod => {\n return pod?.metadata?.name === podName;\n }),\n [pods, podName],\n );\n\n return (\n <Grid container>\n <Grid item xs={3}>\n <Paper>\n <TaskStatusStepper\n steps={sortedTaskRuns}\n currentStepId={currentStepId}\n onUserStepChange={setActiveTask}\n />\n </Paper>\n </Grid>\n <Grid item xs={9}>\n {!currentStepId && <Progress />}\n <div style={{ height: '80vh' }}>\n {!podData ? (\n <Paper\n elevation={1}\n style={{ height: '100%', width: '100%', minHeight: '30rem' }}\n >\n <LogViewer text={t('pipelineRunLogs.noLogs')} />\n </Paper>\n ) : (\n <PipelineRunLogViewer pod={podData} />\n )}\n </div>\n </Grid>\n </Grid>\n );\n};\n\nexport default PipelineRunLogs;\n"],"names":["PipelineRunLogViewer"],"mappings":";;;;;;;;;;;;AA2CO,MAAM,kBAAkB,CAAC;AAAA,EAC9B,WAAA;AAAA,EACA,QAAA;AAAA,EACA,IAAA;AAAA,EACA,UAAA;AAAA,EACA;AACF,CAA4B,KAAA;AAC1B,EAAM,MAAA,WAAA,GAAc,yBAA0B,CAAA,WAAA,EAAa,QAAQ,CAAA;AACnE,EAAM,MAAA,cAAA,GAAiB,kBAAkB,WAAW,CAAA;AACpD,EAAA,MAAM,kBAAkB,WAAa,EAAA,MAAA;AAAA,IACnC,CAAC,KAAuC,KAAU,KAAA;AAChD,MAAI,IAAA,KAAA,EAAO,UAAU,IAAM,EAAA;AACzB,QAAI,GAAA,CAAA,KAAA,CAAM,QAAS,CAAA,IAAI,CAAI,GAAA,KAAA;AAAA;AAE7B,MAAO,OAAA,GAAA;AAAA,KACT;AAAA,IACA;AAAC,GACH;AAEA,EAAM,MAAA,SAAA,GAAY,yBAAy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BAAC,KACC,EAAA,EAAA,QAAA,kBAAA,GAAA;AAAA,MAAC,iBAAA;AAAA,MAAA;AAAA,QACC,KAAO,EAAA,cAAA;AAAA,QACP,aAAA;AAAA,QACA,gBAAkB,EAAA;AAAA;AAAA,OAEtB,CACF,EAAA,CAAA;AAAA,oBACC,IAAA,CAAA,IAAA,EAAA,EAAK,IAAI,EAAA,IAAA,EAAC,IAAI,CACZ,EAAA,QAAA,EAAA;AAAA,MAAC,CAAA,aAAA,wBAAkB,QAAS,EAAA,EAAA,CAAA;AAAA,sBAC7B,GAAA,CAAC,SAAI,KAAO,EAAA,EAAE,QAAQ,MAAO,EAAA,EAC1B,WAAC,OACA,mBAAA,GAAA;AAAA,QAAC,KAAA;AAAA,QAAA;AAAA,UACC,SAAW,EAAA,CAAA;AAAA,UACX,OAAO,EAAE,MAAA,EAAQ,QAAQ,KAAO,EAAA,MAAA,EAAQ,WAAW,OAAQ,EAAA;AAAA,UAE3D,QAAC,kBAAA,GAAA,CAAA,SAAA,EAAA,EAAU,IAAM,EAAA,CAAA,CAAE,wBAAwB,CAAG,EAAA;AAAA;AAAA,OAGhD,mBAAA,GAAA,CAACA,mCAAqB,EAAA,EAAA,GAAA,EAAK,SAAS,CAExC,EAAA;AAAA,KACF,EAAA;AAAA,GACF,EAAA,CAAA;AAEJ;;;;"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { useState, useContext } from 'react';
|
|
2
3
|
import { useApi } from '@backstage/core-plugin-api';
|
|
3
4
|
import { makeStyles, Link, createStyles } from '@material-ui/core';
|
|
4
5
|
import DownloadIcon from '@mui/icons-material/FileDownloadOutlined';
|
|
@@ -7,6 +8,8 @@ import { downloadLogFile } from '@janus-idp/shared-react';
|
|
|
7
8
|
import { TektonResourcesContext } from '../../hooks/TektonResourcesContext.esm.js';
|
|
8
9
|
import { kubernetesProxyApiRef } from '../../types/types.esm.js';
|
|
9
10
|
import { getPodLogs } from '../../utils/log-downloader-utils.esm.js';
|
|
11
|
+
import { useTranslationRef } from '@backstage/core-plugin-api/alpha';
|
|
12
|
+
import { tektonTranslationRef } from '../../translation.esm.js';
|
|
10
13
|
|
|
11
14
|
const useStyles = makeStyles(
|
|
12
15
|
(theme) => createStyles({
|
|
@@ -24,9 +27,10 @@ const useStyles = makeStyles(
|
|
|
24
27
|
);
|
|
25
28
|
const PodLogsDownloadLink = ({ pods, fileName, downloadTitle, ...props }) => {
|
|
26
29
|
const classes = useStyles();
|
|
27
|
-
const [downloading, setDownloading] =
|
|
30
|
+
const [downloading, setDownloading] = useState(false);
|
|
28
31
|
const kubernetesProxyApi = useApi(kubernetesProxyApiRef);
|
|
29
|
-
const {
|
|
32
|
+
const { t } = useTranslationRef(tektonTranslationRef);
|
|
33
|
+
const { clusters, selectedCluster = 0 } = useContext(TektonResourcesContext);
|
|
30
34
|
const currCluster = clusters.length > 0 ? clusters[selectedCluster] : "";
|
|
31
35
|
const getLogs = (podScope) => {
|
|
32
36
|
const { podName, podNamespace, containerName, clusterName } = podScope;
|
|
@@ -37,14 +41,14 @@ const PodLogsDownloadLink = ({ pods, fileName, downloadTitle, ...props }) => {
|
|
|
37
41
|
clusterName
|
|
38
42
|
});
|
|
39
43
|
};
|
|
40
|
-
return /* @__PURE__ */
|
|
44
|
+
return /* @__PURE__ */ jsxs(
|
|
41
45
|
Link,
|
|
42
46
|
{
|
|
43
47
|
component: "button",
|
|
44
48
|
variant: "body2",
|
|
45
49
|
underline: "none",
|
|
46
50
|
disabled: downloading,
|
|
47
|
-
title: downloading ? "downloading
|
|
51
|
+
title: downloading ? t("pipelineRunLogs.podLogsDownloadLink.downloading") : downloadTitle,
|
|
48
52
|
onClick: () => {
|
|
49
53
|
setDownloading(true);
|
|
50
54
|
getPodLogs(pods, getLogs, currCluster).then((logs) => {
|
|
@@ -58,10 +62,12 @@ const PodLogsDownloadLink = ({ pods, fileName, downloadTitle, ...props }) => {
|
|
|
58
62
|
className: classNames(classes.downloadAction, {
|
|
59
63
|
[classes.buttonDisabled]: downloading
|
|
60
64
|
}),
|
|
61
|
-
...props
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
+
...props,
|
|
66
|
+
children: [
|
|
67
|
+
/* @__PURE__ */ jsx(DownloadIcon, { style: { verticalAlign: "-0.180em" } }),
|
|
68
|
+
downloadTitle || t("pipelineRunLogs.podLogsDownloadLink.title")
|
|
69
|
+
]
|
|
70
|
+
}
|
|
65
71
|
);
|
|
66
72
|
};
|
|
67
73
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PodLogsDownloadLink.esm.js","sources":["../../../src/components/PipelineRunLogs/PodLogsDownloadLink.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":"PodLogsDownloadLink.esm.js","sources":["../../../src/components/PipelineRunLogs/PodLogsDownloadLink.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, ReactElement } from 'react';\n\nimport { useState, useContext } from 'react';\n\nimport { useApi } from '@backstage/core-plugin-api';\n\nimport { V1Pod } from '@kubernetes/client-node';\nimport { createStyles, Link, makeStyles, Theme } from '@material-ui/core';\nimport DownloadIcon from '@mui/icons-material/FileDownloadOutlined';\nimport classNames from 'classnames';\n\nimport { downloadLogFile } from '@janus-idp/shared-react';\n\nimport { TektonResourcesContext } from '../../hooks/TektonResourcesContext';\nimport { ContainerScope } from '../../hooks/usePodLogsOfPipelineRun';\nimport {\n kubernetesProxyApiRef,\n TektonResourcesContextData,\n} from '../../types/types';\nimport { getPodLogs } from '../../utils/log-downloader-utils';\nimport { useTranslationRef } from '@backstage/core-plugin-api/alpha';\nimport { tektonTranslationRef } from '../../translation';\n\nconst useStyles = makeStyles((theme: Theme) =>\n createStyles({\n downloadAction: {\n position: 'relative',\n marginBottom: 'var(--pf-t--global--spacer--sm)',\n color: 'var(--pf-t--global--icon--color--100)',\n cursor: 'pointer',\n },\n buttonDisabled: {\n color: theme.palette.grey[400],\n cursor: 'not-allowed',\n },\n }),\n);\n\nconst PodLogsDownloadLink: FC<{\n pods: V1Pod[];\n fileName: string;\n downloadTitle: string;\n}> = ({ pods, fileName, downloadTitle, ...props }): ReactElement => {\n const classes = useStyles();\n const [downloading, setDownloading] = useState<boolean>(false);\n const kubernetesProxyApi = useApi(kubernetesProxyApiRef);\n const { t } = useTranslationRef(tektonTranslationRef);\n\n const { clusters, selectedCluster = 0 } =\n useContext<TektonResourcesContextData>(TektonResourcesContext);\n const currCluster = clusters.length > 0 ? clusters[selectedCluster] : '';\n\n const getLogs = (podScope: ContainerScope): Promise<{ text: string }> => {\n const { podName, podNamespace, containerName, clusterName } = podScope;\n return kubernetesProxyApi.getPodLogs({\n podName: podName,\n namespace: podNamespace,\n containerName: containerName,\n clusterName: clusterName,\n });\n };\n\n return (\n <Link\n component=\"button\"\n variant=\"body2\"\n underline=\"none\"\n disabled={downloading}\n title={\n downloading\n ? t('pipelineRunLogs.podLogsDownloadLink.downloading')\n : downloadTitle\n }\n onClick={() => {\n setDownloading(true);\n getPodLogs(pods, getLogs, currCluster)\n .then((logs: string) => {\n setDownloading(false);\n downloadLogFile(logs || '', fileName);\n })\n .catch(err => {\n // eslint-disable-next-line no-console\n console.warn('Download failed', err);\n setDownloading(false);\n });\n }}\n className={classNames(classes.downloadAction, {\n [classes.buttonDisabled]: downloading,\n })}\n {...props}\n >\n <DownloadIcon style={{ verticalAlign: '-0.180em' }} />\n {downloadTitle || t('pipelineRunLogs.podLogsDownloadLink.title')}\n </Link>\n );\n};\nexport default PodLogsDownloadLink;\n"],"names":[],"mappings":";;;;;;;;;;;;;AAsCA,MAAM,SAAY,GAAA,UAAA;AAAA,EAAW,CAAC,UAC5B,YAAa,CAAA;AAAA,IACX,cAAgB,EAAA;AAAA,MACd,QAAU,EAAA,UAAA;AAAA,MACV,YAAc,EAAA,iCAAA;AAAA,MACd,KAAO,EAAA,uCAAA;AAAA,MACP,MAAQ,EAAA;AAAA,KACV;AAAA,IACA,cAAgB,EAAA;AAAA,MACd,KAAO,EAAA,KAAA,CAAM,OAAQ,CAAA,IAAA,CAAK,GAAG,CAAA;AAAA,MAC7B,MAAQ,EAAA;AAAA;AACV,GACD;AACH,CAAA;AAEM,MAAA,mBAAA,GAID,CAAC,EAAE,IAAA,EAAM,UAAU,aAAe,EAAA,GAAG,OAA0B,KAAA;AAClE,EAAA,MAAM,UAAU,SAAU,EAAA;AAC1B,EAAA,MAAM,CAAC,WAAA,EAAa,cAAc,CAAA,GAAI,SAAkB,KAAK,CAAA;AAC7D,EAAM,MAAA,kBAAA,GAAqB,OAAO,qBAAqB,CAAA;AACvD,EAAA,MAAM,EAAE,CAAA,EAAM,GAAA,iBAAA,CAAkB,oBAAoB,CAAA;AAEpD,EAAA,MAAM,EAAE,QAAU,EAAA,eAAA,GAAkB,CAAE,EAAA,GACpC,WAAuC,sBAAsB,CAAA;AAC/D,EAAA,MAAM,cAAc,QAAS,CAAA,MAAA,GAAS,CAAI,GAAA,QAAA,CAAS,eAAe,CAAI,GAAA,EAAA;AAEtE,EAAM,MAAA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;AAAA,GACjE;AAEJ;;;;"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
|
+
import { memo, useState } from 'react';
|
|
2
3
|
import useInterval from 'react-use/lib/useInterval';
|
|
3
4
|
import { makeStyles, StepButton, createStyles, CircularProgress } from '@material-ui/core';
|
|
4
5
|
import Step from '@material-ui/core/Step';
|
|
@@ -11,6 +12,8 @@ import FiberManualRecordIcon from '@material-ui/icons/FiberManualRecord';
|
|
|
11
12
|
import classNames from 'classnames';
|
|
12
13
|
import { ComputedStatus } from '@janus-idp/shared-react';
|
|
13
14
|
import { calculateDuration } from '../../utils/tekton-utils.esm.js';
|
|
15
|
+
import { useTranslationRef } from '@backstage/core-plugin-api/alpha';
|
|
16
|
+
import { tektonTranslationRef } from '../../translation.esm.js';
|
|
14
17
|
|
|
15
18
|
const useStyles = makeStyles(
|
|
16
19
|
(theme) => createStyles({
|
|
@@ -40,7 +43,7 @@ const useStyles = makeStyles(
|
|
|
40
43
|
})
|
|
41
44
|
);
|
|
42
45
|
const StepTimeTicker = ({ step }) => {
|
|
43
|
-
const [time, setTime] =
|
|
46
|
+
const [time, setTime] = useState("");
|
|
44
47
|
useInterval(() => {
|
|
45
48
|
if (!step.startedAt) {
|
|
46
49
|
setTime("");
|
|
@@ -48,7 +51,7 @@ const StepTimeTicker = ({ step }) => {
|
|
|
48
51
|
}
|
|
49
52
|
setTime(calculateDuration(step.startedAt, step.endedAt));
|
|
50
53
|
}, 1e3);
|
|
51
|
-
return /* @__PURE__ */
|
|
54
|
+
return /* @__PURE__ */ jsx(Typography, { variant: "caption", children: time });
|
|
52
55
|
};
|
|
53
56
|
const useStepIconStyles = makeStyles(
|
|
54
57
|
(theme) => createStyles({
|
|
@@ -70,58 +73,62 @@ const TaskStepIconComponent = ({ active, completed, error }) => {
|
|
|
70
73
|
const classes = useStepIconStyles();
|
|
71
74
|
const getMiddle = () => {
|
|
72
75
|
if (active) {
|
|
73
|
-
return /* @__PURE__ */
|
|
76
|
+
return /* @__PURE__ */ jsx(CircularProgress, { size: "24px" });
|
|
74
77
|
}
|
|
75
78
|
if (completed) {
|
|
76
|
-
return /* @__PURE__ */
|
|
79
|
+
return /* @__PURE__ */ jsx(Check, {});
|
|
77
80
|
}
|
|
78
81
|
if (error) {
|
|
79
|
-
return /* @__PURE__ */
|
|
82
|
+
return /* @__PURE__ */ jsx(Cancel, {});
|
|
80
83
|
}
|
|
81
|
-
return /* @__PURE__ */
|
|
84
|
+
return /* @__PURE__ */ jsx(FiberManualRecordIcon, {});
|
|
82
85
|
};
|
|
83
|
-
return /* @__PURE__ */
|
|
86
|
+
return /* @__PURE__ */ jsx(
|
|
84
87
|
"div",
|
|
85
88
|
{
|
|
86
89
|
className: classNames(classes.root, {
|
|
87
90
|
[classes.completed]: completed,
|
|
88
91
|
[classes.error]: error
|
|
89
|
-
})
|
|
90
|
-
|
|
91
|
-
|
|
92
|
+
}),
|
|
93
|
+
children: getMiddle()
|
|
94
|
+
}
|
|
92
95
|
);
|
|
93
96
|
};
|
|
94
|
-
const TaskStatusStepper =
|
|
97
|
+
const TaskStatusStepper = memo((props) => {
|
|
95
98
|
const { steps, currentStepId, onUserStepChange } = props;
|
|
96
99
|
const classes = useStyles(props);
|
|
97
|
-
|
|
100
|
+
const { t } = useTranslationRef(tektonTranslationRef);
|
|
101
|
+
return /* @__PURE__ */ jsx("div", { className: classes.root, children: /* @__PURE__ */ jsx(
|
|
98
102
|
Stepper,
|
|
99
103
|
{
|
|
100
104
|
activeStep: steps.findIndex((s) => s.id === currentStepId),
|
|
101
105
|
orientation: "vertical",
|
|
102
|
-
nonLinear: true
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
106
|
+
nonLinear: true,
|
|
107
|
+
children: steps.map((step, _) => {
|
|
108
|
+
const isCancelled = step.status === ComputedStatus.Cancelled;
|
|
109
|
+
const isActive = step.status === ComputedStatus.Running;
|
|
110
|
+
const isCompleted = step.status === ComputedStatus.Succeeded;
|
|
111
|
+
const isFailed = step.status === ComputedStatus.Failed;
|
|
112
|
+
const isSkipped = step.status === ComputedStatus.Skipped;
|
|
113
|
+
return /* @__PURE__ */ jsx(Step, { expanded: true, children: /* @__PURE__ */ jsx(StepButton, { onClick: () => onUserStepChange(step.id), children: /* @__PURE__ */ jsx(
|
|
114
|
+
StepLabel,
|
|
115
|
+
{
|
|
116
|
+
StepIconProps: {
|
|
117
|
+
completed: isCompleted,
|
|
118
|
+
error: isFailed || isCancelled,
|
|
119
|
+
active: isActive
|
|
120
|
+
},
|
|
121
|
+
StepIconComponent: TaskStepIconComponent,
|
|
122
|
+
className: classes.stepWrapper,
|
|
123
|
+
children: /* @__PURE__ */ jsxs("div", { className: classes.labelWrapper, children: [
|
|
124
|
+
/* @__PURE__ */ jsx(Typography, { variant: "subtitle2", children: step.name }),
|
|
125
|
+
isSkipped ? /* @__PURE__ */ jsx(Typography, { variant: "caption", children: t("pipelineRunLogs.taskStatusStepper.skipped") }) : /* @__PURE__ */ jsx(StepTimeTicker, { step })
|
|
126
|
+
] })
|
|
127
|
+
}
|
|
128
|
+
) }) }, step.id);
|
|
129
|
+
})
|
|
130
|
+
}
|
|
131
|
+
) });
|
|
125
132
|
});
|
|
126
133
|
|
|
127
134
|
export { TaskStatusStepper };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TaskStatusStepper.esm.js","sources":["../../../src/components/PipelineRunLogs/TaskStatusStepper.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":"TaskStatusStepper.esm.js","sources":["../../../src/components/PipelineRunLogs/TaskStatusStepper.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, memo } from 'react';\nimport useInterval from 'react-use/lib/useInterval';\n\nimport {\n CircularProgress,\n createStyles,\n makeStyles,\n StepButton,\n StepIconProps,\n Theme,\n} from '@material-ui/core';\nimport Step from '@material-ui/core/Step';\nimport StepLabel from '@material-ui/core/StepLabel';\nimport Stepper from '@material-ui/core/Stepper';\nimport Typography from '@material-ui/core/Typography';\nimport Cancel from '@material-ui/icons/Cancel';\nimport Check from '@material-ui/icons/Check';\nimport FiberManualRecordIcon from '@material-ui/icons/FiberManualRecord';\nimport classNames from 'classnames';\n\nimport { ComputedStatus } from '@janus-idp/shared-react';\n\nimport { TaskStep } from '../../utils/taskRun-utils';\nimport { calculateDuration } from '../../utils/tekton-utils';\nimport { useTranslationRef } from '@backstage/core-plugin-api/alpha';\nimport { tektonTranslationRef } from '../../translation';\n\nconst useStyles = makeStyles((theme: Theme) =>\n createStyles({\n root: {\n width: '100%',\n },\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 labelWrapper: {\n display: 'flex',\n flex: 1,\n flexDirection: 'row',\n justifyContent: 'space-between',\n },\n stepWrapper: {\n width: '100%',\n },\n }),\n);\n\nconst StepTimeTicker = ({ step }: { step: TaskStep }) => {\n const [time, setTime] = useState('');\n\n useInterval(() => {\n if (!step.startedAt) {\n setTime('');\n return;\n }\n\n setTime(calculateDuration(step.startedAt, step.endedAt));\n }, 1000);\n\n return <Typography variant=\"caption\">{time}</Typography>;\n};\n\nconst useStepIconStyles = makeStyles((theme: Theme) =>\n createStyles({\n root: {\n color: theme.palette.text.disabled,\n display: 'flex',\n height: 22,\n alignItems: 'center',\n },\n completed: {\n color: theme.palette.status.ok,\n },\n error: {\n color: theme.palette.status.error,\n },\n }),\n);\n\nconst TaskStepIconComponent = ({ active, completed, error }: StepIconProps) => {\n const classes = useStepIconStyles();\n\n const getMiddle = () => {\n if (active) {\n return <CircularProgress size=\"24px\" />;\n }\n if (completed) {\n return <Check />;\n }\n if (error) {\n return <Cancel />;\n }\n return <FiberManualRecordIcon />;\n };\n\n return (\n <div\n className={classNames(classes.root, {\n [classes.completed]: completed,\n [classes.error]: error,\n })}\n >\n {getMiddle()}\n </div>\n );\n};\n\ntype TaskStatusStepperProps = {\n steps: TaskStep[];\n currentStepId: string | undefined;\n onUserStepChange: (id: string) => void;\n classes?: {\n root?: string;\n };\n};\n\nexport const TaskStatusStepper = memo((props: TaskStatusStepperProps) => {\n const { steps, currentStepId, onUserStepChange } = props;\n const classes = useStyles(props);\n const { t } = useTranslationRef(tektonTranslationRef);\n\n return (\n <div className={classes.root}>\n <Stepper\n activeStep={steps.findIndex(s => s.id === currentStepId)}\n orientation=\"vertical\"\n nonLinear\n >\n {steps.map((step, _) => {\n const isCancelled = step.status === ComputedStatus.Cancelled;\n const isActive = step.status === ComputedStatus.Running;\n const isCompleted = step.status === ComputedStatus.Succeeded;\n const isFailed = step.status === ComputedStatus.Failed;\n const isSkipped = step.status === ComputedStatus.Skipped;\n\n return (\n <Step key={step.id} expanded>\n <StepButton onClick={() => onUserStepChange(step.id)}>\n <StepLabel\n StepIconProps={{\n completed: isCompleted,\n error: isFailed || isCancelled,\n active: isActive,\n }}\n StepIconComponent={TaskStepIconComponent}\n className={classes.stepWrapper}\n >\n <div className={classes.labelWrapper}>\n <Typography variant=\"subtitle2\">{step.name}</Typography>\n {isSkipped ? (\n <Typography variant=\"caption\">\n {t('pipelineRunLogs.taskStatusStepper.skipped')}\n </Typography>\n ) : (\n <StepTimeTicker step={step} />\n )}\n </div>\n </StepLabel>\n </StepButton>\n </Step>\n );\n })}\n </Stepper>\n </div>\n );\n});\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AA0CA,MAAM,SAAY,GAAA,UAAA;AAAA,EAAW,CAAC,UAC5B,YAAa,CAAA;AAAA,IACX,IAAM,EAAA;AAAA,MACJ,KAAO,EAAA;AAAA,KACT;AAAA,IACA,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,KAC/B;AAAA,IACA,YAAc,EAAA;AAAA,MACZ,OAAS,EAAA,MAAA;AAAA,MACT,IAAM,EAAA,CAAA;AAAA,MACN,aAAe,EAAA,KAAA;AAAA,MACf,cAAgB,EAAA;AAAA,KAClB;AAAA,IACA,WAAa,EAAA;AAAA,MACX,KAAO,EAAA;AAAA;AACT,GACD;AACH,CAAA;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|
1
|
-
import
|
|
1
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { memo } 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';
|
|
5
6
|
import { tektonGroupColor } from '../../types/types.esm.js';
|
|
6
7
|
import PipelineRunOutput from '../PipelineRunList/PipelineRunOutput.esm.js';
|
|
7
8
|
import ResourceBadge from '../PipelineRunList/ResourceBadge.esm.js';
|
|
9
|
+
import { useTranslationRef } from '@backstage/core-plugin-api/alpha';
|
|
10
|
+
import { tektonTranslationRef } from '../../translation.esm.js';
|
|
8
11
|
|
|
9
12
|
const useStyles = makeStyles(
|
|
10
13
|
(theme) => createStyles({
|
|
@@ -28,35 +31,42 @@ const PipelineRunOutputDialog = ({
|
|
|
28
31
|
taskRuns
|
|
29
32
|
}) => {
|
|
30
33
|
const classes = useStyles();
|
|
31
|
-
|
|
34
|
+
const { t } = useTranslationRef(tektonTranslationRef);
|
|
35
|
+
return /* @__PURE__ */ jsxs(
|
|
32
36
|
Dialog,
|
|
33
37
|
{
|
|
34
38
|
"data-testid": "pipelinerun-output-dialog",
|
|
35
39
|
maxWidth: "xl",
|
|
36
40
|
fullWidth: true,
|
|
37
41
|
open,
|
|
38
|
-
onClose: closeDialog
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
42
|
+
onClose: closeDialog,
|
|
43
|
+
children: [
|
|
44
|
+
/* @__PURE__ */ jsx(DialogTitle, { id: "pipelinerun-output", title: t("pipelineRunOutput.title"), children: /* @__PURE__ */ jsxs(Box, { className: classes.titleContainer, children: [
|
|
45
|
+
/* @__PURE__ */ jsx(
|
|
46
|
+
ResourceBadge,
|
|
47
|
+
{
|
|
48
|
+
color: tektonGroupColor,
|
|
49
|
+
abbr: "PLR",
|
|
50
|
+
name: pipelineRun?.metadata?.name ?? ""
|
|
51
|
+
}
|
|
52
|
+
),
|
|
53
|
+
" ",
|
|
54
|
+
/* @__PURE__ */ jsx(
|
|
55
|
+
IconButton,
|
|
56
|
+
{
|
|
57
|
+
"aria-label": "close",
|
|
58
|
+
className: classes.closeButton,
|
|
59
|
+
onClick: closeDialog,
|
|
60
|
+
children: /* @__PURE__ */ jsx(CloseIcon, {})
|
|
61
|
+
}
|
|
62
|
+
)
|
|
63
|
+
] }) }),
|
|
64
|
+
/* @__PURE__ */ jsx(DialogContent, { children: /* @__PURE__ */ jsx(ErrorBoundary, { children: /* @__PURE__ */ jsx(PipelineRunOutput, { pipelineRun, taskRuns }) }) })
|
|
65
|
+
]
|
|
66
|
+
}
|
|
57
67
|
);
|
|
58
68
|
};
|
|
59
|
-
var PipelineRunOutputDialog$1 =
|
|
69
|
+
var PipelineRunOutputDialog$1 = memo(PipelineRunOutputDialog);
|
|
60
70
|
|
|
61
71
|
export { PipelineRunOutputDialog$1 as default };
|
|
62
72
|
//# sourceMappingURL=PipelineRunOutputDialog.esm.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PipelineRunOutputDialog.esm.js","sources":["../../../src/components/PipelineRunOutput/PipelineRunOutputDialog.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":"PipelineRunOutputDialog.esm.js","sources":["../../../src/components/PipelineRunOutput/PipelineRunOutputDialog.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 { memo } from 'react';\n\nimport { ErrorBoundary } from '@backstage/core-components';\n\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 PipelineRunOutput from '../PipelineRunList/PipelineRunOutput';\nimport ResourceBadge from '../PipelineRunList/ResourceBadge';\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 PipelineRunOutputDialogProps = {\n open: boolean;\n closeDialog: () => void;\n pipelineRun: PipelineRunKind;\n taskRuns: TaskRunKind[];\n};\nconst PipelineRunOutputDialog = ({\n open,\n closeDialog,\n pipelineRun,\n taskRuns,\n}: PipelineRunOutputDialogProps) => {\n const classes = useStyles();\n const { t } = useTranslationRef(tektonTranslationRef);\n\n return (\n <Dialog\n data-testid=\"pipelinerun-output-dialog\"\n maxWidth=\"xl\"\n fullWidth\n open={open}\n onClose={closeDialog}\n >\n <DialogTitle id=\"pipelinerun-output\" title={t('pipelineRunOutput.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 <PipelineRunOutput pipelineRun={pipelineRun} taskRuns={taskRuns} />\n </ErrorBoundary>\n </DialogContent>\n </Dialog>\n );\n};\n\nexport default memo(PipelineRunOutputDialog);\n"],"names":[],"mappings":";;;;;;;;;;;AAuCA,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;AAQA,MAAM,0BAA0B,CAAC;AAAA,EAC/B,IAAA;AAAA,EACA,WAAA;AAAA,EACA,WAAA;AAAA,EACA;AACF,CAAoC,KAAA;AAClC,EAAA,MAAM,UAAU,SAAU,EAAA;AAC1B,EAAA,MAAM,EAAE,CAAA,EAAM,GAAA,iBAAA,CAAkB,oBAAoB,CAAA;AAEpD,EACE,uBAAA,IAAA;AAAA,IAAC,MAAA;AAAA,IAAA;AAAA,MACC,aAAY,EAAA,2BAAA;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,oBAAA,EAAqB,KAAO,EAAA,CAAA,CAAE,yBAAyB,CAAA,EACrE,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,UAAG,GAAA;AAAA,0BACH,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,iBACC,QAAC,kBAAA,GAAA,CAAA,aAAA,EAAA,EACC,8BAAC,iBAAkB,EAAA,EAAA,WAAA,EAA0B,QAAoB,EAAA,CAAA,EACnE,CACF,EAAA;AAAA;AAAA;AAAA,GACF;AAEJ,CAAA;AAEA,gCAAe,KAAK,uBAAuB,CAAA;;;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
2
|
import { Routes, Route } from 'react-router-dom';
|
|
3
3
|
import { useEntity } from '@backstage/plugin-catalog-react';
|
|
4
4
|
import { TektonCIComponent } from './Tekton/TektonCIComponent.esm.js';
|
|
@@ -7,7 +7,7 @@ import { isTektonCIAvailable } from '../utils/isTektonCIAvailable.esm.js';
|
|
|
7
7
|
const Router = () => {
|
|
8
8
|
const { entity } = useEntity();
|
|
9
9
|
if (isTektonCIAvailable(entity)) {
|
|
10
|
-
return /* @__PURE__ */
|
|
10
|
+
return /* @__PURE__ */ jsx(Routes, { children: /* @__PURE__ */ jsx(Route, { path: "/", element: /* @__PURE__ */ jsx(TektonCIComponent, {}) }) });
|
|
11
11
|
}
|
|
12
12
|
return null;
|
|
13
13
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Router.esm.js","sources":["../../src/components/Router.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":"Router.esm.js","sources":["../../src/components/Router.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 { Route, Routes } from 'react-router-dom';\n\nimport { useEntity } from '@backstage/plugin-catalog-react';\n\nimport { TektonCIComponent } from './Tekton/TektonCIComponent';\nimport { isTektonCIAvailable } from '../utils/isTektonCIAvailable';\n\n/** @public */\nexport const Router = () => {\n const { entity } = useEntity();\n if (isTektonCIAvailable(entity)) {\n return (\n <Routes>\n <Route path=\"/\" element={<TektonCIComponent />} />\n </Routes>\n );\n }\n return null;\n};\n"],"names":[],"mappings":";;;;;;AAuBO,MAAM,SAAS,MAAM;AAC1B,EAAM,MAAA,EAAE,MAAO,EAAA,GAAI,SAAU,EAAA;AAC7B,EAAI,IAAA,mBAAA,CAAoB,MAAM,CAAG,EAAA;AAC/B,IACE,uBAAA,GAAA,CAAC,MACC,EAAA,EAAA,QAAA,kBAAA,GAAA,CAAC,KAAM,EAAA,EAAA,IAAA,EAAK,KAAI,OAAS,kBAAA,GAAA,CAAC,iBAAkB,EAAA,EAAA,CAAA,EAAI,CAClD,EAAA,CAAA;AAAA;AAGJ,EAAO,OAAA,IAAA;AACT;;;;"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { useLayoutEffect } from 'react';
|
|
2
3
|
import { TektonResourcesContext } from '../../hooks/TektonResourcesContext.esm.js';
|
|
3
4
|
import { useDarkTheme } from '../../hooks/useDarkTheme.esm.js';
|
|
4
5
|
import { useTektonObjectsResponse } from '../../hooks/useTektonObjectsResponse.esm.js';
|
|
@@ -12,7 +13,7 @@ import '@patternfly/patternfly/utilities/Accessibility/accessibility.css';
|
|
|
12
13
|
const savedStylesheets = /* @__PURE__ */ new Set();
|
|
13
14
|
const TektonCIComponent = () => {
|
|
14
15
|
useDarkTheme();
|
|
15
|
-
|
|
16
|
+
useLayoutEffect(() => {
|
|
16
17
|
const scalprumStyles = Array.from(
|
|
17
18
|
document.querySelectorAll('link[rel="stylesheet"]')
|
|
18
19
|
).filter(
|
|
@@ -42,9 +43,9 @@ const TektonCIComponent = () => {
|
|
|
42
43
|
const tektonResourcesContextData = useTektonObjectsResponse(watchedResources);
|
|
43
44
|
const hasViewPermission = useTektonViewPermission();
|
|
44
45
|
if (!hasViewPermission) {
|
|
45
|
-
return /* @__PURE__ */
|
|
46
|
+
return /* @__PURE__ */ jsx(PermissionAlert, {});
|
|
46
47
|
}
|
|
47
|
-
return /* @__PURE__ */
|
|
48
|
+
return /* @__PURE__ */ jsx(TektonResourcesContext.Provider, { value: tektonResourcesContextData, children: /* @__PURE__ */ jsx(PipelineRunList, {}) });
|
|
48
49
|
};
|
|
49
50
|
|
|
50
51
|
export { TektonCIComponent };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TektonCIComponent.esm.js","sources":["../../../src/components/Tekton/TektonCIComponent.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":"TektonCIComponent.esm.js","sources":["../../../src/components/Tekton/TektonCIComponent.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 { useLayoutEffect } from 'react';\n\nimport { TektonResourcesContext } from '../../hooks/TektonResourcesContext';\nimport { useDarkTheme } from '../../hooks/useDarkTheme';\nimport { useTektonObjectsResponse } from '../../hooks/useTektonObjectsResponse';\nimport { useTektonViewPermission } from '../../hooks/useTektonViewPermission';\nimport { ModelsPlural } from '../../models';\nimport PermissionAlert from '../common/PermissionAlert';\nimport PipelineRunList from '../PipelineRunList/PipelineRunList';\n\nimport '@patternfly/react-core/dist/styles/base-no-reset.css';\nimport '@patternfly/patternfly/utilities/Accessibility/accessibility.css';\n\nconst savedStylesheets = new Set<HTMLLinkElement>();\n\nexport const TektonCIComponent = () => {\n useDarkTheme();\n\n useLayoutEffect(() => {\n const scalprumStyles = Array.from(\n document.querySelectorAll('link[rel=\"stylesheet\"]'),\n ).filter(link =>\n link.attributes\n .getNamedItem('href')\n ?.value?.includes('backstage-plugin-tekton'),\n );\n\n scalprumStyles.forEach(link =>\n savedStylesheets.add(link as HTMLLinkElement),\n );\n\n savedStylesheets.forEach(link => {\n if (!document.head.contains(link)) {\n document.head.appendChild(link);\n }\n });\n return () => {\n savedStylesheets.forEach(link => {\n if (document.head.contains(link)) {\n document.head.removeChild(link);\n }\n });\n };\n }, []);\n\n const watchedResources = [\n ModelsPlural.pipelineruns,\n ModelsPlural.taskruns,\n ModelsPlural.pods,\n ];\n const tektonResourcesContextData = useTektonObjectsResponse(watchedResources);\n const hasViewPermission = useTektonViewPermission();\n\n if (!hasViewPermission) {\n return <PermissionAlert />;\n }\n return (\n <TektonResourcesContext.Provider value={tektonResourcesContextData}>\n <PipelineRunList />\n </TektonResourcesContext.Provider>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;AA4BA,MAAM,gBAAA,uBAAuB,GAAqB,EAAA;AAE3C,MAAM,oBAAoB,MAAM;AACrC,EAAa,YAAA,EAAA;AAEb,EAAA,eAAA,CAAgB,MAAM;AACpB,IAAA,MAAM,iBAAiB,KAAM,CAAA,IAAA;AAAA,MAC3B,QAAA,CAAS,iBAAiB,wBAAwB;AAAA,KAClD,CAAA,MAAA;AAAA,MAAO,CAAA,IAAA,KACP,KAAK,UACF,CAAA,YAAA,CAAa,MAAM,CAClB,EAAA,KAAA,EAAO,SAAS,yBAAyB;AAAA,KAC/C;AAEA,IAAe,cAAA,CAAA,OAAA;AAAA,MAAQ,CAAA,IAAA,KACrB,gBAAiB,CAAA,GAAA,CAAI,IAAuB;AAAA,KAC9C;AAEA,IAAA,gBAAA,CAAiB,QAAQ,CAAQ,IAAA,KAAA;AAC/B,MAAA,IAAI,CAAC,QAAA,CAAS,IAAK,CAAA,QAAA,CAAS,IAAI,CAAG,EAAA;AACjC,QAAS,QAAA,CAAA,IAAA,CAAK,YAAY,IAAI,CAAA;AAAA;AAChC,KACD,CAAA;AACD,IAAA,OAAO,MAAM;AACX,MAAA,gBAAA,CAAiB,QAAQ,CAAQ,IAAA,KAAA;AAC/B,QAAA,IAAI,QAAS,CAAA,IAAA,CAAK,QAAS,CAAA,IAAI,CAAG,EAAA;AAChC,UAAS,QAAA,CAAA,IAAA,CAAK,YAAY,IAAI,CAAA;AAAA;AAChC,OACD,CAAA;AAAA,KACH;AAAA,GACF,EAAG,EAAE,CAAA;AAEL,EAAA,MAAM,gBAAmB,GAAA;AAAA,IACvB,YAAa,CAAA,YAAA;AAAA,IACb,YAAa,CAAA,QAAA;AAAA,IACb,YAAa,CAAA;AAAA,GACf;AACA,EAAM,MAAA,0BAAA,GAA6B,yBAAyB,gBAAgB,CAAA;AAC5E,EAAA,MAAM,oBAAoB,uBAAwB,EAAA;AAElD,EAAA,IAAI,CAAC,iBAAmB,EAAA;AACtB,IAAA,2BAAQ,eAAgB,EAAA,EAAA,CAAA;AAAA;AAE1B,EACE,uBAAA,GAAA,CAAC,uBAAuB,QAAvB,EAAA,EAAgC,OAAO,0BACtC,EAAA,QAAA,kBAAA,GAAA,CAAC,mBAAgB,CACnB,EAAA,CAAA;AAEJ;;;;"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { useContext, useState } from 'react';
|
|
2
3
|
import { Select } from '@backstage/core-components';
|
|
3
4
|
import { makeStyles, Typography } from '@material-ui/core';
|
|
4
5
|
import { TektonResourcesContext } from '../../hooks/TektonResourcesContext.esm.js';
|
|
@@ -18,28 +19,31 @@ const ClusterSelector = () => {
|
|
|
18
19
|
clusters: k8sClusters,
|
|
19
20
|
selectedCluster,
|
|
20
21
|
setSelectedCluster: setClusterContext
|
|
21
|
-
} =
|
|
22
|
+
} = useContext(TektonResourcesContext);
|
|
22
23
|
const clusterOptions = k8sClusters.map((cluster) => ({
|
|
23
24
|
value: cluster,
|
|
24
25
|
label: cluster
|
|
25
26
|
}));
|
|
26
27
|
const curCluster = selectedCluster && k8sClusters?.length > 0 ? k8sClusters[selectedCluster] : k8sClusters?.[0];
|
|
27
|
-
const [clusterSelected, setClusterSelected] =
|
|
28
|
+
const [clusterSelected, setClusterSelected] = useState(curCluster);
|
|
28
29
|
const onClusterChange = (arg) => {
|
|
29
30
|
const index = k8sClusters.findIndex((cluster) => cluster === arg);
|
|
30
31
|
setClusterContext(index);
|
|
31
32
|
setClusterSelected(arg);
|
|
32
33
|
};
|
|
33
|
-
return /* @__PURE__ */
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
34
|
+
return /* @__PURE__ */ jsxs("div", { className: "bs-tkn-cluster-selector", children: [
|
|
35
|
+
/* @__PURE__ */ jsx(Typography, { className: classes.label, children: "Cluster" }),
|
|
36
|
+
/* @__PURE__ */ jsx(
|
|
37
|
+
Select,
|
|
38
|
+
{
|
|
39
|
+
onChange: onClusterChange,
|
|
40
|
+
label: "",
|
|
41
|
+
items: clusterOptions,
|
|
42
|
+
selected: clusterSelected,
|
|
43
|
+
margin: "dense"
|
|
44
|
+
}
|
|
45
|
+
)
|
|
46
|
+
] });
|
|
43
47
|
};
|
|
44
48
|
|
|
45
49
|
export { ClusterSelector };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ClusterSelector.esm.js","sources":["../../../src/components/common/ClusterSelector.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":"ClusterSelector.esm.js","sources":["../../../src/components/common/ClusterSelector.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 { useContext, useState } from 'react';\n\nimport { Select, SelectedItems } from '@backstage/core-components';\nimport { BackstageTheme } from '@backstage/theme';\n\nimport { makeStyles, Typography } from '@material-ui/core';\n\nimport { TektonResourcesContext } from '../../hooks/TektonResourcesContext';\n\nimport './ClusterSelector.css';\n\nconst useStyles = makeStyles<BackstageTheme>(theme => ({\n label: {\n color: theme.palette.text.primary,\n fontSize: '1rem',\n paddingRight: '10px',\n fontWeight: 'bold',\n },\n}));\n\nexport const ClusterSelector = () => {\n const classes = useStyles();\n const {\n clusters: k8sClusters,\n selectedCluster,\n setSelectedCluster: setClusterContext,\n } = useContext(TektonResourcesContext);\n const clusterOptions = k8sClusters.map(cluster => ({\n value: cluster,\n label: cluster,\n }));\n\n const curCluster =\n selectedCluster && k8sClusters?.length > 0\n ? k8sClusters[selectedCluster]\n : k8sClusters?.[0];\n\n const [clusterSelected, setClusterSelected] =\n useState<SelectedItems>(curCluster);\n\n const onClusterChange = (arg: SelectedItems) => {\n const index = k8sClusters.findIndex(cluster => cluster === arg);\n setClusterContext(index);\n setClusterSelected(arg);\n };\n return (\n <div className=\"bs-tkn-cluster-selector\">\n <Typography className={classes.label}>Cluster</Typography>\n <Select\n onChange={onClusterChange}\n label=\"\"\n items={clusterOptions}\n selected={clusterSelected}\n margin=\"dense\"\n />\n </div>\n );\n};\n"],"names":[],"mappings":";;;;;;;AA0BA,MAAM,SAAA,GAAY,WAA2B,CAAU,KAAA,MAAA;AAAA,EACrD,KAAO,EAAA;AAAA,IACL,KAAA,EAAO,KAAM,CAAA,OAAA,CAAQ,IAAK,CAAA,OAAA;AAAA,IAC1B,QAAU,EAAA,MAAA;AAAA,IACV,YAAc,EAAA,MAAA;AAAA,IACd,UAAY,EAAA;AAAA;AAEhB,CAAE,CAAA,CAAA;AAEK,MAAM,kBAAkB,MAAM;AACnC,EAAA,MAAM,UAAU,SAAU,EAAA;AAC1B,EAAM,MAAA;AAAA,IACJ,QAAU,EAAA,WAAA;AAAA,IACV,eAAA;AAAA,IACA,kBAAoB,EAAA;AAAA,GACtB,GAAI,WAAW,sBAAsB,CAAA;AACrC,EAAM,MAAA,cAAA,GAAiB,WAAY,CAAA,GAAA,CAAI,CAAY,OAAA,MAAA;AAAA,IACjD,KAAO,EAAA,OAAA;AAAA,IACP,KAAO,EAAA;AAAA,GACP,CAAA,CAAA;AAEF,EAAM,MAAA,UAAA,GACJ,mBAAmB,WAAa,EAAA,MAAA,GAAS,IACrC,WAAY,CAAA,eAAe,CAC3B,GAAA,WAAA,GAAc,CAAC,CAAA;AAErB,EAAA,MAAM,CAAC,eAAA,EAAiB,kBAAkB,CAAA,GACxC,SAAwB,UAAU,CAAA;AAEpC,EAAM,MAAA,eAAA,GAAkB,CAAC,GAAuB,KAAA;AAC9C,IAAA,MAAM,KAAQ,GAAA,WAAA,CAAY,SAAU,CAAA,CAAA,OAAA,KAAW,YAAY,GAAG,CAAA;AAC9D,IAAA,iBAAA,CAAkB,KAAK,CAAA;AACvB,IAAA,kBAAA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