@backstage/plugin-kubernetes-react 0.5.5 → 0.5.6-next.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +28 -0
- package/dist/components/Cluster/Cluster.esm.js +64 -39
- package/dist/components/Cluster/Cluster.esm.js.map +1 -1
- package/dist/components/CronJobsAccordions/CronJobsAccordions.esm.js +44 -32
- package/dist/components/CronJobsAccordions/CronJobsAccordions.esm.js.map +1 -1
- package/dist/components/CronJobsAccordions/CronJobsDrawer.esm.js +20 -17
- package/dist/components/CronJobsAccordions/CronJobsDrawer.esm.js.map +1 -1
- package/dist/components/CustomResources/ArgoRollouts/Rollout.esm.js +149 -100
- package/dist/components/CustomResources/ArgoRollouts/Rollout.esm.js.map +1 -1
- package/dist/components/CustomResources/ArgoRollouts/RolloutDrawer.esm.js +20 -17
- package/dist/components/CustomResources/ArgoRollouts/RolloutDrawer.esm.js.map +1 -1
- package/dist/components/CustomResources/ArgoRollouts/StepsProgress.esm.js +8 -5
- package/dist/components/CustomResources/ArgoRollouts/StepsProgress.esm.js.map +1 -1
- package/dist/components/CustomResources/CustomResources.esm.js +8 -7
- package/dist/components/CustomResources/CustomResources.esm.js.map +1 -1
- package/dist/components/CustomResources/DefaultCustomResource.esm.js +41 -39
- package/dist/components/CustomResources/DefaultCustomResource.esm.js.map +1 -1
- package/dist/components/CustomResources/DefaultCustomResourceDrawer.esm.js +19 -16
- package/dist/components/CustomResources/DefaultCustomResourceDrawer.esm.js.map +1 -1
- package/dist/components/DaemonSetsAccordions/DaemonSetsAccordions.esm.js +59 -43
- package/dist/components/DaemonSetsAccordions/DaemonSetsAccordions.esm.js.map +1 -1
- package/dist/components/DaemonSetsAccordions/DaemonSetsDrawer.esm.js +19 -16
- package/dist/components/DaemonSetsAccordions/DaemonSetsDrawer.esm.js.map +1 -1
- package/dist/components/DeploymentsAccordions/DeploymentDrawer.esm.js +19 -16
- package/dist/components/DeploymentsAccordions/DeploymentDrawer.esm.js.map +1 -1
- package/dist/components/DeploymentsAccordions/DeploymentsAccordions.esm.js +102 -70
- package/dist/components/DeploymentsAccordions/DeploymentsAccordions.esm.js.map +1 -1
- package/dist/components/ErrorPanel/ErrorPanel.esm.js +21 -9
- package/dist/components/ErrorPanel/ErrorPanel.esm.js.map +1 -1
- package/dist/components/ErrorReporting/ErrorReporting.esm.js +7 -4
- package/dist/components/ErrorReporting/ErrorReporting.esm.js.map +1 -1
- package/dist/components/HorizontalPodAutoscalers/HorizontalPodAutoscalerDrawer.esm.js +6 -5
- package/dist/components/HorizontalPodAutoscalers/HorizontalPodAutoscalerDrawer.esm.js.map +1 -1
- package/dist/components/IngressesAccordions/IngressDrawer.esm.js +19 -16
- package/dist/components/IngressesAccordions/IngressDrawer.esm.js.map +1 -1
- package/dist/components/IngressesAccordions/IngressesAccordions.esm.js +15 -11
- package/dist/components/IngressesAccordions/IngressesAccordions.esm.js.map +1 -1
- package/dist/components/JobsAccordions/JobsAccordions.esm.js +49 -31
- package/dist/components/JobsAccordions/JobsAccordions.esm.js.map +1 -1
- package/dist/components/JobsAccordions/JobsDrawer.esm.js +18 -15
- package/dist/components/JobsAccordions/JobsDrawer.esm.js.map +1 -1
- package/dist/components/KubernetesDialog/KubernetesDialog.esm.js +40 -31
- package/dist/components/KubernetesDialog/KubernetesDialog.esm.js.map +1 -1
- package/dist/components/KubernetesDrawer/KubernetesDrawer.esm.js +57 -42
- package/dist/components/KubernetesDrawer/KubernetesDrawer.esm.js.map +1 -1
- package/dist/components/KubernetesDrawer/KubernetesStructuredMetadataTableDrawer.esm.js +95 -75
- package/dist/components/KubernetesDrawer/KubernetesStructuredMetadataTableDrawer.esm.js.map +1 -1
- package/dist/components/KubernetesDrawer/ManifestYaml.esm.js +36 -32
- package/dist/components/KubernetesDrawer/ManifestYaml.esm.js.map +1 -1
- package/dist/components/PodExecTerminal/PodExecTerminal.esm.js +4 -3
- package/dist/components/PodExecTerminal/PodExecTerminal.esm.js.map +1 -1
- package/dist/components/PodExecTerminal/PodExecTerminalDialog.esm.js +7 -6
- package/dist/components/PodExecTerminal/PodExecTerminalDialog.esm.js.map +1 -1
- package/dist/components/Pods/ErrorList/ErrorList.esm.js +27 -21
- package/dist/components/Pods/ErrorList/ErrorList.esm.js.map +1 -1
- package/dist/components/Pods/Events/Events.esm.js +30 -23
- package/dist/components/Pods/Events/Events.esm.js.map +1 -1
- package/dist/components/Pods/FixDialog/FixDialog.esm.js +85 -51
- package/dist/components/Pods/FixDialog/FixDialog.esm.js.map +1 -1
- package/dist/components/Pods/PodDelete/PodDeleteButton.esm.js +25 -21
- package/dist/components/Pods/PodDelete/PodDeleteButton.esm.js.map +1 -1
- package/dist/components/Pods/PodDrawer/ContainerCard.esm.js +137 -95
- package/dist/components/Pods/PodDrawer/ContainerCard.esm.js.map +1 -1
- package/dist/components/Pods/PodDrawer/PendingPodContent.esm.js +36 -9
- package/dist/components/Pods/PodDrawer/PendingPodContent.esm.js.map +1 -1
- package/dist/components/Pods/PodDrawer/PodDrawer.esm.js +89 -64
- package/dist/components/Pods/PodDrawer/PodDrawer.esm.js.map +1 -1
- package/dist/components/Pods/PodLogs/PodLogs.esm.js +30 -25
- package/dist/components/Pods/PodLogs/PodLogs.esm.js.map +1 -1
- package/dist/components/Pods/PodLogs/PodLogsDialog.esm.js +6 -6
- package/dist/components/Pods/PodLogs/PodLogsDialog.esm.js.map +1 -1
- package/dist/components/Pods/PodsTable.esm.js +12 -11
- package/dist/components/Pods/PodsTable.esm.js.map +1 -1
- package/dist/components/ResourceUtilization/ResourceUtilization.esm.js +24 -15
- package/dist/components/ResourceUtilization/ResourceUtilization.esm.js.map +1 -1
- package/dist/components/ServicesAccordions/ServiceDrawer.esm.js +19 -16
- package/dist/components/ServicesAccordions/ServiceDrawer.esm.js.map +1 -1
- package/dist/components/ServicesAccordions/ServicesAccordions.esm.js +21 -12
- package/dist/components/ServicesAccordions/ServicesAccordions.esm.js.map +1 -1
- package/dist/components/StatefulSetsAccordions/StatefulSetDrawer.esm.js +19 -16
- package/dist/components/StatefulSetsAccordions/StatefulSetDrawer.esm.js.map +1 -1
- package/dist/components/StatefulSetsAccordions/StatefulSetsAccordions.esm.js +98 -66
- package/dist/components/StatefulSetsAccordions/StatefulSetsAccordions.esm.js.map +1 -1
- package/dist/hooks/Cluster.esm.js +2 -2
- package/dist/hooks/Cluster.esm.js.map +1 -1
- package/dist/hooks/GroupedResponses.esm.js +2 -2
- package/dist/hooks/GroupedResponses.esm.js.map +1 -1
- package/dist/hooks/PodNamesWithErrors.esm.js +2 -2
- package/dist/hooks/PodNamesWithErrors.esm.js.map +1 -1
- package/dist/hooks/PodNamesWithMetrics.esm.js +2 -2
- package/dist/hooks/PodNamesWithMetrics.esm.js.map +1 -1
- package/dist/hooks/useMatchingErrors.esm.js +2 -2
- package/dist/hooks/useMatchingErrors.esm.js.map +1 -1
- package/dist/hooks/usePodMetrics.esm.js +4 -2
- package/dist/hooks/usePodMetrics.esm.js.map +1 -1
- package/dist/index.d.ts +47 -46
- package/dist/utils/pod.esm.js +25 -15
- package/dist/utils/pod.esm.js.map +1 -1
- package/package.json +13 -13
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
2
|
+
import { useContext } from 'react';
|
|
2
3
|
import Accordion from '@material-ui/core/Accordion';
|
|
3
4
|
import AccordionDetails from '@material-ui/core/AccordionDetails';
|
|
4
5
|
import AccordionSummary from '@material-ui/core/AccordionSummary';
|
|
@@ -49,17 +50,19 @@ import ErrorOutlineIcon from '@material-ui/icons/ErrorOutline';
|
|
|
49
50
|
import { StepsProgress } from './StepsProgress.esm.js';
|
|
50
51
|
import { getMatchingHpa, getOwnedPodsThroughReplicaSets } from '../../../utils/owner.esm.js';
|
|
51
52
|
|
|
52
|
-
const AbortedTitle = /* @__PURE__ */
|
|
53
|
+
const AbortedTitle = /* @__PURE__ */ jsxs(
|
|
53
54
|
"div",
|
|
54
55
|
{
|
|
55
56
|
style: {
|
|
56
57
|
display: "flex",
|
|
57
58
|
alignItems: "center",
|
|
58
59
|
flexWrap: "wrap"
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
60
|
+
},
|
|
61
|
+
children: [
|
|
62
|
+
/* @__PURE__ */ jsx(ErrorOutlineIcon, {}),
|
|
63
|
+
/* @__PURE__ */ jsx(Typography, { variant: "subtitle1", children: "Aborted" })
|
|
64
|
+
]
|
|
65
|
+
}
|
|
63
66
|
);
|
|
64
67
|
const findAbortedMessage = (rollout) => rollout.status?.conditions?.find(
|
|
65
68
|
(c) => c.type === "Progressing" && c.status === "False" && c.reason === "RolloutAborted"
|
|
@@ -80,57 +83,91 @@ const RolloutSummary = ({
|
|
|
80
83
|
const cpuUtil = hpa?.status?.currentMetrics?.find(
|
|
81
84
|
(metric) => metric.type === "Resource" && metric.resource?.name === "cpu"
|
|
82
85
|
)?.resource?.current.averageUtilization;
|
|
83
|
-
return /* @__PURE__ */
|
|
86
|
+
return /* @__PURE__ */ jsxs(
|
|
84
87
|
Grid,
|
|
85
88
|
{
|
|
86
89
|
container: true,
|
|
87
90
|
direction: "row",
|
|
88
91
|
justifyContent: "space-between",
|
|
89
92
|
alignItems: "center",
|
|
90
|
-
spacing: 0
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
93
|
+
spacing: 0,
|
|
94
|
+
children: [
|
|
95
|
+
/* @__PURE__ */ jsx(Grid, { xs: 6, item: true, children: /* @__PURE__ */ jsx(RolloutDrawer, { rollout }) }),
|
|
96
|
+
hpa && /* @__PURE__ */ jsx(Grid, { item: true, xs: 3, children: /* @__PURE__ */ jsx(HorizontalPodAutoscalerDrawer, { hpa, children: /* @__PURE__ */ jsxs(
|
|
97
|
+
Grid,
|
|
98
|
+
{
|
|
99
|
+
item: true,
|
|
100
|
+
container: true,
|
|
101
|
+
direction: "column",
|
|
102
|
+
justifyContent: "flex-start",
|
|
103
|
+
alignItems: "flex-start",
|
|
104
|
+
spacing: 0,
|
|
105
|
+
children: [
|
|
106
|
+
/* @__PURE__ */ jsx(Grid, { item: true, children: /* @__PURE__ */ jsxs(Typography, { variant: "subtitle2", children: [
|
|
107
|
+
"min replicas ",
|
|
108
|
+
hpa.spec?.minReplicas ?? "?",
|
|
109
|
+
" / max replicas",
|
|
110
|
+
" ",
|
|
111
|
+
hpa.spec?.maxReplicas ?? "?"
|
|
112
|
+
] }) }),
|
|
113
|
+
/* @__PURE__ */ jsx(Grid, { item: true, children: /* @__PURE__ */ jsxs(Typography, { variant: "subtitle2", children: [
|
|
114
|
+
"current CPU usage: ",
|
|
115
|
+
cpuUtil ?? "?",
|
|
116
|
+
"%"
|
|
117
|
+
] }) }),
|
|
118
|
+
/* @__PURE__ */ jsx(Grid, { item: true, children: /* @__PURE__ */ jsxs(Typography, { variant: "subtitle2", children: [
|
|
119
|
+
"target CPU usage: ",
|
|
120
|
+
specCpuUtil ?? "?",
|
|
121
|
+
"%"
|
|
122
|
+
] }) })
|
|
123
|
+
]
|
|
124
|
+
}
|
|
125
|
+
) }) }),
|
|
126
|
+
/* @__PURE__ */ jsxs(
|
|
127
|
+
Grid,
|
|
128
|
+
{
|
|
129
|
+
item: true,
|
|
130
|
+
container: true,
|
|
131
|
+
xs: 3,
|
|
132
|
+
direction: "column",
|
|
133
|
+
justifyContent: "flex-start",
|
|
134
|
+
alignItems: "flex-end",
|
|
135
|
+
spacing: 0,
|
|
136
|
+
children: [
|
|
137
|
+
/* @__PURE__ */ jsx(Grid, { item: true, children: /* @__PURE__ */ jsxs(StatusOK, { children: [
|
|
138
|
+
numberOfCurrentPods,
|
|
139
|
+
" pods"
|
|
140
|
+
] }) }),
|
|
141
|
+
/* @__PURE__ */ jsx(Grid, { item: true, children: numberOfPodsWithErrors > 0 ? /* @__PURE__ */ jsxs(StatusError, { children: [
|
|
142
|
+
numberOfPodsWithErrors,
|
|
143
|
+
" pod",
|
|
144
|
+
numberOfPodsWithErrors > 1 ? "s" : "",
|
|
145
|
+
" with errors"
|
|
146
|
+
] }) : /* @__PURE__ */ jsx(StatusOK, { children: "No pods with errors" }) })
|
|
147
|
+
]
|
|
148
|
+
}
|
|
149
|
+
),
|
|
150
|
+
pauseTime && /* @__PURE__ */ jsx(Grid, { item: true, xs: 3, children: /* @__PURE__ */ jsxs(
|
|
151
|
+
"div",
|
|
152
|
+
{
|
|
153
|
+
style: {
|
|
154
|
+
display: "flex",
|
|
155
|
+
alignItems: "center",
|
|
156
|
+
flexWrap: "wrap"
|
|
157
|
+
},
|
|
158
|
+
children: [
|
|
159
|
+
/* @__PURE__ */ jsx(PauseIcon, {}),
|
|
160
|
+
/* @__PURE__ */ jsxs(Typography, { variant: "subtitle1", children: [
|
|
161
|
+
"Paused (",
|
|
162
|
+
DateTime.fromISO(pauseTime).toRelative({ locale: "en" }),
|
|
163
|
+
")"
|
|
164
|
+
] })
|
|
165
|
+
]
|
|
166
|
+
}
|
|
167
|
+
) }),
|
|
168
|
+
abortedMessage && /* @__PURE__ */ jsx(Grid, { item: true, xs: 3, children: AbortedTitle })
|
|
169
|
+
]
|
|
170
|
+
}
|
|
134
171
|
);
|
|
135
172
|
};
|
|
136
173
|
const RolloutAccordion = ({
|
|
@@ -145,36 +182,48 @@ const RolloutAccordion = ({
|
|
|
145
182
|
);
|
|
146
183
|
const currentStepIndex = rollout.status?.currentStepIndex ?? 0;
|
|
147
184
|
const abortedMessage = findAbortedMessage(rollout);
|
|
148
|
-
return /* @__PURE__ */
|
|
185
|
+
return /* @__PURE__ */ jsxs(
|
|
149
186
|
Accordion,
|
|
150
187
|
{
|
|
151
188
|
defaultExpanded,
|
|
152
189
|
TransitionProps: { unmountOnExit: true },
|
|
153
|
-
variant: "outlined"
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
190
|
+
variant: "outlined",
|
|
191
|
+
children: [
|
|
192
|
+
/* @__PURE__ */ jsx(AccordionSummary, { expandIcon: /* @__PURE__ */ jsx(ExpandMoreIcon, {}), children: /* @__PURE__ */ jsx(
|
|
193
|
+
RolloutSummary,
|
|
194
|
+
{
|
|
195
|
+
rollout,
|
|
196
|
+
numberOfCurrentPods: ownedPods.length,
|
|
197
|
+
numberOfPodsWithErrors: podsWithErrors.length,
|
|
198
|
+
hpa: matchingHpa
|
|
199
|
+
}
|
|
200
|
+
) }),
|
|
201
|
+
/* @__PURE__ */ jsx(AccordionDetails, { children: /* @__PURE__ */ jsxs("div", { style: { width: "100%" }, children: [
|
|
202
|
+
/* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(Typography, { variant: "h6", children: "Rollout status" }) }),
|
|
203
|
+
/* @__PURE__ */ jsxs("div", { style: { margin: "1rem" }, children: [
|
|
204
|
+
abortedMessage && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
205
|
+
AbortedTitle,
|
|
206
|
+
/* @__PURE__ */ jsx(Typography, { variant: "subtitle2", children: abortedMessage })
|
|
207
|
+
] }),
|
|
208
|
+
/* @__PURE__ */ jsx(
|
|
209
|
+
StepsProgress,
|
|
210
|
+
{
|
|
211
|
+
aborted: abortedMessage !== void 0,
|
|
212
|
+
steps: rollout.spec?.strategy?.canary?.steps ?? [],
|
|
213
|
+
currentStepIndex
|
|
214
|
+
}
|
|
215
|
+
)
|
|
216
|
+
] }),
|
|
217
|
+
/* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(
|
|
218
|
+
PodsTable,
|
|
219
|
+
{
|
|
220
|
+
pods: ownedPods,
|
|
221
|
+
extraColumns: [READY_COLUMNS, RESOURCE_COLUMNS]
|
|
222
|
+
}
|
|
223
|
+
) })
|
|
224
|
+
] }) })
|
|
225
|
+
]
|
|
226
|
+
}
|
|
178
227
|
);
|
|
179
228
|
};
|
|
180
229
|
const RolloutAccordions = ({
|
|
@@ -182,34 +231,34 @@ const RolloutAccordions = ({
|
|
|
182
231
|
defaultExpanded = false
|
|
183
232
|
}) => {
|
|
184
233
|
const groupedResponses = useContext(GroupedResponsesContext);
|
|
185
|
-
return /* @__PURE__ */
|
|
234
|
+
return /* @__PURE__ */ jsx(
|
|
186
235
|
Grid,
|
|
187
236
|
{
|
|
188
237
|
container: true,
|
|
189
238
|
direction: "column",
|
|
190
239
|
justifyContent: "flex-start",
|
|
191
|
-
alignItems: "flex-start"
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
}
|
|
212
|
-
|
|
240
|
+
alignItems: "flex-start",
|
|
241
|
+
children: rollouts.map((rollout, i) => /* @__PURE__ */ jsx(Grid, { container: true, item: true, xs: true, children: /* @__PURE__ */ jsx(Grid, { item: true, xs: true, children: /* @__PURE__ */ jsx(
|
|
242
|
+
RolloutAccordion,
|
|
243
|
+
{
|
|
244
|
+
defaultExpanded,
|
|
245
|
+
matchingHpa: getMatchingHpa(
|
|
246
|
+
{
|
|
247
|
+
name: rollout.metadata?.name,
|
|
248
|
+
namespace: rollout.metadata?.namespace,
|
|
249
|
+
kind: "rollout"
|
|
250
|
+
},
|
|
251
|
+
groupedResponses.horizontalPodAutoscalers
|
|
252
|
+
),
|
|
253
|
+
ownedPods: getOwnedPodsThroughReplicaSets(
|
|
254
|
+
rollout,
|
|
255
|
+
groupedResponses.replicaSets,
|
|
256
|
+
groupedResponses.pods
|
|
257
|
+
),
|
|
258
|
+
rollout
|
|
259
|
+
}
|
|
260
|
+
) }) }, i))
|
|
261
|
+
}
|
|
213
262
|
);
|
|
214
263
|
};
|
|
215
264
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Rollout.esm.js","sources":["../../../../src/components/CustomResources/ArgoRollouts/Rollout.tsx"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React, { useContext } from 'react';\nimport Accordion from '@material-ui/core/Accordion';\nimport AccordionDetails from '@material-ui/core/AccordionDetails';\nimport AccordionSummary from '@material-ui/core/AccordionSummary';\nimport Grid from '@material-ui/core/Grid';\nimport Typography from '@material-ui/core/Typography';\nimport ExpandMoreIcon from '@material-ui/icons/ExpandMore';\nimport { V1Pod, V2HorizontalPodAutoscaler } from '@kubernetes/client-node';\nimport { PodsTable } from '../../Pods';\nimport { HorizontalPodAutoscalerDrawer } from '../../HorizontalPodAutoscalers';\nimport { RolloutDrawer } from './RolloutDrawer';\nimport PauseIcon from '@material-ui/icons/Pause';\nimport ErrorOutlineIcon from '@material-ui/icons/ErrorOutline';\nimport { DateTime } from 'luxon';\nimport { StepsProgress } from './StepsProgress';\nimport {\n PodNamesWithErrorsContext,\n GroupedResponsesContext,\n} from '../../../hooks';\nimport {\n getMatchingHpa,\n getOwnedPodsThroughReplicaSets,\n} from '../../../utils/owner';\nimport { StatusError, StatusOK } from '@backstage/core-components';\nimport { READY_COLUMNS, RESOURCE_COLUMNS } from '../../Pods/PodsTable';\n\ntype RolloutAccordionsProps = {\n rollouts: any[];\n defaultExpanded?: boolean;\n children?: React.ReactNode;\n};\n\ntype RolloutAccordionProps = {\n rollout: any;\n ownedPods: V1Pod[];\n defaultExpanded?: boolean;\n matchingHpa?: V2HorizontalPodAutoscaler;\n children?: React.ReactNode;\n};\n\ntype RolloutSummaryProps = {\n rollout: any;\n numberOfCurrentPods: number;\n numberOfPodsWithErrors: number;\n hpa?: V2HorizontalPodAutoscaler;\n children?: React.ReactNode;\n};\n\nconst AbortedTitle = (\n <div\n style={{\n display: 'flex',\n alignItems: 'center',\n flexWrap: 'wrap',\n }}\n >\n <ErrorOutlineIcon />\n <Typography variant=\"subtitle1\">Aborted</Typography>\n </div>\n);\n\nconst findAbortedMessage = (rollout: any): string | undefined =>\n rollout.status?.conditions?.find(\n (c: any) =>\n c.type === 'Progressing' &&\n c.status === 'False' &&\n c.reason === 'RolloutAborted',\n )?.message;\n\nconst RolloutSummary = ({\n rollout,\n numberOfCurrentPods,\n numberOfPodsWithErrors,\n hpa,\n}: RolloutSummaryProps) => {\n const pauseTime: string | undefined = rollout.status?.pauseConditions?.find(\n (p: any) => p.reason === 'CanaryPauseStep',\n )?.startTime;\n const abortedMessage = findAbortedMessage(rollout);\n const specCpuUtil = hpa?.spec?.metrics?.find(\n metric => metric.type === 'Resource' && metric.resource?.name === 'cpu',\n )?.resource?.target.averageUtilization;\n\n const cpuUtil = hpa?.status?.currentMetrics?.find(\n metric => metric.type === 'Resource' && metric.resource?.name === 'cpu',\n )?.resource?.current.averageUtilization;\n\n return (\n <Grid\n container\n direction=\"row\"\n justifyContent=\"space-between\"\n alignItems=\"center\"\n spacing={0}\n >\n <Grid xs={6} item>\n <RolloutDrawer rollout={rollout} />\n </Grid>\n {hpa && (\n <Grid item xs={3}>\n <HorizontalPodAutoscalerDrawer hpa={hpa}>\n <Grid\n item\n container\n direction=\"column\"\n justifyContent=\"flex-start\"\n alignItems=\"flex-start\"\n spacing={0}\n >\n <Grid item>\n <Typography variant=\"subtitle2\">\n min replicas {hpa.spec?.minReplicas ?? '?'} / max replicas{' '}\n {hpa.spec?.maxReplicas ?? '?'}\n </Typography>\n </Grid>\n <Grid item>\n <Typography variant=\"subtitle2\">\n current CPU usage: {cpuUtil ?? '?'}%\n </Typography>\n </Grid>\n <Grid item>\n <Typography variant=\"subtitle2\">\n target CPU usage: {specCpuUtil ?? '?'}%\n </Typography>\n </Grid>\n </Grid>\n </HorizontalPodAutoscalerDrawer>\n </Grid>\n )}\n <Grid\n item\n container\n xs={3}\n direction=\"column\"\n justifyContent=\"flex-start\"\n alignItems=\"flex-end\"\n spacing={0}\n >\n <Grid item>\n <StatusOK>{numberOfCurrentPods} pods</StatusOK>\n </Grid>\n <Grid item>\n {numberOfPodsWithErrors > 0 ? (\n <StatusError>\n {numberOfPodsWithErrors} pod\n {numberOfPodsWithErrors > 1 ? 's' : ''} with errors\n </StatusError>\n ) : (\n <StatusOK>No pods with errors</StatusOK>\n )}\n </Grid>\n </Grid>\n {pauseTime && (\n <Grid item xs={3}>\n <div\n style={{\n display: 'flex',\n alignItems: 'center',\n flexWrap: 'wrap',\n }}\n >\n <PauseIcon />\n <Typography variant=\"subtitle1\">\n Paused ({DateTime.fromISO(pauseTime).toRelative({ locale: 'en' })}\n )\n </Typography>\n </div>\n </Grid>\n )}\n {abortedMessage && (\n <Grid item xs={3}>\n {AbortedTitle}\n </Grid>\n )}\n </Grid>\n );\n};\n\nconst RolloutAccordion = ({\n rollout,\n ownedPods,\n matchingHpa,\n defaultExpanded,\n}: RolloutAccordionProps) => {\n const podNamesWithErrors = useContext(PodNamesWithErrorsContext);\n\n const podsWithErrors = ownedPods.filter(p =>\n podNamesWithErrors.has(p.metadata?.name ?? ''),\n );\n\n const currentStepIndex = rollout.status?.currentStepIndex ?? 0;\n const abortedMessage = findAbortedMessage(rollout);\n\n return (\n <Accordion\n defaultExpanded={defaultExpanded}\n TransitionProps={{ unmountOnExit: true }}\n variant=\"outlined\"\n >\n <AccordionSummary expandIcon={<ExpandMoreIcon />}>\n <RolloutSummary\n rollout={rollout}\n numberOfCurrentPods={ownedPods.length}\n numberOfPodsWithErrors={podsWithErrors.length}\n hpa={matchingHpa}\n />\n </AccordionSummary>\n <AccordionDetails>\n <div style={{ width: '100%' }}>\n <div>\n <Typography variant=\"h6\">Rollout status</Typography>\n </div>\n <div style={{ margin: '1rem' }}>\n {abortedMessage && (\n <>\n {AbortedTitle}\n <Typography variant=\"subtitle2\">{abortedMessage}</Typography>\n </>\n )}\n <StepsProgress\n aborted={abortedMessage !== undefined}\n steps={rollout.spec?.strategy?.canary?.steps ?? []}\n currentStepIndex={currentStepIndex}\n />\n </div>\n <div>\n <PodsTable\n pods={ownedPods}\n extraColumns={[READY_COLUMNS, RESOURCE_COLUMNS]}\n />\n </div>\n </div>\n </AccordionDetails>\n </Accordion>\n );\n};\n\nexport const RolloutAccordions = ({\n rollouts,\n defaultExpanded = false,\n}: RolloutAccordionsProps) => {\n const groupedResponses = useContext(GroupedResponsesContext);\n\n return (\n <Grid\n container\n direction=\"column\"\n justifyContent=\"flex-start\"\n alignItems=\"flex-start\"\n >\n {rollouts.map((rollout, i) => (\n <Grid container item key={i} xs>\n <Grid item xs>\n <RolloutAccordion\n defaultExpanded={defaultExpanded}\n matchingHpa={getMatchingHpa(\n {\n name: rollout.metadata?.name,\n namespace: rollout.metadata?.namespace,\n kind: 'rollout',\n },\n groupedResponses.horizontalPodAutoscalers,\n )}\n ownedPods={getOwnedPodsThroughReplicaSets(\n rollout,\n groupedResponses.replicaSets,\n groupedResponses.pods,\n )}\n rollout={rollout}\n />\n </Grid>\n </Grid>\n ))}\n </Grid>\n );\n};\n"],"names":["React"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgEA,MAAM,YACJ,mBAAAA,cAAA,CAAA,aAAA;AAAA,EAAC,KAAA;AAAA,EAAA;AAAA,IACC,KAAO,EAAA;AAAA,MACL,OAAS,EAAA,MAAA;AAAA,MACT,UAAY,EAAA,QAAA;AAAA,MACZ,QAAU,EAAA;AAAA;AACZ,GAAA;AAAA,+CAEC,gBAAiB,EAAA,IAAA,CAAA;AAAA,kBACjBA,cAAA,CAAA,aAAA,CAAA,UAAA,EAAA,EAAW,OAAQ,EAAA,WAAA,EAAA,EAAY,SAAO;AACzC,CAAA;AAGF,MAAM,kBAAqB,GAAA,CAAC,OAC1B,KAAA,OAAA,CAAQ,QAAQ,UAAY,EAAA,IAAA;AAAA,EAC1B,CAAC,MACC,CAAE,CAAA,IAAA,KAAS,iBACX,CAAE,CAAA,MAAA,KAAW,OACb,IAAA,CAAA,CAAE,MAAW,KAAA;AACjB,CAAG,EAAA,OAAA;AAEL,MAAM,iBAAiB,CAAC;AAAA,EACtB,OAAA;AAAA,EACA,mBAAA;AAAA,EACA,sBAAA;AAAA,EACA;AACF,CAA2B,KAAA;AACzB,EAAM,MAAA,SAAA,GAAgC,OAAQ,CAAA,MAAA,EAAQ,eAAiB,EAAA,IAAA;AAAA,IACrE,CAAC,CAAW,KAAA,CAAA,CAAE,MAAW,KAAA;AAAA,GACxB,EAAA,SAAA;AACH,EAAM,MAAA,cAAA,GAAiB,mBAAmB,OAAO,CAAA;AACjD,EAAM,MAAA,WAAA,GAAc,GAAK,EAAA,IAAA,E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,aAAA,EAAe,gBAAgB;AAAA;AAAA,KAElD,CACF,CACF;AAAA,GACF;AAEJ,CAAA;AAEO,MAAM,oBAAoB,CAAC;AAAA,EAChC,QAAA;AAAA,EACA,eAAkB,GAAA;AACpB,CAA8B,KAAA;AAC5B,EAAM,MAAA,gBAAA,GAAmB,WAAW,uBAAuB,CAAA;AAE3D,EACE,uBAAAA,cAAA,CAAA,aAAA;AAAA,IAAC,IAAA;AAAA,IAAA;AAAA,MACC,SAAS,EAAA,IAAA;AAAA,MACT,SAAU,EAAA,QAAA;AAAA,MACV,cAAe,EAAA,YAAA;AAAA,MACf,UAAW,EAAA;AAAA,KAAA;AAAA,IAEV,QAAA,CAAS,IAAI,CAAC,OAAA,EAAS,sBACrBA,cAAA,CAAA,aAAA,CAAA,IAAA,EAAA,EAAK,WAAS,IAAC,EAAA,IAAA,EAAI,MAAC,GAAK,EAAA,CAAA,EAAG,IAAE,IAC7B,EAAA,kBAAAA,cAAA,CAAA,aAAA,CAAC,QAAK,IAAI,EAAA,IAAA,EAAC,IAAE,IACX,EAAA,kBAAAA,cAAA,CAAA,aAAA;AAAA,MAAC,gBAAA;AAAA,MAAA;AAAA,QACC,eAAA;AAAA,QACA,WAAa,EAAA,cAAA;AAAA,UACX;AAAA,YACE,IAAA,EAAM,QAAQ,QAAU,EAAA,IAAA;AAAA,YACxB,SAAA,EAAW,QAAQ,QAAU,EAAA,SAAA;AAAA,YAC7B,IAAM,EAAA;AAAA,WACR;AAAA,UACA,gBAAiB,CAAA;AAAA,SACnB;AAAA,QACA,SAAW,EAAA,8BAAA;AAAA,UACT,OAAA;AAAA,UACA,gBAAiB,CAAA,WAAA;AAAA,UACjB,gBAAiB,CAAA;AAAA,SACnB;AAAA,QACA;AAAA;AAAA,KAEJ,CACF,CACD;AAAA,GACH;AAEJ;;;;"}
|
|
1
|
+
{"version":3,"file":"Rollout.esm.js","sources":["../../../../src/components/CustomResources/ArgoRollouts/Rollout.tsx"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { ReactNode, useContext } from 'react';\nimport Accordion from '@material-ui/core/Accordion';\nimport AccordionDetails from '@material-ui/core/AccordionDetails';\nimport AccordionSummary from '@material-ui/core/AccordionSummary';\nimport Grid from '@material-ui/core/Grid';\nimport Typography from '@material-ui/core/Typography';\nimport ExpandMoreIcon from '@material-ui/icons/ExpandMore';\nimport { V1Pod, V2HorizontalPodAutoscaler } from '@kubernetes/client-node';\nimport { PodsTable } from '../../Pods';\nimport { HorizontalPodAutoscalerDrawer } from '../../HorizontalPodAutoscalers';\nimport { RolloutDrawer } from './RolloutDrawer';\nimport PauseIcon from '@material-ui/icons/Pause';\nimport ErrorOutlineIcon from '@material-ui/icons/ErrorOutline';\nimport { DateTime } from 'luxon';\nimport { StepsProgress } from './StepsProgress';\nimport {\n PodNamesWithErrorsContext,\n GroupedResponsesContext,\n} from '../../../hooks';\nimport {\n getMatchingHpa,\n getOwnedPodsThroughReplicaSets,\n} from '../../../utils/owner';\nimport { StatusError, StatusOK } from '@backstage/core-components';\nimport { READY_COLUMNS, RESOURCE_COLUMNS } from '../../Pods/PodsTable';\n\ntype RolloutAccordionsProps = {\n rollouts: any[];\n defaultExpanded?: boolean;\n children?: ReactNode;\n};\n\ntype RolloutAccordionProps = {\n rollout: any;\n ownedPods: V1Pod[];\n defaultExpanded?: boolean;\n matchingHpa?: V2HorizontalPodAutoscaler;\n children?: ReactNode;\n};\n\ntype RolloutSummaryProps = {\n rollout: any;\n numberOfCurrentPods: number;\n numberOfPodsWithErrors: number;\n hpa?: V2HorizontalPodAutoscaler;\n children?: ReactNode;\n};\n\nconst AbortedTitle = (\n <div\n style={{\n display: 'flex',\n alignItems: 'center',\n flexWrap: 'wrap',\n }}\n >\n <ErrorOutlineIcon />\n <Typography variant=\"subtitle1\">Aborted</Typography>\n </div>\n);\n\nconst findAbortedMessage = (rollout: any): string | undefined =>\n rollout.status?.conditions?.find(\n (c: any) =>\n c.type === 'Progressing' &&\n c.status === 'False' &&\n c.reason === 'RolloutAborted',\n )?.message;\n\nconst RolloutSummary = ({\n rollout,\n numberOfCurrentPods,\n numberOfPodsWithErrors,\n hpa,\n}: RolloutSummaryProps) => {\n const pauseTime: string | undefined = rollout.status?.pauseConditions?.find(\n (p: any) => p.reason === 'CanaryPauseStep',\n )?.startTime;\n const abortedMessage = findAbortedMessage(rollout);\n const specCpuUtil = hpa?.spec?.metrics?.find(\n metric => metric.type === 'Resource' && metric.resource?.name === 'cpu',\n )?.resource?.target.averageUtilization;\n\n const cpuUtil = hpa?.status?.currentMetrics?.find(\n metric => metric.type === 'Resource' && metric.resource?.name === 'cpu',\n )?.resource?.current.averageUtilization;\n\n return (\n <Grid\n container\n direction=\"row\"\n justifyContent=\"space-between\"\n alignItems=\"center\"\n spacing={0}\n >\n <Grid xs={6} item>\n <RolloutDrawer rollout={rollout} />\n </Grid>\n {hpa && (\n <Grid item xs={3}>\n <HorizontalPodAutoscalerDrawer hpa={hpa}>\n <Grid\n item\n container\n direction=\"column\"\n justifyContent=\"flex-start\"\n alignItems=\"flex-start\"\n spacing={0}\n >\n <Grid item>\n <Typography variant=\"subtitle2\">\n min replicas {hpa.spec?.minReplicas ?? '?'} / max replicas{' '}\n {hpa.spec?.maxReplicas ?? '?'}\n </Typography>\n </Grid>\n <Grid item>\n <Typography variant=\"subtitle2\">\n current CPU usage: {cpuUtil ?? '?'}%\n </Typography>\n </Grid>\n <Grid item>\n <Typography variant=\"subtitle2\">\n target CPU usage: {specCpuUtil ?? '?'}%\n </Typography>\n </Grid>\n </Grid>\n </HorizontalPodAutoscalerDrawer>\n </Grid>\n )}\n <Grid\n item\n container\n xs={3}\n direction=\"column\"\n justifyContent=\"flex-start\"\n alignItems=\"flex-end\"\n spacing={0}\n >\n <Grid item>\n <StatusOK>{numberOfCurrentPods} pods</StatusOK>\n </Grid>\n <Grid item>\n {numberOfPodsWithErrors > 0 ? (\n <StatusError>\n {numberOfPodsWithErrors} pod\n {numberOfPodsWithErrors > 1 ? 's' : ''} with errors\n </StatusError>\n ) : (\n <StatusOK>No pods with errors</StatusOK>\n )}\n </Grid>\n </Grid>\n {pauseTime && (\n <Grid item xs={3}>\n <div\n style={{\n display: 'flex',\n alignItems: 'center',\n flexWrap: 'wrap',\n }}\n >\n <PauseIcon />\n <Typography variant=\"subtitle1\">\n Paused ({DateTime.fromISO(pauseTime).toRelative({ locale: 'en' })}\n )\n </Typography>\n </div>\n </Grid>\n )}\n {abortedMessage && (\n <Grid item xs={3}>\n {AbortedTitle}\n </Grid>\n )}\n </Grid>\n );\n};\n\nconst RolloutAccordion = ({\n rollout,\n ownedPods,\n matchingHpa,\n defaultExpanded,\n}: RolloutAccordionProps) => {\n const podNamesWithErrors = useContext(PodNamesWithErrorsContext);\n\n const podsWithErrors = ownedPods.filter(p =>\n podNamesWithErrors.has(p.metadata?.name ?? ''),\n );\n\n const currentStepIndex = rollout.status?.currentStepIndex ?? 0;\n const abortedMessage = findAbortedMessage(rollout);\n\n return (\n <Accordion\n defaultExpanded={defaultExpanded}\n TransitionProps={{ unmountOnExit: true }}\n variant=\"outlined\"\n >\n <AccordionSummary expandIcon={<ExpandMoreIcon />}>\n <RolloutSummary\n rollout={rollout}\n numberOfCurrentPods={ownedPods.length}\n numberOfPodsWithErrors={podsWithErrors.length}\n hpa={matchingHpa}\n />\n </AccordionSummary>\n <AccordionDetails>\n <div style={{ width: '100%' }}>\n <div>\n <Typography variant=\"h6\">Rollout status</Typography>\n </div>\n <div style={{ margin: '1rem' }}>\n {abortedMessage && (\n <>\n {AbortedTitle}\n <Typography variant=\"subtitle2\">{abortedMessage}</Typography>\n </>\n )}\n <StepsProgress\n aborted={abortedMessage !== undefined}\n steps={rollout.spec?.strategy?.canary?.steps ?? []}\n currentStepIndex={currentStepIndex}\n />\n </div>\n <div>\n <PodsTable\n pods={ownedPods}\n extraColumns={[READY_COLUMNS, RESOURCE_COLUMNS]}\n />\n </div>\n </div>\n </AccordionDetails>\n </Accordion>\n );\n};\n\nexport const RolloutAccordions = ({\n rollouts,\n defaultExpanded = false,\n}: RolloutAccordionsProps) => {\n const groupedResponses = useContext(GroupedResponsesContext);\n\n return (\n <Grid\n container\n direction=\"column\"\n justifyContent=\"flex-start\"\n alignItems=\"flex-start\"\n >\n {rollouts.map((rollout, i) => (\n <Grid container item key={i} xs>\n <Grid item xs>\n <RolloutAccordion\n defaultExpanded={defaultExpanded}\n matchingHpa={getMatchingHpa(\n {\n name: rollout.metadata?.name,\n namespace: rollout.metadata?.namespace,\n kind: 'rollout',\n },\n groupedResponses.horizontalPodAutoscalers,\n )}\n ownedPods={getOwnedPodsThroughReplicaSets(\n rollout,\n groupedResponses.replicaSets,\n groupedResponses.pods,\n )}\n rollout={rollout}\n />\n </Grid>\n </Grid>\n ))}\n </Grid>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgEA,MAAM,YACJ,mBAAA,IAAA;AAAA,EAAC,KAAA;AAAA,EAAA;AAAA,IACC,KAAO,EAAA;AAAA,MACL,OAAS,EAAA,MAAA;AAAA,MACT,UAAY,EAAA,QAAA;AAAA,MACZ,QAAU,EAAA;AAAA,KACZ;AAAA,IAEA,QAAA,EAAA;AAAA,sBAAA,GAAA,CAAC,gBAAiB,EAAA,EAAA,CAAA;AAAA,sBACjB,GAAA,CAAA,UAAA,EAAA,EAAW,OAAQ,EAAA,WAAA,EAAY,QAAO,EAAA,SAAA,EAAA;AAAA;AAAA;AACzC,CAAA;AAGF,MAAM,kBAAqB,GAAA,CAAC,OAC1B,KA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AAAA,MACV,cAAe,EAAA,YAAA;AAAA,MACf,UAAW,EAAA,YAAA;AAAA,MAEV,mBAAS,GAAI,CAAA,CAAC,SAAS,CACtB,qBAAA,GAAA,CAAC,QAAK,SAAS,EAAA,IAAA,EAAC,IAAI,EAAA,IAAA,EAAS,IAAE,IAC7B,EAAA,QAAA,kBAAA,GAAA,CAAC,QAAK,IAAI,EAAA,IAAA,EAAC,IAAE,IACX,EAAA,QAAA,kBAAA,GAAA;AAAA,QAAC,gBAAA;AAAA,QAAA;AAAA,UACC,eAAA;AAAA,UACA,WAAa,EAAA,cAAA;AAAA,YACX;AAAA,cACE,IAAA,EAAM,QAAQ,QAAU,EAAA,IAAA;AAAA,cACxB,SAAA,EAAW,QAAQ,QAAU,EAAA,SAAA;AAAA,cAC7B,IAAM,EAAA;AAAA,aACR;AAAA,YACA,gBAAiB,CAAA;AAAA,WACnB;AAAA,UACA,SAAW,EAAA,8BAAA;AAAA,YACT,OAAA;AAAA,YACA,gBAAiB,CAAA,WAAA;AAAA,YACjB,gBAAiB,CAAA;AAAA,WACnB;AAAA,UACA;AAAA;AAAA,OACF,EACF,CAnBwB,EAAA,EAAA,CAoB1B,CACD;AAAA;AAAA,GACH;AAEJ;;;;"}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
2
|
import { KubernetesStructuredMetadataTableDrawer } from '../../KubernetesDrawer/KubernetesStructuredMetadataTableDrawer.esm.js';
|
|
3
3
|
import '../../KubernetesDrawer/KubernetesDrawer.esm.js';
|
|
4
4
|
import '@backstage/core-components';
|
|
5
5
|
import '@material-ui/core/FormControlLabel';
|
|
6
6
|
import '@material-ui/core/Switch';
|
|
7
7
|
import 'js-yaml';
|
|
8
|
+
import 'react';
|
|
8
9
|
import Typography from '@material-ui/core/Typography';
|
|
9
10
|
import Grid from '@material-ui/core/Grid';
|
|
10
11
|
import Chip from '@material-ui/core/Chip';
|
|
@@ -14,27 +15,29 @@ const RolloutDrawer = ({
|
|
|
14
15
|
expanded
|
|
15
16
|
}) => {
|
|
16
17
|
const namespace = rollout.metadata?.namespace;
|
|
17
|
-
return /* @__PURE__ */
|
|
18
|
+
return /* @__PURE__ */ jsx(
|
|
18
19
|
KubernetesStructuredMetadataTableDrawer,
|
|
19
20
|
{
|
|
20
21
|
object: rollout,
|
|
21
22
|
expanded,
|
|
22
23
|
kind: "Rollout",
|
|
23
|
-
renderObject: () => ({})
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
24
|
+
renderObject: () => ({}),
|
|
25
|
+
children: /* @__PURE__ */ jsxs(
|
|
26
|
+
Grid,
|
|
27
|
+
{
|
|
28
|
+
container: true,
|
|
29
|
+
direction: "column",
|
|
30
|
+
justifyContent: "flex-start",
|
|
31
|
+
alignItems: "flex-start",
|
|
32
|
+
spacing: 0,
|
|
33
|
+
children: [
|
|
34
|
+
/* @__PURE__ */ jsx(Grid, { item: true, children: /* @__PURE__ */ jsx(Typography, { variant: "body1", children: rollout.metadata?.name ?? "unknown object" }) }),
|
|
35
|
+
/* @__PURE__ */ jsx(Grid, { item: true, children: /* @__PURE__ */ jsx(Typography, { color: "textSecondary", variant: "subtitle1", children: "Rollout" }) }),
|
|
36
|
+
namespace && /* @__PURE__ */ jsx(Grid, { item: true, children: /* @__PURE__ */ jsx(Chip, { size: "small", label: `namespace: ${namespace}` }) })
|
|
37
|
+
]
|
|
38
|
+
}
|
|
39
|
+
)
|
|
40
|
+
}
|
|
38
41
|
);
|
|
39
42
|
};
|
|
40
43
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RolloutDrawer.esm.js","sources":["../../../../src/components/CustomResources/ArgoRollouts/RolloutDrawer.tsx"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport
|
|
1
|
+
{"version":3,"file":"RolloutDrawer.esm.js","sources":["../../../../src/components/CustomResources/ArgoRollouts/RolloutDrawer.tsx"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { KubernetesStructuredMetadataTableDrawer } from '../../KubernetesDrawer';\nimport Typography from '@material-ui/core/Typography';\nimport Grid from '@material-ui/core/Grid';\nimport Chip from '@material-ui/core/Chip';\n\nexport const RolloutDrawer = ({\n rollout,\n expanded,\n}: {\n rollout: any;\n expanded?: boolean;\n}) => {\n const namespace = rollout.metadata?.namespace;\n return (\n <KubernetesStructuredMetadataTableDrawer\n object={rollout}\n expanded={expanded}\n kind=\"Rollout\"\n renderObject={() => ({})}\n >\n <Grid\n container\n direction=\"column\"\n justifyContent=\"flex-start\"\n alignItems=\"flex-start\"\n spacing={0}\n >\n <Grid item>\n <Typography variant=\"body1\">\n {rollout.metadata?.name ?? 'unknown object'}\n </Typography>\n </Grid>\n <Grid item>\n <Typography color=\"textSecondary\" variant=\"subtitle1\">\n Rollout\n </Typography>\n </Grid>\n {namespace && (\n <Grid item>\n <Chip size=\"small\"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AAS,IAAI,CACvD,EAAA;AAAA;AAAA;AAAA;AAEJ;AAAA,GACF;AAEJ;;;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
2
|
import Step from '@material-ui/core/Step';
|
|
3
3
|
import StepLabel from '@material-ui/core/StepLabel';
|
|
4
4
|
import Stepper from '@material-ui/core/Stepper';
|
|
@@ -13,7 +13,10 @@ const createLabelForStep = (step) => {
|
|
|
13
13
|
} else if (isPauseStep(step)) {
|
|
14
14
|
return step.pause.duration === void 0 ? "infinite pause" : `pause for ${step.pause.duration}`;
|
|
15
15
|
} else if (isAnalysisStep(step)) {
|
|
16
|
-
return /* @__PURE__ */
|
|
16
|
+
return /* @__PURE__ */ jsxs("div", { children: [
|
|
17
|
+
/* @__PURE__ */ jsx(Typography, { paragraph: true, children: "analysis templates:" }),
|
|
18
|
+
step.analysis.templates.map((t, i) => /* @__PURE__ */ jsx(Typography, { paragraph: true, children: `${t.templateName}${t.clusterScope ? " (cluster scoped)" : ""}` }, i))
|
|
19
|
+
] });
|
|
17
20
|
}
|
|
18
21
|
return "unknown step";
|
|
19
22
|
};
|
|
@@ -23,9 +26,9 @@ const StepsProgress = ({
|
|
|
23
26
|
steps
|
|
24
27
|
}) => {
|
|
25
28
|
const activeStepIndex = currentStepIndex >= steps.length ? currentStepIndex + 1 : currentStepIndex;
|
|
26
|
-
return /* @__PURE__ */
|
|
27
|
-
/* @__PURE__ */
|
|
28
|
-
));
|
|
29
|
+
return /* @__PURE__ */ jsx(Stepper, { activeStep: aborted ? -1 : activeStepIndex, alternativeLabel: true, children: steps.map((step, i) => /* @__PURE__ */ jsx(Step, { children: /* @__PURE__ */ jsx(StepLabel, { "data-testid": `step-${i}`, children: createLabelForStep(step) }) }, i)).concat(
|
|
30
|
+
/* @__PURE__ */ jsx(Step, { children: /* @__PURE__ */ jsx(StepLabel, { "data-testid": "step--1", children: "Canary promoted" }) }, "-1")
|
|
31
|
+
) });
|
|
29
32
|
};
|
|
30
33
|
|
|
31
34
|
export { StepsProgress };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StepsProgress.esm.js","sources":["../../../../src/components/CustomResources/ArgoRollouts/StepsProgress.tsx"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport
|
|
1
|
+
{"version":3,"file":"StepsProgress.esm.js","sources":["../../../../src/components/CustomResources/ArgoRollouts/StepsProgress.tsx"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { ReactNode } from 'react';\nimport Step from '@material-ui/core/Step';\nimport StepLabel from '@material-ui/core/StepLabel';\nimport Stepper from '@material-ui/core/Stepper';\nimport Typography from '@material-ui/core/Typography';\nimport {\n ArgoRolloutCanaryStep,\n SetWeightStep,\n PauseStep,\n AnalysisStep,\n} from './types';\n\ninterface StepsProgressProps {\n currentStepIndex: number;\n aborted: boolean;\n steps: ArgoRolloutCanaryStep[];\n children?: ReactNode;\n}\n\nconst isSetWeightStep = (step: ArgoRolloutCanaryStep): step is SetWeightStep =>\n step.hasOwnProperty('setWeight');\n\nconst isPauseStep = (step: ArgoRolloutCanaryStep): step is PauseStep =>\n step.hasOwnProperty('pause');\n\nconst isAnalysisStep = (step: ArgoRolloutCanaryStep): step is AnalysisStep =>\n step.hasOwnProperty('analysis');\n\nconst createLabelForStep = (step: ArgoRolloutCanaryStep): ReactNode => {\n if (isSetWeightStep(step)) {\n return `setWeight ${step.setWeight}%`;\n } else if (isPauseStep(step)) {\n return step.pause.duration === undefined\n ? 'infinite pause'\n : `pause for ${step.pause.duration}`;\n } else if (isAnalysisStep(step)) {\n return (\n <div>\n <Typography paragraph>analysis templates:</Typography>\n {step.analysis.templates.map((t, i) => (\n <Typography paragraph key={i}>{`${t.templateName}${\n t.clusterScope ? ' (cluster scoped)' : ''\n }`}</Typography>\n ))}\n </div>\n );\n }\n return 'unknown step';\n};\n\nexport const StepsProgress = ({\n currentStepIndex,\n aborted,\n steps,\n}: StepsProgressProps) => {\n // If the activeStep is greater/equal to the number of steps\n // Then the canary is being promoted\n // Increase the step index to mark the 'canary promoted' step as done also\n const activeStepIndex =\n currentStepIndex >= steps.length ? currentStepIndex + 1 : currentStepIndex;\n\n /*\n * When the Rollout is aborted set the active step to -1\n * otherwise it appears to always be on the first step\n */\n return (\n <Stepper activeStep={aborted ? -1 : activeStepIndex} alternativeLabel>\n {steps\n .map((step, i) => (\n <Step key={i}>\n <StepLabel data-testid={`step-${i}`}>\n {createLabelForStep(step)}\n </StepLabel>\n </Step>\n ))\n .concat(\n <Step key=\"-1\">\n <StepLabel data-testid=\"step--1\">Canary promoted</StepLabel>\n </Step>,\n )}\n </Stepper>\n );\n};\n"],"names":[],"mappings":";;;;;;AAmCA,MAAM,eAAkB,GAAA,CAAC,IACvB,KAAA,IAAA,CAAK,eAAe,WAAW,CAAA;AAEjC,MAAM,WAAc,GAAA,CAAC,IACnB,KAAA,IAAA,CAAK,eAAe,OAAO,CAAA;AAE7B,MAAM,cAAiB,GAAA,CAAC,IACtB,KAAA,IAAA,CAAK,eAAe,UAAU,CAAA;AAEhC,MAAM,kB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,qBACT,GAAA,CAAA,IAAA,EAAA,EACC,QAAC,kBAAA,GAAA,CAAA,SAAA,EAAA,EAAU,aAAa,EAAA,CAAA,KAAA,EAAQ,CAAC,CAAA,CAAA,EAC9B,QAAmB,EAAA,kBAAA,CAAA,IAAI,CAC1B,EAAA,CAAA,EAAA,EAHS,CAIX,CACD,CACA,CAAA,MAAA;AAAA,oBACC,GAAA,CAAC,QACC,QAAC,kBAAA,GAAA,CAAA,SAAA,EAAA,EAAU,eAAY,SAAU,EAAA,QAAA,EAAA,iBAAA,EAAe,KADxC,IAEV;AAAA,GAEN,EAAA,CAAA;AAEJ;;;;"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { jsx, Fragment } from 'react/jsx-runtime';
|
|
2
|
+
import { useContext } from 'react';
|
|
2
3
|
import lodash from 'lodash';
|
|
3
4
|
import { RolloutAccordions } from './ArgoRollouts/Rollout.esm.js';
|
|
4
5
|
import { DefaultCustomResourceAccordions } from './DefaultCustomResource.esm.js';
|
|
@@ -23,21 +24,21 @@ const kindToResource = (customResources) => {
|
|
|
23
24
|
const CustomResources = ({}) => {
|
|
24
25
|
const groupedResponses = useContext(GroupedResponsesContext);
|
|
25
26
|
const kindToResourceMap = kindToResource(groupedResponses.customResources);
|
|
26
|
-
return /* @__PURE__ */
|
|
27
|
+
return /* @__PURE__ */ jsx(Fragment, { children: Object.entries(kindToResourceMap).map(([kind, resources], i) => {
|
|
27
28
|
switch (kind) {
|
|
28
29
|
case "Rollout":
|
|
29
|
-
return /* @__PURE__ */
|
|
30
|
+
return /* @__PURE__ */ jsx(RolloutAccordions, { rollouts: resources }, i);
|
|
30
31
|
default:
|
|
31
|
-
return /* @__PURE__ */
|
|
32
|
+
return /* @__PURE__ */ jsx(
|
|
32
33
|
DefaultCustomResourceAccordions,
|
|
33
34
|
{
|
|
34
|
-
key: i,
|
|
35
35
|
customResources: resources,
|
|
36
36
|
customResourceName: kind
|
|
37
|
-
}
|
|
37
|
+
},
|
|
38
|
+
i
|
|
38
39
|
);
|
|
39
40
|
}
|
|
40
|
-
}));
|
|
41
|
+
}) });
|
|
41
42
|
};
|
|
42
43
|
|
|
43
44
|
export { CustomResources };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CustomResources.esm.js","sources":["../../../src/components/CustomResources/CustomResources.tsx"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport
|
|
1
|
+
{"version":3,"file":"CustomResources.esm.js","sources":["../../../src/components/CustomResources/CustomResources.tsx"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { ReactNode, useContext } from 'react';\nimport lodash, { Dictionary } from 'lodash';\nimport { RolloutAccordions } from './ArgoRollouts';\nimport { DefaultCustomResourceAccordions } from './DefaultCustomResource';\nimport { GroupedResponsesContext } from '../../hooks';\n\n/**\n *\n *\n * @public\n */\nexport interface CustomResourcesProps {\n children?: ReactNode;\n}\n\nconst kindToResource = (customResources: any[]): Dictionary<any[]> => {\n return lodash.groupBy(customResources, value => {\n return value.kind;\n });\n};\n\n/**\n *\n *\n * @public\n */\nexport const CustomResources = ({}: CustomResourcesProps) => {\n const groupedResponses = useContext(GroupedResponsesContext);\n const kindToResourceMap = kindToResource(groupedResponses.customResources);\n\n return (\n <>\n {Object.entries(kindToResourceMap).map(([kind, resources], i) => {\n switch (kind) {\n case 'Rollout':\n return <RolloutAccordions key={i} rollouts={resources} />;\n default:\n return (\n <DefaultCustomResourceAccordions\n key={i}\n customResources={resources}\n customResourceName={kind}\n />\n );\n }\n })}\n </>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AA+BA,MAAM,cAAA,GAAiB,CAAC,eAA8C,KAAA;AACpE,EAAO,OAAA,MAAA,CAAO,OAAQ,CAAA,eAAA,EAAiB,CAAS,KAAA,KAAA;AAC9C,IAAA,OAAO,KAAM,CAAA,IAAA;AAAA,GACd,CAAA;AACH,CAAA;AAOa,MAAA,eAAA,GAAkB,CAAC,EAA6B,KAAA;AAC3D,EAAM,MAAA,gBAAA,GAAmB,WAAW,uBAAuB,CAAA;AAC3D,EAAM,MAAA,iBAAA,GAAoB,cAAe,CAAA,gBAAA,CAAiB,eAAe,CAAA;AAEzE,EACE,uBAAA,GAAA,CAAA,QAAA,EAAA,EACG,QAAO,EAAA,MAAA,CAAA,OAAA,CAAQ,iBAAiB,CAAA,CAAE,GAAI,CAAA,CAAC,CAAC,IAAA,EAAM,SAAS,CAAA,EAAG,CAAM,KAAA;AAC/D,IAAA,QAAQ,IAAM;AAAA,MACZ,KAAK,SAAA;AACH,QAAA,uBAAQ,GAAA,CAAA,iBAAA,EAAA,EAA0B,QAAU,EAAA,SAAA,EAAA,EAAb,CAAwB,CAAA;AAAA,MACzD;AACE,QACE,uBAAA,GAAA;AAAA,UAAC,+BAAA;AAAA,UAAA;AAAA,YAEC,eAAiB,EAAA,SAAA;AAAA,YACjB,kBAAoB,EAAA;AAAA,WAAA;AAAA,UAFf;AAAA,SAGP;AAAA;AAEN,GACD,CACH,EAAA,CAAA;AAEJ;;;;"}
|