@backstage-community/plugin-tekton 3.16.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.
Files changed (151) hide show
  1. package/CHANGELOG.md +801 -0
  2. package/README.md +369 -0
  3. package/app-config.dynamic.yaml +12 -0
  4. package/dist/components/Charts/PipelineBars.esm.js +49 -0
  5. package/dist/components/Charts/PipelineBars.esm.js.map +1 -0
  6. package/dist/components/Icons/CriticalRiskIcon.esm.js +22 -0
  7. package/dist/components/Icons/CriticalRiskIcon.esm.js.map +1 -0
  8. package/dist/components/Icons/EqualsIcon.esm.js +22 -0
  9. package/dist/components/Icons/EqualsIcon.esm.js.map +1 -0
  10. package/dist/components/Icons/LinkToSbomIcon.esm.js +37 -0
  11. package/dist/components/Icons/LinkToSbomIcon.esm.js.map +1 -0
  12. package/dist/components/Icons/OutputIcon.esm.js +36 -0
  13. package/dist/components/Icons/OutputIcon.esm.js.map +1 -0
  14. package/dist/components/Icons/SignedBadge.esm.js +16 -0
  15. package/dist/components/Icons/SignedBadge.esm.js.map +1 -0
  16. package/dist/components/Icons/ViewLogsIcon.esm.js +35 -0
  17. package/dist/components/Icons/ViewLogsIcon.esm.js.map +1 -0
  18. package/dist/components/PipelineRunList/PipelineRunColumnHeader.esm.js +43 -0
  19. package/dist/components/PipelineRunList/PipelineRunColumnHeader.esm.js.map +1 -0
  20. package/dist/components/PipelineRunList/PipelineRunList.esm.js +185 -0
  21. package/dist/components/PipelineRunList/PipelineRunList.esm.js.map +1 -0
  22. package/dist/components/PipelineRunList/PipelineRunListSearchBar.esm.js +42 -0
  23. package/dist/components/PipelineRunList/PipelineRunListSearchBar.esm.js.map +1 -0
  24. package/dist/components/PipelineRunList/PipelineRunOutput.esm.js +70 -0
  25. package/dist/components/PipelineRunList/PipelineRunOutput.esm.js.map +1 -0
  26. package/dist/components/PipelineRunList/PipelineRunRow.css.esm.js +7 -0
  27. package/dist/components/PipelineRunList/PipelineRunRow.css.esm.js.map +1 -0
  28. package/dist/components/PipelineRunList/PipelineRunRow.esm.js +110 -0
  29. package/dist/components/PipelineRunList/PipelineRunRow.esm.js.map +1 -0
  30. package/dist/components/PipelineRunList/PipelineRunRowActions.esm.js +137 -0
  31. package/dist/components/PipelineRunList/PipelineRunRowActions.esm.js.map +1 -0
  32. package/dist/components/PipelineRunList/PipelineRunSBOMLink.esm.js +25 -0
  33. package/dist/components/PipelineRunList/PipelineRunSBOMLink.esm.js.map +1 -0
  34. package/dist/components/PipelineRunList/PipelineRunTableBody.esm.js +32 -0
  35. package/dist/components/PipelineRunList/PipelineRunTableBody.esm.js.map +1 -0
  36. package/dist/components/PipelineRunList/PipelineRunTaskStatus.esm.js +11 -0
  37. package/dist/components/PipelineRunList/PipelineRunTaskStatus.esm.js.map +1 -0
  38. package/dist/components/PipelineRunList/PipelineRunVulnerabilities.esm.js +81 -0
  39. package/dist/components/PipelineRunList/PipelineRunVulnerabilities.esm.js.map +1 -0
  40. package/dist/components/PipelineRunList/PipelineTableHeader.esm.js +53 -0
  41. package/dist/components/PipelineRunList/PipelineTableHeader.esm.js.map +1 -0
  42. package/dist/components/PipelineRunList/PlrStatus.css.esm.js +7 -0
  43. package/dist/components/PipelineRunList/PlrStatus.css.esm.js.map +1 -0
  44. package/dist/components/PipelineRunList/PlrStatus.esm.js +11 -0
  45. package/dist/components/PipelineRunList/PlrStatus.esm.js.map +1 -0
  46. package/dist/components/PipelineRunList/ResourceBadge.css.esm.js +7 -0
  47. package/dist/components/PipelineRunList/ResourceBadge.css.esm.js.map +1 -0
  48. package/dist/components/PipelineRunList/ResourceBadge.esm.js +15 -0
  49. package/dist/components/PipelineRunList/ResourceBadge.esm.js.map +1 -0
  50. package/dist/components/PipelineRunLogs/PipelineRunLogDialog.esm.js +82 -0
  51. package/dist/components/PipelineRunLogs/PipelineRunLogDialog.esm.js.map +1 -0
  52. package/dist/components/PipelineRunLogs/PipelineRunLogDownloader.esm.js +47 -0
  53. package/dist/components/PipelineRunLogs/PipelineRunLogDownloader.esm.js.map +1 -0
  54. package/dist/components/PipelineRunLogs/PipelineRunLogViewer.esm.js +53 -0
  55. package/dist/components/PipelineRunLogs/PipelineRunLogViewer.esm.js.map +1 -0
  56. package/dist/components/PipelineRunLogs/PipelineRunLogs.esm.js +69 -0
  57. package/dist/components/PipelineRunLogs/PipelineRunLogs.esm.js.map +1 -0
  58. package/dist/components/PipelineRunLogs/PodLogsDownloadLink.esm.js +69 -0
  59. package/dist/components/PipelineRunLogs/PodLogsDownloadLink.esm.js.map +1 -0
  60. package/dist/components/PipelineRunLogs/TaskStatusStepper.esm.js +128 -0
  61. package/dist/components/PipelineRunLogs/TaskStatusStepper.esm.js.map +1 -0
  62. package/dist/components/PipelineRunOutput/PipelineRunOutputDialog.esm.js +62 -0
  63. package/dist/components/PipelineRunOutput/PipelineRunOutputDialog.esm.js.map +1 -0
  64. package/dist/components/Router.esm.js +16 -0
  65. package/dist/components/Router.esm.js.map +1 -0
  66. package/dist/components/Tekton/TektonCIComponent.esm.js +53 -0
  67. package/dist/components/Tekton/TektonCIComponent.esm.js.map +1 -0
  68. package/dist/components/common/ClusterSelector.css.esm.js +7 -0
  69. package/dist/components/common/ClusterSelector.css.esm.js.map +1 -0
  70. package/dist/components/common/ClusterSelector.esm.js +46 -0
  71. package/dist/components/common/ClusterSelector.esm.js.map +1 -0
  72. package/dist/components/common/ErrorPanel.esm.js +33 -0
  73. package/dist/components/common/ErrorPanel.esm.js.map +1 -0
  74. package/dist/components/common/PermissionAlert.esm.js +9 -0
  75. package/dist/components/common/PermissionAlert.esm.js.map +1 -0
  76. package/dist/components/common/ResourceStatus.css.esm.js +7 -0
  77. package/dist/components/common/ResourceStatus.css.esm.js.map +1 -0
  78. package/dist/components/common/StatusSelector.css.esm.js +7 -0
  79. package/dist/components/common/StatusSelector.css.esm.js.map +1 -0
  80. package/dist/components/common/StatusSelector.esm.js +48 -0
  81. package/dist/components/common/StatusSelector.esm.js.map +1 -0
  82. package/dist/components/common/TableExpandCollapse.esm.js +44 -0
  83. package/dist/components/common/TableExpandCollapse.esm.js.map +1 -0
  84. package/dist/components/pipeline-topology/PipelineLayout.esm.js +126 -0
  85. package/dist/components/pipeline-topology/PipelineLayout.esm.js.map +1 -0
  86. package/dist/components/pipeline-topology/PipelineRunVisualization.esm.js +13 -0
  87. package/dist/components/pipeline-topology/PipelineRunVisualization.esm.js.map +1 -0
  88. package/dist/components/pipeline-topology/PipelineTaskNode.css.esm.js +7 -0
  89. package/dist/components/pipeline-topology/PipelineTaskNode.css.esm.js.map +1 -0
  90. package/dist/components/pipeline-topology/PipelineTaskNode.esm.js +132 -0
  91. package/dist/components/pipeline-topology/PipelineTaskNode.esm.js.map +1 -0
  92. package/dist/components/pipeline-topology/PipelineVisualization.css.esm.js +7 -0
  93. package/dist/components/pipeline-topology/PipelineVisualization.css.esm.js.map +1 -0
  94. package/dist/components/pipeline-topology/PipelineVisualization.esm.js +24 -0
  95. package/dist/components/pipeline-topology/PipelineVisualization.esm.js.map +1 -0
  96. package/dist/components/pipeline-topology/PipelineVisualizationStepList.css.esm.js +7 -0
  97. package/dist/components/pipeline-topology/PipelineVisualizationStepList.css.esm.js.map +1 -0
  98. package/dist/components/pipeline-topology/PipelineVisualizationStepList.esm.js +39 -0
  99. package/dist/components/pipeline-topology/PipelineVisualizationStepList.esm.js.map +1 -0
  100. package/dist/components/pipeline-topology/PipelineVisualizationView.esm.js +41 -0
  101. package/dist/components/pipeline-topology/PipelineVisualizationView.esm.js.map +1 -0
  102. package/dist/components/pipeline-topology/TaskGroupEdge.esm.js +16 -0
  103. package/dist/components/pipeline-topology/TaskGroupEdge.esm.js.map +1 -0
  104. package/dist/components/pipeline-topology/dag.esm.js +119 -0
  105. package/dist/components/pipeline-topology/dag.esm.js.map +1 -0
  106. package/dist/components/pipeline-topology/pipelineComponentFactory.esm.js +60 -0
  107. package/dist/components/pipeline-topology/pipelineComponentFactory.esm.js.map +1 -0
  108. package/dist/consts/pipeline-topology-const.esm.js +66 -0
  109. package/dist/consts/pipeline-topology-const.esm.js.map +1 -0
  110. package/dist/consts/tekton-const.esm.js +7 -0
  111. package/dist/consts/tekton-const.esm.js.map +1 -0
  112. package/dist/hooks/TektonResourcesContext.esm.js +16 -0
  113. package/dist/hooks/TektonResourcesContext.esm.js.map +1 -0
  114. package/dist/hooks/useAllWatchResources.esm.js +35 -0
  115. package/dist/hooks/useAllWatchResources.esm.js.map +1 -0
  116. package/dist/hooks/useDarkTheme.esm.js +21 -0
  117. package/dist/hooks/useDarkTheme.esm.js.map +1 -0
  118. package/dist/hooks/usePipelineRunScanResults.esm.js +35 -0
  119. package/dist/hooks/usePipelineRunScanResults.esm.js.map +1 -0
  120. package/dist/hooks/usePodLogsOfPipelineRun.esm.js +67 -0
  121. package/dist/hooks/usePodLogsOfPipelineRun.esm.js.map +1 -0
  122. package/dist/hooks/useResourcesClusters.esm.js +24 -0
  123. package/dist/hooks/useResourcesClusters.esm.js.map +1 -0
  124. package/dist/hooks/useTektonObjectsResponse.esm.js +78 -0
  125. package/dist/hooks/useTektonObjectsResponse.esm.js.map +1 -0
  126. package/dist/hooks/useTektonViewPermission.esm.js +12 -0
  127. package/dist/hooks/useTektonViewPermission.esm.js.map +1 -0
  128. package/dist/index.d.ts +32 -0
  129. package/dist/index.esm.js +3 -0
  130. package/dist/index.esm.js.map +1 -0
  131. package/dist/models.esm.js +21 -0
  132. package/dist/models.esm.js.map +1 -0
  133. package/dist/plugin.esm.js +72 -0
  134. package/dist/plugin.esm.js.map +1 -0
  135. package/dist/types/types.esm.js +15 -0
  136. package/dist/types/types.esm.js.map +1 -0
  137. package/dist/utils/isTektonCIAvailable.esm.js +7 -0
  138. package/dist/utils/isTektonCIAvailable.esm.js.map +1 -0
  139. package/dist/utils/log-downloader-utils.esm.js +33 -0
  140. package/dist/utils/log-downloader-utils.esm.js.map +1 -0
  141. package/dist/utils/pipeline-step-utils.esm.js +53 -0
  142. package/dist/utils/pipeline-step-utils.esm.js.map +1 -0
  143. package/dist/utils/pipeline-topology-utils.esm.js +250 -0
  144. package/dist/utils/pipeline-topology-utils.esm.js.map +1 -0
  145. package/dist/utils/pipelineRun-utils.esm.js +128 -0
  146. package/dist/utils/pipelineRun-utils.esm.js.map +1 -0
  147. package/dist/utils/taskRun-utils.esm.js +50 -0
  148. package/dist/utils/taskRun-utils.esm.js.map +1 -0
  149. package/dist/utils/tekton-utils.esm.js +191 -0
  150. package/dist/utils/tekton-utils.esm.js.map +1 -0
  151. package/package.json +114 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PipelineVisualization.esm.js","sources":["../../../src/components/pipeline-topology/PipelineVisualization.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 { PipelineRunKind, TaskRunKind } from '@janus-idp/shared-react';\n\nimport { useDarkTheme } from '../../hooks/useDarkTheme';\nimport { getGraphDataModel } from '../../utils/pipeline-topology-utils';\nimport { PipelineLayout } from './PipelineLayout';\n\nimport './PipelineVisualization.css';\n\ntype PipelineVisualizationProps = {\n pipelineRun: PipelineRunKind | null;\n taskRuns: TaskRunKind[];\n};\n\nexport const PipelineVisualization = ({\n pipelineRun,\n taskRuns,\n}: PipelineVisualizationProps) => {\n useDarkTheme();\n\n const model = getGraphDataModel(pipelineRun ?? undefined, taskRuns ?? []);\n\n return (\n <>\n {!model || (model.nodes.length === 0 && model.edges.length === 0) ? (\n <div data-testid=\"pipeline-no-tasks\">\n This Pipeline Run has no tasks to visualize\n </div>\n ) : (\n <div\n data-testid=\"pipelineRun-visualization\"\n className=\"bs-tkn-pipeline-visualization__layout\"\n >\n <PipelineLayout model={model} />\n </div>\n )}\n </>\n );\n};\n"],"names":["React"],"mappings":";;;;;;AA8BO,MAAM,wBAAwB,CAAC;AAAA,EACpC,WAAA;AAAA,EACA;AACF,CAAkC,KAAA;AAChC,EAAa,YAAA,EAAA;AAEb,EAAA,MAAM,QAAQ,iBAAkB,CAAA,WAAA,IAAe,KAAW,CAAA,EAAA,QAAA,IAAY,EAAE,CAAA;AAExE,EAAA,mFAEK,CAAC,KAAA,IAAU,KAAM,CAAA,KAAA,CAAM,WAAW,CAAK,IAAA,KAAA,CAAM,KAAM,CAAA,MAAA,KAAW,oBAC5DA,cAAA,CAAA,aAAA,CAAA,KAAA,EAAA,EAAI,aAAY,EAAA,mBAAA,EAAA,EAAoB,6CAErC,CAEA,mBAAAA,cAAA,CAAA,aAAA;AAAA,IAAC,KAAA;AAAA,IAAA;AAAA,MACC,aAAY,EAAA,2BAAA;AAAA,MACZ,SAAU,EAAA;AAAA,KAAA;AAAA,oBAEVA,cAAA,CAAA,aAAA,CAAC,kBAAe,KAAc,EAAA;AAAA,GAGpC,CAAA;AAEJ;;;;"}
@@ -0,0 +1,7 @@
1
+ import styleInject from '../../node_modules/style-inject/dist/style-inject.es.esm.js';
2
+
3
+ var css_248z = ".bs-tkn-pipeline-visualization-step-list {\n min-width: 10em;\n}\n\n.bs-tkn-pipeline-visualization-step-list__task-name {\n font-weight: var(--pf-v5-global--FontWeight--bold);\n line-height: var(--pf-v5-global--spacer--lg);\n max-height: var(--pf-v5-global--spacer--2xl);\n max-width: 15em;\n margin: 0 auto 10px auto;\n\n display: -webkit-box;\n -webkit-box-orient: vertical;\n -webkit-line-clamp: 2;\n overflow: hidden;\n}\n\n.bs-tkn-pipeline-visualization-step-list__task-type {\n line-height: var(--pf-v5-global--spacer--xs);\n max-height: var(--pf-v5-global--spacer--2xl);\n margin: 0 auto 10px auto;\n}\n\n.bs-tkn-pipeline-visualization-step-list__step {\n display: flex;\n margin-bottom: var(--pf-v5-global--spacer--xs);\n}\n\n.bs-tkn-pipeline-visualization-step-list__step--task-run {\n margin-bottom: var(--pf-v5-global--spacer--sm);\n}\n\n.bs-tkn-pipeline-visualization-step-list__step:last-child {\n margin-bottom: 0;\n}\n\n.bs-tkn-pipeline-visualization-step-list__bullet {\n font-size: 1rem;\n}\n\n.bs-tkn-pipeline-visualization-step-list__icon {\n flex: 0 0 18px;\n}\n\n.bs-tkn-pipeline-visualization-step-list__icon-backdrop {\n fill: var(--pf-v5-global--Color--light-100);\n}\n\n.bs-tkn-pipeline-visualization-step-list__name {\n flex: 1 1 auto;\n overflow: hidden;\n padding-left: var(--pf-v5-global--spacer--sm);\n text-align: left;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n\n.bs-tkn-pipeline-visualization-step-list__name.is-main-focus {\n padding: 0 var(--pf-v5-global--spacer--sm);\n text-align: center;\n}\n\n.bs-tkn-pipeline-visualization-step-list__duration {\n flex: 0 0 auto;\n padding-left: var(--pf-v5-global--spacer--sm);\n text-align: right;\n}\n";
4
+ styleInject(css_248z);
5
+
6
+ export { css_248z as default };
7
+ //# sourceMappingURL=PipelineVisualizationStepList.css.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PipelineVisualizationStepList.css.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;"}
@@ -0,0 +1,39 @@
1
+ import React__default from 'react';
2
+ import classNames from 'classnames';
3
+ import { Status } from '@janus-idp/shared-react';
4
+ import './PipelineVisualizationStepList.css.esm.js';
5
+
6
+ const TooltipColoredStatusIcon = ({
7
+ status
8
+ }) => {
9
+ const icon = /* @__PURE__ */ React__default.createElement(Status, { status, iconOnly: true });
10
+ return icon;
11
+ };
12
+ const PipelineVisualizationStepList = ({
13
+ isSpecOverview,
14
+ taskName,
15
+ steps,
16
+ isFinallyTask,
17
+ hideHeader
18
+ }) => {
19
+ return /* @__PURE__ */ React__default.createElement("div", { className: "bs-tkn-pipeline-visualization-step-list" }, !hideHeader && /* @__PURE__ */ React__default.createElement("div", { className: "bs-tkn-pipeline-visualization-step-list__task-name" }, taskName), isFinallyTask && /* @__PURE__ */ React__default.createElement("div", { className: "bs-tkn-pipeline-visualization-step-list__task-type" }, "Finally task"), steps?.map(({ duration, name, status }) => {
20
+ return /* @__PURE__ */ React__default.createElement(
21
+ "div",
22
+ {
23
+ className: classNames(
24
+ "bs-tkn-pipeline-visualization-step-list__step",
25
+ {
26
+ "bs-tkn-pipeline-visualization-step-list__step--task-run": !isSpecOverview
27
+ }
28
+ ),
29
+ key: name
30
+ },
31
+ !isSpecOverview ? /* @__PURE__ */ React__default.createElement("div", { className: "bs-tkn-pipeline-visualization-step-list__icon" }, /* @__PURE__ */ React__default.createElement(TooltipColoredStatusIcon, { status })) : /* @__PURE__ */ React__default.createElement("span", { className: "bs-tkn-pipeline-visualization-step-list__bullet" }, "\u2022"),
32
+ /* @__PURE__ */ React__default.createElement("div", { className: "bs-tkn-pipeline-visualization-step-list__name" }, name),
33
+ !isSpecOverview && /* @__PURE__ */ React__default.createElement("div", { className: "bs-tkn-pipeline-visualization-step-list__duration" }, duration)
34
+ );
35
+ }));
36
+ };
37
+
38
+ export { PipelineVisualizationStepList };
39
+ //# sourceMappingURL=PipelineVisualizationStepList.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PipelineVisualizationStepList.esm.js","sources":["../../../src/components/pipeline-topology/PipelineVisualizationStepList.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 { RunStatus } from '@patternfly/react-topology';\nimport classNames from 'classnames';\n\nimport { Status } from '@janus-idp/shared-react';\n\nimport { StepStatus } from '../../types/taskRun';\n\nimport './PipelineVisualizationStepList.css';\n\nexport type PipelineVisualizationStepListProps = {\n isSpecOverview: boolean;\n taskName: string;\n steps: StepStatus[];\n isFinallyTask?: boolean;\n hideHeader?: boolean;\n};\n\ntype TooltipColoredStatusIconProps = {\n status: RunStatus;\n};\n\nconst TooltipColoredStatusIcon = ({\n status,\n}: TooltipColoredStatusIconProps) => {\n const icon = <Status status={status} iconOnly />;\n return icon;\n};\n\nexport const PipelineVisualizationStepList = ({\n isSpecOverview,\n taskName,\n steps,\n isFinallyTask,\n hideHeader,\n}: PipelineVisualizationStepListProps) => {\n return (\n <div className=\"bs-tkn-pipeline-visualization-step-list\">\n {!hideHeader && (\n <div className=\"bs-tkn-pipeline-visualization-step-list__task-name\">\n {taskName}\n </div>\n )}\n {isFinallyTask && (\n <div className=\"bs-tkn-pipeline-visualization-step-list__task-type\">\n Finally task\n </div>\n )}\n {steps?.map(({ duration, name, status }) => {\n return (\n <div\n className={classNames(\n 'bs-tkn-pipeline-visualization-step-list__step',\n {\n 'bs-tkn-pipeline-visualization-step-list__step--task-run':\n !isSpecOverview,\n },\n )}\n key={name}\n >\n {!isSpecOverview ? (\n <div className=\"bs-tkn-pipeline-visualization-step-list__icon\">\n <TooltipColoredStatusIcon status={status} />\n </div>\n ) : (\n <span className=\"bs-tkn-pipeline-visualization-step-list__bullet\">\n &bull;\n </span>\n )}\n <div className=\"bs-tkn-pipeline-visualization-step-list__name\">\n {name}\n </div>\n {!isSpecOverview && (\n <div className=\"bs-tkn-pipeline-visualization-step-list__duration\">\n {duration}\n </div>\n )}\n </div>\n );\n })}\n </div>\n );\n};\n"],"names":["React"],"mappings":";;;;;AAsCA,MAAM,2BAA2B,CAAC;AAAA,EAChC;AACF,CAAqC,KAAA;AACnC,EAAA,MAAM,IAAO,mBAAAA,cAAA,CAAA,aAAA,CAAC,MAAO,EAAA,EAAA,MAAA,EAAgB,UAA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J;;;;"}
@@ -0,0 +1,41 @@
1
+ import React__default from 'react';
2
+ import { Progress, EmptyState } from '@backstage/core-components';
3
+ import { isEmpty } from 'lodash';
4
+ import { TektonResourcesContext } from '../../hooks/TektonResourcesContext.esm.js';
5
+ import { getPipelineRun } from '../../utils/pipelineRun-utils.esm.js';
6
+ import { PipelineVisualization } from './PipelineVisualization.esm.js';
7
+ import './PipelineVisualization.css.esm.js';
8
+
9
+ const PipelineVisualizationView = ({
10
+ pipelineRun
11
+ }) => {
12
+ const { loaded, responseError, watchResourcesData } = React__default.useContext(
13
+ TektonResourcesContext
14
+ );
15
+ const pipelineRunResource = React__default.useMemo(
16
+ () => getPipelineRun(watchResourcesData?.pipelineruns?.data ?? [], pipelineRun),
17
+ [watchResourcesData, pipelineRun]
18
+ );
19
+ if (!loaded)
20
+ return /* @__PURE__ */ React__default.createElement("div", { "data-testid": "tekton-progress" }, /* @__PURE__ */ React__default.createElement(Progress, null));
21
+ if (loaded && (responseError || isEmpty(pipelineRunResource))) {
22
+ return /* @__PURE__ */ React__default.createElement(
23
+ EmptyState,
24
+ {
25
+ missing: "data",
26
+ description: "No Pipeline Run to visualize",
27
+ title: ""
28
+ }
29
+ );
30
+ }
31
+ return /* @__PURE__ */ React__default.createElement(
32
+ PipelineVisualization,
33
+ {
34
+ pipelineRun: pipelineRunResource,
35
+ taskRuns: watchResourcesData?.taskruns?.data ?? []
36
+ }
37
+ );
38
+ };
39
+
40
+ export { PipelineVisualizationView };
41
+ //# sourceMappingURL=PipelineVisualizationView.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PipelineVisualizationView.esm.js","sources":["../../../src/components/pipeline-topology/PipelineVisualizationView.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 { EmptyState, Progress } from '@backstage/core-components';\n\nimport { isEmpty } from 'lodash';\n\nimport { TektonResourcesContext } from '../../hooks/TektonResourcesContext';\nimport { getPipelineRun } from '../../utils/pipelineRun-utils';\nimport { PipelineVisualization } from './PipelineVisualization';\n\nimport './PipelineVisualization.css';\n\ntype PipelineVisualizationViewProps = {\n pipelineRun: string;\n};\n\nexport const PipelineVisualizationView = ({\n pipelineRun,\n}: PipelineVisualizationViewProps) => {\n const { loaded, responseError, watchResourcesData } = React.useContext(\n TektonResourcesContext,\n );\n\n const pipelineRunResource = React.useMemo(\n () =>\n getPipelineRun(watchResourcesData?.pipelineruns?.data ?? [], pipelineRun),\n [watchResourcesData, pipelineRun],\n );\n\n if (!loaded)\n return (\n <div data-testid=\"tekton-progress\">\n <Progress />\n </div>\n );\n\n if (loaded && (responseError || isEmpty(pipelineRunResource))) {\n return (\n <EmptyState\n missing=\"data\"\n description=\"No Pipeline Run to visualize\"\n title=\"\"\n />\n );\n }\n\n return (\n <PipelineVisualization\n pipelineRun={pipelineRunResource}\n taskRuns={watchResourcesData?.taskruns?.data ?? []}\n />\n );\n};\n"],"names":["React"],"mappings":";;;;;;;;AA+BO,MAAM,4BAA4B,CAAC;AAAA,EACxC;AACF,CAAsC,KAAA;AACpC,EAAA,MAAM,EAAE,MAAA,EAAQ,aAAe,EAAA,kBAAA,KAAuBA,cAAM,CAAA,UAAA;AAAA,IAC1D;AAAA,GACF;AAEA,EAAA,MAAM,sBAAsBA,cAAM,CAAA,OAAA;AAAA,IAChC,MACE,cAAe,CAAA,kBAAA,EAAoB,cAAc,IAAQ,IAAA,IAAI,WAAW,CAAA;AAAA,IAC1E,CAAC,oBAAoB,WAAW;AAAA,GAClC;AAEA,EAAA,IAAI,CAAC,MAAA;AACH,IAAA,oDACG,KAAI,EAAA,EAAA,aAAA,EAAY,iBACf,EAAA,kBAAAA,cAAA,CAAA,aAAA,CAAC,cAAS,CACZ,CAAA;AAGJ,EAAA,IAAI,MAAW,KAAA,aAAA,IAAiB,OAAQ,CAAA,mBAAmB,CAAI,CAAA,EAAA;AAC7D,IACE,uBAAAA,cAAA,CAAA,aAAA;AAAA,MAAC,UAAA;AAAA,MAAA;AAAA,QACC,OAAQ,EAAA,MAAA;AAAA,QACR,WAAY,EAAA,8BAAA;AAAA,QACZ,KAAM,EAAA;AAAA;AAAA,KACR;AAAA;AAIJ,EACE,uBAAAA,cAAA,CAAA,aAAA;AAAA,IAAC,qBAAA;AAAA,IAAA;AAAA,MACC,WAAa,EAAA,mBAAA;AAAA,MACb,QAAU,EAAA,kBAAA,EAAoB,QAAU,EAAA,IAAA,IAAQ;AAAC;AAAA,GACnD;AAEJ;;;;"}
@@ -0,0 +1,16 @@
1
+ import React__default from 'react';
2
+ import { TaskEdge } from '@patternfly/react-topology';
3
+ import { observer } from 'mobx-react';
4
+ import { GROUPED_PIPELINE_NODE_SEPARATION_HORIZONTAL } from '../../consts/pipeline-topology-const.esm.js';
5
+
6
+ const TaskGroupEdge = (props) => /* @__PURE__ */ React__default.createElement(
7
+ TaskEdge,
8
+ {
9
+ nodeSeparation: GROUPED_PIPELINE_NODE_SEPARATION_HORIZONTAL,
10
+ ...props
11
+ }
12
+ );
13
+ var TaskGroupEdge$1 = observer(TaskGroupEdge);
14
+
15
+ export { TaskGroupEdge$1 as default };
16
+ //# sourceMappingURL=TaskGroupEdge.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TaskGroupEdge.esm.js","sources":["../../../src/components/pipeline-topology/TaskGroupEdge.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 { Edge, TaskEdge } from '@patternfly/react-topology';\n// eslint-disable-next-line @backstage/no-undeclared-imports\nimport { observer } from 'mobx-react';\n\nimport { GROUPED_PIPELINE_NODE_SEPARATION_HORIZONTAL } from '../../consts/pipeline-topology-const';\n\ninterface TaskEdgeProps {\n element: Edge;\n}\n\nconst TaskGroupEdge = (props: TaskEdgeProps) => (\n <TaskEdge\n nodeSeparation={GROUPED_PIPELINE_NODE_SEPARATION_HORIZONTAL}\n {...props}\n />\n);\n\nexport default observer(TaskGroupEdge);\n"],"names":["React"],"mappings":";;;;;AA2BA,MAAM,aAAA,GAAgB,CAAC,KACrB,qBAAAA,cAAA,CAAA,aAAA;AAAA,EAAC,QAAA;AAAA,EAAA;AAAA,IACC,cAAgB,EAAA,2CAAA;AAAA,IACf,GAAG;AAAA;AACN,CAAA;AAGF,sBAAe,SAAS,aAAa,CAAA;;;;"}
@@ -0,0 +1,119 @@
1
+ class DAG {
2
+ names;
3
+ vertices;
4
+ constructor() {
5
+ this.names = [];
6
+ this.vertices = /* @__PURE__ */ new Map();
7
+ }
8
+ visit(vertex, fn, visited, path) {
9
+ const { name } = vertex;
10
+ const vertices = vertex.dependancy;
11
+ const names = vertex.dependancyNames;
12
+ const len = names.length;
13
+ if (!visited) {
14
+ visited = /* @__PURE__ */ new Map();
15
+ }
16
+ if (!path) {
17
+ path = [];
18
+ }
19
+ if (visited.has(name)) {
20
+ return;
21
+ }
22
+ path.push(name);
23
+ visited.set(name, true);
24
+ for (let i = 0; i < len; i++) {
25
+ this.visit(vertices[names[i]], fn, visited, path);
26
+ }
27
+ fn(vertex, path);
28
+ path.pop();
29
+ }
30
+ map(name, data) {
31
+ const vertex = this.addVertex(name);
32
+ vertex.data = data;
33
+ }
34
+ addVertex(name) {
35
+ if (!name) {
36
+ return null;
37
+ }
38
+ if (this.vertices.has(name)) {
39
+ return this.vertices.get(name);
40
+ }
41
+ const vertex = {
42
+ name,
43
+ level: 0,
44
+ dependancy: {},
45
+ dependancyNames: [],
46
+ hasOutgoing: false,
47
+ data: {}
48
+ };
49
+ this.vertices.set(name, vertex);
50
+ this.names.push(name);
51
+ return vertex;
52
+ }
53
+ addEdge(source, target) {
54
+ if (!source || !target || source === target) {
55
+ return;
56
+ }
57
+ const fromNode = this.addVertex(source);
58
+ const toNode = this.addVertex(target);
59
+ if (toNode.dependancy[source]) {
60
+ return;
61
+ }
62
+ const printPath = (path, tar) => {
63
+ const reversedPath = [...path].reverse();
64
+ return `${reversedPath.join(" --> ")} --> ${tar}`;
65
+ };
66
+ const checkCycle = (vertex, path) => {
67
+ if (vertex.name === target) {
68
+ throw new Error(`cycle detected: ${printPath(path, target)}`);
69
+ } else {
70
+ vertex.level = path.length;
71
+ }
72
+ };
73
+ this.visit(fromNode, checkCycle);
74
+ fromNode.hasOutgoing = true;
75
+ toNode.dependancy[source] = fromNode;
76
+ toNode.dependancyNames.push(source);
77
+ }
78
+ addEdges(name, data, before, after) {
79
+ this.map(name, data);
80
+ if (before) {
81
+ if (typeof before === "string") {
82
+ this.addEdge(name, before);
83
+ } else {
84
+ before.forEach((b) => this.addEdge(name, b));
85
+ }
86
+ }
87
+ if (after) {
88
+ if (typeof after === "string") {
89
+ this.addEdge(after, name);
90
+ } else {
91
+ after.forEach((a) => this.addEdge(a, name));
92
+ }
93
+ }
94
+ }
95
+ topologicalSort(fn) {
96
+ const visited = /* @__PURE__ */ new Map();
97
+ const { vertices } = this;
98
+ const { names } = this;
99
+ const len = names.length;
100
+ for (let i = 0; i < len; i++) {
101
+ const vertex = vertices.get(names[i]);
102
+ if (!vertex.hasOutgoing) {
103
+ this.visit(vertex, fn, visited);
104
+ }
105
+ }
106
+ }
107
+ printGraph() {
108
+ const orderedNodes = [];
109
+ this.topologicalSort((v, t) => {
110
+ v.data.stage = this.names.length - t.length;
111
+ orderedNodes.push(v.name);
112
+ });
113
+ console.log(orderedNodes.join(" --> "));
114
+ return orderedNodes.join(" --> ");
115
+ }
116
+ }
117
+
118
+ export { DAG };
119
+ //# sourceMappingURL=dag.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dag.esm.js","sources":["../../../src/components/pipeline-topology/dag.ts"],"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 */\nexport interface Vertex {\n name: string;\n level: number;\n dependancy: { [key: string]: any };\n dependancyNames: string[];\n hasOutgoing: boolean;\n data: any;\n}\n\ntype Vertices = Map<string, Vertex>;\n\nexport class DAG {\n names: string[];\n\n vertices: Vertices;\n\n constructor() {\n this.names = [];\n this.vertices = new Map();\n }\n\n private visit(\n vertex: Vertex,\n fn: (v: Vertex, path: string[]) => void,\n visited?: any,\n path?: string[],\n ) {\n const { name } = vertex;\n const vertices = vertex.dependancy;\n const names = vertex.dependancyNames;\n const len = names.length;\n\n if (!visited) {\n // eslint-disable-next-line no-param-reassign\n visited = new Map();\n }\n if (!path) {\n // eslint-disable-next-line no-param-reassign\n path = [];\n }\n if (visited.has(name)) {\n return;\n }\n path.push(name);\n visited.set(name, true);\n for (let i = 0; i < len; i++) {\n this.visit(vertices[names[i]], fn, visited, path);\n }\n fn(vertex, path);\n path.pop();\n }\n\n private map(name: string, data: any) {\n const vertex = this.addVertex(name) as Vertex;\n vertex.data = data;\n }\n\n addVertex(name: string) {\n if (!name) {\n return null;\n }\n if (this.vertices.has(name)) {\n return this.vertices.get(name);\n }\n\n const vertex: Vertex = {\n name,\n level: 0,\n dependancy: {},\n dependancyNames: [],\n hasOutgoing: false,\n data: {},\n };\n this.vertices.set(name, vertex);\n this.names.push(name);\n return vertex;\n }\n\n addEdge(source: string, target: string): void {\n if (!source || !target || source === target) {\n return;\n }\n const fromNode = this.addVertex(source) as Vertex;\n const toNode = this.addVertex(target) as Vertex;\n\n if (toNode.dependancy[source]) {\n return;\n }\n\n const printPath = (path: string[], tar: string): string => {\n const reversedPath = [...path].reverse();\n return `${reversedPath.join(' --> ')} --> ${tar}`;\n };\n\n const checkCycle = (vertex: Vertex, path: string[]) => {\n if (vertex.name === target) {\n throw new Error(`cycle detected: ${printPath(path, target)}`);\n } else {\n vertex.level = path.length;\n }\n };\n this.visit(fromNode, checkCycle);\n fromNode.hasOutgoing = true;\n toNode.dependancy[source] = fromNode;\n toNode.dependancyNames.push(source);\n }\n\n addEdges(\n name: string,\n data: any,\n before: string | string[],\n after: string | string[],\n ): void {\n this.map(name, data);\n\n if (before) {\n if (typeof before === 'string') {\n this.addEdge(name, before);\n } else {\n before.forEach(b => this.addEdge(name, b));\n }\n }\n if (after) {\n if (typeof after === 'string') {\n this.addEdge(after, name);\n } else {\n after.forEach(a => this.addEdge(a, name));\n }\n }\n }\n\n topologicalSort(fn: any): void {\n const visited = new Map();\n const { vertices } = this;\n const { names } = this;\n const len = names.length;\n\n for (let i = 0; i < len; i++) {\n const vertex = vertices.get(names[i]) as Vertex;\n if (!vertex.hasOutgoing) {\n this.visit(vertex, fn, visited);\n }\n }\n }\n\n printGraph() {\n const orderedNodes: string[] = [];\n this.topologicalSort((v: Vertex, t: string) => {\n v.data.stage = this.names.length - t.length;\n orderedNodes.push(v.name);\n });\n // eslint-disable-next-line no-console\n console.log(orderedNodes.join(' --> '));\n return orderedNodes.join(' --> ');\n }\n}\n"],"names":[],"mappings":"AA0BO,MAAM,GAAI,CAAA;AAAA,EACf,KAAA;AAAA,EAEA,QAAA;AAAA,EAEA,WAAc,GAAA;AACZ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A,EAAK,CAAK,EAAA,EAAA;AAC5B,MAAA,MAAM,MAAS,GAAA,QAAA,CAAS,GAAI,CAAA,KAAA,CAAM,CAAC,CAAC,CAAA;AACpC,MAAI,IAAA,CAAC,OAAO,WAAa,EAAA;AACvB,QAAK,IAAA,CAAA,KAAA,CAAM,MAAQ,EAAA,EAAA,EAAI,OAAO,CAAA;AAAA;AAChC;AACF;AACF,EAEA,UAAa,GAAA;AACX,IAAA,MAAM,eAAyB,EAAC;AAChC,IAAK,IAAA,CAAA,eAAA,CAAgB,CAAC,CAAA,EAAW,CAAc,KAAA;AAC7C,MAAA,CAAA,CAAE,IAAK,CAAA,KAAA,GAAQ,IAAK,CAAA,KAAA,CAAM,SAAS,CAAE,CAAA,MAAA;AACrC,MAAa,YAAA,CAAA,IAAA,CAAK,EAAE,IAAI,CAAA;AAAA,KACzB,CAAA;AAED,IAAA,OAAA,CAAQ,GAAI,CAAA,YAAA,CAAa,IAAK,CAAA,OAAO,CAAC,CAAA;AACtC,IAAO,OAAA,YAAA,CAAa,KAAK,OAAO,CAAA;AAAA;AAEpC;;;;"}
@@ -0,0 +1,60 @@
1
+ import { PipelineDagreLayout, DagreLayout, ModelKind, withPanZoom, GraphComponent, TaskEdge, SpacerNode, DefaultTaskGroup } from '@patternfly/react-topology';
2
+ import { PipelineLayout, NodeType } from '../../consts/pipeline-topology-const.esm.js';
3
+ import { getLayoutData } from '../../utils/pipeline-topology-utils.esm.js';
4
+ import PipelineTaskNode from './PipelineTaskNode.esm.js';
5
+ import TaskGroupEdge from './TaskGroupEdge.esm.js';
6
+
7
+ const GROUPED_EDGE_TYPE = "GROUPED_EDGE";
8
+ const layoutFactory = (type, graph) => {
9
+ switch (type) {
10
+ case PipelineLayout.DAGRE_BUILDER:
11
+ case PipelineLayout.DAGRE_BUILDER_SPACED:
12
+ return new DagreLayout(graph, {
13
+ // Hack to get around undesirable defaults
14
+ linkDistance: 0,
15
+ nodeDistance: 0,
16
+ groupDistance: 0,
17
+ collideDistance: 0,
18
+ simulationSpeed: 0,
19
+ chargeStrength: 0,
20
+ allowDrag: false,
21
+ layoutOnDrag: false,
22
+ ...getLayoutData(type)
23
+ });
24
+ case PipelineLayout.DAGRE_VIEWER:
25
+ return new PipelineDagreLayout(graph, { nodesep: 25 });
26
+ default:
27
+ return void 0;
28
+ }
29
+ };
30
+ const pipelineComponentFactory = (kind, type) => {
31
+ if (kind === ModelKind.graph) {
32
+ return withPanZoom()(GraphComponent);
33
+ }
34
+ if (kind === ModelKind.edge) {
35
+ return TaskEdge;
36
+ }
37
+ if (kind === ModelKind.node) {
38
+ switch (type) {
39
+ case NodeType.TASK_NODE:
40
+ case NodeType.FINALLY_NODE:
41
+ return PipelineTaskNode;
42
+ case "task-group":
43
+ case NodeType.FINALLY_GROUP:
44
+ return DefaultTaskGroup;
45
+ case NodeType.SPACER_NODE:
46
+ return SpacerNode;
47
+ case "finally-spacer-edge":
48
+ case NodeType.EDGE:
49
+ return TaskEdge;
50
+ case GROUPED_EDGE_TYPE:
51
+ return TaskGroupEdge;
52
+ default:
53
+ return void 0;
54
+ }
55
+ }
56
+ return void 0;
57
+ };
58
+
59
+ export { pipelineComponentFactory as default, layoutFactory };
60
+ //# sourceMappingURL=pipelineComponentFactory.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pipelineComponentFactory.esm.js","sources":["../../../src/components/pipeline-topology/pipelineComponentFactory.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 ComponentFactory,\n DagreLayout,\n DefaultTaskGroup,\n Graph,\n GraphComponent,\n GraphElement,\n LayoutFactory,\n ModelKind,\n PipelineDagreLayout,\n SpacerNode,\n TaskEdge,\n withPanZoom,\n} from '@patternfly/react-topology';\n\nimport { NodeType, PipelineLayout } from '../../consts/pipeline-topology-const';\nimport { getLayoutData } from '../../utils/pipeline-topology-utils';\nimport PipelineTaskNode from './PipelineTaskNode';\nimport TaskGroupEdge from './TaskGroupEdge';\n\nconst GROUPED_EDGE_TYPE = 'GROUPED_EDGE';\n\nexport const layoutFactory: LayoutFactory = (type: string, graph: Graph) => {\n switch (type) {\n case PipelineLayout.DAGRE_BUILDER:\n case PipelineLayout.DAGRE_BUILDER_SPACED:\n return new DagreLayout(graph, {\n // Hack to get around undesirable defaults\n linkDistance: 0,\n nodeDistance: 0,\n groupDistance: 0,\n collideDistance: 0,\n simulationSpeed: 0,\n chargeStrength: 0,\n allowDrag: false,\n layoutOnDrag: false,\n ...getLayoutData(type),\n });\n case PipelineLayout.DAGRE_VIEWER:\n return new PipelineDagreLayout(graph, { nodesep: 25 });\n default:\n return undefined;\n }\n};\n\nconst pipelineComponentFactory: ComponentFactory = (\n kind: ModelKind,\n type: string,\n): React.ComponentType<{ element: GraphElement }> | undefined => {\n if (kind === ModelKind.graph) {\n return withPanZoom()(GraphComponent) as React.ComponentType<{\n element: GraphElement;\n }>;\n }\n if (kind === ModelKind.edge) {\n return TaskEdge as React.ComponentType<{ element: GraphElement }>;\n }\n if (kind === ModelKind.node) {\n switch (type) {\n case NodeType.TASK_NODE:\n case NodeType.FINALLY_NODE:\n return PipelineTaskNode as React.ComponentType<any>;\n case 'task-group':\n case NodeType.FINALLY_GROUP:\n return DefaultTaskGroup as React.ComponentType<{\n element: GraphElement;\n }>;\n case NodeType.SPACER_NODE:\n return SpacerNode as React.ComponentType<{ element: GraphElement }>;\n case 'finally-spacer-edge':\n case NodeType.EDGE:\n return TaskEdge as React.ComponentType<{ element: GraphElement }>;\n case GROUPED_EDGE_TYPE:\n return TaskGroupEdge as React.ComponentType<{ element: GraphElement }>;\n default:\n return undefined;\n }\n }\n return undefined;\n};\n\nexport default pipelineComponentFactory;\n"],"names":[],"mappings":";;;;;;AAqCA,MAAM,iBAAoB,GAAA,cAAA;AAEb,MAAA,aAAA,GAA+B,CAAC,IAAA,EAAc,KAAiB,KAAA;AAC1E,EAAA,QAAQ,IAAM;AAAA,IACZ,KAAK,cAAe,CAAA,aAAA;AAAA,IACpB,KAAK,cAAe,CAAA,oBAAA;AAClB,MAAO,OAAA,IAAI,YAAY,KAAO,EAAA;AAAA;AAAA,QAE5B,YAAc,EAAA,CAAA;AAAA,QACd,YAAc,EAAA,CAAA;AAAA,QACd,aAAe,EAAA,CAAA;AAAA,QACf,eAAiB,EAAA,CAAA;AAAA,QACjB,eAAiB,EAAA,CAAA;AAAA,QACjB,cAAgB,EAAA,CAAA;AAAA,QAChB,SAAW,EAAA,KAAA;AAAA,QACX,YAAc,EAAA,KAAA;AAAA,QACd,GAAG,cAAc,IAAI;AAAA,OACtB,CAAA;AAAA,IACH,KAAK,cAAe,CAAA,YAAA;AAClB,MAAA,OAAO,IAAI,mBAAoB,CAAA,KAAA,EAAO,EAAE,OAAA,EAAS,IAAI,CAAA;AAAA,IACvD;AACE,MAAO,OAAA,KAAA,CAAA;AAAA;AAEb;AAEM,MAAA,wBAAA,GAA6C,CACjD,IAAA,EACA,IAC+D,KAAA;AAC/D,EAAI,IAAA,IAAA,KAAS,UAAU,KAAO,EAAA;AAC5B,IAAO,OAAA,WAAA,GAAc,cAAc,CAAA;AAAA;AAIrC,EAAI,IAAA,IAAA,KAAS,UAAU,IAAM,EAAA;AAC3B,IAAO,OAAA,QAAA;AAAA;AAET,EAAI,IAAA,IAAA,KAAS,UAAU,IAAM,EAAA;AAC3B,IAAA,QAAQ,IAAM;AAAA,MACZ,KAAK,QAAS,CAAA,SAAA;AAAA,MACd,KAAK,QAAS,CAAA,YAAA;AACZ,QAAO,OAAA,gBAAA;AAAA,MACT,KAAK,YAAA;AAAA,MACL,KAAK,QAAS,CAAA,aAAA;AACZ,QAAO,OAAA,gBAAA;AAAA,MAGT,KAAK,QAAS,CAAA,WAAA;AACZ,QAAO,OAAA,UAAA;AAAA,MACT,KAAK,qBAAA;AAAA,MACL,KAAK,QAAS,CAAA,IAAA;AACZ,QAAO,OAAA,QAAA;AAAA,MACT,KAAK,iBAAA;AACH,QAAO,OAAA,aAAA;AAAA,MACT;AACE,QAAO,OAAA,KAAA,CAAA;AAAA;AACX;AAEF,EAAO,OAAA,KAAA,CAAA;AACT;;;;"}
@@ -0,0 +1,66 @@
1
+ const NODE_SEPARATION_HORIZONTAL = 25;
2
+ const NODE_SEPARATION_VERTICAL = 20;
3
+ const DROP_SHADOW_SPACING = 5;
4
+ const BUILDER_NODE_ADD_RADIUS = 9;
5
+ const NODE_WIDTH = 120;
6
+ const NODE_HEIGHT = 30;
7
+ const WHEN_EXPRESSION_SPACING = 25;
8
+ const DEFAULT_NODE_HEIGHT = 32;
9
+ const NODE_PADDING = 12;
10
+ const DEFAULT_NODE_ICON_WIDTH = 30;
11
+ const DEFAULT_BADGE_WIDTH = 40;
12
+ const DEFAULT_FINALLLY_GROUP_PADDING = 35;
13
+ const TOOLBAR_HEIGHT = 40;
14
+ const GRAPH_MIN_WIDTH = 300;
15
+ var NodeType = /* @__PURE__ */ ((NodeType2) => {
16
+ NodeType2["TASK_NODE"] = "task";
17
+ NodeType2["SPACER_NODE"] = "spacer";
18
+ NodeType2["LOADING_NODE"] = "loading";
19
+ NodeType2["TASK_LIST_NODE"] = "task-list";
20
+ NodeType2["BUILDER_NODE"] = "builder";
21
+ NodeType2["INVALID_TASK_LIST_NODE"] = "invalid-task-list";
22
+ NodeType2["FINALLY_NODE"] = "finally-node";
23
+ NodeType2["BUILDER_FINALLY_NODE"] = "builder-finally-node";
24
+ NodeType2["FINALLY_GROUP"] = "finally-group";
25
+ NodeType2["EDGE"] = "edge";
26
+ return NodeType2;
27
+ })(NodeType || {});
28
+ var PipelineLayout = /* @__PURE__ */ ((PipelineLayout2) => {
29
+ PipelineLayout2["DAGRE_BUILDER"] = "dagre-builder";
30
+ PipelineLayout2["DAGRE_BUILDER_SPACED"] = "dagre-builder-spaced";
31
+ PipelineLayout2["DAGRE_VIEWER"] = "dagre-viewer";
32
+ PipelineLayout2["DAGRE_VIEWER_SPACED"] = "dagre-viewer-spaced";
33
+ return PipelineLayout2;
34
+ })(PipelineLayout || {});
35
+ const DAGRE_SHARED_PROPS = {
36
+ nodesep: NODE_SEPARATION_VERTICAL,
37
+ ranksep: NODE_SEPARATION_HORIZONTAL,
38
+ edgesep: 50,
39
+ ranker: "longest-path",
40
+ rankdir: "LR",
41
+ marginx: 20,
42
+ marginy: 20
43
+ };
44
+ const DAGRE_VIEWER_PROPS = {
45
+ ...DAGRE_SHARED_PROPS
46
+ };
47
+ const DAGRE_VIEWER_SPACED_PROPS = {
48
+ ...DAGRE_VIEWER_PROPS,
49
+ ranksep: NODE_SEPARATION_HORIZONTAL + WHEN_EXPRESSION_SPACING
50
+ };
51
+ const DAGRE_BUILDER_PROPS = {
52
+ ...DAGRE_SHARED_PROPS,
53
+ ranksep: NODE_SEPARATION_HORIZONTAL + BUILDER_NODE_ADD_RADIUS * 2,
54
+ nodesep: NODE_SEPARATION_VERTICAL + BUILDER_NODE_ADD_RADIUS,
55
+ marginx: DAGRE_SHARED_PROPS.marginx,
56
+ marginy: DAGRE_SHARED_PROPS.marginy
57
+ };
58
+ const DAGRE_BUILDER_SPACED_PROPS = {
59
+ ...DAGRE_BUILDER_PROPS,
60
+ ranksep: NODE_SEPARATION_HORIZONTAL + WHEN_EXPRESSION_SPACING + BUILDER_NODE_ADD_RADIUS * 2
61
+ };
62
+ const GROUPED_PIPELINE_NODE_SEPARATION_HORIZONTAL = 200;
63
+ const REGEX_EXTRACT_DEPS = /(?:\$\(tasks\.)([a-z0-9_-]+)(?:.results)(?:[.^\w]+\))/g;
64
+
65
+ export { BUILDER_NODE_ADD_RADIUS, DAGRE_BUILDER_PROPS, DAGRE_BUILDER_SPACED_PROPS, DAGRE_VIEWER_PROPS, DAGRE_VIEWER_SPACED_PROPS, DEFAULT_BADGE_WIDTH, DEFAULT_FINALLLY_GROUP_PADDING, DEFAULT_NODE_HEIGHT, DEFAULT_NODE_ICON_WIDTH, DROP_SHADOW_SPACING, GRAPH_MIN_WIDTH, GROUPED_PIPELINE_NODE_SEPARATION_HORIZONTAL, NODE_HEIGHT, NODE_PADDING, NODE_SEPARATION_HORIZONTAL, NODE_SEPARATION_VERTICAL, NODE_WIDTH, NodeType, PipelineLayout, REGEX_EXTRACT_DEPS, TOOLBAR_HEIGHT, WHEN_EXPRESSION_SPACING };
66
+ //# sourceMappingURL=pipeline-topology-const.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pipeline-topology-const.esm.js","sources":["../../src/consts/pipeline-topology-const.ts"],"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 * as dagre from 'dagre';\n\nexport const NODE_SEPARATION_HORIZONTAL = 25;\nexport const NODE_SEPARATION_VERTICAL = 20;\nexport const DROP_SHADOW_SPACING = 5;\nexport const BUILDER_NODE_ADD_RADIUS = 9;\nexport const BUILDER_NODE_DECORATOR_RADIUS = 9;\nexport const BUILDER_NODE_ADD_PADDING = 4;\n\nexport const NODE_WIDTH = 120;\nexport const NODE_HEIGHT = 30;\nexport const FINALLY_NODE_PADDING = 30;\nexport const FINALLY_NODE_VERTICAL_SPACING = 20;\n\nexport const FINALLY_ADD_LINK_TEXT_HEIGHT = 10;\nexport const FINALLY_ADD_LINK_SIZE = 15;\nexport const WHEN_EXPRESSSION_DIAMOND_SIZE = 10;\nexport const WHEN_EXPRESSION_SPACING = 25;\n\nexport const DEFAULT_NODE_HEIGHT = 32;\nexport const NODE_PADDING = 12;\nexport const DEFAULT_NODE_ICON_WIDTH = 30;\nexport const DEFAULT_BADGE_WIDTH = 40;\nexport const DEFAULT_FINALLLY_GROUP_PADDING = 35;\nexport const TOOLBAR_HEIGHT = 40;\nexport const GRAPH_MIN_WIDTH = 300;\nexport const GRAPH_MAX_HEIGHT_PERCENT = 45;\n\nexport enum NodeType {\n TASK_NODE = 'task',\n SPACER_NODE = 'spacer',\n LOADING_NODE = 'loading',\n TASK_LIST_NODE = 'task-list',\n BUILDER_NODE = 'builder',\n INVALID_TASK_LIST_NODE = 'invalid-task-list',\n FINALLY_NODE = 'finally-node',\n BUILDER_FINALLY_NODE = 'builder-finally-node',\n FINALLY_GROUP = 'finally-group',\n EDGE = 'edge',\n}\nexport enum DrawDesign {\n INTEGRAL_SHAPE = 'integral-shape',\n STRAIGHT = 'line',\n}\nexport enum PipelineLayout {\n DAGRE_BUILDER = 'dagre-builder',\n DAGRE_BUILDER_SPACED = 'dagre-builder-spaced',\n DAGRE_VIEWER = 'dagre-viewer',\n DAGRE_VIEWER_SPACED = 'dagre-viewer-spaced',\n}\n\nexport enum AddNodeDirection {\n /**\n * Rules today:\n * - the `relatedTask` is pointing at ONLY us\n * - we inherit all that `relatedTask` is pointing at\n */\n BEFORE = 'in-run-after',\n\n /**\n * Rules today:\n * - the `relatedTask` must be our ONLY runAfter\n * - we are added to all that is pointing at `relatedTask`\n */\n AFTER = 'has-run-after',\n\n /**\n * Rules today:\n * - we inherit all that `relatedTask` is pointing at\n * - we are added to all that is pointing at `relatedTask`\n */\n PARALLEL = 'shared-parallel',\n}\n\nconst DAGRE_SHARED_PROPS: dagre.GraphLabel = {\n nodesep: NODE_SEPARATION_VERTICAL,\n ranksep: NODE_SEPARATION_HORIZONTAL,\n edgesep: 50,\n ranker: 'longest-path',\n rankdir: 'LR',\n marginx: 20,\n marginy: 20,\n};\nexport const DAGRE_VIEWER_PROPS: dagre.GraphLabel = {\n ...DAGRE_SHARED_PROPS,\n};\nexport const DAGRE_VIEWER_SPACED_PROPS: dagre.GraphLabel = {\n ...DAGRE_VIEWER_PROPS,\n ranksep: NODE_SEPARATION_HORIZONTAL + WHEN_EXPRESSION_SPACING,\n};\nexport const DAGRE_BUILDER_PROPS: dagre.GraphLabel = {\n ...DAGRE_SHARED_PROPS,\n ranksep: NODE_SEPARATION_HORIZONTAL + BUILDER_NODE_ADD_RADIUS * 2,\n nodesep: NODE_SEPARATION_VERTICAL + BUILDER_NODE_ADD_RADIUS,\n marginx: DAGRE_SHARED_PROPS.marginx ?? 0 + BUILDER_NODE_ADD_RADIUS * 2,\n marginy: DAGRE_SHARED_PROPS.marginy ?? 0 + BUILDER_NODE_ADD_RADIUS * 2,\n};\n\nexport const DAGRE_BUILDER_SPACED_PROPS: dagre.GraphLabel = {\n ...DAGRE_BUILDER_PROPS,\n ranksep:\n NODE_SEPARATION_HORIZONTAL +\n WHEN_EXPRESSION_SPACING +\n BUILDER_NODE_ADD_RADIUS * 2,\n};\n\nexport const GROUPED_PIPELINE_NODE_SEPARATION_HORIZONTAL = 200;\n\nexport const REGEX_EXTRACT_DEPS =\n /(?:\\$\\(tasks\\.)([a-z0-9_-]+)(?:.results)(?:[.^\\w]+\\))/g;\n"],"names":["NodeType","PipelineLayout"],"mappings":"AAiBO,MAAM,0BAA6B,GAAA;AACnC,MAAM,wBAA2B,GAAA;AACjC,MAAM,mBAAsB,GAAA;AAC5B,MAAM,uBAA0B,GAAA;AAIhC,MAAM,UAAa,GAAA;AACnB,MAAM,WAAc,GAAA;AAOpB,MAAM,uBAA0B,GAAA;AAEhC,MAAM,mBAAsB,GAAA;AAC5B,MAAM,YAAe,GAAA;AACrB,MAAM,uBAA0B,GAAA;AAChC,MAAM,mBAAsB,GAAA;AAC5B,MAAM,8BAAiC,GAAA;AACvC,MAAM,cAAiB,GAAA;AACvB,M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AAM,mBAAwC,GAAA;AAAA,EACnD,GAAG,kBAAA;AAAA,EACH,OAAA,EAAS,6BAA6B,uBAA0B,GAAA,CAAA;AAAA,EAChE,SAAS,wBAA2B,GAAA,uBAAA;AAAA,EACpC,OAAS,EAAA,kBAAA,CAAmB,OAAyC;AAAA,EACrE,OAAS,EAAA,kBAAA,CAAmB;AAC9B;AAEO,MAAM,0BAA+C,GAAA;AAAA,EAC1D,GAAG,mBAAA;AAAA,EACH,OAAA,EACE,0BACA,GAAA,uBAAA,GACA,uBAA0B,GAAA;AAC9B;AAEO,MAAM,2CAA8C,GAAA;AAEpD,MAAM,kBACX,GAAA;;;;"}
@@ -0,0 +1,7 @@
1
+ const TEKTON_PIPELINE_TASK = "tekton.dev/pipelineTask";
2
+ const TEKTON_PIPELINE_RUN = "tekton.dev/pipelineRun";
3
+ const TEKTON_PIPELINE_TASKRUN = "tekton.dev/taskRun";
4
+ const TEKTON_SIGNED_ANNOTATION = "chains.tekton.dev/signed";
5
+
6
+ export { TEKTON_PIPELINE_RUN, TEKTON_PIPELINE_TASK, TEKTON_PIPELINE_TASKRUN, TEKTON_SIGNED_ANNOTATION };
7
+ //# sourceMappingURL=tekton-const.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tekton-const.esm.js","sources":["../../src/consts/tekton-const.ts"],"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 */\nexport const TEKTON_PIPELINE_TASK = 'tekton.dev/pipelineTask';\nexport const TEKTON_PIPELINE_RUN = 'tekton.dev/pipelineRun';\nexport const TEKTON_PIPELINE_TASKRUN = 'tekton.dev/taskRun';\nexport const TEKTON_SIGNED_ANNOTATION = 'chains.tekton.dev/signed';\n"],"names":[],"mappings":"AAeO,MAAM,oBAAuB,GAAA;AAC7B,MAAM,mBAAsB,GAAA;AAC5B,MAAM,uBAA0B,GAAA;AAChC,MAAM,wBAA2B,GAAA;;;;"}
@@ -0,0 +1,16 @@
1
+ import React__default from 'react';
2
+ import { ComputedStatus } from '@janus-idp/shared-react';
3
+
4
+ const TektonResourcesContext = React__default.createContext({
5
+ clusters: [],
6
+ selectedStatus: ComputedStatus.All,
7
+ setSelectedCluster: () => {
8
+ },
9
+ setSelectedStatus: () => {
10
+ },
11
+ setIsExpanded: () => {
12
+ }
13
+ });
14
+
15
+ export { TektonResourcesContext };
16
+ //# sourceMappingURL=TektonResourcesContext.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TektonResourcesContext.esm.js","sources":["../../src/hooks/TektonResourcesContext.ts"],"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 { ComputedStatus } from '@janus-idp/shared-react';\n\nimport { TektonResourcesContextData } from '../types/types';\n\nexport const TektonResourcesContext =\n React.createContext<TektonResourcesContextData>({\n clusters: [],\n selectedStatus: ComputedStatus.All,\n setSelectedCluster: () => {},\n setSelectedStatus: () => {},\n setIsExpanded: () => {},\n });\n"],"names":["React"],"mappings":";;;AAqBa,MAAA,sBAAA,GACXA,eAAM,aAA0C,CAAA;AAAA,EAC9C,UAAU,EAAC;AAAA,EACX,gBAAgB,cAAe,CAAA,GAAA;AAAA,EAC/B,oBAAoB,MAAM;AAAA,GAAC;AAAA,EAC3B,mBAAmB,MAAM;AAAA,GAAC;AAAA,EAC1B,eAAe,MAAM;AAAA;AACvB,CAAC;;;;"}
@@ -0,0 +1,35 @@
1
+ import { useState, useEffect, useMemo } from 'react';
2
+ import { useDeepCompareMemoize } from '@janus-idp/shared-react';
3
+ import { getTektonResources } from '../utils/tekton-utils.esm.js';
4
+
5
+ const useAllWatchResources = (k8sObjectsResponse, cluster, watchedResource = []) => {
6
+ const { kubernetesObjects, loading, error } = k8sObjectsResponse;
7
+ const [resources, setResources] = useState({});
8
+ useEffect(() => {
9
+ let isMounted = true;
10
+ if (isMounted && !loading && kubernetesObjects && !error) {
11
+ const tektonResources = getTektonResources(
12
+ cluster,
13
+ kubernetesObjects
14
+ );
15
+ if (tektonResources) {
16
+ setResources(tektonResources);
17
+ }
18
+ }
19
+ return () => {
20
+ isMounted = false;
21
+ };
22
+ }, [loading, kubernetesObjects, error, cluster]);
23
+ const watchResourcesData = useMemo(() => {
24
+ return watchedResource.reduce((acc, resKind) => {
25
+ if (resources[resKind]) {
26
+ acc[resKind] = resources[resKind];
27
+ }
28
+ return acc;
29
+ }, {});
30
+ }, [watchedResource, resources]);
31
+ return useDeepCompareMemoize(watchResourcesData);
32
+ };
33
+
34
+ export { useAllWatchResources };
35
+ //# sourceMappingURL=useAllWatchResources.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useAllWatchResources.esm.js","sources":["../../src/hooks/useAllWatchResources.ts"],"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 { useEffect, useMemo, useState } from 'react';\n\nimport { KubernetesObjects } from '@backstage/plugin-kubernetes-react';\n\nimport { useDeepCompareMemoize } from '@janus-idp/shared-react';\n\nimport { TektonResponseData } from '../types/types';\nimport { getTektonResources } from '../utils/tekton-utils';\n\nexport const useAllWatchResources = (\n k8sObjectsResponse: KubernetesObjects,\n cluster: number,\n watchedResource: string[] = [],\n): TektonResponseData => {\n const { kubernetesObjects, loading, error } = k8sObjectsResponse;\n const [resources, setResources] = useState<TektonResponseData>({});\n\n useEffect(() => {\n let isMounted = true;\n if (isMounted && !loading && kubernetesObjects && !error) {\n const tektonResources: TektonResponseData = getTektonResources(\n cluster,\n kubernetesObjects,\n );\n if (tektonResources) {\n setResources(tektonResources);\n }\n }\n return () => {\n isMounted = false;\n };\n }, [loading, kubernetesObjects, error, cluster]);\n\n const watchResourcesData = useMemo(() => {\n return watchedResource.reduce((acc: TektonResponseData, resKind) => {\n if (resources[resKind]) {\n acc[resKind] = resources[resKind];\n }\n return acc;\n }, {});\n }, [watchedResource, resources]);\n\n return useDeepCompareMemoize(watchResourcesData);\n};\n"],"names":[],"mappings":";;;;AAwBO,MAAM,uBAAuB,CAClC,kBAAA,EACA,OACA,EAAA,eAAA,GAA4B,EACL,KAAA;AACvB,EAAA,MAAM,EAAE,iBAAA,EAAmB,OAAS,EAAA,KAAA,EAAU,GAAA,kBAAA;AAC9C,EAAA,MAAM,CAAC,SAAW,EAAA,YAAY,CAAI,GAAA,QAAA,CAA6B,EAAE,CAAA;AAEjE,EAAA,SAAA,CAAU,MAAM;AACd,IAAA,IAAI,SAAY,GAAA,IAAA;AAChB,IAAA,IAAI,SAAa,IAAA,CAAC,OAAW,IAAA,iBAAA,IAAqB,CAAC,KAAO,EAAA;AACxD,MAAA,MAAM,eAAsC,GAAA,kBAAA;AAAA,QAC1C,OAAA;AAAA,QACA;AAAA,OACF;AACA,MAAA,IAAI,eAAiB,EAAA;AACnB,QAAA,YAAA,CAAa,eAAe,CAAA;AAAA;AAC9B;AAEF,IAAA,OAAO,MAAM;AACX,MAAY,SAAA,GAAA,KAAA;AAAA,KACd;AAAA,KACC,CAAC,OAAA,EAAS,iBAAmB,EAAA,KAAA,EAAO,OAAO,CAAC,CAAA;AAE/C,EAAM,MAAA,kBAAA,GAAqB,QAAQ,MAAM;AACvC,IAAA,OAAO,eAAgB,CAAA,MAAA,CAAO,CAAC,GAAA,EAAyB,OAAY,KAAA;AAClE,MAAI,IAAA,SAAA,CAAU,OAAO,CAAG,EAAA;AACtB,QAAI,GAAA,CAAA,OAAO,CAAI,GAAA,SAAA,CAAU,OAAO,CAAA;AAAA;AAElC,MAAO,OAAA,GAAA;AAAA,KACT,EAAG,EAAE,CAAA;AAAA,GACJ,EAAA,CAAC,eAAiB,EAAA,SAAS,CAAC,CAAA;AAE/B,EAAA,OAAO,sBAAsB,kBAAkB,CAAA;AACjD;;;;"}
@@ -0,0 +1,21 @@
1
+ import React__default from 'react';
2
+ import { useTheme } from '@material-ui/core/styles';
3
+
4
+ const THEME_DARK = "dark";
5
+ const THEME_DARK_CLASS = "pf-v5-theme-dark";
6
+ const useDarkTheme = () => {
7
+ const {
8
+ palette: { type }
9
+ } = useTheme();
10
+ React__default.useEffect(() => {
11
+ const htmlTagElement = document.documentElement;
12
+ if (type === THEME_DARK) {
13
+ htmlTagElement.classList.add(THEME_DARK_CLASS);
14
+ } else {
15
+ htmlTagElement.classList.remove(THEME_DARK_CLASS);
16
+ }
17
+ }, [type]);
18
+ };
19
+
20
+ export { useDarkTheme };
21
+ //# sourceMappingURL=useDarkTheme.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useDarkTheme.esm.js","sources":["../../src/hooks/useDarkTheme.ts"],"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 { useTheme } from '@material-ui/core/styles';\n\nconst THEME_DARK = 'dark';\nconst THEME_DARK_CLASS = 'pf-v5-theme-dark';\n\nexport const useDarkTheme = () => {\n const {\n palette: { type },\n } = useTheme();\n\n React.useEffect(() => {\n const htmlTagElement = document.documentElement;\n if (type === THEME_DARK) {\n htmlTagElement.classList.add(THEME_DARK_CLASS);\n } else {\n htmlTagElement.classList.remove(THEME_DARK_CLASS);\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [type]);\n};\n"],"names":["React"],"mappings":";;;AAmBA,MAAM,UAAa,GAAA,MAAA;AACnB,MAAM,gBAAmB,GAAA,kBAAA;AAElB,MAAM,eAAe,MAAM;AAChC,EAAM,MAAA;AAAA,IACJ,OAAA,EAAS,EAAE,IAAK;AAAA,MACd,QAAS,EAAA;AAEb,EAAAA,cAAA,CAAM,UAAU,MAAM;AACpB,IAAA,MAAM,iBAAiB,QAAS,CAAA,eAAA;AAChC,IAAA,IAAI,SAAS,UAAY,EAAA;AACvB,MAAe,cAAA,CAAA,SAAA,CAAU,IAAI,gBAAgB,CAAA;AAAA,KACxC,MAAA;AACL,MAAe,cAAA,CAAA,SAAA,CAAU,OAAO,gBAAgB,CAAA;AAAA;AAClD,GAEF,EAAG,CAAC,IAAI,CAAC,CAAA;AACX;;;;"}
@@ -0,0 +1,35 @@
1
+ import * as React from 'react';
2
+
3
+ const SCAN_OUTPUT_SUFFIX = "SCAN_OUTPUT";
4
+ const getPipelineRunScanResults = (pipelineRun) => (pipelineRun.status?.results || pipelineRun.status?.pipelineResults)?.reduce(
5
+ (acc, result) => {
6
+ if (result.name?.endsWith(SCAN_OUTPUT_SUFFIX)) {
7
+ if (!acc.vulnerabilities) {
8
+ acc.vulnerabilities = { critical: 0, high: 0, medium: 0, low: 0 };
9
+ }
10
+ try {
11
+ const taskVulnerabilities = JSON.parse(result.value);
12
+ if (taskVulnerabilities.vulnerabilities) {
13
+ acc.vulnerabilities.critical += taskVulnerabilities.vulnerabilities.critical || 0;
14
+ acc.vulnerabilities.high += taskVulnerabilities.vulnerabilities.high || 0;
15
+ acc.vulnerabilities.medium += taskVulnerabilities.vulnerabilities.medium || 0;
16
+ acc.vulnerabilities.low += taskVulnerabilities.vulnerabilities.low || 0;
17
+ }
18
+ } catch (e) {
19
+ }
20
+ }
21
+ return acc;
22
+ },
23
+ {}
24
+ ) || {};
25
+ const usePipelineRunScanResults = (pipelineRun) => {
26
+ return React.useMemo(() => {
27
+ if (!pipelineRun) {
28
+ return {};
29
+ }
30
+ return getPipelineRunScanResults(pipelineRun);
31
+ }, [pipelineRun]);
32
+ };
33
+
34
+ export { getPipelineRunScanResults, usePipelineRunScanResults };
35
+ //# sourceMappingURL=usePipelineRunScanResults.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"usePipelineRunScanResults.esm.js","sources":["../../src/hooks/usePipelineRunScanResults.ts"],"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 * as React from 'react';\n\nimport { PipelineRunKind } from '@janus-idp/shared-react';\n\nimport { PipelineRunScanResults } from '../types/types';\n\nconst SCAN_OUTPUT_SUFFIX = 'SCAN_OUTPUT';\n\nexport const getPipelineRunScanResults = (\n pipelineRun: PipelineRunKind,\n): PipelineRunScanResults =>\n (pipelineRun.status?.results || pipelineRun.status?.pipelineResults)?.reduce(\n (acc, result) => {\n if (result.name?.endsWith(SCAN_OUTPUT_SUFFIX)) {\n if (!acc.vulnerabilities) {\n acc.vulnerabilities = { critical: 0, high: 0, medium: 0, low: 0 };\n }\n try {\n const taskVulnerabilities = JSON.parse(result.value);\n if (taskVulnerabilities.vulnerabilities) {\n acc.vulnerabilities.critical +=\n taskVulnerabilities.vulnerabilities.critical || 0;\n acc.vulnerabilities.high +=\n taskVulnerabilities.vulnerabilities.high || 0;\n acc.vulnerabilities.medium +=\n taskVulnerabilities.vulnerabilities.medium || 0;\n acc.vulnerabilities.low +=\n taskVulnerabilities.vulnerabilities.low || 0;\n }\n } catch (e) {\n // ignore\n }\n }\n return acc;\n },\n {} as PipelineRunScanResults,\n ) || {};\n\nexport const usePipelineRunScanResults = (\n pipelineRun: PipelineRunKind,\n): PipelineRunScanResults => {\n return React.useMemo(() => {\n if (!pipelineRun) {\n return {};\n }\n\n return getPipelineRunScanResults(pipelineRun);\n }, [pipelineRun]);\n};\n"],"names":[],"mappings":";;AAqBA,MAAM,kBAAqB,GAAA,aAAA;AAEd,MAAA,yBAAA,GAA4B,CACvC,WAEC,KAAA,CAAA,WAAA,CAAY,QAAQ,OAAW,IAAA,WAAA,CAAY,QAAQ,eAAkB,GAAA,MAAA;AAAA,EACpE,CAAC,KAAK,MAAW,KAAA;AACf,IAAA,IAAI,MAAO,CAAA,IAAA,EAAM,QAAS,CAAA,kBAAkB,CAAG,EAAA;AAC7C,MAAI,IAAA,CAAC,IAAI,eAAiB,EAAA;AACxB,QAAI,GAAA,CAAA,eAAA,GAAkB,EAAE,QAAU,EAAA,CAAA,EAAG,MAAM,CAAG,EAAA,MAAA,EAAQ,CAAG,EAAA,GAAA,EAAK,CAAE,EAAA;AAAA;AAElE,MAAI,IAAA;AACF,QAAA,MAAM,mBAAsB,GAAA,IAAA,CAAK,KAAM,CAAA,MAAA,CAAO,KAAK,CAAA;AACnD,QAAA,IAAI,oBAAoB,eAAiB,EAAA;AACvC,UAAA,GAAA,CAAI,eAAgB,CAAA,QAAA,I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