@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 } 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';
|
|
@@ -58,44 +59,72 @@ const DeploymentSummary = ({
|
|
|
58
59
|
const cpuUtil = hpa?.status?.currentMetrics?.find(
|
|
59
60
|
(metric) => metric.type === "Resource" && metric.resource?.name === "cpu"
|
|
60
61
|
)?.resource?.current.averageUtilization;
|
|
61
|
-
return /* @__PURE__ */
|
|
62
|
+
return /* @__PURE__ */ jsxs(
|
|
62
63
|
Grid,
|
|
63
64
|
{
|
|
64
65
|
container: true,
|
|
65
66
|
direction: "row",
|
|
66
67
|
justifyContent: "space-between",
|
|
67
68
|
alignItems: "center",
|
|
68
|
-
spacing: 0
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
69
|
+
spacing: 0,
|
|
70
|
+
children: [
|
|
71
|
+
/* @__PURE__ */ jsx(Grid, { xs: 4, item: true, children: /* @__PURE__ */ jsx(DeploymentDrawer, { deployment }) }),
|
|
72
|
+
hpa && /* @__PURE__ */ jsx(Grid, { item: true, xs: 4, children: /* @__PURE__ */ jsx(HorizontalPodAutoscalerDrawer, { hpa, children: /* @__PURE__ */ jsxs(
|
|
73
|
+
Grid,
|
|
74
|
+
{
|
|
75
|
+
item: true,
|
|
76
|
+
container: true,
|
|
77
|
+
direction: "column",
|
|
78
|
+
justifyContent: "flex-start",
|
|
79
|
+
alignItems: "flex-start",
|
|
80
|
+
spacing: 0,
|
|
81
|
+
children: [
|
|
82
|
+
/* @__PURE__ */ jsx(Grid, { item: true, children: /* @__PURE__ */ jsxs(Typography, { variant: "subtitle2", children: [
|
|
83
|
+
"min replicas ",
|
|
84
|
+
hpa.spec?.minReplicas ?? "?",
|
|
85
|
+
" / max replicas",
|
|
86
|
+
" ",
|
|
87
|
+
hpa.spec?.maxReplicas ?? "?"
|
|
88
|
+
] }) }),
|
|
89
|
+
/* @__PURE__ */ jsx(Grid, { item: true, children: /* @__PURE__ */ jsxs(Typography, { variant: "subtitle2", children: [
|
|
90
|
+
"current CPU usage: ",
|
|
91
|
+
cpuUtil ?? "?",
|
|
92
|
+
"%"
|
|
93
|
+
] }) }),
|
|
94
|
+
/* @__PURE__ */ jsx(Grid, { item: true, children: /* @__PURE__ */ jsxs(Typography, { variant: "subtitle2", children: [
|
|
95
|
+
"target CPU usage: ",
|
|
96
|
+
specCpuUtil ?? "?",
|
|
97
|
+
"%"
|
|
98
|
+
] }) })
|
|
99
|
+
]
|
|
100
|
+
}
|
|
101
|
+
) }) }),
|
|
102
|
+
/* @__PURE__ */ jsxs(
|
|
103
|
+
Grid,
|
|
104
|
+
{
|
|
105
|
+
item: true,
|
|
106
|
+
container: true,
|
|
107
|
+
xs: 4,
|
|
108
|
+
direction: "column",
|
|
109
|
+
justifyContent: "flex-start",
|
|
110
|
+
alignItems: "flex-end",
|
|
111
|
+
spacing: 0,
|
|
112
|
+
children: [
|
|
113
|
+
/* @__PURE__ */ jsx(Grid, { item: true, children: /* @__PURE__ */ jsxs(StatusOK, { children: [
|
|
114
|
+
numberOfCurrentPods,
|
|
115
|
+
" pods"
|
|
116
|
+
] }) }),
|
|
117
|
+
/* @__PURE__ */ jsx(Grid, { item: true, children: numberOfPodsWithErrors > 0 ? /* @__PURE__ */ jsxs(StatusError, { children: [
|
|
118
|
+
numberOfPodsWithErrors,
|
|
119
|
+
" pod",
|
|
120
|
+
numberOfPodsWithErrors > 1 ? "s" : "",
|
|
121
|
+
" with errors"
|
|
122
|
+
] }) : /* @__PURE__ */ jsx(StatusOK, { children: "No pods with errors" }) })
|
|
123
|
+
]
|
|
124
|
+
}
|
|
125
|
+
)
|
|
126
|
+
]
|
|
127
|
+
}
|
|
99
128
|
);
|
|
100
129
|
};
|
|
101
130
|
const DeploymentAccordion = ({
|
|
@@ -107,51 +136,54 @@ const DeploymentAccordion = ({
|
|
|
107
136
|
const podsWithErrors = ownedPods.filter(
|
|
108
137
|
(p) => podNamesWithErrors.has(p.metadata?.name ?? "")
|
|
109
138
|
);
|
|
110
|
-
return /* @__PURE__ */
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
{
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
139
|
+
return /* @__PURE__ */ jsxs(Accordion, { TransitionProps: { unmountOnExit: true }, variant: "outlined", children: [
|
|
140
|
+
/* @__PURE__ */ jsx(AccordionSummary, { expandIcon: /* @__PURE__ */ jsx(ExpandMoreIcon, {}), children: /* @__PURE__ */ jsx(
|
|
141
|
+
DeploymentSummary,
|
|
142
|
+
{
|
|
143
|
+
deployment,
|
|
144
|
+
numberOfCurrentPods: ownedPods.length,
|
|
145
|
+
numberOfPodsWithErrors: podsWithErrors.length,
|
|
146
|
+
hpa: matchingHpa
|
|
147
|
+
}
|
|
148
|
+
) }),
|
|
149
|
+
/* @__PURE__ */ jsx(AccordionDetails, { children: /* @__PURE__ */ jsx(
|
|
150
|
+
PodsTable,
|
|
151
|
+
{
|
|
152
|
+
pods: ownedPods,
|
|
153
|
+
extraColumns: [READY_COLUMNS, RESOURCE_COLUMNS]
|
|
154
|
+
}
|
|
155
|
+
) })
|
|
156
|
+
] });
|
|
125
157
|
};
|
|
126
158
|
const DeploymentsAccordions = ({}) => {
|
|
127
159
|
const groupedResponses = useContext(GroupedResponsesContext);
|
|
128
|
-
return /* @__PURE__ */
|
|
160
|
+
return /* @__PURE__ */ jsx(
|
|
129
161
|
Grid,
|
|
130
162
|
{
|
|
131
163
|
container: true,
|
|
132
164
|
direction: "column",
|
|
133
165
|
justifyContent: "flex-start",
|
|
134
|
-
alignItems: "flex-start"
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
}
|
|
154
|
-
|
|
166
|
+
alignItems: "flex-start",
|
|
167
|
+
children: groupedResponses.deployments.map((deployment, i) => /* @__PURE__ */ jsx(Grid, { container: true, item: true, xs: true, children: /* @__PURE__ */ jsx(Grid, { item: true, xs: true, children: /* @__PURE__ */ jsx(
|
|
168
|
+
DeploymentAccordion,
|
|
169
|
+
{
|
|
170
|
+
matchingHpa: getMatchingHpa(
|
|
171
|
+
{
|
|
172
|
+
name: deployment.metadata?.name,
|
|
173
|
+
namespace: deployment.metadata?.namespace,
|
|
174
|
+
kind: "deployment"
|
|
175
|
+
},
|
|
176
|
+
groupedResponses.horizontalPodAutoscalers
|
|
177
|
+
),
|
|
178
|
+
ownedPods: getOwnedPodsThroughReplicaSets(
|
|
179
|
+
deployment,
|
|
180
|
+
groupedResponses.replicaSets,
|
|
181
|
+
groupedResponses.pods
|
|
182
|
+
),
|
|
183
|
+
deployment
|
|
184
|
+
}
|
|
185
|
+
) }) }, i))
|
|
186
|
+
}
|
|
155
187
|
);
|
|
156
188
|
};
|
|
157
189
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DeploymentsAccordions.esm.js","sources":["../../../src/components/DeploymentsAccordions/DeploymentsAccordions.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 {\n V1Deployment,\n V1Pod,\n V2HorizontalPodAutoscaler,\n} from '@kubernetes/client-node';\nimport { PodsTable } from '../Pods';\nimport { DeploymentDrawer } from './DeploymentDrawer';\nimport { HorizontalPodAutoscalerDrawer } from '../HorizontalPodAutoscalers';\nimport {\n getOwnedPodsThroughReplicaSets,\n getMatchingHpa,\n} from '../../utils/owner';\nimport {\n GroupedResponsesContext,\n PodNamesWithErrorsContext,\n} from '../../hooks';\nimport { StatusError, StatusOK } from '@backstage/core-components';\nimport { READY_COLUMNS, RESOURCE_COLUMNS } from '../Pods/PodsTable';\n\ntype DeploymentsAccordionsProps = {\n children?: React.ReactNode;\n};\n\ntype DeploymentAccordionProps = {\n deployment: V1Deployment;\n ownedPods: V1Pod[];\n matchingHpa?: V2HorizontalPodAutoscaler;\n children?: React.ReactNode;\n};\n\ntype DeploymentSummaryProps = {\n deployment: V1Deployment;\n numberOfCurrentPods: number;\n numberOfPodsWithErrors: number;\n hpa?: V2HorizontalPodAutoscaler;\n children?: React.ReactNode;\n};\n\nconst DeploymentSummary = ({\n deployment,\n numberOfCurrentPods,\n numberOfPodsWithErrors,\n hpa,\n}: DeploymentSummaryProps) => {\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={4} item>\n <DeploymentDrawer deployment={deployment} />\n </Grid>\n {hpa && (\n <Grid item xs={4}>\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={4}\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 </Grid>\n );\n};\n\nconst DeploymentAccordion = ({\n deployment,\n ownedPods,\n matchingHpa,\n}: DeploymentAccordionProps) => {\n const podNamesWithErrors = useContext(PodNamesWithErrorsContext);\n\n const podsWithErrors = ownedPods.filter(p =>\n podNamesWithErrors.has(p.metadata?.name ?? ''),\n );\n\n return (\n <Accordion TransitionProps={{ unmountOnExit: true }} variant=\"outlined\">\n <AccordionSummary expandIcon={<ExpandMoreIcon />}>\n <DeploymentSummary\n deployment={deployment}\n numberOfCurrentPods={ownedPods.length}\n numberOfPodsWithErrors={podsWithErrors.length}\n hpa={matchingHpa}\n />\n </AccordionSummary>\n <AccordionDetails>\n <PodsTable\n pods={ownedPods}\n extraColumns={[READY_COLUMNS, RESOURCE_COLUMNS]}\n />\n </AccordionDetails>\n </Accordion>\n );\n};\n\nexport const DeploymentsAccordions = ({}: DeploymentsAccordionsProps) => {\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 {groupedResponses.deployments.map((deployment, i) => (\n <Grid container item key={i} xs>\n <Grid item xs>\n <DeploymentAccordion\n matchingHpa={getMatchingHpa(\n {\n name: deployment.metadata?.name,\n namespace: deployment.metadata?.namespace,\n kind: 'deployment',\n },\n groupedResponses.horizontalPodAutoscalers,\n )}\n ownedPods={getOwnedPodsThroughReplicaSets(\n deployment,\n groupedResponses.replicaSets,\n groupedResponses.pods,\n )}\n deployment={deployment}\n />\n </Grid>\n </Grid>\n ))}\n </Grid>\n );\n};\n"],"names":["React"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6DA,MAAM,oBAAoB,CAAC;AAAA,EACzB,UAAA;AAAA,EACA,mBAAA;AAAA,EACA,sBAAA;AAAA,EACA;AACF,CAA8B,KAAA;AAC5B,EAAM,MAAA,WAAA,GAAc,GAAK,EAAA,IAAA,EAAM,OAAS,EAAA,IAAA;AAAA,IACtC,YAAU,MAAO,CAAA,IAAA,KAAS,UAAc,IAAA,MAAA,CAAO,UAAU,IAAS,KAAA;AAAA,GACpE,EAAG,UAAU,MAAO,CAAA,kBAAA;AAEpB,EAAM,MAAA,OAAA,GAAU,GAAK,EAAA,MAAA,EAAQ,cAAgB,EAAA,IAAA;AAAA,IAC3C,YAAU,MAAO,CAAA,IAAA,KAAS,UAAc,IAAA,MAAA,CAAO,UAAU,IAAS,KAAA;AAAA,GACpE,EAAG,UAAU,OAAQ,CAAA,kBAAA;AAErB,EACE,uBAAAA,cAAA,CAAA,aAAA;AAAA,IAAC,IAAA;AAAA,IAAA;AAAA,MACC,SAAS,EAAA,IAAA;AAAA,MACT,SAAU,EAAA,KAAA;AAAA,MACV,cAAe,EAAA,eAAA;AAAA,MACf,UAAW,EAAA,QAAA;AAAA,MACX,OAAS,EAAA;AAAA,KAAA;AAAA,oBAETA,cAAA,CAAA,aAAA,CAAC,QAAK,EAAI,EAAA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;AAAA,UACjB,gBAAiB,CAAA;AAAA,SACnB;AAAA,QACA;AAAA;AAAA,KAEJ,CACF,CACD;AAAA,GACH;AAEJ;;;;"}
|
|
1
|
+
{"version":3,"file":"DeploymentsAccordions.esm.js","sources":["../../../src/components/DeploymentsAccordions/DeploymentsAccordions.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 {\n V1Deployment,\n V1Pod,\n V2HorizontalPodAutoscaler,\n} from '@kubernetes/client-node';\nimport { PodsTable } from '../Pods';\nimport { DeploymentDrawer } from './DeploymentDrawer';\nimport { HorizontalPodAutoscalerDrawer } from '../HorizontalPodAutoscalers';\nimport {\n getOwnedPodsThroughReplicaSets,\n getMatchingHpa,\n} from '../../utils/owner';\nimport {\n GroupedResponsesContext,\n PodNamesWithErrorsContext,\n} from '../../hooks';\nimport { StatusError, StatusOK } from '@backstage/core-components';\nimport { READY_COLUMNS, RESOURCE_COLUMNS } from '../Pods/PodsTable';\n\ntype DeploymentsAccordionsProps = {\n children?: ReactNode;\n};\n\ntype DeploymentAccordionProps = {\n deployment: V1Deployment;\n ownedPods: V1Pod[];\n matchingHpa?: V2HorizontalPodAutoscaler;\n children?: ReactNode;\n};\n\ntype DeploymentSummaryProps = {\n deployment: V1Deployment;\n numberOfCurrentPods: number;\n numberOfPodsWithErrors: number;\n hpa?: V2HorizontalPodAutoscaler;\n children?: ReactNode;\n};\n\nconst DeploymentSummary = ({\n deployment,\n numberOfCurrentPods,\n numberOfPodsWithErrors,\n hpa,\n}: DeploymentSummaryProps) => {\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={4} item>\n <DeploymentDrawer deployment={deployment} />\n </Grid>\n {hpa && (\n <Grid item xs={4}>\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={4}\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 </Grid>\n );\n};\n\nconst DeploymentAccordion = ({\n deployment,\n ownedPods,\n matchingHpa,\n}: DeploymentAccordionProps) => {\n const podNamesWithErrors = useContext(PodNamesWithErrorsContext);\n\n const podsWithErrors = ownedPods.filter(p =>\n podNamesWithErrors.has(p.metadata?.name ?? ''),\n );\n\n return (\n <Accordion TransitionProps={{ unmountOnExit: true }} variant=\"outlined\">\n <AccordionSummary expandIcon={<ExpandMoreIcon />}>\n <DeploymentSummary\n deployment={deployment}\n numberOfCurrentPods={ownedPods.length}\n numberOfPodsWithErrors={podsWithErrors.length}\n hpa={matchingHpa}\n />\n </AccordionSummary>\n <AccordionDetails>\n <PodsTable\n pods={ownedPods}\n extraColumns={[READY_COLUMNS, RESOURCE_COLUMNS]}\n />\n </AccordionDetails>\n </Accordion>\n );\n};\n\nexport const DeploymentsAccordions = ({}: DeploymentsAccordionsProps) => {\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 {groupedResponses.deployments.map((deployment, i) => (\n <Grid container item key={i} xs>\n <Grid item xs>\n <DeploymentAccordion\n matchingHpa={getMatchingHpa(\n {\n name: deployment.metadata?.name,\n namespace: deployment.metadata?.namespace,\n kind: 'deployment',\n },\n groupedResponses.horizontalPodAutoscalers,\n )}\n ownedPods={getOwnedPodsThroughReplicaSets(\n deployment,\n groupedResponses.replicaSets,\n groupedResponses.pods,\n )}\n deployment={deployment}\n />\n </Grid>\n </Grid>\n ))}\n </Grid>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6DA,MAAM,oBAAoB,CAAC;AAAA,EACzB,UAAA;AAAA,EACA,mBAAA;AAAA,EACA,sBAAA;AAAA,EACA;AACF,CAA8B,KAAA;AAC5B,EAAM,MAAA,WAAA,GAAc,GA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AA,qBAAA,GAAwB,CAAC,EAAmC,KAAA;AACvE,EAAM,MAAA,gBAAA,GAAmB,WAAW,uBAAuB,CAAA;AAE3D,EACE,uBAAA,GAAA;AAAA,IAAC,IAAA;AAAA,IAAA;AAAA,MACC,SAAS,EAAA,IAAA;AAAA,MACT,SAAU,EAAA,QAAA;AAAA,MACV,cAAe,EAAA,YAAA;AAAA,MACf,UAAW,EAAA,YAAA;AAAA,MAEV,2BAAiB,WAAY,CAAA,GAAA,CAAI,CAAC,UAAY,EAAA,CAAA,yBAC5C,IAAK,EAAA,EAAA,SAAA,EAAS,MAAC,IAAI,EAAA,IAAA,EAAS,IAAE,IAC7B,EAAA,QAAA,kBAAA,GAAA,CAAC,QAAK,IAAI,EAAA,IAAA,EAAC,IAAE,IACX,EAAA,QAAA,kBAAA,GAAA;AAAA,QAAC,mBAAA;AAAA,QAAA;AAAA,UACC,WAAa,EAAA,cAAA;AAAA,YACX;AAAA,cACE,IAAA,EAAM,WAAW,QAAU,EAAA,IAAA;AAAA,cAC3B,SAAA,EAAW,WAAW,QAAU,EAAA,SAAA;AAAA,cAChC,IAAM,EAAA;AAAA,aACR;AAAA,YACA,gBAAiB,CAAA;AAAA,WACnB;AAAA,UACA,SAAW,EAAA,8BAAA;AAAA,YACT,UAAA;AAAA,YACA,gBAAiB,CAAA,WAAA;AAAA,YACjB,gBAAiB,CAAA;AAAA,WACnB;AAAA,UACA;AAAA;AAAA,OACF,EACF,CAlBwB,EAAA,EAAA,CAmB1B,CACD;AAAA;AAAA,GACH;AAEJ;;;;"}
|
|
@@ -1,26 +1,38 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
2
|
import Typography from '@material-ui/core/Typography';
|
|
3
3
|
import { WarningPanel } from '@backstage/core-components';
|
|
4
4
|
|
|
5
5
|
const clustersWithErrorsToErrorMessage = (clustersWithErrors) => {
|
|
6
6
|
return clustersWithErrors.map((c, i) => {
|
|
7
|
-
return /* @__PURE__ */
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
return /* @__PURE__ */ jsxs("div", { children: [
|
|
8
|
+
/* @__PURE__ */ jsx(Typography, { variant: "body2", children: `Cluster: ${c.cluster.title || c.cluster.name}` }),
|
|
9
|
+
c.errors.map((e, j) => {
|
|
10
|
+
return /* @__PURE__ */ jsx(Typography, { variant: "body2", children: e.errorType === "FETCH_ERROR" ? `Error communicating with Kubernetes: ${e.errorType}, message: ${e.message}` : `Error fetching Kubernetes resource: '${e.resourcePath}', error: ${e.errorType}, status code: ${e.statusCode}` }, j);
|
|
11
|
+
}),
|
|
12
|
+
/* @__PURE__ */ jsx("br", {})
|
|
13
|
+
] }, i);
|
|
10
14
|
});
|
|
11
15
|
};
|
|
12
16
|
const ErrorPanel = ({
|
|
13
17
|
entityName,
|
|
14
18
|
errorMessage,
|
|
15
19
|
clustersWithErrors
|
|
16
|
-
}) => /* @__PURE__ */
|
|
20
|
+
}) => /* @__PURE__ */ jsxs(
|
|
17
21
|
WarningPanel,
|
|
18
22
|
{
|
|
19
23
|
title: "There was a problem retrieving Kubernetes objects",
|
|
20
|
-
message: `There was a problem retrieving some Kubernetes resources for the entity: ${entityName}. This could mean that the Error Reporting card is not completely accurate
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
+
message: `There was a problem retrieving some Kubernetes resources for the entity: ${entityName}. This could mean that the Error Reporting card is not completely accurate.`,
|
|
25
|
+
children: [
|
|
26
|
+
clustersWithErrors && /* @__PURE__ */ jsxs("div", { children: [
|
|
27
|
+
"Errors: ",
|
|
28
|
+
clustersWithErrorsToErrorMessage(clustersWithErrors)
|
|
29
|
+
] }),
|
|
30
|
+
errorMessage && /* @__PURE__ */ jsxs(Typography, { variant: "body2", children: [
|
|
31
|
+
"Errors: ",
|
|
32
|
+
errorMessage
|
|
33
|
+
] })
|
|
34
|
+
]
|
|
35
|
+
}
|
|
24
36
|
);
|
|
25
37
|
|
|
26
38
|
export { ErrorPanel };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ErrorPanel.esm.js","sources":["../../../src/components/ErrorPanel/ErrorPanel.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":"ErrorPanel.esm.js","sources":["../../../src/components/ErrorPanel/ErrorPanel.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 Typography from '@material-ui/core/Typography';\nimport { ClusterObjects } from '@backstage/plugin-kubernetes-common';\nimport { WarningPanel } from '@backstage/core-components';\n\nconst clustersWithErrorsToErrorMessage = (\n clustersWithErrors: ClusterObjects[],\n): ReactNode => {\n return clustersWithErrors.map((c, i) => {\n return (\n <div key={i}>\n <Typography variant=\"body2\">{`Cluster: ${\n c.cluster.title || c.cluster.name\n }`}</Typography>\n {c.errors.map((e, j) => {\n return (\n <Typography variant=\"body2\" key={j}>\n {e.errorType === 'FETCH_ERROR'\n ? `Error communicating with Kubernetes: ${e.errorType}, message: ${e.message}`\n : `Error fetching Kubernetes resource: '${e.resourcePath}', error: ${e.errorType}, status code: ${e.statusCode}`}\n </Typography>\n );\n })}\n <br />\n </div>\n );\n });\n};\n\n/**\n *\n *\n * @public\n */\nexport type ErrorPanelProps = {\n entityName: string;\n errorMessage?: string;\n clustersWithErrors?: ClusterObjects[];\n children?: ReactNode;\n};\n\n/**\n *\n *\n * @public\n */\nexport const ErrorPanel = ({\n entityName,\n errorMessage,\n clustersWithErrors,\n}: ErrorPanelProps) => (\n <WarningPanel\n title=\"There was a problem retrieving Kubernetes objects\"\n message={`There was a problem retrieving some Kubernetes resources for the entity: ${entityName}. This could mean that the Error Reporting card is not completely accurate.`}\n >\n {clustersWithErrors && (\n <div>Errors: {clustersWithErrorsToErrorMessage(clustersWithErrors)}</div>\n )}\n {errorMessage && (\n <Typography variant=\"body2\">Errors: {errorMessage}</Typography>\n )}\n </WarningPanel>\n);\n"],"names":[],"mappings":";;;;AAqBA,MAAM,gCAAA,GAAmC,CACvC,kBACc,KAAA;AACd,EAAA,OAAO,kBAAmB,CAAA,GAAA,CAAI,CAAC,CAAA,EAAG,CAAM,KAAA;AACtC,IAAA,4BACG,KACC,EAAA,EAAA,QAAA,EAAA;AAAA,sBAAC,GAAA,CAAA,UAAA,EAAA,EAAW,OAAQ,EAAA,OAAA,EAAS,QAC3B,EAAA,CAAA,SAAA,EAAA,CAAA,CAAE,QAAQ,KAAS,IAAA,CAAA,CAAE,OAAQ,CAAA,IAC/B,CAAG,CAAA,EAAA,CAAA;AAAA,MACF,CAAE,CAAA,MAAA,CAAO,GAAI,CAAA,CAAC,GAAG,CAAM,KAAA;AACtB,QACE,uBAAA,GAAA,CAAC,UAAW,EAAA,EAAA,OAAA,EAAQ,OACjB,EAAA,QAAA,EAAA,CAAA,CAAE,cAAc,aACb,GAAA,CAAA,qCAAA,EAAwC,CAAE,CAAA,SAAS,CAAc,WAAA,EAAA,CAAA,CAAE,OAAO,CAC1E,CAAA,GAAA,CAAA,qCAAA,EAAwC,CAAE,CAAA,YAAY,CAAa,UAAA,EAAA,CAAA,CAAE,SAAS,CAAkB,eAAA,EAAA,CAAA,CAAE,UAAU,CAAA,CAAA,EAAA,EAHjF,CAIjC,CAAA;AAAA,OAEH,CAAA;AAAA,0BACA,IAAG,EAAA,EAAA;AAAA,KAAA,EAAA,EAbI,CAcV,CAAA;AAAA,GAEH,CAAA;AACH,CAAA;AAmBO,MAAM,aAAa,CAAC;AAAA,EACzB,UAAA;AAAA,EACA,YAAA;AAAA,EACA;AACF,CACE,qBAAA,IAAA;AAAA,EAAC,YAAA;AAAA,EAAA;AAAA,IACC,KAAM,EAAA,mDAAA;AAAA,IACN,OAAA,EAAS,4EAA4E,UAAU,CAAA,2EAAA,CAAA;AAAA,IAE9F,QAAA,EAAA;AAAA,MAAA,kBAAA,yBACE,KAAI,EAAA,EAAA,QAAA,EAAA;AAAA,QAAA,UAAA;AAAA,QAAS,iCAAiC,kBAAkB;AAAA,OAAE,EAAA,CAAA;AAAA,MAEpE,YACC,oBAAA,IAAA,CAAC,UAAW,EAAA,EAAA,OAAA,EAAQ,OAAQ,EAAA,QAAA,EAAA;AAAA,QAAA,UAAA;AAAA,QAAS;AAAA,OAAa,EAAA;AAAA;AAAA;AAEtD;;;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
|
|
2
2
|
import { Table } from '@backstage/core-components';
|
|
3
3
|
|
|
4
4
|
const columns = [
|
|
@@ -21,7 +21,10 @@ const columns = [
|
|
|
21
21
|
title: "name",
|
|
22
22
|
width: "30%",
|
|
23
23
|
render: (row) => {
|
|
24
|
-
return /* @__PURE__ */
|
|
24
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
25
|
+
row.error.sourceRef.name,
|
|
26
|
+
" "
|
|
27
|
+
] });
|
|
25
28
|
}
|
|
26
29
|
},
|
|
27
30
|
{
|
|
@@ -48,7 +51,7 @@ const ErrorReporting = ({
|
|
|
48
51
|
error: e
|
|
49
52
|
}));
|
|
50
53
|
}).sort(sortBySeverity);
|
|
51
|
-
return /* @__PURE__ */
|
|
54
|
+
return /* @__PURE__ */ jsx(Fragment, { children: errors.length !== 0 && /* @__PURE__ */ jsx(
|
|
52
55
|
Table,
|
|
53
56
|
{
|
|
54
57
|
title: "Error Reporting",
|
|
@@ -56,7 +59,7 @@ const ErrorReporting = ({
|
|
|
56
59
|
columns,
|
|
57
60
|
options: { paging: true, search: false, emptyRowsWhenPaging: false }
|
|
58
61
|
}
|
|
59
|
-
));
|
|
62
|
+
) });
|
|
60
63
|
};
|
|
61
64
|
|
|
62
65
|
export { ErrorReporting };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ErrorReporting.esm.js","sources":["../../../src/components/ErrorReporting/ErrorReporting.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 */\nimport
|
|
1
|
+
{"version":3,"file":"ErrorReporting.esm.js","sources":["../../../src/components/ErrorReporting/ErrorReporting.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 */\nimport {\n ClusterAttributes,\n DetectedError,\n DetectedErrorsByCluster,\n} from '@backstage/plugin-kubernetes-common';\nimport { Table, TableColumn } from '@backstage/core-components';\n\n/**\n *\n *\n * @public\n */\nexport type ErrorReportingProps = {\n detectedErrors: DetectedErrorsByCluster;\n clusters: ClusterAttributes[];\n};\n\nconst columns: TableColumn<Row>[] = [\n {\n title: 'cluster',\n width: '10%',\n render: (row: Row) => row.cluster.title || row.cluster.name,\n },\n {\n title: 'namespace',\n width: '10%',\n render: (row: Row) => row.error.sourceRef.namespace,\n },\n {\n title: 'kind',\n width: '10%',\n render: (row: Row) => row.error.sourceRef.kind,\n },\n {\n title: 'name',\n width: '30%',\n render: (row: Row) => {\n return <>{row.error.sourceRef.name} </>;\n },\n },\n {\n title: 'messages',\n width: '40%',\n render: (row: Row) => row.error.message,\n },\n];\n\ninterface Row {\n cluster: ClusterAttributes;\n error: DetectedError;\n}\n\nconst sortBySeverity = (a: Row, b: Row) => {\n if (a.error.severity < b.error.severity) {\n return 1;\n } else if (b.error.severity < a.error.severity) {\n return -1;\n }\n return 0;\n};\n\n/**\n *\n *\n * @public\n */\nexport const ErrorReporting = ({\n detectedErrors,\n clusters,\n}: ErrorReportingProps) => {\n const errors = Array.from(detectedErrors.entries())\n .flatMap(([clusterName, resourceErrors]) => {\n return resourceErrors.map(e => ({\n cluster: clusters.find(c => c.name === clusterName)!,\n error: e,\n }));\n })\n .sort(sortBySeverity);\n\n return (\n <>\n {errors.length !== 0 && (\n <Table\n title=\"Error Reporting\"\n data={errors}\n columns={columns}\n options={{ paging: true, search: false, emptyRowsWhenPaging: false }}\n />\n )}\n </>\n );\n};\n"],"names":[],"mappings":";;;AAgCA,MAAM,OAA8B,GAAA;AAAA,EAClC;AAAA,IACE,KAAO,EAAA,SAAA;AAAA,IACP,KAAO,EAAA,KAAA;AAAA,IACP,QAAQ,CAAC,GAAA,KAAa,IAAI,OAAQ,CAAA,KAAA,IAAS,IAAI,OAAQ,CAAA;AAAA,GACzD;AAAA,EACA;AAAA,IACE,KAAO,EAAA,WAAA;AAAA,IACP,KAAO,EAAA,KAAA;AAAA,IACP,MAAQ,EAAA,CAAC,GAA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C9B,SAAS,QAAS,CAAA,IAAA,CAAK,CAAK,CAAA,KAAA,CAAA,CAAE,SAAS,WAAW,CAAA;AAAA,MAClD,KAAO,EAAA;AAAA,KACP,CAAA,CAAA;AAAA,GACH,CACA,CAAA,IAAA,CAAK,cAAc,CAAA;AAEtB,EACE,uBAAA,GAAA,CAAA,QAAA,EAAA,EACG,QAAO,EAAA,MAAA,CAAA,MAAA,KAAW,CACjB,oBAAA,GAAA;AAAA,IAAC,KAAA;AAAA,IAAA;AAAA,MACC,KAAM,EAAA,iBAAA;AAAA,MACN,IAAM,EAAA,MAAA;AAAA,MACN,OAAA;AAAA,MACA,SAAS,EAAE,MAAA,EAAQ,MAAM,MAAQ,EAAA,KAAA,EAAO,qBAAqB,KAAM;AAAA;AAAA,GAGzE,EAAA,CAAA;AAEJ;;;;"}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { jsx } 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
|
|
|
9
10
|
const HorizontalPodAutoscalerDrawer = (props) => {
|
|
10
11
|
const { hpa, expanded, children } = props;
|
|
@@ -14,7 +15,7 @@ const HorizontalPodAutoscalerDrawer = (props) => {
|
|
|
14
15
|
const cpuUtil = hpa?.status?.currentMetrics?.find(
|
|
15
16
|
(metric) => metric.type === "Resource" && metric.resource?.name === "cpu"
|
|
16
17
|
)?.resource?.current.averageUtilization;
|
|
17
|
-
return /* @__PURE__ */
|
|
18
|
+
return /* @__PURE__ */ jsx(
|
|
18
19
|
KubernetesStructuredMetadataTableDrawer,
|
|
19
20
|
{
|
|
20
21
|
kind: "HorizontalPodAutoscaler",
|
|
@@ -30,9 +31,9 @@ const HorizontalPodAutoscalerDrawer = (props) => {
|
|
|
30
31
|
desiredReplicas: hpaObject.status?.desiredReplicas,
|
|
31
32
|
lastScaleTime: hpa?.status?.lastScaleTime
|
|
32
33
|
};
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
|
|
34
|
+
},
|
|
35
|
+
children
|
|
36
|
+
}
|
|
36
37
|
);
|
|
37
38
|
};
|
|
38
39
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HorizontalPodAutoscalerDrawer.esm.js","sources":["../../../src/components/HorizontalPodAutoscalers/HorizontalPodAutoscalerDrawer.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":"HorizontalPodAutoscalerDrawer.esm.js","sources":["../../../src/components/HorizontalPodAutoscalers/HorizontalPodAutoscalerDrawer.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 { V2HorizontalPodAutoscaler } from '@kubernetes/client-node';\nimport { KubernetesStructuredMetadataTableDrawer } from '../KubernetesDrawer';\n\n/** @public */\nexport const HorizontalPodAutoscalerDrawer = (props: {\n hpa: V2HorizontalPodAutoscaler;\n expanded?: boolean;\n children?: ReactNode;\n}) => {\n const { hpa, expanded, children } = props;\n\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 <KubernetesStructuredMetadataTableDrawer\n kind=\"HorizontalPodAutoscaler\"\n object={hpa}\n expanded={expanded}\n renderObject={(hpaObject: V2HorizontalPodAutoscaler) => {\n return {\n targetCPUUtilizationPercentage: specCpuUtil,\n currentCPUUtilizationPercentage: cpuUtil,\n minReplicas: hpaObject.spec?.minReplicas,\n maxReplicas: hpaObject.spec?.maxReplicas,\n currentReplicas: hpaObject.status?.currentReplicas,\n desiredReplicas: hpaObject.status?.desiredReplicas,\n lastScaleTime: hpa?.status?.lastScaleTime,\n };\n }}\n >\n {children}\n </KubernetesStructuredMetadataTableDrawer>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;AAqBa,MAAA,6BAAA,GAAgC,CAAC,KAIxC,KAAA;AACJ,EAAA,MAAM,EAAE,GAAA,EAAK,QAAU,EAAA,QAAA,EAAa,GAAA,KAAA;AAEpC,EAAM,MAAA,WAAA,GAAc,GAAK,EAAA,IAAA,EAAM,OAAS,EAAA,IAAA;AAAA,IACtC,YAAU,MAAO,CAAA,IAAA,KAAS,UAAc,IAAA,MAAA,CAAO,UAAU,IAAS,KAAA;AAAA,GACpE,EAAG,UAAU,MAAO,CAAA,kBAAA;AAEpB,EAAM,MAAA,OAAA,GAAU,GAAK,EAAA,MAAA,EAAQ,cAAgB,EAAA,IAAA;AAAA,IAC3C,YAAU,MAAO,CAAA,IAAA,KAAS,UAAc,IAAA,MAAA,CAAO,UAAU,IAAS,KAAA;AAAA,GACpE,EAAG,UAAU,OAAQ,CAAA,kBAAA;AAErB,EACE,uBAAA,GAAA;AAAA,IAAC,uCAAA;AAAA,IAAA;AAAA,MACC,IAAK,EAAA,yBAAA;AAAA,MACL,MAAQ,EAAA,GAAA;AAAA,MACR,QAAA;AAAA,MACA,YAAA,EAAc,CAAC,SAAyC,KAAA;AACtD,QAAO,OAAA;AAAA,UACL,8BAAgC,EAAA,WAAA;AAAA,UAChC,+BAAiC,EAAA,OAAA;AAAA,UACjC,WAAA,EAAa,UAAU,IAAM,EAAA,WAAA;AAAA,UAC7B,WAAA,EAAa,UAAU,IAAM,EAAA,WAAA;AAAA,UAC7B,eAAA,EAAiB,UAAU,MAAQ,EAAA,eAAA;AAAA,UACnC,eAAA,EAAiB,UAAU,MAAQ,EAAA,eAAA;AAAA,UACnC,aAAA,EAAe,KAAK,MAAQ,EAAA;AAAA,SAC9B;AAAA,OACF;AAAA,MAEC;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,7 +15,7 @@ const IngressDrawer = ({
|
|
|
14
15
|
expanded
|
|
15
16
|
}) => {
|
|
16
17
|
const namespace = ingress.metadata?.namespace;
|
|
17
|
-
return /* @__PURE__ */
|
|
18
|
+
return /* @__PURE__ */ jsx(
|
|
18
19
|
KubernetesStructuredMetadataTableDrawer,
|
|
19
20
|
{
|
|
20
21
|
object: ingress,
|
|
@@ -22,21 +23,23 @@ const IngressDrawer = ({
|
|
|
22
23
|
kind: "Ingress",
|
|
23
24
|
renderObject: (ingressObject) => {
|
|
24
25
|
return ingressObject.spec || {};
|
|
25
|
-
}
|
|
26
|
-
},
|
|
27
|
-
/* @__PURE__ */ React__default.createElement(
|
|
28
|
-
Grid,
|
|
29
|
-
{
|
|
30
|
-
container: true,
|
|
31
|
-
direction: "column",
|
|
32
|
-
justifyContent: "flex-start",
|
|
33
|
-
alignItems: "flex-start",
|
|
34
|
-
spacing: 0
|
|
35
26
|
},
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
27
|
+
children: /* @__PURE__ */ jsxs(
|
|
28
|
+
Grid,
|
|
29
|
+
{
|
|
30
|
+
container: true,
|
|
31
|
+
direction: "column",
|
|
32
|
+
justifyContent: "flex-start",
|
|
33
|
+
alignItems: "flex-start",
|
|
34
|
+
spacing: 0,
|
|
35
|
+
children: [
|
|
36
|
+
/* @__PURE__ */ jsx(Grid, { item: true, children: /* @__PURE__ */ jsx(Typography, { variant: "body1", children: ingress.metadata?.name ?? "unknown object" }) }),
|
|
37
|
+
/* @__PURE__ */ jsx(Grid, { item: true, children: /* @__PURE__ */ jsx(Typography, { color: "textSecondary", variant: "subtitle1", children: "Ingress" }) }),
|
|
38
|
+
namespace && /* @__PURE__ */ jsx(Grid, { item: true, children: /* @__PURE__ */ jsx(Chip, { size: "small", label: `namespace: ${namespace}` }) })
|
|
39
|
+
]
|
|
40
|
+
}
|
|
41
|
+
)
|
|
42
|
+
}
|
|
40
43
|
);
|
|
41
44
|
};
|
|
42
45
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IngressDrawer.esm.js","sources":["../../../src/components/IngressesAccordions/IngressDrawer.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":"IngressDrawer.esm.js","sources":["../../../src/components/IngressesAccordions/IngressDrawer.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 { V1Ingress } from '@kubernetes/client-node';\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 IngressDrawer = ({\n ingress,\n expanded,\n}: {\n ingress: V1Ingress;\n expanded?: boolean;\n}) => {\n const namespace = ingress.metadata?.namespace;\n return (\n <KubernetesStructuredMetadataTableDrawer\n object={ingress}\n expanded={expanded}\n kind=\"Ingress\"\n renderObject={(ingressObject: V1Ingress) => {\n return ingressObject.spec || {};\n }}\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 {ingress.metadata?.name ?? 'unknown object'}\n </Typography>\n </Grid>\n <Grid item>\n <Typography color=\"textSecondary\" variant=\"subtitle1\">\n Ingress\n </Typography>\n </Grid>\n {namespace && (\n <Grid item>\n <Chip size=\"small\" label={`namespace: ${namespace}`} />\n </Grid>\n )}\n </Grid>\n </KubernetesStructuredMetadataTableDrawer>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;AAsBO,MAAM,gBAAgB,CAAC;AAAA,EAC5B,OAAA;AAAA,EACA;AACF,CAGM,KAAA;AACJ,EAAM,MAAA,SAAA,GAAY,QAAQ,QAAU,EAAA,SAAA;AACpC,EACE,uBAAA,GAAA;AAAA,IAAC,uCAAA;AAAA,IAAA;AAAA,MACC,MAAQ,EAAA,OAAA;AAAA,MACR,QAAA;AAAA,MACA,IAAK,EAAA,SAAA;AAAA,MACL,YAAA,EAAc,CAAC,aAA6B,KAAA;AAC1C,QAAO,OAAA,aAAA,CAAc,QAAQ,EAAC;AAAA,OAChC;AAAA,MAEA,QAAA,kBAAA,IAAA;AAAA,QAAC,IAAA;AAAA,QAAA;AAAA,UACC,SAAS,EAAA,IAAA;AAAA,UACT,SAAU,EAAA,QAAA;AAAA,UACV,cAAe,EAAA,YAAA;AAAA,UACf,UAAW,EAAA,YAAA;AAAA,UACX,OAAS,EAAA,CAAA;AAAA,UAET,QAAA,EAAA;AAAA,4BAAC,GAAA,CAAA,IAAA,EAAA,EAAK,IAAI,EAAA,IAAA,EACR,QAAC,kBAAA,GAAA,CAAA,UAAA,EAAA,EAAW,OAAQ,EAAA,OAAA,EACjB,QAAQ,EAAA,OAAA,CAAA,QAAA,EAAU,IAAQ,IAAA,gBAAA,EAC7B,CACF,EAAA,CAAA;AAAA,4BACA,GAAA,CAAC,IAAK,EAAA,EAAA,IAAA,EAAI,IACR,EAAA,QAAA,kBAAA,GAAA,CAAC,UAAW,EAAA,EAAA,KAAA,EAAM,eAAgB,EAAA,OAAA,EAAQ,WAAY,EAAA,QAAA,EAAA,SAAA,EAEtD,CACF,EAAA,CAAA;AAAA,YACC,SACC,oBAAA,GAAA,CAAC,IAAK,EAAA,EAAA,IAAA,EAAI,IACR,EAAA,QAAA,kBAAA,GAAA,CAAC,IAAK,EAAA,EAAA,IAAA,EAAK,OAAQ,EAAA,KAAA,EAAO,CAAc,WAAA,EAAA,SAAS,IAAI,CACvD,EAAA;AAAA;AAAA;AAAA;AAEJ;AAAA,GACF;AAEJ;;;;"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { jsx, jsxs } 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';
|
|
@@ -20,19 +21,19 @@ import '../../hooks/useMatchingErrors.esm.js';
|
|
|
20
21
|
import { StructuredMetadataTable } from '@backstage/core-components';
|
|
21
22
|
|
|
22
23
|
const IngressSummary = ({ ingress }) => {
|
|
23
|
-
return /* @__PURE__ */
|
|
24
|
+
return /* @__PURE__ */ jsx(
|
|
24
25
|
Grid,
|
|
25
26
|
{
|
|
26
27
|
container: true,
|
|
27
28
|
direction: "row",
|
|
28
29
|
justifyContent: "flex-start",
|
|
29
|
-
alignItems: "center"
|
|
30
|
-
|
|
31
|
-
|
|
30
|
+
alignItems: "center",
|
|
31
|
+
children: /* @__PURE__ */ jsx(Grid, { xs: 12, item: true, children: /* @__PURE__ */ jsx(IngressDrawer, { ingress }) })
|
|
32
|
+
}
|
|
32
33
|
);
|
|
33
34
|
};
|
|
34
35
|
const IngressCard = ({ ingress }) => {
|
|
35
|
-
return /* @__PURE__ */
|
|
36
|
+
return /* @__PURE__ */ jsx(
|
|
36
37
|
StructuredMetadataTable,
|
|
37
38
|
{
|
|
38
39
|
metadata: {
|
|
@@ -45,19 +46,22 @@ const IngressCard = ({ ingress }) => {
|
|
|
45
46
|
);
|
|
46
47
|
};
|
|
47
48
|
const IngressAccordion = ({ ingress }) => {
|
|
48
|
-
return /* @__PURE__ */
|
|
49
|
+
return /* @__PURE__ */ jsxs(Accordion, { TransitionProps: { unmountOnExit: true }, children: [
|
|
50
|
+
/* @__PURE__ */ jsx(AccordionSummary, { expandIcon: /* @__PURE__ */ jsx(ExpandMoreIcon, {}), children: /* @__PURE__ */ jsx(IngressSummary, { ingress }) }),
|
|
51
|
+
/* @__PURE__ */ jsx(AccordionDetails, { children: /* @__PURE__ */ jsx(IngressCard, { ingress }) })
|
|
52
|
+
] });
|
|
49
53
|
};
|
|
50
54
|
const IngressesAccordions = ({}) => {
|
|
51
55
|
const groupedResponses = useContext(GroupedResponsesContext);
|
|
52
|
-
return /* @__PURE__ */
|
|
56
|
+
return /* @__PURE__ */ jsx(
|
|
53
57
|
Grid,
|
|
54
58
|
{
|
|
55
59
|
container: true,
|
|
56
60
|
direction: "row",
|
|
57
61
|
justifyContent: "flex-start",
|
|
58
|
-
alignItems: "flex-start"
|
|
59
|
-
|
|
60
|
-
|
|
62
|
+
alignItems: "flex-start",
|
|
63
|
+
children: groupedResponses.ingresses.map((ingress, i) => /* @__PURE__ */ jsx(Grid, { item: true, xs: true, children: /* @__PURE__ */ jsx(IngressAccordion, { ingress }) }, i))
|
|
64
|
+
}
|
|
61
65
|
);
|
|
62
66
|
};
|
|
63
67
|
|