@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,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
2
2
|
import Avatar from '@material-ui/core/Avatar';
|
|
3
3
|
import Container from '@material-ui/core/Container';
|
|
4
4
|
import Grid from '@material-ui/core/Grid';
|
|
@@ -16,16 +16,16 @@ import Skeleton from '@material-ui/lab/Skeleton';
|
|
|
16
16
|
import { DismissableBanner } from '@backstage/core-components';
|
|
17
17
|
|
|
18
18
|
const getAvatarByType = (type) => {
|
|
19
|
-
return /* @__PURE__ */
|
|
19
|
+
return /* @__PURE__ */ jsx(ListItemAvatar, { children: /* @__PURE__ */ jsx(Avatar, { children: type === "Warning" ? /* @__PURE__ */ jsx(WarningIcon, {}) : /* @__PURE__ */ jsx(InfoIcon, {}) }) });
|
|
20
20
|
};
|
|
21
21
|
const EventsContent = ({
|
|
22
22
|
events,
|
|
23
23
|
warningEventsOnly
|
|
24
24
|
}) => {
|
|
25
25
|
if (events.length === 0) {
|
|
26
|
-
return /* @__PURE__ */
|
|
26
|
+
return /* @__PURE__ */ jsx(Typography, { children: "No events found" });
|
|
27
27
|
}
|
|
28
|
-
return /* @__PURE__ */
|
|
28
|
+
return /* @__PURE__ */ jsx(Container, { children: /* @__PURE__ */ jsx(Grid, { children: /* @__PURE__ */ jsx(List, { children: events.filter((event) => {
|
|
29
29
|
if (warningEventsOnly) {
|
|
30
30
|
return event.type === "Warning";
|
|
31
31
|
}
|
|
@@ -36,14 +36,17 @@ const EventsContent = ({
|
|
|
36
36
|
locale: "en"
|
|
37
37
|
}
|
|
38
38
|
) : "unknown";
|
|
39
|
-
return /* @__PURE__ */
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
39
|
+
return /* @__PURE__ */ jsxs(ListItem, { children: [
|
|
40
|
+
/* @__PURE__ */ jsx(Tooltip, { title: `${event.type ?? ""} event`, children: getAvatarByType(event.type) }),
|
|
41
|
+
/* @__PURE__ */ jsx(
|
|
42
|
+
ListItemText,
|
|
43
|
+
{
|
|
44
|
+
primary: `First event ${timeAgo} (count: ${event.count})`,
|
|
45
|
+
secondary: `${event.reason}: ${event.message}`
|
|
46
|
+
}
|
|
47
|
+
)
|
|
48
|
+
] }, `${event.metadata.name}-${index}`);
|
|
49
|
+
}) }) }) });
|
|
47
50
|
};
|
|
48
51
|
const Events = ({
|
|
49
52
|
involvedObjectName,
|
|
@@ -56,17 +59,21 @@ const Events = ({
|
|
|
56
59
|
namespace,
|
|
57
60
|
clusterName
|
|
58
61
|
});
|
|
59
|
-
return /* @__PURE__ */
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
62
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
63
|
+
error && /* @__PURE__ */ jsx(
|
|
64
|
+
DismissableBanner,
|
|
65
|
+
{
|
|
66
|
+
...{
|
|
67
|
+
message: error.message,
|
|
68
|
+
variant: "error",
|
|
69
|
+
fixed: false
|
|
70
|
+
},
|
|
71
|
+
id: "events"
|
|
72
|
+
}
|
|
73
|
+
),
|
|
74
|
+
loading && /* @__PURE__ */ jsx(Skeleton, { variant: "rect", width: "100%", height: "100%" }),
|
|
75
|
+
!loading && value !== void 0 && /* @__PURE__ */ jsx(EventsContent, { warningEventsOnly, events: value })
|
|
76
|
+
] });
|
|
70
77
|
};
|
|
71
78
|
|
|
72
79
|
export { Events, EventsContent };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Events.esm.js","sources":["../../../../src/components/Pods/Events/Events.tsx"],"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":"Events.esm.js","sources":["../../../../src/components/Pods/Events/Events.tsx"],"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 Avatar from '@material-ui/core/Avatar';\nimport Container from '@material-ui/core/Container';\nimport Grid from '@material-ui/core/Grid';\nimport List from '@material-ui/core/List';\nimport ListItem from '@material-ui/core/ListItem';\nimport ListItemAvatar from '@material-ui/core/ListItemAvatar';\nimport ListItemText from '@material-ui/core/ListItemText';\nimport Tooltip from '@material-ui/core/Tooltip';\nimport Typography from '@material-ui/core/Typography';\n\nimport InfoIcon from '@material-ui/icons/Info';\nimport WarningIcon from '@material-ui/icons/Warning';\nimport { DateTime } from 'luxon';\n\nimport { useEvents } from './useEvents';\nimport Skeleton from '@material-ui/lab/Skeleton';\nimport { DismissableBanner } from '@backstage/core-components';\nimport { Event } from 'kubernetes-models/v1';\n\n/**\n * Props for Events\n *\n * @public\n */\nexport interface EventsContentProps {\n warningEventsOnly?: boolean;\n events: Event[];\n}\n\nconst getAvatarByType = (type?: string) => {\n return (\n <ListItemAvatar>\n <Avatar>{type === 'Warning' ? <WarningIcon /> : <InfoIcon />}</Avatar>\n </ListItemAvatar>\n );\n};\n\n/**\n * Shows given Kubernetes events\n *\n * @public\n */\nexport const EventsContent = ({\n events,\n warningEventsOnly,\n}: EventsContentProps) => {\n if (events.length === 0) {\n return <Typography>No events found</Typography>;\n }\n\n return (\n <Container>\n <Grid>\n <List>\n {events\n .filter(event => {\n if (warningEventsOnly) {\n return event.type === 'Warning';\n }\n return true;\n })\n .map((event, index) => {\n const timeAgo = event.metadata.creationTimestamp\n ? DateTime.fromISO(event.metadata.creationTimestamp).toRelative(\n {\n locale: 'en',\n },\n )\n : 'unknown';\n return (\n <ListItem key={`${event.metadata.name}-${index}`}>\n <Tooltip title={`${event.type ?? ''} event`}>\n {getAvatarByType(event.type)}\n </Tooltip>\n <ListItemText\n primary={`First event ${timeAgo} (count: ${event.count})`}\n secondary={`${event.reason}: ${event.message}`}\n />\n </ListItem>\n );\n })}\n </List>\n </Grid>\n </Container>\n );\n};\n\n/**\n * Props for Events\n *\n * @public\n */\nexport interface EventsProps {\n involvedObjectName: string;\n namespace: string;\n clusterName: string;\n warningEventsOnly?: boolean;\n}\n\n/**\n * Retrieves and shows Kubernetes events for the given object\n *\n * @public\n */\nexport const Events = ({\n involvedObjectName,\n namespace,\n clusterName,\n warningEventsOnly,\n}: EventsProps) => {\n const { value, error, loading } = useEvents({\n involvedObjectName,\n namespace,\n clusterName,\n });\n\n return (\n <>\n {error && (\n <DismissableBanner\n {...{\n message: error.message,\n variant: 'error',\n fixed: false,\n }}\n id=\"events\"\n />\n )}\n {loading && <Skeleton variant=\"rect\" width=\"100%\" height=\"100%\" />}\n {!loading && value !== undefined && (\n <EventsContent warningEventsOnly={warningEventsOnly} events={value} />\n )}\n </>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AA4CA,MAAM,eAAA,GAAkB,CAAC,IAAkB,KAAA;AACzC,EAAA,uBACG,GAAA,CAAA,cAAA,EAAA,EACC,QAAC,kBAAA,GAAA,CAAA,MAAA,EAAA,EAAQ,QAAS,EAAA,IAAA,KAAA,SAAA,mBAAa,GAAA,CAAA,WAAA,EAAA,EAAY,CAAK,mBAAA,GAAA,CAAC,QAAS,EAAA,EAAA,CAAA,EAAG,CAC/D,EAAA,CAAA;AAEJ,CAAA;AAOO,MAAM,gBAAgB,CAAC;AAAA,EAC5B,MAAA;AAAA,EACA;AACF,CAA0B,KAAA;AACxB,EAAI,IAAA,MAAA,CAAO,WAAW,CAAG,EAAA;AACvB,IAAO,uBAAA,GAAA,CAAC,cAAW,QAAe,EAAA,iBAAA,EAAA,CAAA;AAAA;AAGpC,EACE,uBAAA,GAAA,CAAC,aACC,QAAC,kBAAA,GAAA,CAAA,IAAA,EAAA,EACC,8BAAC,IACE,EAAA,EAAA,QAAA,EAAA,MAAA,CACE,OAAO,CAAS,KAAA,KAAA;AACf,IAAA,IAAI,iBAAmB,EAAA;AACrB,MAAA,OAAO,MAAM,IAAS,KAAA,SAAA;AAAA;AAExB,IAAO,OAAA,IAAA;AAAA,GACR,CAAA,CACA,GAAI,CAAA,CAAC,O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;AAAA,UACF,SAAS,KAAM,CAAA,OAAA;AAAA,UACf,OAAS,EAAA,OAAA;AAAA,UACT,KAAO,EAAA;AAAA,SACT;AAAA,QACA,EAAG,EAAA;AAAA;AAAA,KACL;AAAA,IAED,OAAA,wBAAY,QAAS,EAAA,EAAA,OAAA,EAAQ,QAAO,KAAM,EAAA,MAAA,EAAO,QAAO,MAAO,EAAA,CAAA;AAAA,IAC/D,CAAC,WAAW,KAAU,KAAA,KAAA,CAAA,wBACpB,aAAc,EAAA,EAAA,iBAAA,EAAsC,QAAQ,KAAO,EAAA;AAAA,GAExE,EAAA,CAAA;AAEJ;;;;"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { useState } from 'react';
|
|
2
3
|
import Button from '@material-ui/core/Button';
|
|
3
4
|
import Grid from '@material-ui/core/Grid';
|
|
4
5
|
import Dialog from '@material-ui/core/Dialog';
|
|
@@ -48,58 +49,91 @@ const FixDialog = ({
|
|
|
48
49
|
};
|
|
49
50
|
const pf = error.proposedFix;
|
|
50
51
|
const dialogContent = () => {
|
|
51
|
-
return /* @__PURE__ */
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
52
|
+
return /* @__PURE__ */ jsxs(Grid, { container: true, children: [
|
|
53
|
+
/* @__PURE__ */ jsxs(Grid, { item: true, xs: 12, children: [
|
|
54
|
+
/* @__PURE__ */ jsx(Typography, { variant: "h6", children: "Detected error:" }),
|
|
55
|
+
/* @__PURE__ */ jsx(Typography, { children: error.message })
|
|
56
|
+
] }),
|
|
57
|
+
/* @__PURE__ */ jsxs(Grid, { item: true, xs: 12, children: [
|
|
58
|
+
/* @__PURE__ */ jsx(Typography, { variant: "h6", children: "Cause explanation:" }),
|
|
59
|
+
/* @__PURE__ */ jsx(Typography, { children: error.proposedFix?.rootCauseExplanation ?? "unknown" })
|
|
60
|
+
] }),
|
|
61
|
+
/* @__PURE__ */ jsxs(Grid, { item: true, xs: 12, children: [
|
|
62
|
+
/* @__PURE__ */ jsx(Typography, { variant: "h6", children: "Fix:" }),
|
|
63
|
+
/* @__PURE__ */ jsx(List, { children: (error.proposedFix?.actions ?? []).map((fix, i) => {
|
|
64
|
+
return /* @__PURE__ */ jsx(ListItem, { children: fix }, `${pod.metadata?.name ?? "unknown"}-pf-${i}`);
|
|
65
|
+
}) })
|
|
66
|
+
] }),
|
|
67
|
+
pf && pf.type === "logs" && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
68
|
+
/* @__PURE__ */ jsx(Grid, { item: true, xs: 12, children: /* @__PURE__ */ jsx(Typography, { variant: "h6", children: "Crash logs:" }) }),
|
|
69
|
+
/* @__PURE__ */ jsx(Grid, { item: true, xs: 9, children: /* @__PURE__ */ jsx(
|
|
70
|
+
PodLogs,
|
|
71
|
+
{
|
|
72
|
+
previous: true,
|
|
73
|
+
containerScope: {
|
|
74
|
+
podName: pod.metadata?.name ?? "unknown",
|
|
75
|
+
podNamespace: pod.metadata?.namespace ?? "unknown",
|
|
76
|
+
cluster: { name: clusterName },
|
|
77
|
+
containerName: pf.container
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
) })
|
|
81
|
+
] }),
|
|
82
|
+
pf && pf.type === "events" && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
83
|
+
/* @__PURE__ */ jsx(Grid, { item: true, xs: 12, children: /* @__PURE__ */ jsx(Typography, { variant: "h6", children: "Events:" }) }),
|
|
84
|
+
/* @__PURE__ */ jsx(Grid, { item: true, xs: 9, children: /* @__PURE__ */ jsx(
|
|
85
|
+
Events,
|
|
86
|
+
{
|
|
87
|
+
warningEventsOnly: true,
|
|
88
|
+
involvedObjectName: pod.metadata?.name ?? "",
|
|
89
|
+
namespace: pod.metadata?.namespace ?? "",
|
|
90
|
+
clusterName
|
|
91
|
+
}
|
|
92
|
+
) })
|
|
93
|
+
] })
|
|
94
|
+
] });
|
|
95
|
+
};
|
|
96
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
97
|
+
/* @__PURE__ */ jsx(
|
|
98
|
+
Button,
|
|
66
99
|
{
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
100
|
+
variant: "outlined",
|
|
101
|
+
"aria-label": "fix issue",
|
|
102
|
+
component: "label",
|
|
103
|
+
onClick: openDialog,
|
|
104
|
+
startIcon: /* @__PURE__ */ jsx(HelpIcon, {}),
|
|
105
|
+
children: "Help"
|
|
71
106
|
}
|
|
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
|
-
|
|
99
|
-
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
))));
|
|
107
|
+
),
|
|
108
|
+
/* @__PURE__ */ jsxs(Dialog, { maxWidth: "xl", fullWidth: true, open: isOpen, onClose: closeDialog, children: [
|
|
109
|
+
/* @__PURE__ */ jsxs(DialogTitle, { id: "dialog-title", children: [
|
|
110
|
+
pod.metadata?.name,
|
|
111
|
+
" - ",
|
|
112
|
+
error.type,
|
|
113
|
+
/* @__PURE__ */ jsx(
|
|
114
|
+
IconButton,
|
|
115
|
+
{
|
|
116
|
+
"aria-label": "close",
|
|
117
|
+
className: classes.closeButton,
|
|
118
|
+
onClick: closeDialog,
|
|
119
|
+
children: /* @__PURE__ */ jsx(CloseIcon, {})
|
|
120
|
+
}
|
|
121
|
+
)
|
|
122
|
+
] }),
|
|
123
|
+
/* @__PURE__ */ jsx(DialogContent, { children: dialogContent() }),
|
|
124
|
+
/* @__PURE__ */ jsx(DialogActions, { children: pf && pf.type === "docs" && /* @__PURE__ */ jsx(
|
|
125
|
+
LinkButton,
|
|
126
|
+
{
|
|
127
|
+
to: pf.docsLink,
|
|
128
|
+
variant: "outlined",
|
|
129
|
+
startIcon: /* @__PURE__ */ jsx(OpenInNewIcon, {}),
|
|
130
|
+
target: "_blank",
|
|
131
|
+
rel: "noopener",
|
|
132
|
+
children: "Open docs"
|
|
133
|
+
}
|
|
134
|
+
) })
|
|
135
|
+
] })
|
|
136
|
+
] });
|
|
103
137
|
};
|
|
104
138
|
|
|
105
139
|
export { FixDialog };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FixDialog.esm.js","sources":["../../../../src/components/Pods/FixDialog/FixDialog.tsx"],"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":"FixDialog.esm.js","sources":["../../../../src/components/Pods/FixDialog/FixDialog.tsx"],"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 { FC, useState } from 'react';\n\nimport Button from '@material-ui/core/Button';\nimport Grid from '@material-ui/core/Grid';\nimport Dialog from '@material-ui/core/Dialog';\nimport DialogActions from '@material-ui/core/DialogActions';\nimport DialogContent from '@material-ui/core/DialogContent';\nimport DialogTitle from '@material-ui/core/DialogTitle';\nimport IconButton from '@material-ui/core/IconButton';\nimport { makeStyles, createStyles, Theme } from '@material-ui/core/styles';\nimport Typography from '@material-ui/core/Typography';\nimport CloseIcon from '@material-ui/icons/Close';\nimport HelpIcon from '@material-ui/icons/Help';\nimport OpenInNewIcon from '@material-ui/icons/OpenInNew';\n\nimport { Pod } from 'kubernetes-models/v1/Pod';\nimport { DetectedError } from '@backstage/plugin-kubernetes-common';\nimport { PodLogs } from '../PodLogs';\nimport { Events } from '../Events';\nimport { LinkButton } from '@backstage/core-components';\nimport List from '@material-ui/core/List';\nimport ListItem from '@material-ui/core/ListItem';\n\nconst useStyles = makeStyles((theme: Theme) =>\n createStyles({\n closeButton: {\n position: 'absolute',\n right: theme.spacing(1),\n top: theme.spacing(1),\n color: theme.palette.grey[500],\n },\n }),\n);\n\n/**\n * Props for FixDialog\n *\n * @public\n */\nexport interface FixDialogProps {\n open?: boolean;\n clusterName: string;\n pod: Pod;\n error: DetectedError;\n}\n\n/**\n * A dialog for fixing detected Kubernetes errors\n *\n * @public\n */\nexport const FixDialog: FC<FixDialogProps> = ({\n open,\n pod,\n error,\n clusterName,\n}: FixDialogProps) => {\n const [isOpen, setOpen] = useState(!!open);\n const classes = useStyles();\n\n const openDialog = () => {\n setOpen(true);\n };\n\n const closeDialog = () => {\n setOpen(false);\n };\n\n const pf = error.proposedFix;\n\n const dialogContent = () => {\n return (\n <Grid container>\n <Grid item xs={12}>\n <Typography variant=\"h6\">Detected error:</Typography>\n <Typography>{error.message}</Typography>\n </Grid>\n <Grid item xs={12}>\n <Typography variant=\"h6\">Cause explanation:</Typography>\n <Typography>\n {error.proposedFix?.rootCauseExplanation ?? 'unknown'}\n </Typography>\n </Grid>\n <Grid item xs={12}>\n <Typography variant=\"h6\">Fix:</Typography>\n <List>\n {(error.proposedFix?.actions ?? []).map((fix, i) => {\n return (\n <ListItem key={`${pod.metadata?.name ?? 'unknown'}-pf-${i}`}>\n {fix}\n </ListItem>\n );\n })}\n </List>\n </Grid>\n\n {pf && pf.type === 'logs' && (\n <>\n <Grid item xs={12}>\n <Typography variant=\"h6\">Crash logs:</Typography>\n </Grid>\n <Grid item xs={9}>\n <PodLogs\n previous\n containerScope={{\n podName: pod.metadata?.name ?? 'unknown',\n podNamespace: pod.metadata?.namespace ?? 'unknown',\n cluster: { name: clusterName },\n containerName: pf.container,\n }}\n />\n </Grid>\n </>\n )}\n {pf && pf.type === 'events' && (\n <>\n <Grid item xs={12}>\n <Typography variant=\"h6\">Events:</Typography>\n </Grid>\n <Grid item xs={9}>\n <Events\n warningEventsOnly\n involvedObjectName={pod.metadata?.name ?? ''}\n namespace={pod.metadata?.namespace ?? ''}\n clusterName={clusterName}\n />\n </Grid>\n </>\n )}\n </Grid>\n );\n };\n\n return (\n <>\n <Button\n variant=\"outlined\"\n aria-label=\"fix issue\"\n component=\"label\"\n onClick={openDialog}\n startIcon={<HelpIcon />}\n >\n Help\n </Button>\n <Dialog maxWidth=\"xl\" fullWidth open={isOpen} onClose={closeDialog}>\n <DialogTitle id=\"dialog-title\">\n {pod.metadata?.name} - {error.type}\n <IconButton\n aria-label=\"close\"\n className={classes.closeButton}\n onClick={closeDialog}\n >\n <CloseIcon />\n </IconButton>\n </DialogTitle>\n <DialogContent>{dialogContent()}</DialogContent>\n <DialogActions>\n {pf && pf.type === 'docs' && (\n <LinkButton\n to={pf.docsLink}\n variant=\"outlined\"\n startIcon={<OpenInNewIcon />}\n target=\"_blank\"\n rel=\"noopener\"\n >\n Open docs\n </LinkButton>\n )}\n </DialogActions>\n </Dialog>\n </>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;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
2
3
|
import Grid from '@material-ui/core/Grid';
|
|
3
4
|
import Typography from '@material-ui/core/Typography';
|
|
4
5
|
import CardActions from '@material-ui/core/CardActions';
|
|
@@ -24,26 +25,29 @@ const PodDeleteButton = ({ podScope }) => {
|
|
|
24
25
|
console.error(error);
|
|
25
26
|
}
|
|
26
27
|
};
|
|
27
|
-
return /* @__PURE__ */
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
28
|
+
return /* @__PURE__ */ jsx(Grid, { container: true, item: true, xs: 12, children: /* @__PURE__ */ jsxs(Grid, { item: true, xs: 12, children: [
|
|
29
|
+
/* @__PURE__ */ jsx(CardActions, { children: /* @__PURE__ */ jsx(
|
|
30
|
+
Button,
|
|
31
|
+
{
|
|
32
|
+
variant: "outlined",
|
|
33
|
+
"aria-label": buttonText,
|
|
34
|
+
component: "label",
|
|
35
|
+
onClick: handleDeleteClick,
|
|
36
|
+
startIcon: isLoading ? /* @__PURE__ */ jsx(CircularProgress, { size: 18 }) : /* @__PURE__ */ jsx(CloseIcon, {}),
|
|
37
|
+
disabled: isLoading,
|
|
38
|
+
children: buttonText
|
|
39
|
+
}
|
|
40
|
+
) }),
|
|
41
|
+
hasError && /* @__PURE__ */ jsx(
|
|
42
|
+
Typography,
|
|
43
|
+
{
|
|
44
|
+
variant: "body1",
|
|
45
|
+
color: "error",
|
|
46
|
+
style: { textAlign: "right" },
|
|
47
|
+
children: "Could not delete the pod. Please check the console for the full report."
|
|
48
|
+
}
|
|
49
|
+
)
|
|
50
|
+
] }) });
|
|
47
51
|
};
|
|
48
52
|
|
|
49
53
|
export { PodDeleteButton };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PodDeleteButton.esm.js","sources":["../../../../src/components/Pods/PodDelete/PodDeleteButton.tsx"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport
|
|
1
|
+
{"version":3,"file":"PodDeleteButton.esm.js","sources":["../../../../src/components/Pods/PodDelete/PodDeleteButton.tsx"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { useState } from 'react';\n\nimport Grid from '@material-ui/core/Grid';\nimport Typography from '@material-ui/core/Typography';\nimport CardActions from '@material-ui/core/CardActions';\nimport Button from '@material-ui/core/Button';\nimport DeleteIcon from '@material-ui/icons/Close';\nimport CircularProgress from '@material-ui/core/CircularProgress';\nimport { useTranslationRef } from '@backstage/core-plugin-api/alpha';\nimport { kubernetesReactTranslationRef } from '../../../translation';\n\nimport { usePodDelete } from './usePodDelete';\nimport { PodScope } from './types';\n\n/**\n * Props for PodDeleteButton\n *\n * @public\n */\nexport interface PodDeleteButtonProps {\n podScope: PodScope;\n}\n\n/**\n * a Delete button to delete a given pod\n *\n * @public\n */\nexport const PodDeleteButton = ({ podScope }: PodDeleteButtonProps) => {\n const [isLoading, setIsLoading] = useState(false);\n const [hasError, setHasError] = useState(false);\n const deletePod = usePodDelete();\n\n const { t } = useTranslationRef(kubernetesReactTranslationRef);\n const buttonText = t('podDrawer.buttons.delete');\n\n const handleDeleteClick = async () => {\n setIsLoading(true);\n try {\n await deletePod(podScope);\n } catch (error) {\n setHasError(true);\n // eslint-disable-next-line no-console\n console.error(error);\n }\n };\n\n return (\n <Grid container item xs={12}>\n <Grid item xs={12}>\n <CardActions>\n <Button\n variant=\"outlined\"\n aria-label={buttonText}\n component=\"label\"\n onClick={handleDeleteClick}\n startIcon={\n isLoading ? <CircularProgress size={18} /> : <DeleteIcon />\n }\n disabled={isLoading}\n >\n {buttonText}\n </Button>\n </CardActions>\n {hasError && (\n <Typography\n variant=\"body1\"\n color=\"error\"\n style={{ textAlign: 'right' }}\n >\n Could not delete the pod. Please check the console for the full\n report.\n </Typography>\n )}\n </Grid>\n </Grid>\n );\n};\n"],"names":["DeleteIcon"],"mappings":";;;;;;;;;;;;AA2CO,MAAM,eAAkB,GAAA,CAAC,EAAE,QAAA,EAAqC,KAAA;AACrE,EAAA,MAAM,CAAC,SAAA,EAAW,YAAY,CAAA,GAAI,SAAS,KAAK,CAAA;AAChD,EAAA,MAAM,CAAC,QAAA,EAAU,WAAW,CAAA,GAAI,SAAS,KAAK,CAAA;AAC9C,EAAA,MAAM,YAAY,YAAa,EAAA;AAE/B,EAAA,MAAM,EAAE,CAAA,EAAM,GAAA,iBAAA,CAAkB,6BAA6B,CAAA;AAC7D,EAAM,MAAA,UAAA,GAAa,EAAE,0BAA0B,CAAA;AAE/C,EAAA,MAAM,oBAAoB,YAAY;AACpC,IAAA,YAAA,CAAa,IAAI,CAAA;AACjB,IAAI,IAAA;AACF,MAAA,MAAM,UAAU,QAAQ,CAAA;AAAA,aACjB,KAAO,EAAA;AACd,MAAA,WAAA,CAAY,IAAI,CAAA;AAEhB,MAAA,OAAA,CAAQ,MAAM,KAAK,CAAA;AAAA;AACrB,GACF;AAEA,EAAA,uBACG,GAAA,CAAA,IAAA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