@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,7 +1,9 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
2
|
import { WarningPanel } from '@backstage/core-components';
|
|
3
3
|
import { useEntity } from '@backstage/plugin-catalog-react';
|
|
4
4
|
import { Typography } from '@material-ui/core';
|
|
5
|
+
import { useTranslationRef } from '@backstage/core-plugin-api/alpha';
|
|
6
|
+
import { tektonTranslationRef } from '../../translation.esm.js';
|
|
5
7
|
|
|
6
8
|
const ErrorPanel = ({ allErrors }) => {
|
|
7
9
|
const {
|
|
@@ -9,24 +11,30 @@ const ErrorPanel = ({ allErrors }) => {
|
|
|
9
11
|
metadata: { name: entityName }
|
|
10
12
|
}
|
|
11
13
|
} = useEntity();
|
|
12
|
-
|
|
14
|
+
const { t } = useTranslationRef(tektonTranslationRef);
|
|
15
|
+
return /* @__PURE__ */ jsx("div", { className: "warning-panel", style: { marginBottom: "16px" }, children: /* @__PURE__ */ jsx(
|
|
13
16
|
WarningPanel,
|
|
14
17
|
{
|
|
15
|
-
title: "
|
|
16
|
-
message:
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
18
|
+
title: t("errorPanel.title"),
|
|
19
|
+
message: t("errorPanel.description", {
|
|
20
|
+
entityName
|
|
21
|
+
}),
|
|
22
|
+
children: /* @__PURE__ */ jsxs("div", { children: [
|
|
23
|
+
"Errors:",
|
|
24
|
+
allErrors.map((err, _index) => {
|
|
25
|
+
const errMessage = err.message ? `${err.message}` : `Error fetching Kubernetes resource: '${err.resourcePath}', error: ${err.errorType}, status code: ${err.statusCode}`;
|
|
26
|
+
return /* @__PURE__ */ jsx(
|
|
27
|
+
Typography,
|
|
28
|
+
{
|
|
29
|
+
variant: "body2",
|
|
30
|
+
children: err.errorType === "FETCH_ERROR" ? `Error communicating with Kubernetes: ${err.errorType}, message: ${err.message}` : errMessage
|
|
31
|
+
},
|
|
32
|
+
`${err.resourcePath}-${err.statusCode}`
|
|
33
|
+
);
|
|
34
|
+
})
|
|
35
|
+
] })
|
|
36
|
+
}
|
|
37
|
+
) });
|
|
30
38
|
};
|
|
31
39
|
|
|
32
40
|
export { ErrorPanel };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ErrorPanel.esm.js","sources":["../../../src/components/common/ErrorPanel.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":"ErrorPanel.esm.js","sources":["../../../src/components/common/ErrorPanel.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 { WarningPanel } from '@backstage/core-components';\nimport { useEntity } from '@backstage/plugin-catalog-react';\n\nimport { Typography } from '@material-ui/core';\n\nimport { ClusterError, ClusterErrors } from '../../types/types';\nimport { useTranslationRef } from '@backstage/core-plugin-api/alpha';\nimport { tektonTranslationRef } from '../../translation';\n\ntype ErrorPanelProps = { allErrors: ClusterErrors };\n\nexport const ErrorPanel = ({ allErrors }: ErrorPanelProps) => {\n const {\n entity: {\n metadata: { name: entityName },\n },\n } = useEntity();\n const { t } = useTranslationRef(tektonTranslationRef);\n return (\n <div className=\"warning-panel\" style={{ marginBottom: '16px' }}>\n <WarningPanel\n title={t('errorPanel.title')}\n message={t('errorPanel.description', {\n entityName,\n })}\n >\n <div>\n Errors:\n {allErrors.map((err: ClusterError, _index) => {\n const errMessage = err.message\n ? `${err.message}`\n : `Error fetching Kubernetes resource: '${err.resourcePath}', error: ${err.errorType}, status code: ${err.statusCode}`;\n return (\n <Typography\n variant=\"body2\"\n key={`${err.resourcePath}-${err.statusCode}`}\n >\n {err.errorType === 'FETCH_ERROR'\n ? `Error communicating with Kubernetes: ${err.errorType}, message: ${err.message}`\n : errMessage}\n </Typography>\n );\n })}\n </div>\n </WarningPanel>\n </div>\n );\n};\n"],"names":[],"mappings":";;;;;;;AA0BO,MAAM,UAAa,GAAA,CAAC,EAAE,SAAA,EAAiC,KAAA;AAC5D,EAAM,MAAA;AAAA,IACJ,MAAQ,EAAA;AAAA,MACN,QAAA,EAAU,EAAE,IAAA,EAAM,UAAW;AAAA;AAC/B,MACE,SAAU,EA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etesClustersReadPermission, kubernetesResourcesReadPermission } from '@backstage/plugin-kubernetes-common';
|
|
4
|
+
import { useTranslationRef } from '@backstage/core-plugin-api/alpha';
|
|
5
|
+
import { tektonTranslationRef } from '../../translation.esm.js';
|
|
4
6
|
|
|
5
7
|
const permissions = [
|
|
6
8
|
kubernetesClustersReadPermission,
|
|
7
9
|
kubernetesResourcesReadPermission
|
|
8
10
|
].map((p) => p.name).join(", ");
|
|
9
11
|
const PermissionAlert = () => {
|
|
10
|
-
|
|
12
|
+
const { t } = useTranslationRef(tektonTranslationRef);
|
|
13
|
+
return /* @__PURE__ */ jsxs(Alert, { severity: "warning", "data-testid": "no-permission-alert", children: [
|
|
14
|
+
/* @__PURE__ */ jsx(AlertTitle, { children: t("permissionAlert.title") }),
|
|
15
|
+
t("permissionAlert.description", { permissions })
|
|
16
|
+
] });
|
|
11
17
|
};
|
|
12
18
|
|
|
13
19
|
export { PermissionAlert as default };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PermissionAlert.esm.js","sources":["../../../src/components/common/PermissionAlert.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":"PermissionAlert.esm.js","sources":["../../../src/components/common/PermissionAlert.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 { Alert, AlertTitle } from '@material-ui/lab';\nimport {\n kubernetesClustersReadPermission,\n kubernetesResourcesReadPermission,\n} from '@backstage/plugin-kubernetes-common';\nimport { useTranslationRef } from '@backstage/core-plugin-api/alpha';\nimport { tektonTranslationRef } from '../../translation';\n\nconst permissions = [\n kubernetesClustersReadPermission,\n kubernetesResourcesReadPermission,\n]\n .map(p => p.name)\n .join(', ');\n\nconst PermissionAlert = () => {\n const { t } = useTranslationRef(tektonTranslationRef);\n\n return (\n <Alert severity=\"warning\" data-testid=\"no-permission-alert\">\n <AlertTitle>{t('permissionAlert.title')}</AlertTitle>\n {t('permissionAlert.description', { permissions })}\n </Alert>\n );\n};\nexport default PermissionAlert;\n"],"names":[],"mappings":";;;;;;AAuBA,MAAM,WAAc,GAAA;AAAA,EAClB,gCAAA;AAAA,EACA;AACF,CAAA,CACG,IAAI,CAAK,CAAA,KAAA,CAAA,CAAE,IAAI,CAAA,CACf,KAAK,IAAI,CAAA;AAEZ,MAAM,kBAAkB,MAAM;AAC5B,EAAA,MAAM,EAAE,CAAA,EAAM,GAAA,iBAAA,CAAkB,oBAAoB,CAAA;AAEpD,EAAA,uBACG,IAAA,CAAA,KAAA,EAAA,EAAM,QAAS,EAAA,SAAA,EAAU,eAAY,qBACpC,EAAA,QAAA,EAAA;AAAA,oBAAC,GAAA,CAAA,UAAA,EAAA,EAAY,QAAE,EAAA,CAAA,CAAA,uBAAuB,CAAE,EAAA,CAAA;AAAA,IACvC,CAAE,CAAA,6BAAA,EAA+B,EAAE,WAAA,EAAa;AAAA,GACnD,EAAA,CAAA;AAEJ;;;;"}
|
|
@@ -1,9 +1,12 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { useContext } from 'react';
|
|
2
3
|
import { Select } from '@backstage/core-components';
|
|
3
4
|
import { makeStyles, Typography } from '@material-ui/core';
|
|
4
5
|
import './StatusSelector.css.esm.js';
|
|
5
6
|
import { ComputedStatus } from '@janus-idp/shared-react';
|
|
6
7
|
import { TektonResourcesContext } from '../../hooks/TektonResourcesContext.esm.js';
|
|
8
|
+
import { useTranslationRef } from '@backstage/core-plugin-api/alpha';
|
|
9
|
+
import { tektonTranslationRef } from '../../translation.esm.js';
|
|
7
10
|
|
|
8
11
|
const useStyles = makeStyles((theme) => ({
|
|
9
12
|
label: {
|
|
@@ -26,22 +29,26 @@ const statusOptions = Object.entries(ComputedStatus).sort(([keyA], [keyB]) => {
|
|
|
26
29
|
}));
|
|
27
30
|
const StatusSelector = () => {
|
|
28
31
|
const classes = useStyles();
|
|
29
|
-
const { selectedStatus, setSelectedStatus } =
|
|
32
|
+
const { selectedStatus, setSelectedStatus } = useContext(
|
|
30
33
|
TektonResourcesContext
|
|
31
34
|
);
|
|
32
35
|
const onStatusChange = (status) => {
|
|
33
36
|
setSelectedStatus(status);
|
|
34
37
|
};
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
{
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
38
|
+
const { t } = useTranslationRef(tektonTranslationRef);
|
|
39
|
+
return /* @__PURE__ */ jsxs("div", { className: "bs-tkn-status-selector", children: [
|
|
40
|
+
/* @__PURE__ */ jsx(Typography, { className: classes.label, children: t("statusSelector.label") }),
|
|
41
|
+
/* @__PURE__ */ jsx(
|
|
42
|
+
Select,
|
|
43
|
+
{
|
|
44
|
+
onChange: onStatusChange,
|
|
45
|
+
label: "",
|
|
46
|
+
items: statusOptions,
|
|
47
|
+
selected: selectedStatus,
|
|
48
|
+
margin: "dense"
|
|
49
|
+
}
|
|
50
|
+
)
|
|
51
|
+
] });
|
|
45
52
|
};
|
|
46
53
|
|
|
47
54
|
export { StatusSelector, statusOptions };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StatusSelector.esm.js","sources":["../../../src/components/common/StatusSelector.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":"StatusSelector.esm.js","sources":["../../../src/components/common/StatusSelector.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 } from 'react';\n\nimport { Select, SelectedItems } from '@backstage/core-components';\n\nimport { makeStyles, Theme, Typography } from '@material-ui/core';\n\nimport './StatusSelector.css';\n\nimport { ComputedStatus } from '@janus-idp/shared-react';\n\nimport { TektonResourcesContext } from '../../hooks/TektonResourcesContext';\nimport { useTranslationRef } from '@backstage/core-plugin-api/alpha';\nimport { tektonTranslationRef } from '../../translation';\n\nconst useStyles = makeStyles<Theme>(theme => ({\n label: {\n color: theme.palette.text.primary,\n fontSize: '1rem',\n paddingRight: '10px',\n fontWeight: 'bold',\n },\n}));\n\nexport const statusOptions = Object.entries(ComputedStatus)\n .sort(([keyA], [keyB]) => {\n if (keyA === keyB) {\n return 0;\n } else if (keyA < keyB) {\n return -1;\n }\n return 1;\n })\n .map(([key, value]) => ({\n value: key,\n label: value,\n }));\n\nexport const StatusSelector = () => {\n const classes = useStyles();\n const { selectedStatus, setSelectedStatus } = useContext(\n TektonResourcesContext,\n );\n\n const onStatusChange = (status: SelectedItems) => {\n setSelectedStatus(status as ComputedStatus);\n };\n const { t } = useTranslationRef(tektonTranslationRef);\n\n return (\n <div className=\"bs-tkn-status-selector\">\n <Typography className={classes.label}>\n {t('statusSelector.label')}\n </Typography>\n <Select\n onChange={onStatusChange}\n label=\"\"\n items={statusOptions}\n selected={selectedStatus}\n margin=\"dense\"\n />\n </div>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;AA6BA,MAAM,SAAA,GAAY,WAAkB,CAAU,KAAA,MAAA;AAAA,EAC5C,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,aAAgB,GAAA,MAAA,CAAO,OAAQ,CAAA,cAAc,CACvD,CAAA,IAAA,CAAK,CAAC,CAAC,IAAI,CAAA,EAAG,CAAC,IAAI,CAAM,KAAA;AACxB,EAAA,IAAI,SAAS,IAAM,EAAA;AACjB,IAAO,OAAA,CAAA;AAAA,GACT,MAAA,IAAW,OAAO,IAAM,EAAA;AACtB,IAAO,OAAA,EAAA;AAAA;AAET,EAAO,OAAA,CAAA;AACT,CAAC,EACA,GAAI,CAAA,CAAC,CAAC,GAAA,EAAK,KAAK,CAAO,MAAA;AAAA,EACtB,KAAO,EAAA,GAAA;AAAA,EACP,KAAO,EAAA;AACT,CAAE,CAAA;AAEG,MAAM,iBAAiB,MAAM;AAClC,EAAA,MAAM,UAAU,SAAU,EAAA;AAC1B,EAAM,MAAA,EAAE,cAAgB,EAAA,iBAAA,EAAsB,GAAA,UAAA;AAAA,IAC5C;AAAA,GACF;AAEA,EAAM,MAAA,cAAA,GAAiB,CAAC,MAA0B,KAAA;AAChD,IAAA,iBAAA,CAAkB,MAAwB,CAAA;AAAA,GAC5C;AACA,EAAA,MAAM,EAAE,CAAA,EAAM,GAAA,iBAAA,CAAkB,oBAAoB,CAAA;AAEpD,EACE,uBAAA,IAAA,CAAC,KAAI,EAAA,EAAA,SAAA,EAAU,wBACb,EAAA,QAAA,EAAA;AAAA,oBAAA,GAAA,CAAC,cAAW,SAAW,EAAA,OAAA,CAAQ,KAC5B,EAAA,QAAA,EAAA,CAAA,CAAE,sBAAsB,CAC3B,EAAA,CAAA;AAAA,oBACA,GAAA;AAAA,MAAC,MAAA;AAAA,MAAA;AAAA,QACC,QAAU,EAAA,cAAA;AAAA,QACV,KAAM,EAAA,EAAA;AAAA,QACN,KAAO,EAAA,aAAA;AAAA,QACP,QAAU,EAAA,cAAA;AAAA,QACV,MAAO,EAAA;AAAA;AAAA;AACT,GACF,EAAA,CAAA;AAEJ;;;;"}
|
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { useContext } from 'react';
|
|
2
3
|
import { makeStyles, Tooltip, IconButton } from '@material-ui/core';
|
|
3
4
|
import Collapse from '@material-ui/icons/UnfoldLess';
|
|
4
5
|
import Expand from '@material-ui/icons/UnfoldMore';
|
|
5
6
|
import { TektonResourcesContext } from '../../hooks/TektonResourcesContext.esm.js';
|
|
7
|
+
import { useTranslationRef } from '@backstage/core-plugin-api/alpha';
|
|
8
|
+
import { tektonTranslationRef } from '../../translation.esm.js';
|
|
6
9
|
|
|
7
10
|
const useStyles = makeStyles({
|
|
8
11
|
expandCollapse: {
|
|
@@ -15,29 +18,31 @@ const useStyles = makeStyles({
|
|
|
15
18
|
});
|
|
16
19
|
const TableExpandCollapse = () => {
|
|
17
20
|
const classes = useStyles();
|
|
18
|
-
const { isExpanded, setIsExpanded } =
|
|
19
|
-
|
|
20
|
-
);
|
|
21
|
+
const { isExpanded, setIsExpanded } = useContext(TektonResourcesContext);
|
|
22
|
+
const { t } = useTranslationRef(tektonTranslationRef);
|
|
21
23
|
const handleExpandCollaspse = () => {
|
|
22
24
|
setIsExpanded(!isExpanded);
|
|
23
25
|
};
|
|
24
|
-
return /* @__PURE__ */
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
{
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
26
|
+
return /* @__PURE__ */ jsxs("div", { className: classes.expandCollapse, children: [
|
|
27
|
+
/* @__PURE__ */ jsx(Tooltip, { title: t("tableExpandCollapse.collapseAll"), placement: "top", children: /* @__PURE__ */ jsx("span", { children: /* @__PURE__ */ jsx(
|
|
28
|
+
IconButton,
|
|
29
|
+
{
|
|
30
|
+
onClick: () => handleExpandCollaspse(),
|
|
31
|
+
disabled: !isExpanded,
|
|
32
|
+
className: classes.iconButton,
|
|
33
|
+
children: /* @__PURE__ */ jsx(Collapse, {})
|
|
34
|
+
}
|
|
35
|
+
) }) }),
|
|
36
|
+
/* @__PURE__ */ jsx(Tooltip, { title: t("tableExpandCollapse.expandAll"), placement: "top", children: /* @__PURE__ */ jsx("span", { children: /* @__PURE__ */ jsx(
|
|
37
|
+
IconButton,
|
|
38
|
+
{
|
|
39
|
+
onClick: () => handleExpandCollaspse(),
|
|
40
|
+
disabled: isExpanded,
|
|
41
|
+
className: classes.iconButton,
|
|
42
|
+
children: /* @__PURE__ */ jsx(Expand, {})
|
|
43
|
+
}
|
|
44
|
+
) }) })
|
|
45
|
+
] });
|
|
41
46
|
};
|
|
42
47
|
|
|
43
48
|
export { TableExpandCollapse };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TableExpandCollapse.esm.js","sources":["../../../src/components/common/TableExpandCollapse.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":"TableExpandCollapse.esm.js","sources":["../../../src/components/common/TableExpandCollapse.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 } from 'react';\n\nimport { IconButton, makeStyles, Tooltip } from '@material-ui/core';\nimport Collapse from '@material-ui/icons/UnfoldLess';\nimport Expand from '@material-ui/icons/UnfoldMore';\n\nimport { TektonResourcesContext } from '../../hooks/TektonResourcesContext';\nimport { useTranslationRef } from '@backstage/core-plugin-api/alpha';\nimport { tektonTranslationRef } from '../../translation';\n\nconst useStyles = makeStyles({\n expandCollapse: {\n flexGrow: 1,\n textAlign: 'end',\n },\n iconButton: {\n padding: '2px',\n },\n});\n\nexport const TableExpandCollapse = () => {\n const classes = useStyles();\n const { isExpanded, setIsExpanded } = useContext(TektonResourcesContext);\n const { t } = useTranslationRef(tektonTranslationRef);\n\n const handleExpandCollaspse = () => {\n setIsExpanded(!isExpanded);\n };\n return (\n <div className={classes.expandCollapse}>\n <Tooltip title={t('tableExpandCollapse.collapseAll')} placement=\"top\">\n <span>\n <IconButton\n onClick={() => handleExpandCollaspse()}\n disabled={!isExpanded}\n className={classes.iconButton}\n >\n <Collapse />\n </IconButton>\n </span>\n </Tooltip>\n <Tooltip title={t('tableExpandCollapse.expandAll')} placement=\"top\">\n <span>\n <IconButton\n onClick={() => handleExpandCollaspse()}\n disabled={isExpanded}\n className={classes.iconButton}\n >\n <Expand />\n </IconButton>\n </span>\n </Tooltip>\n </div>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;AAyBA,MAAM,YAAY,UAAW,CAAA;AAAA,EAC3B,cAAgB,EAAA;AAAA,IACd,QAAU,EAAA,CAAA;AAAA,IACV,SAAW,EAAA;AAAA,GACb;AAAA,EACA,UAAY,EAAA;AAAA,IACV,OAAS,EAAA;AAAA;AAEb,CAAC,CAAA;AAEM,MAAM,sBAAsB,MAAM;AACvC,EAAA,MAAM,UAAU,SAAU,EAAA;AAC1B,EAAA,MAAM,EAAE,UAAA,EAAY,aAAc,EAAA,GAAI,WAAW,sBAAsB,CAAA;AACvE,EAAA,MAAM,EAAE,CAAA,EAAM,GAAA,iBAAA,CAAkB,oBAAoB,CAAA;AAEpD,EAAA,MAAM,wBAAwB,MAAM;AAClC,IAAA,aAAA,CAAc,CAAC,UAAU,CAAA;AAAA,GAC3B;AACA,EAAA,uBACG,IAAA,CAAA,KAAA,EAAA,EAAI,SAAW,EAAA,OAAA,CAAQ,cACtB,EAAA,QAAA,EAAA;AAAA,oBAAC,GAAA,CAAA,OAAA,EAAA,EAAQ,OAAO,CAAE,CAAA,iCAAiC,GAAG,SAAU,EAAA,KAAA,EAC9D,8BAAC,MACC,EAAA,EAAA,QAAA,kBAAA,GAAA;AAAA,MAAC,UAAA;AAAA,MAAA;AAAA,QACC,OAAA,EAAS,MAAM,qBAAsB,EAAA;AAAA,QACrC,UAAU,CAAC,UAAA;AAAA,QACX,WAAW,OAAQ,CAAA,UAAA;AAAA,QAEnB,8BAAC,QAAS,EAAA,EAAA;AAAA;AAAA,OAEd,CACF,EAAA,CAAA;AAAA,oBACA,GAAA,CAAC,WAAQ,KAAO,EAAA,CAAA,CAAE,+BAA+B,CAAG,EAAA,SAAA,EAAU,KAC5D,EAAA,QAAA,kBAAA,GAAA,CAAC,MACC,EAAA,EAAA,QAAA,kBAAA,GAAA;AAAA,MAAC,UAAA;AAAA,MAAA;AAAA,QACC,OAAA,EAAS,MAAM,qBAAsB,EAAA;AAAA,QACrC,QAAU,EAAA,UAAA;AAAA,QACV,WAAW,OAAQ,CAAA,UAAA;AAAA,QAEnB,8BAAC,MAAO,EAAA,EAAA;AAAA;AAAA,OAEZ,CACF,EAAA;AAAA,GACF,EAAA,CAAA;AAEJ;;;;"}
|
|
@@ -1,15 +1,16 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { useState, useRef, useCallback, useEffect } from 'react';
|
|
2
3
|
import { Visualization, GRAPH_POSITION_CHANGE_EVENT, GRAPH_LAYOUT_END_EVENT, VisualizationProvider, TopologyView, VisualizationSurface, TopologyControlBar, createTopologyControlButtons, action, defaultControlButtonsOptions } from '@patternfly/react-topology';
|
|
3
4
|
import { DROP_SHADOW_SPACING, GRAPH_MIN_WIDTH, TOOLBAR_HEIGHT, NODE_HEIGHT } from '../../consts/pipeline-topology-const.esm.js';
|
|
4
5
|
import { getLayoutData } from '../../utils/pipeline-topology-utils.esm.js';
|
|
5
6
|
import pipelineComponentFactory, { layoutFactory } from './pipelineComponentFactory.esm.js';
|
|
6
7
|
|
|
7
8
|
const PipelineLayout = ({ model }) => {
|
|
8
|
-
const [vis, setVis] =
|
|
9
|
-
const [maxSize, setMaxSize] =
|
|
10
|
-
const storedGraphModel =
|
|
9
|
+
const [vis, setVis] = useState(null);
|
|
10
|
+
const [maxSize, setMaxSize] = useState({ height: 0, width: 0 });
|
|
11
|
+
const storedGraphModel = useRef(null);
|
|
11
12
|
const layout = model.graph.layout;
|
|
12
|
-
const onLayoutUpdate =
|
|
13
|
+
const onLayoutUpdate = useCallback(
|
|
13
14
|
(nodes) => {
|
|
14
15
|
const nodeBounds = nodes.map(
|
|
15
16
|
(node) => node.getBounds()
|
|
@@ -45,13 +46,13 @@ const PipelineLayout = ({ model }) => {
|
|
|
45
46
|
},
|
|
46
47
|
[setMaxSize, layout]
|
|
47
48
|
);
|
|
48
|
-
|
|
49
|
+
useEffect(() => {
|
|
49
50
|
if (model.graph.id !== storedGraphModel?.current?.id) {
|
|
50
51
|
storedGraphModel.current = null;
|
|
51
52
|
setVis(null);
|
|
52
53
|
}
|
|
53
54
|
}, [vis, model]);
|
|
54
|
-
|
|
55
|
+
useEffect(() => {
|
|
55
56
|
let mounted = true;
|
|
56
57
|
if (vis === null) {
|
|
57
58
|
const controller = new Visualization();
|
|
@@ -79,7 +80,7 @@ const PipelineLayout = ({ model }) => {
|
|
|
79
80
|
mounted = false;
|
|
80
81
|
};
|
|
81
82
|
}, [vis, model, onLayoutUpdate]);
|
|
82
|
-
|
|
83
|
+
useEffect(() => {
|
|
83
84
|
if (model && vis) {
|
|
84
85
|
const graph = storedGraphModel.current;
|
|
85
86
|
if (graph) {
|
|
@@ -89,7 +90,7 @@ const PipelineLayout = ({ model }) => {
|
|
|
89
90
|
}
|
|
90
91
|
}, [model, vis]);
|
|
91
92
|
if (!vis) return null;
|
|
92
|
-
const controlBar = (controller) => /* @__PURE__ */
|
|
93
|
+
const controlBar = (controller) => /* @__PURE__ */ jsx(
|
|
93
94
|
TopologyControlBar,
|
|
94
95
|
{
|
|
95
96
|
controlButtons: createTopologyControlButtons({
|
|
@@ -111,14 +112,14 @@ const PipelineLayout = ({ model }) => {
|
|
|
111
112
|
})
|
|
112
113
|
}
|
|
113
114
|
);
|
|
114
|
-
return /* @__PURE__ */
|
|
115
|
+
return /* @__PURE__ */ jsx(
|
|
115
116
|
"div",
|
|
116
117
|
{
|
|
117
118
|
style: {
|
|
118
119
|
height: Math.min(window.innerHeight, maxSize?.height)
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
|
|
120
|
+
},
|
|
121
|
+
children: /* @__PURE__ */ jsx(VisualizationProvider, { controller: vis, children: /* @__PURE__ */ jsx(TopologyView, { controlBar: controlBar(vis), children: /* @__PURE__ */ jsx(VisualizationSurface, {}) }) })
|
|
122
|
+
}
|
|
122
123
|
);
|
|
123
124
|
};
|
|
124
125
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PipelineLayout.esm.js","sources":["../../../src/components/pipeline-topology/PipelineLayout.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 React from 'react';\n\nimport {\n action,\n Controller,\n createTopologyControlButtons,\n defaultControlButtonsOptions,\n EdgeModel,\n GRAPH_LAYOUT_END_EVENT,\n GRAPH_POSITION_CHANGE_EVENT,\n GraphModel,\n Node,\n NodeModel,\n Rect,\n TopologyControlBar,\n TopologyView,\n Visualization,\n VisualizationProvider,\n VisualizationSurface,\n} from '@patternfly/react-topology';\n\nimport {\n DROP_SHADOW_SPACING,\n GRAPH_MIN_WIDTH,\n NODE_HEIGHT,\n PipelineLayout as PipelineLayoutTypes,\n TOOLBAR_HEIGHT,\n} from '../../consts/pipeline-topology-const';\nimport { PipelineMixedNodeModel } from '../../types/pipeline-topology-types';\nimport { getLayoutData } from '../../utils/pipeline-topology-utils';\nimport pipelineComponentFactory, {\n layoutFactory,\n} from './pipelineComponentFactory';\n\ntype PipelineLayoutProps = {\n model: {\n graph: GraphModel;\n nodes: PipelineMixedNodeModel[];\n edges: EdgeModel[];\n };\n};\n\nexport const PipelineLayout = ({ model }: PipelineLayoutProps) => {\n const [vis, setVis] = React.useState<Controller | null>(null);\n const [maxSize, setMaxSize] = React.useState<{\n height: number;\n width: number;\n }>({ height: 0, width: 0 });\n const storedGraphModel = React.useRef<GraphModel | null>(null);\n\n const layout: PipelineLayoutTypes = model.graph.layout as PipelineLayoutTypes;\n\n const onLayoutUpdate = React.useCallback(\n (nodes: Node[]) => {\n const nodeBounds = nodes.map((node: Node<NodeModel, any>) =>\n node.getBounds(),\n );\n const maxWidth = Math.floor(\n nodeBounds\n .map((bounds: Rect) => bounds.width)\n .reduce((w1: number, w2: number) => Math.max(w1, w2), 0),\n );\n const maxHeight = Math.floor(\n nodeBounds\n .map((bounds: Rect) => bounds.height)\n .reduce((h1: number, h2: number) => Math.max(h1, h2), 0),\n );\n const maxObject =\n nodeBounds.find((nb: Rect) => nb.height === maxHeight) ??\n ({ y: 0 } as Rect);\n\n const maxX = Math.floor(\n nodeBounds\n .map((bounds: Rect) => bounds.x)\n .reduce((x1: number, x2: number) => Math.max(x1, x2), 0),\n );\n const maxY = Math.floor(\n nodeBounds\n .map((bounds: Rect) => bounds.y)\n .reduce((y1: number, y2: number) => Math.max(y1, y2), 0),\n );\n\n let horizontalMargin = 0;\n let verticalMargin = 0;\n if (layout) {\n horizontalMargin = getLayoutData(layout)?.marginx || 0;\n verticalMargin = getLayoutData(layout)?.marginy || 0;\n }\n const finallyTaskHeight =\n maxObject.y + maxHeight + DROP_SHADOW_SPACING + verticalMargin * 2;\n const regularTaskHeight =\n maxY + NODE_HEIGHT + DROP_SHADOW_SPACING + verticalMargin * 2;\n\n setMaxSize({\n height: Math.max(finallyTaskHeight, regularTaskHeight) + TOOLBAR_HEIGHT,\n width: Math.max(\n maxX + maxWidth + DROP_SHADOW_SPACING + horizontalMargin * 2,\n GRAPH_MIN_WIDTH,\n ),\n });\n },\n [setMaxSize, layout],\n );\n\n React.useEffect(() => {\n if (model.graph.id !== storedGraphModel?.current?.id) {\n storedGraphModel.current = null;\n setVis(null);\n }\n }, [vis, model]);\n\n React.useEffect(() => {\n let mounted = true;\n if (vis === null) {\n const controller = new Visualization();\n controller.registerLayoutFactory(layoutFactory);\n controller.registerComponentFactory(pipelineComponentFactory);\n controller.fromModel(model);\n controller.addEventListener(GRAPH_POSITION_CHANGE_EVENT, () => {\n storedGraphModel.current = controller.getGraph().toModel();\n });\n controller.addEventListener(GRAPH_LAYOUT_END_EVENT, () => {\n onLayoutUpdate(controller.getGraph().getNodes());\n });\n if (mounted) {\n setVis(controller);\n }\n } else {\n const graph = storedGraphModel.current;\n if (graph) {\n model.graph = graph;\n }\n vis.fromModel(model);\n vis.getGraph().layout();\n }\n return () => {\n mounted = false;\n };\n }, [vis, model, onLayoutUpdate]);\n\n React.useEffect(() => {\n if (model && vis) {\n const graph = storedGraphModel.current;\n if (graph) {\n model.graph = graph;\n }\n vis.fromModel(model);\n }\n }, [model, vis]);\n\n if (!vis) return null;\n\n const controlBar = (controller: Controller) => (\n <TopologyControlBar\n controlButtons={createTopologyControlButtons({\n ...defaultControlButtonsOptions,\n zoomInCallback: action(() => {\n controller.getGraph().scaleBy(4 / 3);\n }),\n zoomOutCallback: action(() => {\n controller.getGraph().scaleBy(0.75);\n }),\n fitToScreenCallback: action(() => {\n controller.getGraph().fit(80);\n }),\n resetViewCallback: action(() => {\n controller.getGraph().reset();\n controller.getGraph().layout();\n }),\n legend: false,\n })}\n />\n );\n\n return (\n <div\n style={{\n height: Math.min(window.innerHeight, maxSize?.height),\n }}\n >\n <VisualizationProvider controller={vis}>\n <TopologyView controlBar={controlBar(vis)}>\n <VisualizationSurface />\n </TopologyView>\n </VisualizationProvider>\n </div>\n );\n};\n"],"names":["React"],"mappings":";;;;;;AAyDO,MAAM,cAAiB,GAAA,CAAC,EAAE,KAAA,EAAiC,KAAA;AAChE,EAAA,MAAM,CAAC,GAAK,EAAA,MAAM,CAAI,GAAAA,cAAA,CAAM,SAA4B,IAAI,CAAA;AAC5D,EAAM,MAAA,CAAC,OAAS,EAAA,UAAU,CAAI,GAAAA,cAAA,CAAM,QAGjC,CA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AA,aAAA,CAAA,oBAAA,EAAA,IAAqB,CACxB,CACF;AAAA,GACF;AAEJ;;;;"}
|
|
1
|
+
{"version":3,"file":"PipelineLayout.esm.js","sources":["../../../src/components/pipeline-topology/PipelineLayout.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, useRef, useCallback, useEffect } from 'react';\n\nimport {\n action,\n Controller,\n createTopologyControlButtons,\n defaultControlButtonsOptions,\n EdgeModel,\n GRAPH_LAYOUT_END_EVENT,\n GRAPH_POSITION_CHANGE_EVENT,\n GraphModel,\n Node,\n NodeModel,\n Rect,\n TopologyControlBar,\n TopologyView,\n Visualization,\n VisualizationProvider,\n VisualizationSurface,\n} from '@patternfly/react-topology';\n\nimport {\n DROP_SHADOW_SPACING,\n GRAPH_MIN_WIDTH,\n NODE_HEIGHT,\n PipelineLayout as PipelineLayoutTypes,\n TOOLBAR_HEIGHT,\n} from '../../consts/pipeline-topology-const';\nimport { PipelineMixedNodeModel } from '../../types/pipeline-topology-types';\nimport { getLayoutData } from '../../utils/pipeline-topology-utils';\nimport pipelineComponentFactory, {\n layoutFactory,\n} from './pipelineComponentFactory';\n\ntype PipelineLayoutProps = {\n model: {\n graph: GraphModel;\n nodes: PipelineMixedNodeModel[];\n edges: EdgeModel[];\n };\n};\n\nexport const PipelineLayout = ({ model }: PipelineLayoutProps) => {\n const [vis, setVis] = useState<Controller | null>(null);\n const [maxSize, setMaxSize] = useState<{\n height: number;\n width: number;\n }>({ height: 0, width: 0 });\n const storedGraphModel = useRef<GraphModel | null>(null);\n\n const layout: PipelineLayoutTypes = model.graph.layout as PipelineLayoutTypes;\n\n const onLayoutUpdate = useCallback(\n (nodes: Node[]) => {\n const nodeBounds = nodes.map((node: Node<NodeModel, any>) =>\n node.getBounds(),\n );\n const maxWidth = Math.floor(\n nodeBounds\n .map((bounds: Rect) => bounds.width)\n .reduce((w1: number, w2: number) => Math.max(w1, w2), 0),\n );\n const maxHeight = Math.floor(\n nodeBounds\n .map((bounds: Rect) => bounds.height)\n .reduce((h1: number, h2: number) => Math.max(h1, h2), 0),\n );\n const maxObject =\n nodeBounds.find((nb: Rect) => nb.height === maxHeight) ??\n ({ y: 0 } as Rect);\n\n const maxX = Math.floor(\n nodeBounds\n .map((bounds: Rect) => bounds.x)\n .reduce((x1: number, x2: number) => Math.max(x1, x2), 0),\n );\n const maxY = Math.floor(\n nodeBounds\n .map((bounds: Rect) => bounds.y)\n .reduce((y1: number, y2: number) => Math.max(y1, y2), 0),\n );\n\n let horizontalMargin = 0;\n let verticalMargin = 0;\n if (layout) {\n horizontalMargin = getLayoutData(layout)?.marginx || 0;\n verticalMargin = getLayoutData(layout)?.marginy || 0;\n }\n const finallyTaskHeight =\n maxObject.y + maxHeight + DROP_SHADOW_SPACING + verticalMargin * 2;\n const regularTaskHeight =\n maxY + NODE_HEIGHT + DROP_SHADOW_SPACING + verticalMargin * 2;\n\n setMaxSize({\n height: Math.max(finallyTaskHeight, regularTaskHeight) + TOOLBAR_HEIGHT,\n width: Math.max(\n maxX + maxWidth + DROP_SHADOW_SPACING + horizontalMargin * 2,\n GRAPH_MIN_WIDTH,\n ),\n });\n },\n [setMaxSize, layout],\n );\n\n useEffect(() => {\n if (model.graph.id !== storedGraphModel?.current?.id) {\n storedGraphModel.current = null;\n setVis(null);\n }\n }, [vis, model]);\n\n useEffect(() => {\n let mounted = true;\n if (vis === null) {\n const controller = new Visualization();\n controller.registerLayoutFactory(layoutFactory);\n controller.registerComponentFactory(pipelineComponentFactory);\n controller.fromModel(model);\n controller.addEventListener(GRAPH_POSITION_CHANGE_EVENT, () => {\n storedGraphModel.current = controller.getGraph().toModel();\n });\n controller.addEventListener(GRAPH_LAYOUT_END_EVENT, () => {\n onLayoutUpdate(controller.getGraph().getNodes());\n });\n if (mounted) {\n setVis(controller);\n }\n } else {\n const graph = storedGraphModel.current;\n if (graph) {\n model.graph = graph;\n }\n vis.fromModel(model);\n vis.getGraph().layout();\n }\n return () => {\n mounted = false;\n };\n }, [vis, model, onLayoutUpdate]);\n\n useEffect(() => {\n if (model && vis) {\n const graph = storedGraphModel.current;\n if (graph) {\n model.graph = graph;\n }\n vis.fromModel(model);\n }\n }, [model, vis]);\n\n if (!vis) return null;\n\n const controlBar = (controller: Controller) => (\n <TopologyControlBar\n controlButtons={createTopologyControlButtons({\n ...defaultControlButtonsOptions,\n zoomInCallback: action(() => {\n controller.getGraph().scaleBy(4 / 3);\n }),\n zoomOutCallback: action(() => {\n controller.getGraph().scaleBy(0.75);\n }),\n fitToScreenCallback: action(() => {\n controller.getGraph().fit(80);\n }),\n resetViewCallback: action(() => {\n controller.getGraph().reset();\n controller.getGraph().layout();\n }),\n legend: false,\n })}\n />\n );\n\n return (\n <div\n style={{\n height: Math.min(window.innerHeight, maxSize?.height),\n }}\n >\n <VisualizationProvider controller={vis}>\n <TopologyView controlBar={controlBar(vis)}>\n <VisualizationSurface />\n </TopologyView>\n </VisualizationProvider>\n </div>\n );\n};\n"],"names":[],"mappings":";;;;;;;AAyDO,MAAM,cAAiB,GAAA,CAAC,EAAE,KAAA,EAAiC,KAAA;AAChE,EAAA,MAAM,CAAC,GAAA,EAAK,MAAM,CAAA,GAAI,SAA4B,IAAI,CAAA;AACtD,EAAM,MAAA,CAAC,OAAS,EAAA,UAAU,CAAI,GAAA,QAAA,CAG3B,EAAE,MAAQ,EAAA,CAAA,EAAG,KAAO,EAAA,CAAA,EAAG,CAAA;AAC1B,EAAM,MAAA,gBAAA,GAAmB,OAA0B,IAAI,CAAA;AAEvD,EAAM,MAAA,MAAA,GAA8B,MAAM,KAA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BAA6B,CAAA;AAAA,QAC3C,GAAG,4BAAA;AAAA,QACH,cAAA,EAAgB,OAAO,MAAM;AAC3B,UAAA,UAAA,CAAW,QAAS,EAAA,CAAE,OAAQ,CAAA,CAAA,GAAI,CAAC,CAAA;AAAA,SACpC,CAAA;AAAA,QACD,eAAA,EAAiB,OAAO,MAAM;AAC5B,UAAW,UAAA,CAAA,QAAA,EAAW,CAAA,OAAA,CAAQ,IAAI,CAAA;AAAA,SACnC,CAAA;AAAA,QACD,mBAAA,EAAqB,OAAO,MAAM;AAChC,UAAW,UAAA,CAAA,QAAA,EAAW,CAAA,GAAA,CAAI,EAAE,CAAA;AAAA,SAC7B,CAAA;AAAA,QACD,iBAAA,EAAmB,OAAO,MAAM;AAC9B,UAAW,UAAA,CAAA,QAAA,GAAW,KAAM,EAAA;AAC5B,UAAW,UAAA,CAAA,QAAA,GAAW,MAAO,EAAA;AAAA,SAC9B,CAAA;AAAA,QACD,MAAQ,EAAA;AAAA,OACT;AAAA;AAAA,GACH;AAGF,EACE,uBAAA,GAAA;AAAA,IAAC,KAAA;AAAA,IAAA;AAAA,MACC,KAAO,EAAA;AAAA,QACL,QAAQ,IAAK,CAAA,GAAA,CAAI,MAAO,CAAA,WAAA,EAAa,SAAS,MAAM;AAAA,OACtD;AAAA,MAEA,QAAC,kBAAA,GAAA,CAAA,qBAAA,EAAA,EAAsB,UAAY,EAAA,GAAA,EACjC,QAAC,kBAAA,GAAA,CAAA,YAAA,EAAA,EAAa,UAAY,EAAA,UAAA,CAAW,GAAG,CAAA,EACtC,QAAC,kBAAA,GAAA,CAAA,oBAAA,EAAA,EAAqB,GACxB,CACF,EAAA;AAAA;AAAA,GACF;AAEJ;;;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { jsx, Fragment } from 'react/jsx-runtime';
|
|
2
2
|
import { useDarkTheme } from '../../hooks/useDarkTheme.esm.js';
|
|
3
3
|
import { PipelineVisualizationView } from './PipelineVisualizationView.esm.js';
|
|
4
4
|
|
|
@@ -6,7 +6,7 @@ const PipelineRunVisualization = ({
|
|
|
6
6
|
pipelineRunName
|
|
7
7
|
}) => {
|
|
8
8
|
useDarkTheme();
|
|
9
|
-
return /* @__PURE__ */
|
|
9
|
+
return /* @__PURE__ */ jsx(Fragment, { children: pipelineRunName && /* @__PURE__ */ jsx(PipelineVisualizationView, { pipelineRun: pipelineRunName }) });
|
|
10
10
|
};
|
|
11
11
|
|
|
12
12
|
export { PipelineRunVisualization };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PipelineRunVisualization.esm.js","sources":["../../../src/components/pipeline-topology/PipelineRunVisualization.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":"PipelineRunVisualization.esm.js","sources":["../../../src/components/pipeline-topology/PipelineRunVisualization.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 { useDarkTheme } from '../../hooks/useDarkTheme';\nimport { PipelineVisualizationView } from './PipelineVisualizationView';\n\ntype PipelineRunVisualizationProps = {\n pipelineRunName?: string;\n};\n\nexport const PipelineRunVisualization = ({\n pipelineRunName,\n}: PipelineRunVisualizationProps) => {\n useDarkTheme();\n\n return (\n <>\n {pipelineRunName && (\n <PipelineVisualizationView pipelineRun={pipelineRunName} />\n )}\n </>\n );\n};\n"],"names":[],"mappings":";;;;AAsBO,MAAM,2BAA2B,CAAC;AAAA,EACvC;AACF,CAAqC,KAAA;AACnC,EAAa,YAAA,EAAA;AAEb,EAAA,uCAEK,QACC,EAAA,eAAA,oBAAA,GAAA,CAAC,yBAA0B,EAAA,EAAA,WAAA,EAAa,iBAAiB,CAE7D,EAAA,CAAA;AAEJ;;;;"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
2
|
+
import { memo, useState, useContext, useRef, useMemo } from 'react';
|
|
2
3
|
import { Tooltip } from '@patternfly/react-core';
|
|
3
4
|
import { useHover, useDetailsLevel, RunStatus, WhenDecorator, DEFAULT_WHEN_OFFSET, TaskNode, ScaleDetailsLevel, Layer, TOP_LAYER, DEFAULT_LAYER } from '@patternfly/react-topology';
|
|
4
5
|
import { observer } from 'mobx-react';
|
|
@@ -17,12 +18,12 @@ const PipelineTaskNode = ({
|
|
|
17
18
|
contextMenuOpen,
|
|
18
19
|
...rest
|
|
19
20
|
}) => {
|
|
20
|
-
const [open, setOpen] =
|
|
21
|
-
const { watchResourcesData } =
|
|
21
|
+
const [open, setOpen] = useState(false);
|
|
22
|
+
const { watchResourcesData } = useContext(
|
|
22
23
|
TektonResourcesContext
|
|
23
24
|
);
|
|
24
25
|
const data = element.getData();
|
|
25
|
-
const triggerRef =
|
|
26
|
+
const triggerRef = useRef(null);
|
|
26
27
|
const pipelineRun = data.pipelineRun;
|
|
27
28
|
const [hover, hoverRef] = useHover();
|
|
28
29
|
const detailsLevel = useDetailsLevel();
|
|
@@ -45,7 +46,7 @@ const PipelineTaskNode = ({
|
|
|
45
46
|
({ status }) => status === RunStatus.Succeeded
|
|
46
47
|
).length;
|
|
47
48
|
const badge = stepStatusList.length > 0 && data.status ? `${succeededStepsCount}/${stepStatusList.length}` : null;
|
|
48
|
-
const passedData =
|
|
49
|
+
const passedData = useMemo(() => {
|
|
49
50
|
const newData = { ...data };
|
|
50
51
|
Object.keys(newData).forEach((key) => {
|
|
51
52
|
if (newData[key] === void 0) {
|
|
@@ -55,7 +56,7 @@ const PipelineTaskNode = ({
|
|
|
55
56
|
return newData;
|
|
56
57
|
}, [data]);
|
|
57
58
|
const hasTaskIcon = !!(data.taskIconClass || data.taskIcon);
|
|
58
|
-
const whenDecorator = data.whenStatus ? /* @__PURE__ */
|
|
59
|
+
const whenDecorator = data.whenStatus ? /* @__PURE__ */ jsx(
|
|
59
60
|
WhenDecorator,
|
|
60
61
|
{
|
|
61
62
|
element,
|
|
@@ -66,67 +67,70 @@ const PipelineTaskNode = ({
|
|
|
66
67
|
const activeTaskId = taskRuns.find(
|
|
67
68
|
(tr) => tr?.metadata?.labels?.[TEKTON_PIPELINE_RUN] === pipelineRun?.metadata?.name && tr?.metadata?.labels?.[TEKTON_PIPELINE_TASK] === data.task?.name
|
|
68
69
|
)?.metadata?.name;
|
|
69
|
-
const taskNode = /* @__PURE__ */
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
element,
|
|
84
|
-
onContextMenu: data.showContextMenu ? onContextMenu : void 0,
|
|
85
|
-
contextMenuOpen,
|
|
86
|
-
scaleNode: (hover || contextMenuOpen) && detailsLevel !== ScaleDetailsLevel.high,
|
|
87
|
-
hideDetailsAtMedium: true,
|
|
88
|
-
...passedData,
|
|
89
|
-
...rest,
|
|
90
|
-
badge,
|
|
91
|
-
truncateLength: element.getData()?.label?.length,
|
|
92
|
-
onSelect: activeTaskId && openDialog
|
|
93
|
-
},
|
|
94
|
-
whenDecorator
|
|
95
|
-
));
|
|
96
|
-
return /* @__PURE__ */ React__default.createElement(
|
|
97
|
-
Layer,
|
|
98
|
-
{
|
|
99
|
-
id: detailsLevel !== ScaleDetailsLevel.high && (hover || contextMenuOpen) ? TOP_LAYER : DEFAULT_LAYER
|
|
100
|
-
},
|
|
101
|
-
/* @__PURE__ */ React__default.createElement(
|
|
102
|
-
"g",
|
|
70
|
+
const taskNode = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
71
|
+
/* @__PURE__ */ jsx(
|
|
72
|
+
PipelineRunLogDialog,
|
|
73
|
+
{
|
|
74
|
+
pipelineRun,
|
|
75
|
+
open,
|
|
76
|
+
closeDialog,
|
|
77
|
+
pods,
|
|
78
|
+
taskRuns,
|
|
79
|
+
activeTask: activeTaskId
|
|
80
|
+
}
|
|
81
|
+
),
|
|
82
|
+
/* @__PURE__ */ jsx(
|
|
83
|
+
TaskNode,
|
|
103
84
|
{
|
|
104
|
-
"data-test": `task ${element.getLabel()}`,
|
|
105
85
|
className: "bs-tkn-pipeline-task-node",
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
86
|
+
element,
|
|
87
|
+
onContextMenu: data.showContextMenu ? onContextMenu : void 0,
|
|
88
|
+
contextMenuOpen,
|
|
89
|
+
scaleNode: (hover || contextMenuOpen) && detailsLevel !== ScaleDetailsLevel.high,
|
|
90
|
+
hideDetailsAtMedium: true,
|
|
91
|
+
...passedData,
|
|
92
|
+
...rest,
|
|
93
|
+
badge,
|
|
94
|
+
truncateLength: element.getData()?.label?.length,
|
|
95
|
+
onSelect: activeTaskId && openDialog,
|
|
96
|
+
children: whenDecorator
|
|
97
|
+
}
|
|
98
|
+
)
|
|
99
|
+
] });
|
|
100
|
+
return /* @__PURE__ */ jsx(
|
|
101
|
+
Layer,
|
|
102
|
+
{
|
|
103
|
+
id: detailsLevel !== ScaleDetailsLevel.high && (hover || contextMenuOpen) ? TOP_LAYER : DEFAULT_LAYER,
|
|
104
|
+
children: /* @__PURE__ */ jsx(
|
|
105
|
+
"g",
|
|
110
106
|
{
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
107
|
+
"data-test": `task ${element.getLabel()}`,
|
|
108
|
+
className: "bs-tkn-pipeline-task-node",
|
|
109
|
+
ref: hoverRef,
|
|
110
|
+
children: /* @__PURE__ */ jsx(
|
|
111
|
+
Tooltip,
|
|
115
112
|
{
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
113
|
+
position: "bottom",
|
|
114
|
+
enableFlip: false,
|
|
115
|
+
content: /* @__PURE__ */ jsx(
|
|
116
|
+
PipelineVisualizationStepList,
|
|
117
|
+
{
|
|
118
|
+
isSpecOverview: !data.status,
|
|
119
|
+
taskName: element.getLabel(),
|
|
120
|
+
steps: stepStatusList,
|
|
121
|
+
isFinallyTask
|
|
122
|
+
}
|
|
123
|
+
),
|
|
124
|
+
triggerRef,
|
|
125
|
+
children: /* @__PURE__ */ jsx("g", { ref: triggerRef, children: taskNode })
|
|
120
126
|
}
|
|
121
|
-
)
|
|
122
|
-
|
|
123
|
-
},
|
|
124
|
-
/* @__PURE__ */ React__default.createElement("g", { ref: triggerRef }, taskNode)
|
|
127
|
+
)
|
|
128
|
+
}
|
|
125
129
|
)
|
|
126
|
-
|
|
130
|
+
}
|
|
127
131
|
);
|
|
128
132
|
};
|
|
129
|
-
var PipelineTaskNode$1 =
|
|
133
|
+
var PipelineTaskNode$1 = memo(observer(PipelineTaskNode));
|
|
130
134
|
|
|
131
135
|
export { PipelineTaskNode$1 as default };
|
|
132
136
|
//# sourceMappingURL=PipelineTaskNode.esm.js.map
|