@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,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 { renderCondition } from '../../utils/pod.esm.js';
|
|
9
10
|
import Typography from '@material-ui/core/Typography';
|
|
10
11
|
import Grid from '@material-ui/core/Grid';
|
|
@@ -15,7 +16,7 @@ const StatefulSetDrawer = ({
|
|
|
15
16
|
expanded
|
|
16
17
|
}) => {
|
|
17
18
|
const namespace = statefulset.metadata?.namespace;
|
|
18
|
-
return /* @__PURE__ */
|
|
19
|
+
return /* @__PURE__ */ jsx(
|
|
19
20
|
KubernetesStructuredMetadataTableDrawer,
|
|
20
21
|
{
|
|
21
22
|
object: statefulset,
|
|
@@ -34,21 +35,23 @@ const StatefulSetDrawer = ({
|
|
|
34
35
|
revisionHistoryLimit: statefulset.spec?.revisionHistoryLimit ?? "???",
|
|
35
36
|
...conditions
|
|
36
37
|
};
|
|
37
|
-
}
|
|
38
|
-
},
|
|
39
|
-
/* @__PURE__ */ React__default.createElement(
|
|
40
|
-
Grid,
|
|
41
|
-
{
|
|
42
|
-
container: true,
|
|
43
|
-
direction: "column",
|
|
44
|
-
justifyContent: "flex-start",
|
|
45
|
-
alignItems: "flex-start",
|
|
46
|
-
spacing: 0
|
|
47
38
|
},
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
39
|
+
children: /* @__PURE__ */ jsxs(
|
|
40
|
+
Grid,
|
|
41
|
+
{
|
|
42
|
+
container: true,
|
|
43
|
+
direction: "column",
|
|
44
|
+
justifyContent: "flex-start",
|
|
45
|
+
alignItems: "flex-start",
|
|
46
|
+
spacing: 0,
|
|
47
|
+
children: [
|
|
48
|
+
/* @__PURE__ */ jsx(Grid, { item: true, children: /* @__PURE__ */ jsx(Typography, { variant: "body1", children: statefulset.metadata?.name ?? "unknown object" }) }),
|
|
49
|
+
/* @__PURE__ */ jsx(Grid, { item: true, children: /* @__PURE__ */ jsx(Typography, { color: "textSecondary", variant: "subtitle1", children: "Stateful Set" }) }),
|
|
50
|
+
namespace && /* @__PURE__ */ jsx(Grid, { item: true, children: /* @__PURE__ */ jsx(Chip, { size: "small", label: `namespace: ${namespace}` }) })
|
|
51
|
+
]
|
|
52
|
+
}
|
|
53
|
+
)
|
|
54
|
+
}
|
|
52
55
|
);
|
|
53
56
|
};
|
|
54
57
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StatefulSetDrawer.esm.js","sources":["../../../src/components/StatefulSetsAccordions/StatefulSetDrawer.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":"StatefulSetDrawer.esm.js","sources":["../../../src/components/StatefulSetsAccordions/StatefulSetDrawer.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 { V1StatefulSet } from '@kubernetes/client-node';\nimport { KubernetesStructuredMetadataTableDrawer } from '../KubernetesDrawer';\nimport { renderCondition } from '../../utils/pod';\nimport Typography from '@material-ui/core/Typography';\nimport Grid from '@material-ui/core/Grid';\nimport Chip from '@material-ui/core/Chip';\n\nexport const StatefulSetDrawer = ({\n statefulset,\n expanded,\n}: {\n statefulset: V1StatefulSet;\n expanded?: boolean;\n}) => {\n const namespace = statefulset.metadata?.namespace;\n return (\n <KubernetesStructuredMetadataTableDrawer\n object={statefulset}\n expanded={expanded}\n kind=\"StatefulSet\"\n renderObject={(statefulsetObj: V1StatefulSet) => {\n const conditions = (statefulsetObj.status?.conditions ?? [])\n .map(renderCondition)\n .reduce((accum, next) => {\n accum[next[0]] = next[1];\n return accum;\n }, {} as { [key: string]: ReactNode });\n\n return {\n updateStrategy: statefulset.spec?.updateStrategy ?? '???',\n podManagementPolicy: statefulset.spec?.podManagementPolicy ?? '???',\n serviceName: statefulset.spec?.serviceName ?? '???',\n selector: statefulset.spec?.selector ?? '???',\n revisionHistoryLimit: statefulset.spec?.revisionHistoryLimit ?? '???',\n ...conditions,\n };\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 {statefulset.metadata?.name ?? 'unknown object'}\n </Typography>\n </Grid>\n <Grid item>\n <Typography color=\"textSecondary\" variant=\"subtitle1\">\n Stateful Set\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":";;;;;;;;;;;;;AAwBO,MAAM,oBAAoB,CAAC;AAAA,EAChC,WAAA;AAAA,EACA;AACF,CAGM,KAAA;AACJ,EAAM,MAAA,SAAA,GAAY,YAAY,QAAU,EAAA,SAAA;AACxC,EACE,uBAAA,GAAA;AAAA,IAAC,uCAAA;AAAA,IAAA;AAAA,MACC,MAAQ,EAAA,WAAA;AAAA,MACR,QAAA;AAAA,MACA,IAAK,EAAA,aAAA;AAAA,MACL,YAAA,EAAc,CAAC,cAAkC,KAAA;AAC/C,QAAA,MAAM,UAAc,GAAA,CAAA,cAAA,CAAe,MAAQ,EAAA,UAAA,IAAc,EAAC,EACvD,GAAI,CAAA,eAAe,CACnB,CAAA,MAAA,CAAO,CAAC,KAAA,EAAO,IAAS,KAAA;AACvB,UAAA,KAAA,CAAM,IAAK,CAAA,CAAC,CAAC,CAAA,GAAI,KAAK,CAAC,CAAA;AACvB,UAAO,OAAA,KAAA;AAAA,SACT,EAAG,EAAkC,CAAA;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,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';
|
|
@@ -58,44 +59,72 @@ const StatefulSetSummary = ({
|
|
|
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: 6, item: true, children: /* @__PURE__ */ jsx(StatefulSetDrawer, { statefulset }) }),
|
|
72
|
+
hpa && /* @__PURE__ */ jsx(Grid, { item: true, xs: 3, 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: 3,
|
|
108
|
+
direction: "column",
|
|
109
|
+
justifyContent: "flex-start",
|
|
110
|
+
alignItems: "flex-start",
|
|
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 StatefulSetAccordion = ({
|
|
@@ -107,47 +136,50 @@ const StatefulSetAccordion = ({
|
|
|
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
|
+
StatefulSetSummary,
|
|
142
|
+
{
|
|
143
|
+
statefulset,
|
|
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 StatefulSetsAccordions = ({}) => {
|
|
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
|
-
|
|
166
|
+
alignItems: "flex-start",
|
|
167
|
+
children: groupedResponses.statefulsets.map((statefulset, i) => /* @__PURE__ */ jsx(Grid, { container: true, item: true, xs: true, children: /* @__PURE__ */ jsx(Grid, { item: true, xs: true, children: /* @__PURE__ */ jsx(
|
|
168
|
+
StatefulSetAccordion,
|
|
169
|
+
{
|
|
170
|
+
matchingHpa: getMatchingHpa(
|
|
171
|
+
{
|
|
172
|
+
name: statefulset.metadata?.name,
|
|
173
|
+
namespace: statefulset.metadata?.namespace,
|
|
174
|
+
kind: "statefulset"
|
|
175
|
+
},
|
|
176
|
+
groupedResponses.horizontalPodAutoscalers
|
|
177
|
+
),
|
|
178
|
+
ownedPods: getOwnedResources(statefulset, groupedResponses.pods),
|
|
179
|
+
statefulset
|
|
180
|
+
}
|
|
181
|
+
) }) }, i))
|
|
182
|
+
}
|
|
151
183
|
);
|
|
152
184
|
};
|
|
153
185
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StatefulSetsAccordions.esm.js","sources":["../../../src/components/StatefulSetsAccordions/StatefulSetsAccordions.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 V1Pod,\n V2HorizontalPodAutoscaler,\n V1StatefulSet,\n} from '@kubernetes/client-node';\nimport { PodsTable } from '../Pods';\nimport { StatefulSetDrawer } from './StatefulSetDrawer';\nimport { HorizontalPodAutoscalerDrawer } from '../HorizontalPodAutoscalers';\nimport { getMatchingHpa, getOwnedResources } 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 StatefulSetsAccordionsProps = {\n children?: React.ReactNode;\n};\n\ntype StatefulSetAccordionProps = {\n statefulset: V1StatefulSet;\n ownedPods: V1Pod[];\n matchingHpa?: V2HorizontalPodAutoscaler;\n children?: React.ReactNode;\n};\n\ntype StatefulSetSummaryProps = {\n statefulset: V1StatefulSet;\n numberOfCurrentPods: number;\n numberOfPodsWithErrors: number;\n hpa?: V2HorizontalPodAutoscaler;\n children?: React.ReactNode;\n};\n\nconst StatefulSetSummary = ({\n statefulset,\n numberOfCurrentPods,\n numberOfPodsWithErrors,\n hpa,\n}: StatefulSetSummaryProps) => {\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 <StatefulSetDrawer statefulset={statefulset} />\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-start\"\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 StatefulSetAccordion = ({\n statefulset,\n ownedPods,\n matchingHpa,\n}: StatefulSetAccordionProps) => {\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 <StatefulSetSummary\n statefulset={statefulset}\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 StatefulSetsAccordions = ({}: StatefulSetsAccordionsProps) => {\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.statefulsets.map((statefulset, i) => (\n <Grid container item key={i} xs>\n <Grid item xs>\n <StatefulSetAccordion\n matchingHpa={getMatchingHpa(\n {\n name: statefulset.metadata?.name,\n namespace: statefulset.metadata?.namespace,\n kind: 'statefulset',\n },\n groupedResponses.horizontalPodAutoscalers,\n )}\n ownedPods={getOwnedResources(statefulset, groupedResponses.pods)}\n statefulset={statefulset}\n />\n </Grid>\n </Grid>\n ))}\n </Grid>\n );\n};\n"],"names":["React"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0DA,MAAM,qBAAqB,CAAC;AAAA,EAC1B,WAAA;AAAA,EACA,mBAAA;AAAA,EACA,sBAAA;AAAA,EACA;AACF,CAA+B,KAAA;AAC7B,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,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IAAC,EAAA,GAAA,EAAK,GAAG,EAAE,EAAA,IAAA,EAAA,+CAC5B,IAAK,EAAA,EAAA,IAAA,EAAI,IAAC,EAAA,EAAA,EAAE,IACX,EAAA,kBAAAA,cAAA,CAAA,aAAA;AAAA,MAAC,oBAAA;AAAA,MAAA;AAAA,QACC,WAAa,EAAA,cAAA;AAAA,UACX;AAAA,YACE,IAAA,EAAM,YAAY,QAAU,EAAA,IAAA;AAAA,YAC5B,SAAA,EAAW,YAAY,QAAU,EAAA,SAAA;AAAA,YACjC,IAAM,EAAA;AAAA,WACR;AAAA,UACA,gBAAiB,CAAA;AAAA,SACnB;AAAA,QACA,SAAW,EAAA,iBAAA,CAAkB,WAAa,EAAA,gBAAA,CAAiB,IAAI,CAAA;AAAA,QAC/D;AAAA;AAAA,KAEJ,CACF,CACD;AAAA,GACH;AAEJ;;;;"}
|
|
1
|
+
{"version":3,"file":"StatefulSetsAccordions.esm.js","sources":["../../../src/components/StatefulSetsAccordions/StatefulSetsAccordions.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 V1Pod,\n V2HorizontalPodAutoscaler,\n V1StatefulSet,\n} from '@kubernetes/client-node';\nimport { PodsTable } from '../Pods';\nimport { StatefulSetDrawer } from './StatefulSetDrawer';\nimport { HorizontalPodAutoscalerDrawer } from '../HorizontalPodAutoscalers';\nimport { getMatchingHpa, getOwnedResources } 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 StatefulSetsAccordionsProps = {\n children?: ReactNode;\n};\n\ntype StatefulSetAccordionProps = {\n statefulset: V1StatefulSet;\n ownedPods: V1Pod[];\n matchingHpa?: V2HorizontalPodAutoscaler;\n children?: ReactNode;\n};\n\ntype StatefulSetSummaryProps = {\n statefulset: V1StatefulSet;\n numberOfCurrentPods: number;\n numberOfPodsWithErrors: number;\n hpa?: V2HorizontalPodAutoscaler;\n children?: ReactNode;\n};\n\nconst StatefulSetSummary = ({\n statefulset,\n numberOfCurrentPods,\n numberOfPodsWithErrors,\n hpa,\n}: StatefulSetSummaryProps) => {\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 <StatefulSetDrawer statefulset={statefulset} />\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-start\"\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 StatefulSetAccordion = ({\n statefulset,\n ownedPods,\n matchingHpa,\n}: StatefulSetAccordionProps) => {\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 <StatefulSetSummary\n statefulset={statefulset}\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 StatefulSetsAccordions = ({}: StatefulSetsAccordionsProps) => {\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.statefulsets.map((statefulset, i) => (\n <Grid container item key={i} xs>\n <Grid item xs>\n <StatefulSetAccordion\n matchingHpa={getMatchingHpa(\n {\n name: statefulset.metadata?.name,\n namespace: statefulset.metadata?.namespace,\n kind: 'statefulset',\n },\n groupedResponses.horizontalPodAutoscalers,\n )}\n ownedPods={getOwnedResources(statefulset, groupedResponses.pods)}\n statefulset={statefulset}\n />\n </Grid>\n </Grid>\n ))}\n </Grid>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0DA,MAAM,qBAAqB,CAAC;AAAA,EAC1B,WAAA;AAAA,EACA,mBAAA;AAAA,EACA,sBAAA;AAAA,EACA;AACF,CAA+B,KAAA;AAC7B,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,IAAA;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,CAAA;AAAA,MAET,QAAA,EAAA;AAAA,wBAAC,GAAA,CAAA,IAAA,EAAA,EAAK,IAAI,CAAG,EAAA,IAAA,EAAI,MACf,QAAC,kBAAA,GAAA,CAAA,iBAAA,EAAA,EAAkB,aAA0B,CAC/C,EAAA,CAAA;AAAA,QACC,GAAA,wBACE,IAAK,EAAA,EAAA,IAAA,EAAI,MAAC,EAAI,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B,IAAI,CAAA;AAAA,UAC/D;AAAA;AAAA,OACF,EACF,CAdwB,EAAA,EAAA,CAe1B,CACD;AAAA;AAAA,GACH;AAEJ;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Cluster.esm.js","sources":["../../src/hooks/Cluster.ts"],"sourcesContent":["/*\n * Copyright 2021 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":"Cluster.esm.js","sources":["../../src/hooks/Cluster.ts"],"sourcesContent":["/*\n * Copyright 2021 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 { createContext } from 'react';\nimport { ClusterAttributes } from '@backstage/plugin-kubernetes-common';\n\n/**\n * @public\n */\nexport const ClusterContext = createContext<ClusterAttributes>({\n name: '',\n});\n"],"names":[],"mappings":";;AAqBO,MAAM,iBAAiB,aAAiC,CAAA;AAAA,EAC7D,IAAM,EAAA;AACR,CAAC;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GroupedResponses.esm.js","sources":["../../src/hooks/GroupedResponses.ts"],"sourcesContent":["/*\n * Copyright 2021 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":"GroupedResponses.esm.js","sources":["../../src/hooks/GroupedResponses.ts"],"sourcesContent":["/*\n * Copyright 2021 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 { createContext } from 'react';\nimport { GroupedResponses } from '@backstage/plugin-kubernetes-common';\n\n/**\n *\n *\n * @public\n */\nexport const GroupedResponsesContext = createContext<GroupedResponses>({\n pods: [],\n replicaSets: [],\n deployments: [],\n daemonSets: [],\n services: [],\n configMaps: [],\n horizontalPodAutoscalers: [],\n ingresses: [],\n jobs: [],\n cronJobs: [],\n customResources: [],\n statefulsets: [],\n});\n"],"names":[],"mappings":";;AAuBO,MAAM,0BAA0B,aAAgC,CAAA;AAAA,EACrE,MAAM,EAAC;AAAA,EACP,aAAa,EAAC;AAAA,EACd,aAAa,EAAC;AAAA,EACd,YAAY,EAAC;AAAA,EACb,UAAU,EAAC;AAAA,EACX,YAAY,EAAC;AAAA,EACb,0BAA0B,EAAC;AAAA,EAC3B,WAAW,EAAC;AAAA,EACZ,MAAM,EAAC;AAAA,EACP,UAAU,EAAC;AAAA,EACX,iBAAiB,EAAC;AAAA,EAClB,cAAc;AAChB,CAAC;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PodNamesWithErrors.esm.js","sources":["../../src/hooks/PodNamesWithErrors.ts"],"sourcesContent":["/*\n * Copyright 2021 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":"PodNamesWithErrors.esm.js","sources":["../../src/hooks/PodNamesWithErrors.ts"],"sourcesContent":["/*\n * Copyright 2021 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 { createContext } from 'react';\n\n/**\n * @public\n */\nexport const PodNamesWithErrorsContext = createContext<Set<string>>(\n new Set<string>(),\n);\n"],"names":[],"mappings":";;AAoBO,MAAM,yBAA4B,GAAA,aAAA;AAAA,sBACnC,GAAY;AAClB;;;;"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { createContext } from 'react';
|
|
2
2
|
|
|
3
|
-
const PodNamesWithMetricsContext =
|
|
3
|
+
const PodNamesWithMetricsContext = createContext(/* @__PURE__ */ new Map());
|
|
4
4
|
|
|
5
5
|
export { PodNamesWithMetricsContext };
|
|
6
6
|
//# sourceMappingURL=PodNamesWithMetrics.esm.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PodNamesWithMetrics.esm.js","sources":["../../src/hooks/PodNamesWithMetrics.ts"],"sourcesContent":["/*\n * Copyright 2021 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":"PodNamesWithMetrics.esm.js","sources":["../../src/hooks/PodNamesWithMetrics.ts"],"sourcesContent":["/*\n * Copyright 2021 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 { createContext } from 'react';\nimport { ClientPodStatus } from '@backstage/plugin-kubernetes-common';\n\n/**\n * @public\n */\nexport const PodNamesWithMetricsContext = createContext<\n Map<string, ClientPodStatus>\n>(new Map<string, ClientPodStatus>());\n"],"names":[],"mappings":";;AAqBO,MAAM,0BAA6B,GAAA,aAAA,iBAEpC,IAAA,GAAA,EAA8B;;;;"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { createContext, useContext } from 'react';
|
|
2
2
|
|
|
3
|
-
const DetectedErrorsContext =
|
|
3
|
+
const DetectedErrorsContext = createContext([]);
|
|
4
4
|
const useMatchingErrors = (matcher) => {
|
|
5
5
|
const targetRef = {
|
|
6
6
|
name: matcher.metadata?.name ?? "",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useMatchingErrors.esm.js","sources":["../../src/hooks/useMatchingErrors.ts"],"sourcesContent":["/*\n * Copyright 2023 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":"useMatchingErrors.esm.js","sources":["../../src/hooks/useMatchingErrors.ts"],"sourcesContent":["/*\n * Copyright 2023 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 { createContext, useContext } from 'react';\nimport {\n DetectedError,\n ResourceRef,\n} from '@backstage/plugin-kubernetes-common';\nimport { TypeMeta } from '@kubernetes-models/base';\nimport { IIoK8sApimachineryPkgApisMetaV1ObjectMeta as V1ObjectMeta } from '@kubernetes-models/apimachinery/apis/meta/v1/ObjectMeta';\n\n/**\n * Context for detected errors\n *\n * @public\n */\nexport const DetectedErrorsContext = createContext<DetectedError[]>([]);\n\n/**\n *\n * @public\n */\nexport type ErrorMatcher = {\n metadata?: V1ObjectMeta;\n} & TypeMeta;\n\n/**\n * Find errors which match the resource\n *\n * @public\n */\nexport const useMatchingErrors = (matcher: ErrorMatcher): DetectedError[] => {\n const targetRef: ResourceRef = {\n name: matcher.metadata?.name ?? '',\n namespace: matcher.metadata?.namespace ?? '',\n kind: matcher.kind,\n apiGroup: matcher.apiVersion,\n };\n\n const errors = useContext(DetectedErrorsContext);\n\n return errors.filter(e => {\n const r = e.sourceRef;\n return (\n targetRef.apiGroup === r.apiGroup &&\n targetRef.kind === r.kind &&\n targetRef.name === r.name &&\n targetRef.namespace === r.namespace\n );\n });\n};\n"],"names":[],"mappings":";;AA4Ba,MAAA,qBAAA,GAAwB,aAA+B,CAAA,EAAE;AAezD,MAAA,iBAAA,GAAoB,CAAC,OAA2C,KAAA;AAC3E,EAAA,MAAM,SAAyB,GAAA;AAAA,IAC7B,IAAA,EAAM,OAAQ,CAAA,QAAA,EAAU,IAAQ,IAAA,EAAA;AAAA,IAChC,SAAA,EAAW,OAAQ,CAAA,QAAA,EAAU,SAAa,IAAA,EAAA;AAAA,IAC1C,MAAM,OAAQ,CAAA,IAAA;AAAA,IACd,UAAU,OAAQ,CAAA;AAAA,GACpB;AAEA,EAAM,MAAA,MAAA,GAAS,WAAW,qBAAqB,CAAA;AAE/C,EAAO,OAAA,MAAA,CAAO,OAAO,CAAK,CAAA,KAAA;AACxB,IAAA,MAAM,IAAI,CAAE,CAAA,SAAA;AACZ,IAAA,OACE,SAAU,CAAA,QAAA,KAAa,CAAE,CAAA,QAAA,IACzB,UAAU,IAAS,KAAA,CAAA,CAAE,IACrB,IAAA,SAAA,CAAU,IAAS,KAAA,CAAA,CAAE,IACrB,IAAA,SAAA,CAAU,cAAc,CAAE,CAAA,SAAA;AAAA,GAE7B,CAAA;AACH;;;;"}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { createContext, useContext } from 'react';
|
|
2
2
|
|
|
3
|
-
const PodMetricsContext =
|
|
3
|
+
const PodMetricsContext = createContext(
|
|
4
|
+
/* @__PURE__ */ new Map()
|
|
5
|
+
);
|
|
4
6
|
const usePodMetrics = (clusterName, matcher) => {
|
|
5
7
|
const targetRef = {
|
|
6
8
|
name: matcher.metadata?.name ?? "",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"usePodMetrics.esm.js","sources":["../../src/hooks/usePodMetrics.ts"],"sourcesContent":["/*\n * Copyright 2023 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":"usePodMetrics.esm.js","sources":["../../src/hooks/usePodMetrics.ts"],"sourcesContent":["/*\n * Copyright 2023 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 { createContext, useContext } from 'react';\nimport { IObjectMeta } from '@kubernetes-models/apimachinery/apis/meta/v1/ObjectMeta';\nimport { ClientPodStatus } from '@backstage/plugin-kubernetes-common';\n\n/**\n * Context for Pod Metrics\n *\n * @public\n */\nexport const PodMetricsContext = createContext<Map<string, ClientPodStatus[]>>(\n new Map(),\n);\n\n/**\n * @public\n */\nexport type PodMetricsMatcher = {\n metadata?: IObjectMeta;\n};\n\n/**\n * Find metrics matching the provided pod\n *\n * @public\n */\nexport const usePodMetrics = (\n clusterName: string,\n matcher: PodMetricsMatcher,\n): ClientPodStatus | undefined => {\n const targetRef = {\n name: matcher.metadata?.name ?? '',\n namespace: matcher.metadata?.namespace ?? '',\n };\n\n const metricsMap = useContext(PodMetricsContext);\n\n const metrics = metricsMap.get(clusterName);\n\n return metrics?.find(m => {\n const pod = m.pod;\n return (\n targetRef.name === (pod.metadata?.name ?? '') &&\n targetRef.namespace === (pod.metadata?.namespace ?? '')\n );\n });\n};\n"],"names":[],"mappings":";;AAwBO,MAAM,iBAAoB,GAAA,aAAA;AAAA,sBAC3B,GAAI;AACV;AAca,MAAA,aAAA,GAAgB,CAC3B,WAAA,EACA,OACgC,KAAA;AAChC,EAAA,MAAM,SAAY,GAAA;AAAA,IAChB,IAAA,EAAM,OAAQ,CAAA,QAAA,EAAU,IAAQ,IAAA,EAAA;AAAA,IAChC,SAAA,EAAW,OAAQ,CAAA,QAAA,EAAU,SAAa,IAAA;AAAA,GAC5C;AAEA,EAAM,MAAA,UAAA,GAAa,WAAW,iBAAiB,CAAA;AAE/C,EAAM,MAAA,OAAA,GAAU,UAAW,CAAA,GAAA,CAAI,WAAW,CAAA;AAE1C,EAAO,OAAA,OAAA,EAAS,KAAK,CAAK,CAAA,KAAA;AACxB,IAAA,MAAM,MAAM,CAAE,CAAA,GAAA;AACd,IACE,OAAA,SAAA,CAAU,IAAU,MAAA,GAAA,CAAI,QAAU,EAAA,IAAA,IAAQ,OAC1C,SAAU,CAAA,SAAA,MAAe,GAAI,CAAA,QAAA,EAAU,SAAa,IAAA,EAAA,CAAA;AAAA,GAEvD,CAAA;AACH;;;;"}
|