@backstage/plugin-kubernetes-react 0.5.13 → 0.5.14-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.
Files changed (75) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/dist/alpha.d.ts +77 -0
  3. package/dist/components/Cluster/Cluster.esm.js +8 -9
  4. package/dist/components/Cluster/Cluster.esm.js.map +1 -1
  5. package/dist/components/ConfigmapsAccordions/ConfigmapsDrawer.esm.js +10 -1
  6. package/dist/components/ConfigmapsAccordions/ConfigmapsDrawer.esm.js.map +1 -1
  7. package/dist/components/CronJobsAccordions/CronJobsDrawer.esm.js +10 -1
  8. package/dist/components/CronJobsAccordions/CronJobsDrawer.esm.js.map +1 -1
  9. package/dist/components/CustomResources/ArgoRollouts/Rollout.esm.js +15 -27
  10. package/dist/components/CustomResources/ArgoRollouts/Rollout.esm.js.map +1 -1
  11. package/dist/components/CustomResources/ArgoRollouts/RolloutDrawer.esm.js +10 -1
  12. package/dist/components/CustomResources/ArgoRollouts/RolloutDrawer.esm.js.map +1 -1
  13. package/dist/components/CustomResources/DefaultCustomResourceDrawer.esm.js +2 -0
  14. package/dist/components/CustomResources/DefaultCustomResourceDrawer.esm.js.map +1 -1
  15. package/dist/components/DaemonSetsAccordions/DaemonSetsAccordions.esm.js +5 -10
  16. package/dist/components/DaemonSetsAccordions/DaemonSetsAccordions.esm.js.map +1 -1
  17. package/dist/components/DaemonSetsAccordions/DaemonSetsDrawer.esm.js +10 -1
  18. package/dist/components/DaemonSetsAccordions/DaemonSetsDrawer.esm.js.map +1 -1
  19. package/dist/components/DeploymentsAccordions/DeploymentDrawer.esm.js +10 -1
  20. package/dist/components/DeploymentsAccordions/DeploymentDrawer.esm.js.map +1 -1
  21. package/dist/components/DeploymentsAccordions/DeploymentsAccordions.esm.js +15 -27
  22. package/dist/components/DeploymentsAccordions/DeploymentsAccordions.esm.js.map +1 -1
  23. package/dist/components/ErrorPanel/ErrorPanel.esm.js +37 -20
  24. package/dist/components/ErrorPanel/ErrorPanel.esm.js.map +1 -1
  25. package/dist/components/ErrorReporting/ErrorReporting.esm.js +41 -34
  26. package/dist/components/ErrorReporting/ErrorReporting.esm.js.map +1 -1
  27. package/dist/components/HorizontalPodAutoscalers/HorizontalPodAutoscalerDrawer.esm.js +2 -0
  28. package/dist/components/HorizontalPodAutoscalers/HorizontalPodAutoscalerDrawer.esm.js.map +1 -1
  29. package/dist/components/IngressesAccordions/IngressDrawer.esm.js +4 -1
  30. package/dist/components/IngressesAccordions/IngressDrawer.esm.js.map +1 -1
  31. package/dist/components/JobsAccordions/JobsAccordions.esm.js +2 -0
  32. package/dist/components/JobsAccordions/JobsAccordions.esm.js.map +1 -1
  33. package/dist/components/JobsAccordions/JobsDrawer.esm.js +2 -0
  34. package/dist/components/JobsAccordions/JobsDrawer.esm.js.map +1 -1
  35. package/dist/components/KubernetesDialog/KubernetesDialog.esm.js +4 -1
  36. package/dist/components/KubernetesDialog/KubernetesDialog.esm.js.map +1 -1
  37. package/dist/components/KubernetesDrawer/KubernetesDrawer.esm.js +6 -3
  38. package/dist/components/KubernetesDrawer/KubernetesDrawer.esm.js.map +1 -1
  39. package/dist/components/KubernetesDrawer/KubernetesStructuredMetadataTableDrawer.esm.js +25 -15
  40. package/dist/components/KubernetesDrawer/KubernetesStructuredMetadataTableDrawer.esm.js.map +1 -1
  41. package/dist/components/KubernetesDrawer/ManifestYaml.esm.js +5 -2
  42. package/dist/components/KubernetesDrawer/ManifestYaml.esm.js.map +1 -1
  43. package/dist/components/PodExecTerminal/PodExecTerminalDialog.esm.js +10 -3
  44. package/dist/components/PodExecTerminal/PodExecTerminalDialog.esm.js.map +1 -1
  45. package/dist/components/Pods/Events/Events.esm.js +4 -1
  46. package/dist/components/Pods/Events/Events.esm.js.map +1 -1
  47. package/dist/components/Pods/FixDialog/FixDialog.esm.js +26 -16
  48. package/dist/components/Pods/FixDialog/FixDialog.esm.js.map +1 -1
  49. package/dist/components/Pods/PodDrawer/ContainerCard.esm.js +8 -5
  50. package/dist/components/Pods/PodDrawer/ContainerCard.esm.js.map +1 -1
  51. package/dist/components/Pods/PodDrawer/PodDrawer.esm.js +8 -5
  52. package/dist/components/Pods/PodDrawer/PodDrawer.esm.js.map +1 -1
  53. package/dist/components/Pods/PodLogs/PodLogs.esm.js +5 -2
  54. package/dist/components/Pods/PodLogs/PodLogs.esm.js.map +1 -1
  55. package/dist/components/Pods/PodLogs/PodLogsDialog.esm.js +10 -3
  56. package/dist/components/Pods/PodLogs/PodLogsDialog.esm.js.map +1 -1
  57. package/dist/components/Pods/PodsTable.esm.js +30 -25
  58. package/dist/components/Pods/PodsTable.esm.js.map +1 -1
  59. package/dist/components/SecretsAccordions/SecretsAccordions.esm.js +77 -0
  60. package/dist/components/SecretsAccordions/SecretsAccordions.esm.js.map +1 -0
  61. package/dist/components/SecretsAccordions/SecretsDrawer.esm.js +49 -0
  62. package/dist/components/SecretsAccordions/SecretsDrawer.esm.js.map +1 -0
  63. package/dist/components/ServicesAccordions/ServiceDrawer.esm.js +4 -1
  64. package/dist/components/ServicesAccordions/ServiceDrawer.esm.js.map +1 -1
  65. package/dist/components/StatefulSetsAccordions/StatefulSetDrawer.esm.js +4 -1
  66. package/dist/components/StatefulSetsAccordions/StatefulSetDrawer.esm.js.map +1 -1
  67. package/dist/components/StatefulSetsAccordions/StatefulSetsAccordions.esm.js +14 -14
  68. package/dist/components/StatefulSetsAccordions/StatefulSetsAccordions.esm.js.map +1 -1
  69. package/dist/hooks/GroupedResponses.esm.js +1 -0
  70. package/dist/hooks/GroupedResponses.esm.js.map +1 -1
  71. package/dist/hooks/useIsPodExecTerminalSupported.esm.js +1 -1
  72. package/dist/hooks/useIsPodExecTerminalSupported.esm.js.map +1 -1
  73. package/dist/translation.esm.js +113 -0
  74. package/dist/translation.esm.js.map +1 -1
  75. package/package.json +10 -10
@@ -15,6 +15,8 @@ import OpenInNewIcon from '@material-ui/icons/OpenInNew';
15
15
  import { PodLogs } from '../PodLogs/PodLogs.esm.js';
16
16
  import '@material-ui/icons/Subject';
17
17
  import '../../KubernetesDialog/KubernetesDialog.esm.js';
18
+ import { useTranslationRef } from '@backstage/core-plugin-api/alpha';
19
+ import { kubernetesReactTranslationRef } from '../../../translation.esm.js';
18
20
  import 'react-use/esm/useAsync';
19
21
  import '@backstage/core-plugin-api';
20
22
  import '../../../api/types.esm.js';
@@ -41,6 +43,7 @@ const FixDialog = ({
41
43
  }) => {
42
44
  const [isOpen, setOpen] = useState(!!open);
43
45
  const classes = useStyles();
46
+ const { t } = useTranslationRef(kubernetesReactTranslationRef);
44
47
  const openDialog = () => {
45
48
  setOpen(true);
46
49
  };
@@ -51,28 +54,34 @@ const FixDialog = ({
51
54
  const dialogContent = () => {
52
55
  return /* @__PURE__ */ jsxs(Grid, { container: true, children: [
53
56
  /* @__PURE__ */ jsxs(Grid, { item: true, xs: 12, children: [
54
- /* @__PURE__ */ jsx(Typography, { variant: "h6", children: "Detected error:" }),
57
+ /* @__PURE__ */ jsx(Typography, { variant: "h6", children: t("fixDialog.detectedError") }),
55
58
  /* @__PURE__ */ jsx(Typography, { children: error.message })
56
59
  ] }),
57
60
  /* @__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" })
61
+ /* @__PURE__ */ jsx(Typography, { variant: "h6", children: t("fixDialog.causeExplanation") }),
62
+ /* @__PURE__ */ jsx(Typography, { children: error.proposedFix?.rootCauseExplanation ?? t("podsTable.unknown") })
60
63
  ] }),
61
64
  /* @__PURE__ */ jsxs(Grid, { item: true, xs: 12, children: [
62
- /* @__PURE__ */ jsx(Typography, { variant: "h6", children: "Fix:" }),
65
+ /* @__PURE__ */ jsx(Typography, { variant: "h6", children: t("fixDialog.fix") }),
63
66
  /* @__PURE__ */ jsx(List, { children: (error.proposedFix?.actions ?? []).map((fix, i) => {
64
- return /* @__PURE__ */ jsx(ListItem, { children: fix }, `${pod.metadata?.name ?? "unknown"}-pf-${i}`);
67
+ return /* @__PURE__ */ jsx(
68
+ ListItem,
69
+ {
70
+ children: fix
71
+ },
72
+ `${pod.metadata?.name ?? t("podsTable.unknown")}-pf-${i}`
73
+ );
65
74
  }) })
66
75
  ] }),
67
76
  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:" }) }),
77
+ /* @__PURE__ */ jsx(Grid, { item: true, xs: 12, children: /* @__PURE__ */ jsx(Typography, { variant: "h6", children: t("fixDialog.crashLogs") }) }),
69
78
  /* @__PURE__ */ jsx(Grid, { item: true, xs: 9, children: /* @__PURE__ */ jsx(
70
79
  PodLogs,
71
80
  {
72
81
  previous: true,
73
82
  containerScope: {
74
- podName: pod.metadata?.name ?? "unknown",
75
- podNamespace: pod.metadata?.namespace ?? "unknown",
83
+ podName: pod.metadata?.name ?? t("podsTable.unknown"),
84
+ podNamespace: pod.metadata?.namespace ?? t("podsTable.unknown"),
76
85
  cluster: { name: clusterName },
77
86
  containerName: pf.container
78
87
  }
@@ -80,7 +89,7 @@ const FixDialog = ({
80
89
  ) })
81
90
  ] }),
82
91
  pf && pf.type === "events" && /* @__PURE__ */ jsxs(Fragment, { children: [
83
- /* @__PURE__ */ jsx(Grid, { item: true, xs: 12, children: /* @__PURE__ */ jsx(Typography, { variant: "h6", children: "Events:" }) }),
92
+ /* @__PURE__ */ jsx(Grid, { item: true, xs: 12, children: /* @__PURE__ */ jsx(Typography, { variant: "h6", children: t("fixDialog.events") }) }),
84
93
  /* @__PURE__ */ jsx(Grid, { item: true, xs: 9, children: /* @__PURE__ */ jsx(
85
94
  Events,
86
95
  {
@@ -98,22 +107,23 @@ const FixDialog = ({
98
107
  Button,
99
108
  {
100
109
  variant: "outlined",
101
- "aria-label": "fix issue",
110
+ "aria-label": t("fixDialog.ariaLabels.fixIssue"),
102
111
  component: "label",
103
112
  onClick: openDialog,
104
113
  startIcon: /* @__PURE__ */ jsx(HelpIcon, {}),
105
- children: "Help"
114
+ children: t("fixDialog.helpButton")
106
115
  }
107
116
  ),
108
117
  /* @__PURE__ */ jsxs(Dialog, { maxWidth: "xl", fullWidth: true, open: isOpen, onClose: closeDialog, children: [
109
118
  /* @__PURE__ */ jsxs(DialogTitle, { id: "dialog-title", children: [
110
- pod.metadata?.name,
111
- " - ",
112
- error.type,
119
+ t("fixDialog.title", {
120
+ podName: pod.metadata?.name ?? "",
121
+ errorType: error.type
122
+ }),
113
123
  /* @__PURE__ */ jsx(
114
124
  IconButton,
115
125
  {
116
- "aria-label": "close",
126
+ "aria-label": t("fixDialog.ariaLabels.close"),
117
127
  className: classes.closeButton,
118
128
  onClick: closeDialog,
119
129
  children: /* @__PURE__ */ jsx(CloseIcon, {})
@@ -129,7 +139,7 @@ const FixDialog = ({
129
139
  startIcon: /* @__PURE__ */ jsx(OpenInNewIcon, {}),
130
140
  target: "_blank",
131
141
  rel: "noopener",
132
- children: "Open docs"
142
+ children: t("fixDialog.openDocs")
133
143
  }
134
144
  ) })
135
145
  ] })
@@ -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 { 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":";;;;;;;;;;;;;;;;;;;;;;;;;AAsCA,MAAM,SAAA,GAAY,UAAA;AAAA,EAAW,CAAC,UAC5B,YAAA,CAAa;AAAA,IACX,WAAA,EAAa;AAAA,MACX,QAAA,EAAU,UA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AA;AAAA,KAED;AAAA,oBACA,IAAA,CAAC,UAAO,QAAA,EAAS,IAAA,EAAK,WAAS,IAAA,EAAC,IAAA,EAAM,MAAA,EAAQ,OAAA,EAAS,WAAA,EACrD,QAAA,EAAA;AAAA,sBAAA,IAAA,CAAC,WAAA,EAAA,EAAY,IAAG,cAAA,EACb,QAAA,EAAA;AAAA,QAAA,GAAA,CAAI,QAAA,EAAU,IAAA;AAAA,QAAK,KAAA;AAAA,QAAI,KAAA,CAAM,IAAA;AAAA,wBAC9B,GAAA;AAAA,UAAC,UAAA;AAAA,UAAA;AAAA,YACC,YAAA,EAAW,OAAA;AAAA,YACX,WAAW,OAAA,CAAQ,WAAA;AAAA,YACnB,OAAA,EAAS,WAAA;AAAA,YAET,8BAAC,SAAA,EAAA,EAAU;AAAA;AAAA;AACb,OAAA,EACF,CAAA;AAAA,sBACA,GAAA,CAAC,aAAA,EAAA,EAAe,QAAA,EAAA,aAAA,EAAc,EAAE,CAAA;AAAA,sBAChC,GAAA,CAAC,aAAA,EAAA,EACE,QAAA,EAAA,EAAA,IAAM,EAAA,CAAG,SAAS,MAAA,oBACjB,GAAA;AAAA,QAAC,UAAA;AAAA,QAAA;AAAA,UACC,IAAI,EAAA,CAAG,QAAA;AAAA,UACP,OAAA,EAAQ,UAAA;AAAA,UACR,SAAA,sBAAY,aAAA,EAAA,EAAc,CAAA;AAAA,UAC1B,MAAA,EAAO,QAAA;AAAA,UACP,GAAA,EAAI,UAAA;AAAA,UACL,QAAA,EAAA;AAAA;AAAA,OAED,EAEJ;AAAA,KAAA,EACF;AAAA,GAAA,EACF,CAAA;AAEJ;;;;"}
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';\nimport { useTranslationRef } from '@backstage/core-plugin-api/alpha';\nimport { kubernetesReactTranslationRef } from '../../../translation';\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 const { t } = useTranslationRef(kubernetesReactTranslationRef);\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\">{t('fixDialog.detectedError')}</Typography>\n <Typography>{error.message}</Typography>\n </Grid>\n <Grid item xs={12}>\n <Typography variant=\"h6\">\n {t('fixDialog.causeExplanation')}\n </Typography>\n <Typography>\n {error.proposedFix?.rootCauseExplanation ?? t('podsTable.unknown')}\n </Typography>\n </Grid>\n <Grid item xs={12}>\n <Typography variant=\"h6\">{t('fixDialog.fix')}</Typography>\n <List>\n {(error.proposedFix?.actions ?? []).map((fix, i) => {\n return (\n <ListItem\n key={`${\n pod.metadata?.name ?? t('podsTable.unknown')\n }-pf-${i}`}\n >\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\">{t('fixDialog.crashLogs')}</Typography>\n </Grid>\n <Grid item xs={9}>\n <PodLogs\n previous\n containerScope={{\n podName: pod.metadata?.name ?? t('podsTable.unknown'),\n podNamespace:\n pod.metadata?.namespace ?? t('podsTable.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\">{t('fixDialog.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={t('fixDialog.ariaLabels.fixIssue')}\n component=\"label\"\n onClick={openDialog}\n startIcon={<HelpIcon />}\n >\n {t('fixDialog.helpButton')}\n </Button>\n <Dialog maxWidth=\"xl\" fullWidth open={isOpen} onClose={closeDialog}>\n <DialogTitle id=\"dialog-title\">\n {t('fixDialog.title', {\n podName: pod.metadata?.name ?? '',\n errorType: error.type,\n })}\n <IconButton\n aria-label={t('fixDialog.ariaLabels.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 {t('fixDialog.openDocs')}\n </LinkButton>\n )}\n </DialogActions>\n </Dialog>\n </>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAwCA,MAAM,SAAA,GAAY,UAAA;AAAA,EAAW,CAAC,UAC5B,YAAA,CAAa;AAAA,IACX,WAAA,EAAa;AAAA,MACX,QAAA,EAAU,UAAA;AAAA,MACV,KAAA,EAAO,KAAA,CAAM,OAAA,CAAQ,CAAC,CAAA;AAAA,MACtB,GAAA,EAAK,KAAA,CAAM,OAAA,CAAQ,CAAC,CAAA;AAAA,MACpB,KAAA,EAAO,KAAA,CAAM,OAAA,CAAQ,IAAA,CAAK,GAAG;AAAA;AAC/B,GACD;AACH,CAAA;AAmBO,MAAM,YAAgC,CAAC;AAAA,EAC5C,IAAA;AAAA,EACA,GAAA;AAAA,EACA,KAAA;AAAA,EACA;AACF,CAAA,KAAsB;AACpB,EAAA,MAAM,CAAC,MAAA,EAAQ,OAAO,IAAI,QAAA,CAAS,CAAC,CAAC,IAAI,CAAA;AACzC,EAAA,MAAM,UAAU,SAAA,EAAU;AAC1B,EAAA,MAAM,EAAE,CAAA,EAAE,GAAI,iBAAA,CAAkB,6BAA6B,CAAA;AAE7D,EAAA,MAAM,aAAa,MAAM;AACvB,IAAA,OAAA,CAAQ,IAAI,CAAA;AAAA,EACd,CAAA;AAEA,EAAA,MAAM,cAAc,MAAM;AACxB,IAAA,OAAA,CAAQ,KAAK,CAAA;AAAA,EACf,CAAA;AAEA,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AAA,UAAA;AAAA,YACC,YAAA,EAAY,EAAE,4BAA4B,CAAA;AAAA,YAC1C,WAAW,OAAA,CAAQ,WAAA;AAAA,YACnB,OAAA,EAAS,WAAA;AAAA,YAET,8BAAC,SAAA,EAAA,EAAU;AAAA;AAAA;AACb,OAAA,EACF,CAAA;AAAA,sBACA,GAAA,CAAC,aAAA,EAAA,EAAe,QAAA,EAAA,aAAA,EAAc,EAAE,CAAA;AAAA,sBAChC,GAAA,CAAC,aAAA,EAAA,EACE,QAAA,EAAA,EAAA,IAAM,EAAA,CAAG,SAAS,MAAA,oBACjB,GAAA;AAAA,QAAC,UAAA;AAAA,QAAA;AAAA,UACC,IAAI,EAAA,CAAG,QAAA;AAAA,UACP,OAAA,EAAQ,UAAA;AAAA,UACR,SAAA,sBAAY,aAAA,EAAA,EAAc,CAAA;AAAA,UAC1B,MAAA,EAAO,QAAA;AAAA,UACP,GAAA,EAAI,UAAA;AAAA,UAEH,YAAE,oBAAoB;AAAA;AAAA,OACzB,EAEJ;AAAA,KAAA,EACF;AAAA,GAAA,EACF,CAAA;AAEJ;;;;"}
@@ -26,6 +26,8 @@ import { PodExecTerminalDialog } from '../../PodExecTerminal/PodExecTerminalDial
26
26
  import { ResourceUtilization } from '../../ResourceUtilization/ResourceUtilization.esm.js';
27
27
  import '@material-ui/core/Paper';
28
28
  import '@material-ui/lab/Skeleton';
29
+ import { useTranslationRef } from '@backstage/core-plugin-api/alpha';
30
+ import { kubernetesReactTranslationRef } from '../../../translation.esm.js';
29
31
  import { PodLogsDialog } from '../PodLogs/PodLogsDialog.esm.js';
30
32
 
31
33
  const getContainerHealthChecks = (containerSpec, containerStatus) => {
@@ -71,6 +73,7 @@ const ContainerCard = ({
71
73
  containerStatus,
72
74
  containerMetrics
73
75
  }) => {
76
+ const { t } = useTranslationRef(kubernetesReactTranslationRef);
74
77
  const isPodExecTerminalEnabled = useIsPodExecTerminalEnabled();
75
78
  if (containerSpec === void 0) {
76
79
  return /* @__PURE__ */ jsx(Typography, { children: "error reading pod from cluster" });
@@ -131,13 +134,13 @@ const ContainerCard = ({
131
134
  }
132
135
  ) }),
133
136
  containerMetrics && /* @__PURE__ */ jsxs(Grid, { container: true, item: true, xs: 12, spacing: 0, children: [
134
- /* @__PURE__ */ jsx(Grid, { item: true, xs: 12, children: /* @__PURE__ */ jsx(Typography, { variant: "subtitle1", children: "Resource utilization" }) }),
137
+ /* @__PURE__ */ jsx(Grid, { item: true, xs: 12, children: /* @__PURE__ */ jsx(Typography, { variant: "subtitle1", children: t("podDrawer.resourceUtilization") }) }),
135
138
  /* @__PURE__ */ jsxs(Grid, { item: true, xs: 12, style: { minHeight: "5rem" }, children: [
136
139
  /* @__PURE__ */ jsx(
137
140
  ResourceUtilization,
138
141
  {
139
142
  compressed: true,
140
- title: "CPU requests",
143
+ title: t("podDrawer.cpuRequests"),
141
144
  usage: containerMetrics.cpuUsage.currentUsage,
142
145
  total: containerMetrics.cpuUsage.requestTotal,
143
146
  totalFormatted: formatMillicores(
@@ -149,7 +152,7 @@ const ContainerCard = ({
149
152
  ResourceUtilization,
150
153
  {
151
154
  compressed: true,
152
- title: "CPU limits",
155
+ title: t("podDrawer.cpuLimits"),
153
156
  usage: containerMetrics.cpuUsage.currentUsage,
154
157
  total: containerMetrics.cpuUsage.limitTotal,
155
158
  totalFormatted: formatMillicores(
@@ -161,7 +164,7 @@ const ContainerCard = ({
161
164
  ResourceUtilization,
162
165
  {
163
166
  compressed: true,
164
- title: "Memory requests",
167
+ title: t("podDrawer.memoryRequests"),
165
168
  usage: containerMetrics.memoryUsage.currentUsage,
166
169
  total: containerMetrics.memoryUsage.requestTotal,
167
170
  totalFormatted: bytesToMiB(
@@ -173,7 +176,7 @@ const ContainerCard = ({
173
176
  ResourceUtilization,
174
177
  {
175
178
  compressed: true,
176
- title: "Memory limits",
179
+ title: t("podDrawer.memoryLimits"),
177
180
  usage: containerMetrics.memoryUsage.currentUsage,
178
181
  total: containerMetrics.memoryUsage.limitTotal,
179
182
  totalFormatted: bytesToMiB(
@@ -1 +1 @@
1
- {"version":3,"file":"ContainerCard.esm.js","sources":["../../../../src/components/Pods/PodDrawer/ContainerCard.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 { StructuredMetadataTable } from '@backstage/core-components';\nimport { ClientContainerStatus } from '@backstage/plugin-kubernetes-common';\nimport Card from '@material-ui/core/Card';\nimport CardActions from '@material-ui/core/CardActions';\nimport CardContent from '@material-ui/core/CardContent';\nimport CardHeader from '@material-ui/core/CardHeader';\nimport Grid from '@material-ui/core/Grid';\nimport Typography from '@material-ui/core/Typography';\nimport { IContainer, IContainerStatus } from 'kubernetes-models/v1';\nimport { DateTime } from 'luxon';\nimport { FC } from 'react';\n\nimport { useIsPodExecTerminalEnabled } from '../../../hooks';\nimport { bytesToMiB, formatMillicores } from '../../../utils/resources';\nimport { PodExecTerminalDialog } from '../../PodExecTerminal/PodExecTerminalDialog';\nimport { ResourceUtilization } from '../../ResourceUtilization';\nimport { PodLogsDialog, PodScope } from '../PodLogs';\n\nconst getContainerHealthChecks = (\n containerSpec: IContainer,\n containerStatus: IContainerStatus,\n): { [key: string]: boolean } => {\n const healthCheck = {\n 'not waiting to start': containerStatus.state?.waiting === undefined,\n 'no restarts': containerStatus.restartCount === 0,\n };\n if (containerStatus.state?.terminated?.reason === 'Completed') {\n return healthCheck;\n }\n Object.assign(\n healthCheck,\n { started: !!containerStatus.started },\n { ready: containerStatus.ready },\n { 'readiness probe set': containerSpec?.readinessProbe !== undefined },\n );\n if (containerSpec && containerSpec?.livenessProbe !== undefined) {\n Object.assign(healthCheck, {\n 'liveness probe set': containerSpec.livenessProbe,\n });\n }\n return healthCheck;\n};\n\nconst getCurrentState = (containerStatus: IContainerStatus): string => {\n return (\n containerStatus.state?.waiting?.reason ||\n containerStatus.state?.terminated?.reason ||\n (containerStatus.state?.running !== undefined ? 'Running' : 'Unknown')\n );\n};\n\nconst getStartedAtTime = (\n containerStatus: IContainerStatus,\n): string | undefined => {\n return (\n containerStatus.state?.running?.startedAt ||\n containerStatus.state?.terminated?.startedAt\n );\n};\n\ninterface ContainerDatetimeProps {\n prefix: string;\n dateTime: string;\n}\n\nconst ContainerDatetime = ({ prefix, dateTime }: ContainerDatetimeProps) => {\n return (\n <Typography variant=\"subtitle2\">\n {prefix}:{' '}\n {DateTime.fromISO(dateTime).toRelative({\n locale: 'en',\n })}\n </Typography>\n );\n};\n\n/**\n * Props for ContainerCard\n *\n * @public\n */\nexport interface ContainerCardProps {\n podScope: PodScope;\n containerSpec?: IContainer;\n containerStatus: IContainerStatus;\n containerMetrics?: ClientContainerStatus;\n}\n\n/**\n * Shows details about a container within a pod\n *\n * @public\n */\nexport const ContainerCard: FC<ContainerCardProps> = ({\n podScope,\n containerSpec,\n containerStatus,\n containerMetrics,\n}: ContainerCardProps) => {\n const isPodExecTerminalEnabled = useIsPodExecTerminalEnabled();\n\n // This should never be undefined\n if (containerSpec === undefined) {\n return <Typography>error reading pod from cluster</Typography>;\n }\n const containerStartedTime = getStartedAtTime(containerStatus);\n const containerFinishedTime = containerStatus.state?.terminated?.finishedAt;\n\n return (\n <Card>\n <CardHeader\n title={containerStatus.name}\n subheader={containerStatus.image}\n />\n <CardContent>\n <Grid container>\n <Grid item xs={12}>\n {containerStartedTime && (\n <ContainerDatetime\n prefix=\"Started\"\n dateTime={containerStartedTime}\n />\n )}\n {containerFinishedTime && (\n <ContainerDatetime\n prefix=\"Completed\"\n dateTime={containerFinishedTime}\n />\n )}\n {containerStartedTime && containerFinishedTime && (\n <Typography variant=\"subtitle2\">\n Execution time:{' '}\n {DateTime.fromISO(containerFinishedTime)\n .diff(DateTime.fromISO(containerStartedTime), [\n 'hours',\n 'minutes',\n 'seconds',\n ])\n .toHuman()}\n </Typography>\n )}\n </Grid>\n <Grid item xs={12}>\n <Typography variant=\"subtitle2\">\n Status: {getCurrentState(containerStatus)}\n </Typography>\n </Grid>\n {containerStatus.restartCount > 0 && (\n <Grid item xs={12}>\n <Typography variant=\"subtitle2\">\n Restarts: {containerStatus.restartCount}\n </Typography>\n </Grid>\n )}\n <Grid item xs={12}>\n <Typography variant=\"subtitle2\">Container health</Typography>\n </Grid>\n <Grid item xs={12}>\n <StructuredMetadataTable\n metadata={getContainerHealthChecks(\n containerSpec,\n containerStatus,\n )}\n options={{ nestedValuesAsYaml: true }}\n />\n </Grid>\n {containerMetrics && (\n <Grid container item xs={12} spacing={0}>\n <Grid item xs={12}>\n <Typography variant=\"subtitle1\">\n Resource utilization\n </Typography>\n </Grid>\n <Grid item xs={12} style={{ minHeight: '5rem' }}>\n <ResourceUtilization\n compressed\n title=\"CPU requests\"\n usage={containerMetrics.cpuUsage.currentUsage}\n total={containerMetrics.cpuUsage.requestTotal}\n totalFormatted={formatMillicores(\n containerMetrics.cpuUsage.requestTotal,\n )}\n />\n <ResourceUtilization\n compressed\n title=\"CPU limits\"\n usage={containerMetrics.cpuUsage.currentUsage}\n total={containerMetrics.cpuUsage.limitTotal}\n totalFormatted={formatMillicores(\n containerMetrics.cpuUsage.limitTotal,\n )}\n />\n <ResourceUtilization\n compressed\n title=\"Memory requests\"\n usage={containerMetrics.memoryUsage.currentUsage}\n total={containerMetrics.memoryUsage.requestTotal}\n totalFormatted={bytesToMiB(\n containerMetrics.memoryUsage.requestTotal,\n )}\n />\n <ResourceUtilization\n compressed\n title=\"Memory limits\"\n usage={containerMetrics.memoryUsage.currentUsage}\n total={containerMetrics.memoryUsage.limitTotal}\n totalFormatted={bytesToMiB(\n containerMetrics.memoryUsage.limitTotal,\n )}\n />\n </Grid>\n </Grid>\n )}\n </Grid>\n </CardContent>\n <CardActions>\n <PodLogsDialog\n containerScope={{\n containerName: containerStatus.name,\n ...podScope,\n }}\n />\n {isPodExecTerminalEnabled && (\n <PodExecTerminalDialog\n cluster={podScope.cluster}\n containerName={containerStatus.name}\n podName={podScope.podName}\n podNamespace={podScope.podNamespace}\n />\n )}\n </CardActions>\n </Card>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiCA,MAAM,wBAAA,GAA2B,CAC/B,aAAA,EACA,eAAA,KAC+B;AAC/B,EAAA,MAAM,WAAA,GAAc;AAAA,IAClB,sBAAA,EAAwB,eAAA,CAAgB,KAAA,EAAO,OAAA,KAAY,MAAA;AAAA,IAC3D,aAAA,EAAe,gBAAgB,YAAA,KAAiB;AAAA,GAClD;AACA,EAAA,IAAI,eAAA,CAAgB,KAAA,EAAO,UAAA,EAAY,MAAA,KAAW,WAAA,EAAa;AAC7D,IAAA,OAAO,WAAA;AAAA,EACT;AACA,EAAA,MAAA,CAAO,MAAA;AAAA,IACL,WAAA;AAAA,IACA,EAAE,OAAA,EAAS,CAAC,CAAC,gBAAgB,OAAA,EAAQ;AAAA,IACrC,EAAE,KAAA,EAAO,eAAA,CAAgB,KAAA,EAAM;AAAA,IAC/B,EAAE,qBAAA,EAAuB,aAAA,EAAe,cAAA,KAAmB,MAAA;AAAU,GACvE;AACA,EAAA,IAAI,aAAA,IAAiB,aAAA,EAAe,aAAA,KAAkB,MAAA,EAAW;AAC/D,IAAA,MAAA,CAAO,OAAO,WAAA,EAAa;AAAA,MACzB,sBAAsB,aAAA,CAAc;AAAA,KACrC,CAAA;AAAA,EACH;AACA,EAAA,OAAO,WAAA;AACT,CAAA;AAEA,MAAM,eAAA,GAAkB,CAAC,eAAA,KAA8C;AACrE,EAAA,OACE,eAAA,CAAgB,KAAA,EAAO,OAAA,EAAS,MAAA,IAChC,eAAA,CAAgB,KAAA,EAAO,UAAA,EAAY,MAAA,KAClC,eAAA,CAAgB,K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,wBAAA,oBACC,GAAA;AAAA,QAAC,qBAAA;AAAA,QAAA;AAAA,UACC,SAAS,QAAA,CAAS,OAAA;AAAA,UAClB,eAAe,eAAA,CAAgB,IAAA;AAAA,UAC/B,SAAS,QAAA,CAAS,OAAA;AAAA,UAClB,cAAc,QAAA,CAAS;AAAA;AAAA;AACzB,KAAA,EAEJ;AAAA,GAAA,EACF,CAAA;AAEJ;;;;"}
1
+ {"version":3,"file":"ContainerCard.esm.js","sources":["../../../../src/components/Pods/PodDrawer/ContainerCard.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 { StructuredMetadataTable } from '@backstage/core-components';\nimport { ClientContainerStatus } from '@backstage/plugin-kubernetes-common';\nimport Card from '@material-ui/core/Card';\nimport CardActions from '@material-ui/core/CardActions';\nimport CardContent from '@material-ui/core/CardContent';\nimport CardHeader from '@material-ui/core/CardHeader';\nimport Grid from '@material-ui/core/Grid';\nimport Typography from '@material-ui/core/Typography';\nimport { IContainer, IContainerStatus } from 'kubernetes-models/v1';\nimport { DateTime } from 'luxon';\nimport { FC } from 'react';\n\nimport { useIsPodExecTerminalEnabled } from '../../../hooks';\nimport { bytesToMiB, formatMillicores } from '../../../utils/resources';\nimport { PodExecTerminalDialog } from '../../PodExecTerminal/PodExecTerminalDialog';\nimport { ResourceUtilization } from '../../ResourceUtilization';\nimport { PodLogsDialog, PodScope } from '../PodLogs';\nimport { useTranslationRef } from '@backstage/core-plugin-api/alpha';\nimport { kubernetesReactTranslationRef } from '../../../translation';\n\nconst getContainerHealthChecks = (\n containerSpec: IContainer,\n containerStatus: IContainerStatus,\n): { [key: string]: boolean } => {\n const healthCheck = {\n 'not waiting to start': containerStatus.state?.waiting === undefined,\n 'no restarts': containerStatus.restartCount === 0,\n };\n if (containerStatus.state?.terminated?.reason === 'Completed') {\n return healthCheck;\n }\n Object.assign(\n healthCheck,\n { started: !!containerStatus.started },\n { ready: containerStatus.ready },\n { 'readiness probe set': containerSpec?.readinessProbe !== undefined },\n );\n if (containerSpec && containerSpec?.livenessProbe !== undefined) {\n Object.assign(healthCheck, {\n 'liveness probe set': containerSpec.livenessProbe,\n });\n }\n return healthCheck;\n};\n\nconst getCurrentState = (containerStatus: IContainerStatus): string => {\n return (\n containerStatus.state?.waiting?.reason ||\n containerStatus.state?.terminated?.reason ||\n (containerStatus.state?.running !== undefined ? 'Running' : 'Unknown')\n );\n};\n\nconst getStartedAtTime = (\n containerStatus: IContainerStatus,\n): string | undefined => {\n return (\n containerStatus.state?.running?.startedAt ||\n containerStatus.state?.terminated?.startedAt\n );\n};\n\ninterface ContainerDatetimeProps {\n prefix: string;\n dateTime: string;\n}\n\nconst ContainerDatetime = ({ prefix, dateTime }: ContainerDatetimeProps) => {\n return (\n <Typography variant=\"subtitle2\">\n {prefix}:{' '}\n {DateTime.fromISO(dateTime).toRelative({\n locale: 'en',\n })}\n </Typography>\n );\n};\n\n/**\n * Props for ContainerCard\n *\n * @public\n */\nexport interface ContainerCardProps {\n podScope: PodScope;\n containerSpec?: IContainer;\n containerStatus: IContainerStatus;\n containerMetrics?: ClientContainerStatus;\n}\n\n/**\n * Shows details about a container within a pod\n *\n * @public\n */\nexport const ContainerCard: FC<ContainerCardProps> = ({\n podScope,\n containerSpec,\n containerStatus,\n containerMetrics,\n}: ContainerCardProps) => {\n const { t } = useTranslationRef(kubernetesReactTranslationRef);\n const isPodExecTerminalEnabled = useIsPodExecTerminalEnabled();\n\n // This should never be undefined\n if (containerSpec === undefined) {\n return <Typography>error reading pod from cluster</Typography>;\n }\n const containerStartedTime = getStartedAtTime(containerStatus);\n const containerFinishedTime = containerStatus.state?.terminated?.finishedAt;\n\n return (\n <Card>\n <CardHeader\n title={containerStatus.name}\n subheader={containerStatus.image}\n />\n <CardContent>\n <Grid container>\n <Grid item xs={12}>\n {containerStartedTime && (\n <ContainerDatetime\n prefix=\"Started\"\n dateTime={containerStartedTime}\n />\n )}\n {containerFinishedTime && (\n <ContainerDatetime\n prefix=\"Completed\"\n dateTime={containerFinishedTime}\n />\n )}\n {containerStartedTime && containerFinishedTime && (\n <Typography variant=\"subtitle2\">\n Execution time:{' '}\n {DateTime.fromISO(containerFinishedTime)\n .diff(DateTime.fromISO(containerStartedTime), [\n 'hours',\n 'minutes',\n 'seconds',\n ])\n .toHuman()}\n </Typography>\n )}\n </Grid>\n <Grid item xs={12}>\n <Typography variant=\"subtitle2\">\n Status: {getCurrentState(containerStatus)}\n </Typography>\n </Grid>\n {containerStatus.restartCount > 0 && (\n <Grid item xs={12}>\n <Typography variant=\"subtitle2\">\n Restarts: {containerStatus.restartCount}\n </Typography>\n </Grid>\n )}\n <Grid item xs={12}>\n <Typography variant=\"subtitle2\">Container health</Typography>\n </Grid>\n <Grid item xs={12}>\n <StructuredMetadataTable\n metadata={getContainerHealthChecks(\n containerSpec,\n containerStatus,\n )}\n options={{ nestedValuesAsYaml: true }}\n />\n </Grid>\n {containerMetrics && (\n <Grid container item xs={12} spacing={0}>\n <Grid item xs={12}>\n <Typography variant=\"subtitle1\">\n {t('podDrawer.resourceUtilization')}\n </Typography>\n </Grid>\n <Grid item xs={12} style={{ minHeight: '5rem' }}>\n <ResourceUtilization\n compressed\n title={t('podDrawer.cpuRequests')}\n usage={containerMetrics.cpuUsage.currentUsage}\n total={containerMetrics.cpuUsage.requestTotal}\n totalFormatted={formatMillicores(\n containerMetrics.cpuUsage.requestTotal,\n )}\n />\n <ResourceUtilization\n compressed\n title={t('podDrawer.cpuLimits')}\n usage={containerMetrics.cpuUsage.currentUsage}\n total={containerMetrics.cpuUsage.limitTotal}\n totalFormatted={formatMillicores(\n containerMetrics.cpuUsage.limitTotal,\n )}\n />\n <ResourceUtilization\n compressed\n title={t('podDrawer.memoryRequests')}\n usage={containerMetrics.memoryUsage.currentUsage}\n total={containerMetrics.memoryUsage.requestTotal}\n totalFormatted={bytesToMiB(\n containerMetrics.memoryUsage.requestTotal,\n )}\n />\n <ResourceUtilization\n compressed\n title={t('podDrawer.memoryLimits')}\n usage={containerMetrics.memoryUsage.currentUsage}\n total={containerMetrics.memoryUsage.limitTotal}\n totalFormatted={bytesToMiB(\n containerMetrics.memoryUsage.limitTotal,\n )}\n />\n </Grid>\n </Grid>\n )}\n </Grid>\n </CardContent>\n <CardActions>\n <PodLogsDialog\n containerScope={{\n containerName: containerStatus.name,\n ...podScope,\n }}\n />\n {isPodExecTerminalEnabled && (\n <PodExecTerminalDialog\n cluster={podScope.cluster}\n containerName={containerStatus.name}\n podName={podScope.podName}\n podNamespace={podScope.podNamespace}\n />\n )}\n </CardActions>\n </Card>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmCA,MAAM,wBAAA,GAA2B,CAC/B,aAAA,EACA,eAAA,KAC+B;AAC/B,EAAA,MAAM,WAAA,GAAc;AAAA,IAClB,sBAAA,EAAwB,eAAA,CAAgB,KAAA,EAAO,OAAA,KAAY,MAAA;AAAA,IAC3D,aAAA,EAAe,gBAAgB,YAAA,KAAiB;AAAA,GAClD;AACA,EAAA,IAAI,eAAA,CAAgB,KAAA,EAAO,UAAA,EAAY,MAAA,KAAW,WAAA,EAAa;AAC7D,IAAA,OAAO,WAAA;AAAA,EACT;AACA,EAAA,MAAA,CAAO,MAAA;AAAA,IACL,WAAA;AAAA,IACA,EAAE,OAAA,EAAS,CAAC,CAAC,gBAAgB,OAAA,EAAQ;AAAA,IACrC,EAAE,KAAA,EAAO,eAAA,CAAgB,KAAA,EAAM;AAAA,IAC/B,EAAE,qBAAA,EAAuB,aAAA,EAAe,cAAA,KAAmB,MAAA;AAAU,GAC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AA,YAAC,mBAAA;AAAA,YAAA;AAAA,cACC,UAAA,EAAU,IAAA;AAAA,cACV,KAAA,EAAO,EAAE,wBAAwB,CAAA;AAAA,cACjC,KAAA,EAAO,iBAAiB,WAAA,CAAY,YAAA;AAAA,cACpC,KAAA,EAAO,iBAAiB,WAAA,CAAY,UAAA;AAAA,cACpC,cAAA,EAAgB,UAAA;AAAA,gBACd,iBAAiB,WAAA,CAAY;AAAA;AAC/B;AAAA;AACF,SAAA,EACF;AAAA,OAAA,EACF;AAAA,KAAA,EAEJ,CAAA,EACF,CAAA;AAAA,yBACC,WAAA,EAAA,EACC,QAAA,EAAA;AAAA,sBAAA,GAAA;AAAA,QAAC,aAAA;AAAA,QAAA;AAAA,UACC,cAAA,EAAgB;AAAA,YACd,eAAe,eAAA,CAAgB,IAAA;AAAA,YAC/B,GAAG;AAAA;AACL;AAAA,OACF;AAAA,MACC,wBAAA,oBACC,GAAA;AAAA,QAAC,qBAAA;AAAA,QAAA;AAAA,UACC,SAAS,QAAA,CAAS,OAAA;AAAA,UAClB,eAAe,eAAA,CAAgB,IAAA;AAAA,UAC/B,SAAS,QAAA,CAAS,OAAA;AAAA,UAClB,cAAc,QAAA,CAAS;AAAA;AAAA;AACzB,KAAA,EAEJ;AAAA,GAAA,EACF,CAAA;AAEJ;;;;"}
@@ -10,6 +10,8 @@ import '@material-ui/core/FormControlLabel';
10
10
  import '@material-ui/core/Switch';
11
11
  import 'js-yaml';
12
12
  import 'react';
13
+ import { useTranslationRef } from '@backstage/core-plugin-api/alpha';
14
+ import { kubernetesReactTranslationRef } from '../../../translation.esm.js';
13
15
  import { PodDeleteButton } from '../PodDelete/PodDeleteButton.esm.js';
14
16
  import { PendingPodContent } from './PendingPodContent.esm.js';
15
17
  import { ErrorList } from '../ErrorList/ErrorList.esm.js';
@@ -56,6 +58,7 @@ const PodDrawer = ({ podAndErrors, open }) => {
56
58
  const classes = useDrawerContentStyles();
57
59
  const podMetrics = usePodMetrics(podAndErrors.cluster.name, podAndErrors.pod);
58
60
  const isPodDeleteEnabled = useIsPodDeleteEnabled();
61
+ const { t } = useTranslationRef(kubernetesReactTranslationRef);
59
62
  return /* @__PURE__ */ jsx(
60
63
  KubernetesDrawer,
61
64
  {
@@ -79,12 +82,12 @@ const PodDrawer = ({ podAndErrors, open }) => {
79
82
  }
80
83
  ),
81
84
  podMetrics && /* @__PURE__ */ jsxs(Grid, { container: true, item: true, xs: 12, children: [
82
- /* @__PURE__ */ jsx(Grid, { item: true, xs: 12, children: /* @__PURE__ */ jsx(Typography, { variant: "h5", children: "Resource utilization" }) }),
85
+ /* @__PURE__ */ jsx(Grid, { item: true, xs: 12, children: /* @__PURE__ */ jsx(Typography, { variant: "h5", children: t("podDrawer.resourceUtilization") }) }),
83
86
  /* @__PURE__ */ jsxs(Grid, { item: true, xs: 6, children: [
84
87
  /* @__PURE__ */ jsx(
85
88
  ResourceUtilization,
86
89
  {
87
- title: "CPU requests",
90
+ title: t("podDrawer.cpuRequests"),
88
91
  usage: podMetrics.cpu.currentUsage,
89
92
  total: podMetrics.cpu.requestTotal,
90
93
  totalFormatted: formatMillicores(podMetrics.cpu.requestTotal)
@@ -93,7 +96,7 @@ const PodDrawer = ({ podAndErrors, open }) => {
93
96
  /* @__PURE__ */ jsx(
94
97
  ResourceUtilization,
95
98
  {
96
- title: "CPU limits",
99
+ title: t("podDrawer.cpuLimits"),
97
100
  usage: podMetrics.cpu.currentUsage,
98
101
  total: podMetrics.cpu.limitTotal,
99
102
  totalFormatted: formatMillicores(podMetrics.cpu.limitTotal)
@@ -104,7 +107,7 @@ const PodDrawer = ({ podAndErrors, open }) => {
104
107
  /* @__PURE__ */ jsx(
105
108
  ResourceUtilization,
106
109
  {
107
- title: "Memory requests",
110
+ title: t("podDrawer.memoryRequests"),
108
111
  usage: podMetrics.memory.currentUsage,
109
112
  total: podMetrics.memory.requestTotal,
110
113
  totalFormatted: bytesToMiB(podMetrics.memory.requestTotal)
@@ -113,7 +116,7 @@ const PodDrawer = ({ podAndErrors, open }) => {
113
116
  /* @__PURE__ */ jsx(
114
117
  ResourceUtilization,
115
118
  {
116
- title: "Memory limits",
119
+ title: t("podDrawer.memoryLimits"),
117
120
  usage: podMetrics.memory.currentUsage,
118
121
  total: podMetrics.memory.limitTotal,
119
122
  totalFormatted: bytesToMiB(podMetrics.memory.limitTotal)
@@ -1 +1 @@
1
- {"version":3,"file":"PodDrawer.esm.js","sources":["../../../../src/components/Pods/PodDrawer/PodDrawer.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 { ItemCardGrid } from '@backstage/core-components';\nimport Grid from '@material-ui/core/Grid';\nimport Typography from '@material-ui/core/Typography';\nimport { createStyles, makeStyles, Theme } from '@material-ui/core/styles';\n\nimport { Pod } from 'kubernetes-models/v1';\n\nimport { ContainerCard } from './ContainerCard';\n\nimport { PodAndErrors } from '../types';\nimport { KubernetesDrawer } from '../../KubernetesDrawer';\nimport { PodDeleteButton } from '../PodDelete/PodDeleteButton';\nimport { PendingPodContent } from './PendingPodContent';\nimport { ErrorList } from '../ErrorList';\nimport { usePodMetrics } from '../../../hooks/usePodMetrics';\nimport { ResourceUtilization } from '../../ResourceUtilization';\nimport { bytesToMiB, formatMillicores } from '../../../utils/resources';\nimport { useIsPodDeleteEnabled } from '../../../hooks';\n\nconst useDrawerContentStyles = makeStyles((_theme: Theme) =>\n createStyles({\n header: {\n display: 'flex',\n flexDirection: 'row',\n justifyContent: 'space-between',\n },\n content: {\n height: '80%',\n },\n icon: {\n fontSize: 20,\n },\n podoklist: {\n width: '100%',\n maxWidth: 360,\n maxHeight: 360,\n },\n }),\n);\n\nfunction getContainerSpecByName(pod: Pod, containerName: string) {\n return pod.spec?.containers.find(c => c.name === containerName);\n}\n\n/**\n * Props for PodDrawer\n *\n * @public\n */\nexport interface PodDrawerProps {\n open?: boolean;\n podAndErrors: PodAndErrors;\n}\n\n/**\n * A Drawer for Kubernetes Pods\n *\n * @public\n */\nexport const PodDrawer = ({ podAndErrors, open }: PodDrawerProps) => {\n const classes = useDrawerContentStyles();\n const podMetrics = usePodMetrics(podAndErrors.cluster.name, podAndErrors.pod);\n const isPodDeleteEnabled = useIsPodDeleteEnabled();\n\n return (\n <KubernetesDrawer\n open={open}\n drawerContentsHeader={\n <Typography variant=\"subtitle1\">\n Pod{' '}\n {podAndErrors.pod.status?.podIP &&\n `(${podAndErrors.pod.status?.podIP})`}\n </Typography>\n }\n kubernetesObject={podAndErrors.pod}\n label={\n <Typography variant=\"subtitle1\">\n {podAndErrors.pod.metadata?.name ?? 'unknown'}\n </Typography>\n }\n >\n <div className={classes.content}>\n {isPodDeleteEnabled && (\n <PodDeleteButton\n podScope={{\n podName: podAndErrors.pod.metadata?.name ?? 'unknown',\n podNamespace: podAndErrors.pod.metadata?.namespace ?? 'default',\n cluster: podAndErrors.cluster,\n }}\n />\n )}\n {podMetrics && (\n <Grid container item xs={12}>\n <Grid item xs={12}>\n <Typography variant=\"h5\">Resource utilization</Typography>\n </Grid>\n <Grid item xs={6}>\n <ResourceUtilization\n title=\"CPU requests\"\n usage={podMetrics.cpu.currentUsage}\n total={podMetrics.cpu.requestTotal}\n totalFormatted={formatMillicores(podMetrics.cpu.requestTotal)}\n />\n <ResourceUtilization\n title=\"CPU limits\"\n usage={podMetrics.cpu.currentUsage}\n total={podMetrics.cpu.limitTotal}\n totalFormatted={formatMillicores(podMetrics.cpu.limitTotal)}\n />\n </Grid>\n <Grid item xs={6}>\n <ResourceUtilization\n title=\"Memory requests\"\n usage={podMetrics.memory.currentUsage}\n total={podMetrics.memory.requestTotal}\n totalFormatted={bytesToMiB(podMetrics.memory.requestTotal)}\n />\n <ResourceUtilization\n title=\"Memory limits\"\n usage={podMetrics.memory.currentUsage}\n total={podMetrics.memory.limitTotal}\n totalFormatted={bytesToMiB(podMetrics.memory.limitTotal)}\n />\n </Grid>\n </Grid>\n )}\n {podAndErrors.pod.status?.phase === 'Pending' && (\n <PendingPodContent pod={podAndErrors.pod} />\n )}\n {podAndErrors.pod.status?.containerStatuses?.length && (\n <Grid container spacing={2}>\n <Grid item xs={12}>\n <Typography variant=\"h5\">Containers</Typography>\n </Grid>\n <Grid item xs={12}>\n <ItemCardGrid>\n {podAndErrors.pod.status?.containerStatuses?.map(\n (containerStatus, i) => {\n const containerSpec = getContainerSpecByName(\n podAndErrors.pod,\n containerStatus.name,\n );\n const containerMetrics = (\n podMetrics?.containers ?? []\n ).find(c => c.container === containerStatus.name);\n return (\n <ContainerCard\n key={`container-card-${podAndErrors.pod.metadata?.name}-${i}`}\n containerMetrics={containerMetrics}\n podScope={{\n podName: podAndErrors.pod.metadata?.name ?? 'unknown',\n podNamespace:\n podAndErrors.pod.metadata?.namespace ?? 'unknown',\n cluster: podAndErrors.cluster,\n }}\n containerSpec={containerSpec}\n containerStatus={containerStatus}\n />\n );\n },\n )}\n </ItemCardGrid>\n </Grid>\n {podAndErrors.errors.length > 0 && (\n <Grid item xs={12}>\n <Typography variant=\"h5\">Errors</Typography>\n </Grid>\n )}\n {podAndErrors.errors.length > 0 && (\n <Grid item xs={12}>\n <ErrorList podAndErrors={[podAndErrors]} />\n </Grid>\n )}\n </Grid>\n )}\n </div>\n </KubernetesDrawer>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmCA,MAAM,sBAAA,GAAyB,UAAA;AAAA,EAAW,CAAC,WACzC,YAAA,CAAa;AAAA,IACX,MAAA,EAAQ;AAAA,MACN,OAAA,EAAS,MAAA;AAAA,MACT,aAAA,EAAe,KAAA;AAAA,MACf,cAAA,EAAgB;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AAA,EAAC,EAAA,EAAI,EAAA,EACb,8BAAC,SAAA,EAAA,EAAU,YAAA,EAAc,CAAC,YAAY,GAAG,CAAA,EAC3C;AAAA,SAAA,EAEJ;AAAA,OAAA,EAEJ;AAAA;AAAA,GACF;AAEJ;;;;"}
1
+ {"version":3,"file":"PodDrawer.esm.js","sources":["../../../../src/components/Pods/PodDrawer/PodDrawer.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 { ItemCardGrid } from '@backstage/core-components';\nimport Grid from '@material-ui/core/Grid';\nimport Typography from '@material-ui/core/Typography';\nimport { createStyles, makeStyles, Theme } from '@material-ui/core/styles';\n\nimport { Pod } from 'kubernetes-models/v1';\n\nimport { ContainerCard } from './ContainerCard';\n\nimport { PodAndErrors } from '../types';\nimport { KubernetesDrawer } from '../../KubernetesDrawer';\nimport { PodDeleteButton } from '../PodDelete/PodDeleteButton';\nimport { PendingPodContent } from './PendingPodContent';\nimport { ErrorList } from '../ErrorList';\nimport { usePodMetrics } from '../../../hooks/usePodMetrics';\nimport { ResourceUtilization } from '../../ResourceUtilization';\nimport { bytesToMiB, formatMillicores } from '../../../utils/resources';\nimport { useIsPodDeleteEnabled } from '../../../hooks';\nimport { useTranslationRef } from '@backstage/core-plugin-api/alpha';\nimport { kubernetesReactTranslationRef } from '../../../translation';\n\nconst useDrawerContentStyles = makeStyles((_theme: Theme) =>\n createStyles({\n header: {\n display: 'flex',\n flexDirection: 'row',\n justifyContent: 'space-between',\n },\n content: {\n height: '80%',\n },\n icon: {\n fontSize: 20,\n },\n podoklist: {\n width: '100%',\n maxWidth: 360,\n maxHeight: 360,\n },\n }),\n);\n\nfunction getContainerSpecByName(pod: Pod, containerName: string) {\n return pod.spec?.containers.find(c => c.name === containerName);\n}\n\n/**\n * Props for PodDrawer\n *\n * @public\n */\nexport interface PodDrawerProps {\n open?: boolean;\n podAndErrors: PodAndErrors;\n}\n\n/**\n * A Drawer for Kubernetes Pods\n *\n * @public\n */\nexport const PodDrawer = ({ podAndErrors, open }: PodDrawerProps) => {\n const classes = useDrawerContentStyles();\n const podMetrics = usePodMetrics(podAndErrors.cluster.name, podAndErrors.pod);\n const isPodDeleteEnabled = useIsPodDeleteEnabled();\n const { t } = useTranslationRef(kubernetesReactTranslationRef);\n\n return (\n <KubernetesDrawer\n open={open}\n drawerContentsHeader={\n <Typography variant=\"subtitle1\">\n Pod{' '}\n {podAndErrors.pod.status?.podIP &&\n `(${podAndErrors.pod.status?.podIP})`}\n </Typography>\n }\n kubernetesObject={podAndErrors.pod}\n label={\n <Typography variant=\"subtitle1\">\n {podAndErrors.pod.metadata?.name ?? 'unknown'}\n </Typography>\n }\n >\n <div className={classes.content}>\n {isPodDeleteEnabled && (\n <PodDeleteButton\n podScope={{\n podName: podAndErrors.pod.metadata?.name ?? 'unknown',\n podNamespace: podAndErrors.pod.metadata?.namespace ?? 'default',\n cluster: podAndErrors.cluster,\n }}\n />\n )}\n {podMetrics && (\n <Grid container item xs={12}>\n <Grid item xs={12}>\n <Typography variant=\"h5\">\n {t('podDrawer.resourceUtilization')}\n </Typography>\n </Grid>\n <Grid item xs={6}>\n <ResourceUtilization\n title={t('podDrawer.cpuRequests')}\n usage={podMetrics.cpu.currentUsage}\n total={podMetrics.cpu.requestTotal}\n totalFormatted={formatMillicores(podMetrics.cpu.requestTotal)}\n />\n <ResourceUtilization\n title={t('podDrawer.cpuLimits')}\n usage={podMetrics.cpu.currentUsage}\n total={podMetrics.cpu.limitTotal}\n totalFormatted={formatMillicores(podMetrics.cpu.limitTotal)}\n />\n </Grid>\n <Grid item xs={6}>\n <ResourceUtilization\n title={t('podDrawer.memoryRequests')}\n usage={podMetrics.memory.currentUsage}\n total={podMetrics.memory.requestTotal}\n totalFormatted={bytesToMiB(podMetrics.memory.requestTotal)}\n />\n <ResourceUtilization\n title={t('podDrawer.memoryLimits')}\n usage={podMetrics.memory.currentUsage}\n total={podMetrics.memory.limitTotal}\n totalFormatted={bytesToMiB(podMetrics.memory.limitTotal)}\n />\n </Grid>\n </Grid>\n )}\n {podAndErrors.pod.status?.phase === 'Pending' && (\n <PendingPodContent pod={podAndErrors.pod} />\n )}\n {podAndErrors.pod.status?.containerStatuses?.length && (\n <Grid container spacing={2}>\n <Grid item xs={12}>\n <Typography variant=\"h5\">Containers</Typography>\n </Grid>\n <Grid item xs={12}>\n <ItemCardGrid>\n {podAndErrors.pod.status?.containerStatuses?.map(\n (containerStatus, i) => {\n const containerSpec = getContainerSpecByName(\n podAndErrors.pod,\n containerStatus.name,\n );\n const containerMetrics = (\n podMetrics?.containers ?? []\n ).find(c => c.container === containerStatus.name);\n return (\n <ContainerCard\n key={`container-card-${podAndErrors.pod.metadata?.name}-${i}`}\n containerMetrics={containerMetrics}\n podScope={{\n podName: podAndErrors.pod.metadata?.name ?? 'unknown',\n podNamespace:\n podAndErrors.pod.metadata?.namespace ?? 'unknown',\n cluster: podAndErrors.cluster,\n }}\n containerSpec={containerSpec}\n containerStatus={containerStatus}\n />\n );\n },\n )}\n </ItemCardGrid>\n </Grid>\n {podAndErrors.errors.length > 0 && (\n <Grid item xs={12}>\n <Typography variant=\"h5\">Errors</Typography>\n </Grid>\n )}\n {podAndErrors.errors.length > 0 && (\n <Grid item xs={12}>\n <ErrorList podAndErrors={[podAndErrors]} />\n </Grid>\n )}\n </Grid>\n )}\n </div>\n </KubernetesDrawer>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqCA,MAAM,sBAAA,GAAyB,UAAA;AAAA,EAAW,CAAC,WACzC,YAAA,CAAa;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,CAAO,MAAA,GAAS,CAAA,wBAC3B,IAAA,EAAA,EAAK,IAAA,EAAI,IAAA,EAAC,EAAA,EAAI,IACb,QAAA,kBAAA,GAAA,CAAC,UAAA,EAAA,EAAW,OAAA,EAAQ,IAAA,EAAK,oBAAM,CAAA,EACjC,CAAA;AAAA,UAED,aAAa,MAAA,CAAO,MAAA,GAAS,CAAA,oBAC5B,GAAA,CAAC,QAAK,IAAA,EAAI,IAAA,EAAC,EAAA,EAAI,EAAA,EACb,8BAAC,SAAA,EAAA,EAAU,YAAA,EAAc,CAAC,YAAY,GAAG,CAAA,EAC3C;AAAA,SAAA,EAEJ;AAAA,OAAA,EAEJ;AAAA;AAAA,GACF;AAEJ;;;;"}
@@ -3,11 +3,14 @@ import { DismissableBanner, EmptyState, LogViewer } from '@backstage/core-compon
3
3
  import Paper from '@material-ui/core/Paper';
4
4
  import Skeleton from '@material-ui/lab/Skeleton';
5
5
  import { usePodLogs } from './usePodLogs.esm.js';
6
+ import { useTranslationRef } from '@backstage/core-plugin-api/alpha';
7
+ import { kubernetesReactTranslationRef } from '../../../translation.esm.js';
6
8
 
7
9
  const PodLogs = ({
8
10
  containerScope,
9
11
  previous
10
12
  }) => {
13
+ const { t } = useTranslationRef(kubernetesReactTranslationRef);
11
14
  const { value, error, loading } = usePodLogs({
12
15
  containerScope,
13
16
  previous
@@ -35,8 +38,8 @@ const PodLogs = ({
35
38
  EmptyState,
36
39
  {
37
40
  missing: "data",
38
- title: "No logs emitted",
39
- description: "No logs were emitted by the container"
41
+ title: t("podLogs.title"),
42
+ description: t("podLogs.description")
40
43
  }
41
44
  ) : /* @__PURE__ */ jsx(LogViewer, { text: value.text }))
42
45
  ]
@@ -1 +1 @@
1
- {"version":3,"file":"PodLogs.esm.js","sources":["../../../../src/components/Pods/PodLogs/PodLogs.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 } from 'react';\n\nimport {\n DismissableBanner,\n EmptyState,\n LogViewer,\n} from '@backstage/core-components';\nimport Paper from '@material-ui/core/Paper';\nimport Skeleton from '@material-ui/lab/Skeleton';\n\nimport { ContainerScope } from './types';\nimport { usePodLogs } from './usePodLogs';\n\n/**\n * Props for PodLogs\n *\n * @public\n */\nexport interface PodLogsProps {\n containerScope: ContainerScope;\n previous?: boolean;\n}\n\n/**\n * Shows the logs for the given pod\n *\n * @public\n */\nexport const PodLogs: FC<PodLogsProps> = ({\n containerScope,\n previous,\n}: PodLogsProps) => {\n const { value, error, loading } = usePodLogs({\n containerScope,\n previous,\n });\n\n return (\n <>\n {error && (\n <DismissableBanner\n {...{\n message: error.message,\n variant: 'error',\n fixed: false,\n }}\n id=\"pod-logs\"\n />\n )}\n <Paper\n elevation={1}\n style={{ height: '100%', width: '100%', minHeight: '55rem' }}\n >\n {loading && <Skeleton variant=\"rect\" width=\"100%\" height=\"100%\" />}\n {!loading &&\n value !== undefined &&\n (value.text === '' ? (\n <EmptyState\n missing=\"data\"\n title=\"No logs emitted\"\n description=\"No logs were emitted by the container\"\n />\n ) : (\n <LogViewer text={value.text} />\n ))}\n </Paper>\n </>\n );\n};\n"],"names":[],"mappings":";;;;;;AA2CO,MAAM,UAA4B,CAAC;AAAA,EACxC,cAAA;AAAA,EACA;AACF,CAAA,KAAoB;AAClB,EAAA,MAAM,EAAE,KAAA,EAAO,KAAA,EAAO,OAAA,KAAY,UAAA,CAAW;AAAA,IAC3C,cAAA;AAAA,IACA;AAAA,GACD,CAAA;AAED,EAAA,uBACE,IAAA,CAAA,QAAA,EAAA,EACG,QAAA,EAAA;AAAA,IAAA,KAAA,oBACC,GAAA;AAAA,MAAC,iBAAA;AAAA,MAAA;AAAA,QACE,GAAG;AAAA,UACF,SAAS,KAAA,CAAM,OAAA;AAAA,UACf,OAAA,EAAS,OAAA;AAAA,UACT,KAAA,EAAO;AAAA,SACT;AAAA,QACA,EAAA,EAAG;AAAA;AAAA,KACL;AAAA,oBAEF,IAAA;AAAA,MAAC,KAAA;AAAA,MAAA;AAAA,QACC,SAAA,EAAW,CAAA;AAAA,QACX,OAAO,EAAE,MAAA,EAAQ,QAAQ,KAAA,EAAO,MAAA,EAAQ,WAAW,OAAA,EAAQ;AAAA,QAE1D,QAAA,EAAA;AAAA,UAAA,OAAA,wBAAY,QAAA,EAAA,EAAS,OAAA,EAAQ,QAAO,KAAA,EAAM,MAAA,EAAO,QAAO,MAAA,EAAO,CAAA;AAAA,UAC/D,CAAC,OAAA,IACA,KAAA,KAAU,MAAA,KACT,KAAA,CAAM,SAAS,EAAA,mBACd,GAAA;AAAA,YAAC,UAAA;AAAA,YAAA;AAAA,cACC,OAAA,EAAQ,MAAA;AAAA,cACR,KAAA,EAAM,iBAAA;AAAA,cACN,WAAA,EAAY;AAAA;AAAA,WACd,mBAEA,GAAA,CAAC,SAAA,EAAA,EAAU,IAAA,EAAM,MAAM,IAAA,EAAM,CAAA;AAAA;AAAA;AAAA;AAEnC,GAAA,EACF,CAAA;AAEJ;;;;"}
1
+ {"version":3,"file":"PodLogs.esm.js","sources":["../../../../src/components/Pods/PodLogs/PodLogs.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 } from 'react';\n\nimport {\n DismissableBanner,\n EmptyState,\n LogViewer,\n} from '@backstage/core-components';\nimport Paper from '@material-ui/core/Paper';\nimport Skeleton from '@material-ui/lab/Skeleton';\n\nimport { ContainerScope } from './types';\nimport { usePodLogs } from './usePodLogs';\nimport { useTranslationRef } from '@backstage/core-plugin-api/alpha';\nimport { kubernetesReactTranslationRef } from '../../../translation';\n\n/**\n * Props for PodLogs\n *\n * @public\n */\nexport interface PodLogsProps {\n containerScope: ContainerScope;\n previous?: boolean;\n}\n\n/**\n * Shows the logs for the given pod\n *\n * @public\n */\nexport const PodLogs: FC<PodLogsProps> = ({\n containerScope,\n previous,\n}: PodLogsProps) => {\n const { t } = useTranslationRef(kubernetesReactTranslationRef);\n const { value, error, loading } = usePodLogs({\n containerScope,\n previous,\n });\n\n return (\n <>\n {error && (\n <DismissableBanner\n {...{\n message: error.message,\n variant: 'error',\n fixed: false,\n }}\n id=\"pod-logs\"\n />\n )}\n <Paper\n elevation={1}\n style={{ height: '100%', width: '100%', minHeight: '55rem' }}\n >\n {loading && <Skeleton variant=\"rect\" width=\"100%\" height=\"100%\" />}\n {!loading &&\n value !== undefined &&\n (value.text === '' ? (\n <EmptyState\n missing=\"data\"\n title={t('podLogs.title')}\n description={t('podLogs.description')}\n />\n ) : (\n <LogViewer text={value.text} />\n ))}\n </Paper>\n </>\n );\n};\n"],"names":[],"mappings":";;;;;;;;AA6CO,MAAM,UAA4B,CAAC;AAAA,EACxC,cAAA;AAAA,EACA;AACF,CAAA,KAAoB;AAClB,EAAA,MAAM,EAAE,CAAA,EAAE,GAAI,iBAAA,CAAkB,6BAA6B,CAAA;AAC7D,EAAA,MAAM,EAAE,KAAA,EAAO,KAAA,EAAO,OAAA,KAAY,UAAA,CAAW;AAAA,IAC3C,cAAA;AAAA,IACA;AAAA,GACD,CAAA;AAED,EAAA,uBACE,IAAA,CAAA,QAAA,EAAA,EACG,QAAA,EAAA;AAAA,IAAA,KAAA,oBACC,GAAA;AAAA,MAAC,iBAAA;AAAA,MAAA;AAAA,QACE,GAAG;AAAA,UACF,SAAS,KAAA,CAAM,OAAA;AAAA,UACf,OAAA,EAAS,OAAA;AAAA,UACT,KAAA,EAAO;AAAA,SACT;AAAA,QACA,EAAA,EAAG;AAAA;AAAA,KACL;AAAA,oBAEF,IAAA;AAAA,MAAC,KAAA;AAAA,MAAA;AAAA,QACC,SAAA,EAAW,CAAA;AAAA,QACX,OAAO,EAAE,MAAA,EAAQ,QAAQ,KAAA,EAAO,MAAA,EAAQ,WAAW,OAAA,EAAQ;AAAA,QAE1D,QAAA,EAAA;AAAA,UAAA,OAAA,wBAAY,QAAA,EAAA,EAAS,OAAA,EAAQ,QAAO,KAAA,EAAM,MAAA,EAAO,QAAO,MAAA,EAAO,CAAA;AAAA,UAC/D,CAAC,OAAA,IACA,KAAA,KAAU,MAAA,KACT,KAAA,CAAM,SAAS,EAAA,mBACd,GAAA;AAAA,YAAC,UAAA;AAAA,YAAA;AAAA,cACC,OAAA,EAAQ,MAAA;AAAA,cACR,KAAA,EAAO,EAAE,eAAe,CAAA;AAAA,cACxB,WAAA,EAAa,EAAE,qBAAqB;AAAA;AAAA,WACtC,mBAEA,GAAA,CAAC,SAAA,EAAA,EAAU,IAAA,EAAM,MAAM,IAAA,EAAM,CAAA;AAAA;AAAA;AAAA;AAEnC,GAAA,EACF,CAAA;AAEJ;;;;"}
@@ -2,16 +2,23 @@ import { jsx } from 'react/jsx-runtime';
2
2
  import SubjectIcon from '@material-ui/icons/Subject';
3
3
  import { KubernetesDialog } from '../../KubernetesDialog/KubernetesDialog.esm.js';
4
4
  import { PodLogs } from './PodLogs.esm.js';
5
+ import { useTranslationRef } from '@backstage/core-plugin-api/alpha';
6
+ import { kubernetesReactTranslationRef } from '../../../translation.esm.js';
5
7
 
6
8
  const PodLogsDialog = ({ containerScope }) => {
9
+ const { t } = useTranslationRef(kubernetesReactTranslationRef);
7
10
  return /* @__PURE__ */ jsx(
8
11
  KubernetesDialog,
9
12
  {
10
- buttonAriaLabel: "get logs",
13
+ buttonAriaLabel: t("podLogs.buttonAriaLabel"),
11
14
  buttonIcon: /* @__PURE__ */ jsx(SubjectIcon, {}),
12
- buttonText: "Logs",
15
+ buttonText: t("podLogs.buttonText"),
13
16
  disabled: false,
14
- title: `${containerScope.podName} - ${containerScope.containerName} logs on cluster ${containerScope.cluster.title || containerScope.cluster.name}`,
17
+ title: t("podLogs.titleTemplate", {
18
+ podName: containerScope.podName,
19
+ containerName: containerScope.containerName,
20
+ clusterName: containerScope.cluster.title || containerScope.cluster.name
21
+ }),
15
22
  children: /* @__PURE__ */ jsx(PodLogs, { containerScope })
16
23
  }
17
24
  );
@@ -1 +1 @@
1
- {"version":3,"file":"PodLogsDialog.esm.js","sources":["../../../../src/components/Pods/PodLogs/PodLogsDialog.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 SubjectIcon from '@material-ui/icons/Subject';\n\nimport { KubernetesDialog } from '../../KubernetesDialog';\nimport { PodLogs } from './PodLogs';\nimport { ContainerScope } from './types';\n\n/**\n * Props for PodLogsDialog\n *\n * @public\n */\nexport interface PodLogsDialogProps {\n containerScope: ContainerScope;\n}\n\n/**\n * Shows the logs for the given pod in a Dialog\n *\n * @public\n */\nexport const PodLogsDialog = ({ containerScope }: PodLogsDialogProps) => {\n return (\n <KubernetesDialog\n buttonAriaLabel=\"get logs\"\n buttonIcon={<SubjectIcon />}\n buttonText=\"Logs\"\n disabled={false}\n title={`${containerScope.podName} - ${\n containerScope.containerName\n } logs on cluster ${\n containerScope.cluster.title || containerScope.cluster.name\n }`}\n >\n <PodLogs containerScope={containerScope} />\n </KubernetesDialog>\n );\n};\n"],"names":[],"mappings":";;;;;AAmCO,MAAM,aAAA,GAAgB,CAAC,EAAE,cAAA,EAAe,KAA0B;AACvE,EAAA,uBACE,GAAA;AAAA,IAAC,gBAAA;AAAA,IAAA;AAAA,MACC,eAAA,EAAgB,UAAA;AAAA,MAChB,UAAA,sBAAa,WAAA,EAAA,EAAY,CAAA;AAAA,MACzB,UAAA,EAAW,MAAA;AAAA,MACX,QAAA,EAAU,KAAA;AAAA,MACV,KAAA,EAAO,CAAA,EAAG,cAAA,CAAe,OAAO,CAAA,GAAA,EAC9B,cAAA,CAAe,aACjB,CAAA,iBAAA,EACE,cAAA,CAAe,OAAA,CAAQ,KAAA,IAAS,cAAA,CAAe,QAAQ,IACzD,CAAA,CAAA;AAAA,MAEA,QAAA,kBAAA,GAAA,CAAC,WAAQ,cAAA,EAAgC;AAAA;AAAA,GAC3C;AAEJ;;;;"}
1
+ {"version":3,"file":"PodLogsDialog.esm.js","sources":["../../../../src/components/Pods/PodLogs/PodLogsDialog.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 SubjectIcon from '@material-ui/icons/Subject';\n\nimport { KubernetesDialog } from '../../KubernetesDialog';\nimport { PodLogs } from './PodLogs';\nimport { ContainerScope } from './types';\nimport { useTranslationRef } from '@backstage/core-plugin-api/alpha';\nimport { kubernetesReactTranslationRef } from '../../../translation';\n\n/**\n * Props for PodLogsDialog\n *\n * @public\n */\nexport interface PodLogsDialogProps {\n containerScope: ContainerScope;\n}\n\n/**\n * Shows the logs for the given pod in a Dialog\n *\n * @public\n */\nexport const PodLogsDialog = ({ containerScope }: PodLogsDialogProps) => {\n const { t } = useTranslationRef(kubernetesReactTranslationRef);\n return (\n <KubernetesDialog\n buttonAriaLabel={t('podLogs.buttonAriaLabel')}\n buttonIcon={<SubjectIcon />}\n buttonText={t('podLogs.buttonText')}\n disabled={false}\n title={t('podLogs.titleTemplate', {\n podName: containerScope.podName,\n containerName: containerScope.containerName,\n clusterName:\n containerScope.cluster.title || containerScope.cluster.name,\n })}\n >\n <PodLogs containerScope={containerScope} />\n </KubernetesDialog>\n );\n};\n"],"names":[],"mappings":";;;;;;;AAqCO,MAAM,aAAA,GAAgB,CAAC,EAAE,cAAA,EAAe,KAA0B;AACvE,EAAA,MAAM,EAAE,CAAA,EAAE,GAAI,iBAAA,CAAkB,6BAA6B,CAAA;AAC7D,EAAA,uBACE,GAAA;AAAA,IAAC,gBAAA;AAAA,IAAA;AAAA,MACC,eAAA,EAAiB,EAAE,yBAAyB,CAAA;AAAA,MAC5C,UAAA,sBAAa,WAAA,EAAA,EAAY,CAAA;AAAA,MACzB,UAAA,EAAY,EAAE,oBAAoB,CAAA;AAAA,MAClC,QAAA,EAAU,KAAA;AAAA,MACV,KAAA,EAAO,EAAE,uBAAA,EAAyB;AAAA,QAChC,SAAS,cAAA,CAAe,OAAA;AAAA,QACxB,eAAe,cAAA,CAAe,aAAA;AAAA,QAC9B,WAAA,EACE,cAAA,CAAe,OAAA,CAAQ,KAAA,IAAS,eAAe,OAAA,CAAQ;AAAA,OAC1D,CAAA;AAAA,MAED,QAAA,kBAAA,GAAA,CAAC,WAAQ,cAAA,EAAgC;AAAA;AAAA,GAC3C;AAEJ;;;;"}
@@ -24,30 +24,17 @@ import { useMatchingErrors } from '../../hooks/useMatchingErrors.esm.js';
24
24
  import '@material-ui/icons/OpenInBrowser';
25
25
  import '../KubernetesDialog/KubernetesDialog.esm.js';
26
26
  import '../PodExecTerminal/PodExecTerminal.esm.js';
27
+ import { useTranslationRef } from '@backstage/core-plugin-api/alpha';
28
+ import { kubernetesReactTranslationRef } from '../../translation.esm.js';
27
29
  import '@material-ui/core/Paper';
28
30
  import '@material-ui/lab/Skeleton';
29
31
  import '@material-ui/icons/Subject';
30
32
  import '@material-ui/core/List';
31
33
  import '@material-ui/core/ListItem';
32
- import { containerStatuses, containersReady, totalRestarts, podStatusToCpuUtil, podStatusToMemoryUtil } from '../../utils/pod.esm.js';
34
+ import { containersReady, totalRestarts, containerStatuses, podStatusToCpuUtil, podStatusToMemoryUtil } from '../../utils/pod.esm.js';
33
35
 
34
36
  const READY_COLUMNS = "READY";
35
37
  const RESOURCE_COLUMNS = "RESOURCE";
36
- const READY = [
37
- {
38
- title: "containers ready",
39
- align: "center",
40
- render: containersReady,
41
- width: "auto"
42
- },
43
- {
44
- title: "total restarts",
45
- align: "center",
46
- render: totalRestarts,
47
- type: "numeric",
48
- width: "auto"
49
- }
50
- ];
51
38
  const PodDrawerTrigger = ({ pod }) => {
52
39
  const errors = useMatchingErrors({
53
40
  kind: "Pod",
@@ -67,40 +54,58 @@ const PodDrawerTrigger = ({ pod }) => {
67
54
  };
68
55
  const Cpu = ({ clusterName, pod }) => {
69
56
  const metrics = usePodMetrics(clusterName, pod);
57
+ const { t } = useTranslationRef(kubernetesReactTranslationRef);
70
58
  if (!metrics) {
71
- return /* @__PURE__ */ jsx(Typography, { children: "unknown" });
59
+ return /* @__PURE__ */ jsx(Typography, { children: t("podsTable.unknown") });
72
60
  }
73
61
  return /* @__PURE__ */ jsx(Fragment, { children: podStatusToCpuUtil(metrics) });
74
62
  };
75
63
  const Memory = ({ clusterName, pod }) => {
76
64
  const metrics = usePodMetrics(clusterName, pod);
65
+ const { t } = useTranslationRef(kubernetesReactTranslationRef);
77
66
  if (!metrics) {
78
- return /* @__PURE__ */ jsx(Typography, { children: "unknown" });
67
+ return /* @__PURE__ */ jsx(Typography, { children: t("podsTable.unknown") });
79
68
  }
80
69
  return /* @__PURE__ */ jsx(Fragment, { children: podStatusToMemoryUtil(metrics) });
81
70
  };
82
71
  const PodsTable = ({ pods, extraColumns = [] }) => {
83
72
  const cluster = useContext(ClusterContext);
73
+ const { t } = useTranslationRef(kubernetesReactTranslationRef);
74
+ const READY = [
75
+ {
76
+ title: t("podsTable.columns.containersReady"),
77
+ align: "center",
78
+ render: containersReady,
79
+ width: "auto"
80
+ },
81
+ {
82
+ title: t("podsTable.columns.totalRestarts"),
83
+ align: "center",
84
+ render: totalRestarts,
85
+ type: "numeric",
86
+ width: "auto"
87
+ }
88
+ ];
84
89
  const defaultColumns = [
85
90
  {
86
- title: "ID",
91
+ title: t("podsTable.columns.id"),
87
92
  field: "metadata.uid",
88
93
  hidden: true
89
94
  },
90
95
  {
91
- title: "name",
96
+ title: t("podsTable.columns.name"),
92
97
  highlight: true,
93
98
  render: (pod) => {
94
99
  return /* @__PURE__ */ jsx(PodDrawerTrigger, { pod });
95
100
  }
96
101
  },
97
102
  {
98
- title: "phase",
99
- render: (pod) => pod.status?.phase ?? "unknown",
103
+ title: t("podsTable.columns.phase"),
104
+ render: (pod) => pod.status?.phase ?? t("podsTable.unknown"),
100
105
  width: "auto"
101
106
  },
102
107
  {
103
- title: "status",
108
+ title: t("podsTable.columns.status"),
104
109
  render: containerStatuses
105
110
  }
106
111
  ];
@@ -111,14 +116,14 @@ const PodsTable = ({ pods, extraColumns = [] }) => {
111
116
  if (extraColumns.includes(RESOURCE_COLUMNS)) {
112
117
  const resourceColumns = [
113
118
  {
114
- title: "CPU usage %",
119
+ title: t("podsTable.columns.cpuUsage"),
115
120
  render: (pod) => {
116
121
  return /* @__PURE__ */ jsx(Cpu, { clusterName: cluster.name, pod });
117
122
  },
118
123
  width: "auto"
119
124
  },
120
125
  {
121
- title: "Memory usage %",
126
+ title: t("podsTable.columns.memoryUsage"),
122
127
  render: (pod) => {
123
128
  return /* @__PURE__ */ jsx(Memory, { clusterName: cluster.name, pod });
124
129
  },