@backstage/plugin-kubernetes-react 0.5.13 → 0.5.14-next.0

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 (67) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/dist/alpha.d.ts +77 -0
  3. package/dist/components/Cluster/Cluster.esm.js +6 -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/ServicesAccordions/ServiceDrawer.esm.js +4 -1
  60. package/dist/components/ServicesAccordions/ServiceDrawer.esm.js.map +1 -1
  61. package/dist/components/StatefulSetsAccordions/StatefulSetDrawer.esm.js +4 -1
  62. package/dist/components/StatefulSetsAccordions/StatefulSetDrawer.esm.js.map +1 -1
  63. package/dist/components/StatefulSetsAccordions/StatefulSetsAccordions.esm.js +14 -14
  64. package/dist/components/StatefulSetsAccordions/StatefulSetsAccordions.esm.js.map +1 -1
  65. package/dist/translation.esm.js +113 -0
  66. package/dist/translation.esm.js.map +1 -1
  67. package/package.json +10 -10
@@ -1 +1 @@
1
- {"version":3,"file":"DaemonSetsAccordions.esm.js","sources":["../../../src/components/DaemonSetsAccordions/DaemonSetsAccordions.tsx"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { ReactNode, useContext } from 'react';\nimport Accordion from '@material-ui/core/Accordion';\nimport AccordionDetails from '@material-ui/core/AccordionDetails';\nimport AccordionSummary from '@material-ui/core/AccordionSummary';\nimport Grid from '@material-ui/core/Grid';\nimport ExpandMoreIcon from '@material-ui/icons/ExpandMore';\nimport type { V1Pod, V1DaemonSet } from '@kubernetes/client-node';\nimport { PodsTable } from '../Pods';\nimport { DaemonSetDrawer } from './DaemonSetsDrawer';\nimport { getOwnedResources } from '../../utils/owner';\nimport {\n GroupedResponsesContext,\n PodNamesWithErrorsContext,\n} from '../../hooks';\nimport { StatusError, StatusOK } from '@backstage/core-components';\nimport { READY_COLUMNS, RESOURCE_COLUMNS } from '../Pods/PodsTable';\n\ntype DaemonSetsAccordionsProps = {\n children?: ReactNode;\n};\n\ntype DaemonSetAccordionProps = {\n daemonset: V1DaemonSet;\n ownedPods: V1Pod[];\n children?: ReactNode;\n};\n\ntype DaemonSetSummaryProps = {\n daemonset: V1DaemonSet;\n numberOfCurrentPods: number;\n numberOfPodsWithErrors: number;\n children?: ReactNode;\n};\n\nconst DaemonSetSummary = ({\n daemonset,\n numberOfCurrentPods,\n numberOfPodsWithErrors,\n}: DaemonSetSummaryProps) => {\n return (\n <Grid\n container\n direction=\"row\"\n justifyContent=\"space-between\"\n alignItems=\"center\"\n spacing={0}\n >\n <Grid xs={4} item>\n <DaemonSetDrawer daemonset={daemonset} />\n </Grid>\n <Grid\n item\n container\n xs={4}\n direction=\"column\"\n justifyContent=\"flex-start\"\n alignItems=\"flex-end\"\n spacing={0}\n >\n <Grid item>\n <StatusOK>{numberOfCurrentPods} pods</StatusOK>\n </Grid>\n <Grid item>\n {numberOfPodsWithErrors > 0 ? (\n <StatusError>\n {numberOfPodsWithErrors} pod\n {numberOfPodsWithErrors > 1 ? 's' : ''} with errors\n </StatusError>\n ) : (\n <StatusOK>No pods with errors</StatusOK>\n )}\n </Grid>\n </Grid>\n </Grid>\n );\n};\n\nconst DaemonSetAccordion = ({\n daemonset,\n ownedPods,\n}: DaemonSetAccordionProps) => {\n const podNamesWithErrors = useContext(PodNamesWithErrorsContext);\n\n const podsWithErrors = ownedPods.filter(p =>\n podNamesWithErrors.has(p.metadata?.name ?? ''),\n );\n\n return (\n <Accordion TransitionProps={{ unmountOnExit: true }} variant=\"outlined\">\n <AccordionSummary expandIcon={<ExpandMoreIcon />}>\n <DaemonSetSummary\n daemonset={daemonset}\n numberOfCurrentPods={ownedPods.length}\n numberOfPodsWithErrors={podsWithErrors.length}\n />\n </AccordionSummary>\n <AccordionDetails>\n <PodsTable\n pods={ownedPods}\n extraColumns={[READY_COLUMNS, RESOURCE_COLUMNS]}\n />\n </AccordionDetails>\n </Accordion>\n );\n};\n\nexport const DaemonSetsAccordions = ({}: DaemonSetsAccordionsProps) => {\n const groupedResponses = useContext(GroupedResponsesContext);\n\n return (\n <Grid\n container\n direction=\"column\"\n justifyContent=\"flex-start\"\n alignItems=\"flex-start\"\n >\n {groupedResponses.daemonSets.map((daemonset, i) => (\n <Grid container item key={i} xs>\n <Grid item xs>\n <DaemonSetAccordion\n ownedPods={getOwnedResources(daemonset, groupedResponses.pods)}\n daemonset={daemonset}\n />\n </Grid>\n </Grid>\n ))}\n </Grid>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkDA,MAAM,mBAAmB,CAAC;AAAA,EACxB,SAAA;AAAA,EACA,mBAAA;AAAA,EACA;AACF,CAAA,KAA6B;AAC3B,EAAA,uBACE,IAAA;AAAA,IAAC,IAAA;AAAA,IAAA;AAAA,MACC,SAAA,EAAS,IAAA;AAAA,MACT,SAAA,EAAU,KAAA;AAAA,MACV,cAAA,EAAe,eAAA;AAAA,MACf,UAAA,EAAW,QAAA;AAAA,MACX,OAAA,EAAS,CAAA;AAAA,MAET,QAAA,EAAA;AAAA,wBAAA,GAAA,CAAC,IAAA,EAAA,EAAK,IAAI,CAAA,EAAG,IAAA,EAAI,MACf,QAAA,kBAAA,GAAA,CAAC,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EJ;;;;"}
1
+ {"version":3,"file":"DaemonSetsAccordions.esm.js","sources":["../../../src/components/DaemonSetsAccordions/DaemonSetsAccordions.tsx"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { ReactNode, useContext } from 'react';\nimport Accordion from '@material-ui/core/Accordion';\nimport AccordionDetails from '@material-ui/core/AccordionDetails';\nimport AccordionSummary from '@material-ui/core/AccordionSummary';\nimport Grid from '@material-ui/core/Grid';\nimport ExpandMoreIcon from '@material-ui/icons/ExpandMore';\nimport type { V1Pod, V1DaemonSet } from '@kubernetes/client-node';\nimport { PodsTable } from '../Pods';\nimport { DaemonSetDrawer } from './DaemonSetsDrawer';\nimport { getOwnedResources } from '../../utils/owner';\nimport {\n GroupedResponsesContext,\n PodNamesWithErrorsContext,\n} from '../../hooks';\nimport { StatusError, StatusOK } from '@backstage/core-components';\nimport { READY_COLUMNS, RESOURCE_COLUMNS } from '../Pods/PodsTable';\nimport { useTranslationRef } from '@backstage/core-plugin-api/alpha';\nimport { kubernetesReactTranslationRef } from '../../translation';\n\ntype DaemonSetsAccordionsProps = {\n children?: ReactNode;\n};\n\ntype DaemonSetAccordionProps = {\n daemonset: V1DaemonSet;\n ownedPods: V1Pod[];\n children?: ReactNode;\n};\n\ntype DaemonSetSummaryProps = {\n daemonset: V1DaemonSet;\n numberOfCurrentPods: number;\n numberOfPodsWithErrors: number;\n children?: ReactNode;\n};\n\nconst DaemonSetSummary = ({\n daemonset,\n numberOfCurrentPods,\n numberOfPodsWithErrors,\n}: DaemonSetSummaryProps) => {\n const { t } = useTranslationRef(kubernetesReactTranslationRef);\n return (\n <Grid\n container\n direction=\"row\"\n justifyContent=\"space-between\"\n alignItems=\"center\"\n spacing={0}\n >\n <Grid xs={4} item>\n <DaemonSetDrawer daemonset={daemonset} />\n </Grid>\n <Grid\n item\n container\n xs={4}\n direction=\"column\"\n justifyContent=\"flex-start\"\n alignItems=\"flex-end\"\n spacing={0}\n >\n <Grid item>\n <StatusOK>{t('pods.pods', { count: numberOfCurrentPods })}</StatusOK>\n </Grid>\n <Grid item>\n {numberOfPodsWithErrors > 0 ? (\n <StatusError>\n {t('cluster.podsWithErrors', { count: numberOfPodsWithErrors })}\n </StatusError>\n ) : (\n <StatusOK>{t('cluster.noPodsWithErrors')}</StatusOK>\n )}\n </Grid>\n </Grid>\n </Grid>\n );\n};\n\nconst DaemonSetAccordion = ({\n daemonset,\n ownedPods,\n}: DaemonSetAccordionProps) => {\n const podNamesWithErrors = useContext(PodNamesWithErrorsContext);\n\n const podsWithErrors = ownedPods.filter(p =>\n podNamesWithErrors.has(p.metadata?.name ?? ''),\n );\n\n return (\n <Accordion TransitionProps={{ unmountOnExit: true }} variant=\"outlined\">\n <AccordionSummary expandIcon={<ExpandMoreIcon />}>\n <DaemonSetSummary\n daemonset={daemonset}\n numberOfCurrentPods={ownedPods.length}\n numberOfPodsWithErrors={podsWithErrors.length}\n />\n </AccordionSummary>\n <AccordionDetails>\n <PodsTable\n pods={ownedPods}\n extraColumns={[READY_COLUMNS, RESOURCE_COLUMNS]}\n />\n </AccordionDetails>\n </Accordion>\n );\n};\n\nexport const DaemonSetsAccordions = ({}: DaemonSetsAccordionsProps) => {\n const groupedResponses = useContext(GroupedResponsesContext);\n\n return (\n <Grid\n container\n direction=\"column\"\n justifyContent=\"flex-start\"\n alignItems=\"flex-start\"\n >\n {groupedResponses.daemonSets.map((daemonset, i) => (\n <Grid container item key={i} xs>\n <Grid item xs>\n <DaemonSetAccordion\n ownedPods={getOwnedResources(daemonset, groupedResponses.pods)}\n daemonset={daemonset}\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AAAA,IAAA;AAAA,MACC,SAAA,EAAS,IAAA;AAAA,MACT,SAAA,EAAU,QAAA;AAAA,MACV,cAAA,EAAe,YAAA;AAAA,MACf,UAAA,EAAW,YAAA;AAAA,MAEV,2BAAiB,UAAA,CAAW,GAAA,CAAI,CAAC,SAAA,EAAW,CAAA,yBAC1C,IAAA,EAAA,EAAK,SAAA,EAAS,MAAC,IAAA,EAAI,IAAA,EAAS,IAAE,IAAA,EAC7B,QAAA,kBAAA,GAAA,CAAC,QAAK,IAAA,EAAI,IAAA,EAAC,IAAE,IAAA,EACX,QAAA,kBAAA,GAAA;AAAA,QAAC,kBAAA;AAAA,QAAA;AAAA,UACC,SAAA,EAAW,iBAAA,CAAkB,SAAA,EAAW,gBAAA,CAAiB,IAAI,CAAA;AAAA,UAC7D;AAAA;AAAA,OACF,EACF,CAAA,EAAA,EANwB,CAO1B,CACD;AAAA;AAAA,GACH;AAEJ;;;;"}
@@ -6,6 +6,8 @@ import '@material-ui/core/FormControlLabel';
6
6
  import '@material-ui/core/Switch';
7
7
  import 'js-yaml';
8
8
  import 'react';
9
+ import { useTranslationRef } from '@backstage/core-plugin-api/alpha';
10
+ import { kubernetesReactTranslationRef } from '../../translation.esm.js';
9
11
  import Typography from '@material-ui/core/Typography';
10
12
  import Grid from '@material-ui/core/Grid';
11
13
  import Chip from '@material-ui/core/Chip';
@@ -14,6 +16,7 @@ const DaemonSetDrawer = ({
14
16
  daemonset,
15
17
  expanded
16
18
  }) => {
19
+ const { t } = useTranslationRef(kubernetesReactTranslationRef);
17
20
  const namespace = daemonset.metadata?.namespace;
18
21
  return /* @__PURE__ */ jsx(
19
22
  KubernetesStructuredMetadataTableDrawer,
@@ -44,7 +47,13 @@ const DaemonSetDrawer = ({
44
47
  children: [
45
48
  /* @__PURE__ */ jsx(Grid, { item: true, children: /* @__PURE__ */ jsx(Typography, { variant: "body1", children: daemonset.metadata?.name ?? "unknown object" }) }),
46
49
  /* @__PURE__ */ jsx(Grid, { item: true, children: /* @__PURE__ */ jsx(Typography, { color: "textSecondary", variant: "subtitle1", children: "DaemonSet" }) }),
47
- namespace && /* @__PURE__ */ jsx(Grid, { item: true, children: /* @__PURE__ */ jsx(Chip, { size: "small", label: `namespace: ${namespace}` }) })
50
+ namespace && /* @__PURE__ */ jsx(Grid, { item: true, children: /* @__PURE__ */ jsx(
51
+ Chip,
52
+ {
53
+ size: "small",
54
+ label: t("namespace.labelWithValue", { namespace })
55
+ }
56
+ ) })
48
57
  ]
49
58
  }
50
59
  )
@@ -1 +1 @@
1
- {"version":3,"file":"DaemonSetsDrawer.esm.js","sources":["../../../src/components/DaemonSetsAccordions/DaemonSetsDrawer.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 type { V1DaemonSet } from '@kubernetes/client-node';\nimport { KubernetesStructuredMetadataTableDrawer } from '../KubernetesDrawer';\nimport Typography from '@material-ui/core/Typography';\nimport Grid from '@material-ui/core/Grid';\nimport Chip from '@material-ui/core/Chip';\n\nexport const DaemonSetDrawer = ({\n daemonset,\n expanded,\n}: {\n daemonset: V1DaemonSet;\n expanded?: boolean;\n}) => {\n const namespace = daemonset.metadata?.namespace;\n return (\n <KubernetesStructuredMetadataTableDrawer\n object={daemonset}\n expanded={expanded}\n kind=\"DaemonSet\"\n renderObject={(daemonsetObj: V1DaemonSet) => {\n return {\n updateStrategyType: daemonsetObj.spec?.updateStrategy?.type ?? '???',\n minReadySeconds: daemonsetObj.spec?.minReadySeconds ?? '???',\n revisionHistoryLimit:\n daemonsetObj.spec?.revisionHistoryLimit ?? '???',\n currentNumberScheduled:\n daemonsetObj.status?.currentNumberScheduled ?? '???',\n desiredNumberScheduled:\n daemonsetObj.status?.desiredNumberScheduled ?? '???',\n numberAvailable: daemonsetObj.status?.numberAvailable ?? '???',\n numberMisscheduled: daemonsetObj.status?.numberMisscheduled ?? '???',\n numberReady: daemonsetObj.status?.numberReady ?? '???',\n };\n }}\n >\n <Grid\n container\n direction=\"column\"\n justifyContent=\"flex-start\"\n alignItems=\"flex-start\"\n spacing={0}\n >\n <Grid item>\n <Typography variant=\"body1\">\n {daemonset.metadata?.name ?? 'unknown object'}\n </Typography>\n </Grid>\n <Grid item>\n <Typography color=\"textSecondary\" variant=\"subtitle1\">\n DaemonSet\n </Typography>\n </Grid>\n {namespace && (\n <Grid item>\n <Chip size=\"small\" label={`namespace: ${namespace}`} />\n </Grid>\n )}\n </Grid>\n </KubernetesStructuredMetadataTableDrawer>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;AAsBO,MAAM,kBAAkB,CAAC;AAAA,EAC9B,SAAA;AAAA,EACA;AACF,CAAA,KAGM;AACJ,EAAA,MAAM,SAAA,GAAY,UAAU,QAAA,EAAU,SAAA;AACtC,EAAA,uBACE,GAAA;AAAA,IAAC,uCAAA;AAAA,IAAA;AAAA,MACC,MAAA,EAAQ,SAAA;AAAA,MACR,QAAA;AAAA,MACA,IAAA,EAAK,WAAA;AAAA,MACL,YAAA,EAAc,CAAC,YAAA,KAA8B;AAC3C,QAAA,OAAO;AAAA,UACL,kBAAA,EAAoB,YAAA,CAAa,IAAA,EAAM,cAAA,EAAgB,IAAA,IAAQ,KAAA;AAAA,UAC/D,eAAA,EAAiB,YAAA,CAAa,IAAA,EAAM,eAAA,IAAmB,KAAA;AAAA,UACvD,oBAAA,EACE,YAAA,CAAa,IAAA,EAAM,oBAAA,IAAwB,KAAA;AAAA,UAC7C,sBAAA,EACE,YAAA,CAAa,MAAA,EAAQ,sBAAA,IAA0B,KAAA;AAAA,UACjD,sBAAA,EACE,YAAA,CAAa,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etsDrawer.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 type { V1DaemonSet } from '@kubernetes/client-node';\nimport { KubernetesStructuredMetadataTableDrawer } from '../KubernetesDrawer';\nimport Typography from '@material-ui/core/Typography';\nimport Grid from '@material-ui/core/Grid';\nimport Chip from '@material-ui/core/Chip';\nimport { useTranslationRef } from '@backstage/core-plugin-api/alpha';\nimport { kubernetesReactTranslationRef } from '../../translation';\n\nexport const DaemonSetDrawer = ({\n daemonset,\n expanded,\n}: {\n daemonset: V1DaemonSet;\n expanded?: boolean;\n}) => {\n const { t } = useTranslationRef(kubernetesReactTranslationRef);\n const namespace = daemonset.metadata?.namespace;\n return (\n <KubernetesStructuredMetadataTableDrawer\n object={daemonset}\n expanded={expanded}\n kind=\"DaemonSet\"\n renderObject={(daemonsetObj: V1DaemonSet) => {\n return {\n updateStrategyType: daemonsetObj.spec?.updateStrategy?.type ?? '???',\n minReadySeconds: daemonsetObj.spec?.minReadySeconds ?? '???',\n revisionHistoryLimit:\n daemonsetObj.spec?.revisionHistoryLimit ?? '???',\n currentNumberScheduled:\n daemonsetObj.status?.currentNumberScheduled ?? '???',\n desiredNumberScheduled:\n daemonsetObj.status?.desiredNumberScheduled ?? '???',\n numberAvailable: daemonsetObj.status?.numberAvailable ?? '???',\n numberMisscheduled: daemonsetObj.status?.numberMisscheduled ?? '???',\n numberReady: daemonsetObj.status?.numberReady ?? '???',\n };\n }}\n >\n <Grid\n container\n direction=\"column\"\n justifyContent=\"flex-start\"\n alignItems=\"flex-start\"\n spacing={0}\n >\n <Grid item>\n <Typography variant=\"body1\">\n {daemonset.metadata?.name ?? 'unknown object'}\n </Typography>\n </Grid>\n <Grid item>\n <Typography color=\"textSecondary\" variant=\"subtitle1\">\n DaemonSet\n </Typography>\n </Grid>\n {namespace && (\n <Grid item>\n <Chip\n size=\"small\"\n label={t('namespace.labelWithValue', { namespace })}\n />\n </Grid>\n )}\n </Grid>\n </KubernetesStructuredMetadataTableDrawer>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;AAwBO,MAAM,kBAAkB,CAAC;AAAA,EAC9B,SAAA;AAAA,EACA;AACF,CAAA,KAGM;AACJ,EAAA,MAAM,EAAE,CAAA,EAAE,GAAI,iBAAA,CAAkB,6BAA6B,CAAA;AAC7D,EAAA,MAAM,SAAA,GAAY,UAAU,QAAA,EAAU,SAAA;AACtC,EAAA,uBACE,GAAA;AAAA,IAAC,uCAAA;AAAA,IAAA;AAAA,MACC,MAAA,EAAQ,SAAA;AAAA,MACR,QAAA;AAAA,MACA,IAAA,EAAK,WAAA;AAAA,MACL,YAAA,EAAc,CAAC,YAAA,KAA8B;AAC3C,QAAA,OAAO;AAAA,UACL,kBAAA,EAAoB,YAAA,CAAa,IAAA,EAAM,cAAA,EAAgB,IAAA,IAAQ,KAAA;AAAA,UAC/D,eAAA,EAAiB,YAAA,CAAa,IAAA,EAAM,eAAA,IAAmB,KAAA;AAAA,UACvD,oBAAA,EACE,YAAA,CAAa,IAAA,EAAM,oBAAA,IAAwB,KAAA;AAAA,UAC7C,sBAAA,EACE,YAAA,CAAa,MAAA,EAAQ,sBAAA,IAA0B,KAAA;AAAA,UACjD,sBAAA,EACE,YAAA,CAAa,MAAA,EAAQ,sBAAA,IAA0B,KAAA;AAAA,UACjD,eAAA,EAAiB,YAAA,CAAa,MAAA,EAAQ,eAAA,IAAmB,KAAA;AAAA,UACzD,kBAAA,EAAoB,YAAA,CAAa,MAAA,EAAQ,kBAAA,IAAsB,KAAA;AAAA,UAC/D,WAAA,EAAa,YAAA,CAAa,MAAA,EAAQ,WAAA,IAAe;AAAA,SACnD;AAAA,MACF,CAAA;AAAA,MAEA,QAAA,kBAAA,IAAA;AAAA,QAAC,IAAA;AAAA,QAAA;AAAA,UACC,SAAA,EAAS,IAAA;AAAA,UACT,SAAA,EAAU,QAAA;AAAA,UACV,cAAA,EAAe,YAAA;AAAA,UACf,UAAA,EAAW,YAAA;AAAA,UACX,OAAA,EAAS,CAAA;AAAA,UAET,QAAA,EAAA;AAAA,4BAAA,GAAA,CAAC,IAAA,EAAA,EAAK,IAAA,EAAI,IAAA,EACR,QAAA,kBAAA,GAAA,CAAC,UAAA,EAAA,EAAW,OAAA,EAAQ,OAAA,EACjB,QAAA,EAAA,SAAA,CAAU,QAAA,EAAU,IAAA,IAAQ,gBAAA,EAC/B,CAAA,EACF,CAAA;AAAA,4BACA,GAAA,CAAC,IAAA,EAAA,EAAK,IAAA,EAAI,IAAA,EACR,QAAA,kBAAA,GAAA,CAAC,UAAA,EAAA,EAAW,KAAA,EAAM,eAAA,EAAgB,OAAA,EAAQ,WAAA,EAAY,QAAA,EAAA,WAAA,EAEtD,CAAA,EACF,CAAA;AAAA,YACC,SAAA,oBACC,GAAA,CAAC,IAAA,EAAA,EAAK,IAAA,EAAI,IAAA,EACR,QAAA,kBAAA,GAAA;AAAA,cAAC,IAAA;AAAA,cAAA;AAAA,gBACC,IAAA,EAAK,OAAA;AAAA,gBACL,KAAA,EAAO,CAAA,CAAE,0BAAA,EAA4B,EAAE,WAAW;AAAA;AAAA,aACpD,EACF;AAAA;AAAA;AAAA;AAEJ;AAAA,GACF;AAEJ;;;;"}
@@ -6,6 +6,8 @@ import '@material-ui/core/FormControlLabel';
6
6
  import '@material-ui/core/Switch';
7
7
  import 'js-yaml';
8
8
  import 'react';
9
+ import { useTranslationRef } from '@backstage/core-plugin-api/alpha';
10
+ import { kubernetesReactTranslationRef } from '../../translation.esm.js';
9
11
  import { renderCondition } from '../../utils/pod.esm.js';
10
12
  import Typography from '@material-ui/core/Typography';
11
13
  import Grid from '@material-ui/core/Grid';
@@ -15,6 +17,7 @@ const DeploymentDrawer = ({
15
17
  deployment,
16
18
  expanded
17
19
  }) => {
20
+ const { t } = useTranslationRef(kubernetesReactTranslationRef);
18
21
  const namespace = deployment.metadata?.namespace;
19
22
  return /* @__PURE__ */ jsx(
20
23
  KubernetesStructuredMetadataTableDrawer,
@@ -45,7 +48,13 @@ const DeploymentDrawer = ({
45
48
  children: [
46
49
  /* @__PURE__ */ jsx(Grid, { item: true, children: /* @__PURE__ */ jsx(Typography, { variant: "body1", children: deployment.metadata?.name ?? "unknown object" }) }),
47
50
  /* @__PURE__ */ jsx(Grid, { item: true, children: /* @__PURE__ */ jsx(Typography, { color: "textSecondary", variant: "subtitle1", children: "Deployment" }) }),
48
- namespace && /* @__PURE__ */ jsx(Grid, { item: true, children: /* @__PURE__ */ jsx(Chip, { size: "small", label: `namespace: ${namespace}` }) })
51
+ namespace && /* @__PURE__ */ jsx(Grid, { item: true, children: /* @__PURE__ */ jsx(
52
+ Chip,
53
+ {
54
+ size: "small",
55
+ label: t("namespace.labelWithValue", { namespace })
56
+ }
57
+ ) })
49
58
  ]
50
59
  }
51
60
  )
@@ -1 +1 @@
1
- {"version":3,"file":"DeploymentDrawer.esm.js","sources":["../../../src/components/DeploymentsAccordions/DeploymentDrawer.tsx"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { ReactNode } from 'react';\nimport type { V1Deployment } from '@kubernetes/client-node';\nimport { KubernetesStructuredMetadataTableDrawer } from '../KubernetesDrawer';\nimport { renderCondition } from '../../utils/pod';\nimport Typography from '@material-ui/core/Typography';\nimport Grid from '@material-ui/core/Grid';\nimport Chip from '@material-ui/core/Chip';\n\nexport const DeploymentDrawer = ({\n deployment,\n expanded,\n}: {\n deployment: V1Deployment;\n expanded?: boolean;\n}) => {\n const namespace = deployment.metadata?.namespace;\n return (\n <KubernetesStructuredMetadataTableDrawer\n object={deployment}\n expanded={expanded}\n kind=\"Deployment\"\n renderObject={(deploymentObj: V1Deployment) => {\n const conditions = (deploymentObj.status?.conditions ?? [])\n .map(renderCondition)\n .reduce((accum, next) => {\n accum[next[0]] = next[1];\n return accum;\n }, {} as { [key: string]: ReactNode });\n\n return {\n strategy: deploymentObj.spec?.strategy ?? '???',\n minReadySeconds: deploymentObj.spec?.minReadySeconds ?? '???',\n progressDeadlineSeconds:\n deploymentObj.spec?.progressDeadlineSeconds ?? '???',\n ...conditions,\n };\n }}\n >\n <Grid\n container\n direction=\"column\"\n justifyContent=\"flex-start\"\n alignItems=\"flex-start\"\n spacing={0}\n >\n <Grid item>\n <Typography variant=\"body1\">\n {deployment.metadata?.name ?? 'unknown object'}\n </Typography>\n </Grid>\n <Grid item>\n <Typography color=\"textSecondary\" variant=\"subtitle1\">\n Deployment\n </Typography>\n </Grid>\n {namespace && (\n <Grid item>\n <Chip size=\"small\" label={`namespace: ${namespace}`} />\n </Grid>\n )}\n </Grid>\n </KubernetesStructuredMetadataTableDrawer>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;AAwBO,MAAM,mBAAmB,CAAC;AAAA,EAC/B,UAAA;AAAA,EACA;AACF,CAAA,KAGM;AACJ,EAAA,MAAM,SAAA,GAAY,WAAW,QAAA,EAAU,SAAA;AACvC,EAAA,uBACE,GAAA;AAAA,IAAC,uCAAA;AAAA,IAAA;AAAA,MACC,MAAA,EAAQ,UAAA;AAAA,MACR,QAAA;AAAA,MACA,IAAA,EAAK,YAAA;AAAA,MACL,YAAA,EAAc,CAAC,aAAA,KAAgC;AAC7C,QAAA,MAAM,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AAA,EAAK,IAAA,EAAI,IAAA,EACR,QAAA,kBAAA,GAAA,CAAC,IAAA,EAAA,EAAK,IAAA,EAAK,OAAA,EAAQ,KAAA,EAAO,CAAA,WAAA,EAAc,SAAS,IAAI,CAAA,EACvD;AAAA;AAAA;AAAA;AAEJ;AAAA,GACF;AAEJ;;;;"}
1
+ {"version":3,"file":"DeploymentDrawer.esm.js","sources":["../../../src/components/DeploymentsAccordions/DeploymentDrawer.tsx"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { ReactNode } from 'react';\nimport type { V1Deployment } from '@kubernetes/client-node';\nimport { KubernetesStructuredMetadataTableDrawer } from '../KubernetesDrawer';\nimport { renderCondition } from '../../utils/pod';\nimport Typography from '@material-ui/core/Typography';\nimport Grid from '@material-ui/core/Grid';\nimport Chip from '@material-ui/core/Chip';\nimport { useTranslationRef } from '@backstage/core-plugin-api/alpha';\nimport { kubernetesReactTranslationRef } from '../../translation';\n\nexport const DeploymentDrawer = ({\n deployment,\n expanded,\n}: {\n deployment: V1Deployment;\n expanded?: boolean;\n}) => {\n const { t } = useTranslationRef(kubernetesReactTranslationRef);\n const namespace = deployment.metadata?.namespace;\n return (\n <KubernetesStructuredMetadataTableDrawer\n object={deployment}\n expanded={expanded}\n kind=\"Deployment\"\n renderObject={(deploymentObj: V1Deployment) => {\n const conditions = (deploymentObj.status?.conditions ?? [])\n .map(renderCondition)\n .reduce((accum, next) => {\n accum[next[0]] = next[1];\n return accum;\n }, {} as { [key: string]: ReactNode });\n\n return {\n strategy: deploymentObj.spec?.strategy ?? '???',\n minReadySeconds: deploymentObj.spec?.minReadySeconds ?? '???',\n progressDeadlineSeconds:\n deploymentObj.spec?.progressDeadlineSeconds ?? '???',\n ...conditions,\n };\n }}\n >\n <Grid\n container\n direction=\"column\"\n justifyContent=\"flex-start\"\n alignItems=\"flex-start\"\n spacing={0}\n >\n <Grid item>\n <Typography variant=\"body1\">\n {deployment.metadata?.name ?? 'unknown object'}\n </Typography>\n </Grid>\n <Grid item>\n <Typography color=\"textSecondary\" variant=\"subtitle1\">\n Deployment\n </Typography>\n </Grid>\n {namespace && (\n <Grid item>\n <Chip\n size=\"small\"\n label={t('namespace.labelWithValue', { namespace })}\n />\n </Grid>\n )}\n </Grid>\n </KubernetesStructuredMetadataTableDrawer>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;AA0BO,MAAM,mBAAmB,CAAC;AAAA,EAC/B,UAAA;AAAA,EACA;AACF,CAAA,KAGM;AACJ,EAAA,MAAM,EAAE,CAAA,EAAE,GAAI,iBAAA,CAAkB,6BAA6B,CAAA;AAC7D,EAAA,MAAM,SAAA,GAAY,WAAW,QAAA,EAAU,SAAA;AACvC,EAAA,uBACE,GAAA;AAAA,IAAC,uCAAA;AAAA,IAAA;AAAA,MACC,MAAA,EAAQ,UAAA;AAAA,MACR,QAAA;AAAA,MACA,IAAA,EAAK,YAAA;AAAA,MACL,YAAA,EAAc,CAAC,aAAA,KAAgC;AAC7C,QAAA,MAAM,UAAA,GAAA,CAAc,aAAA,CAAc,MAAA,EAAQ,UAAA,IAAc,EAAC,EACtD,GAAA,CAAI,eAAe,CAAA,CACnB,MAAA,CAAO,CAAC,KAAA,EAAO,IAAA,KAAS;AACvB,UAAA,KAAA,CAAM,IAAA,CAAK,CAAC,CAAC,CAAA,GAAI,KAAK,CAAC,CAAA;AACvB,UAAA,OAAO,KAAA;AAAA,QACT,CAAA,EAAG,EAAkC,CAAA;AAEvC,QAAA,OAAO;AAAA,UACL,QAAA,EAAU,aAAA,CAAc,IAAA,EAAM,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ialog/KubernetesDialog.esm.js';
30
30
  import '../PodExecTerminal/PodExecTerminal.esm.js';
31
+ import { useTranslationRef } from '@backstage/core-plugin-api/alpha';
32
+ import { kubernetesReactTranslationRef } from '../../translation.esm.js';
31
33
  import '@material-ui/core/Paper';
32
34
  import '@material-ui/lab/Skeleton';
33
35
  import '@material-ui/icons/Subject';
@@ -53,6 +55,7 @@ const DeploymentSummary = ({
53
55
  numberOfPodsWithErrors,
54
56
  hpa
55
57
  }) => {
58
+ const { t } = useTranslationRef(kubernetesReactTranslationRef);
56
59
  const specCpuUtil = hpa?.spec?.metrics?.find(
57
60
  (metric) => metric.type === "Resource" && metric.resource?.name === "cpu"
58
61
  )?.resource?.target.averageUtilization;
@@ -79,23 +82,16 @@ const DeploymentSummary = ({
79
82
  alignItems: "flex-start",
80
83
  spacing: 0,
81
84
  children: [
82
- /* @__PURE__ */ jsx(Grid, { item: true, children: /* @__PURE__ */ jsxs(Typography, { variant: "subtitle2", children: [
83
- "min replicas ",
84
- hpa.spec?.minReplicas ?? "?",
85
- " / max replicas",
86
- " ",
87
- hpa.spec?.maxReplicas ?? "?"
88
- ] }) }),
89
- /* @__PURE__ */ jsx(Grid, { item: true, children: /* @__PURE__ */ jsxs(Typography, { variant: "subtitle2", children: [
90
- "current CPU usage: ",
91
- cpuUtil ?? "?",
92
- "%"
93
- ] }) }),
94
- /* @__PURE__ */ jsx(Grid, { item: true, children: /* @__PURE__ */ jsxs(Typography, { variant: "subtitle2", children: [
95
- "target CPU usage: ",
96
- specCpuUtil ?? "?",
97
- "%"
98
- ] }) })
85
+ /* @__PURE__ */ jsx(Grid, { item: true, children: /* @__PURE__ */ jsx(Typography, { variant: "subtitle2", children: t("hpa.replicasSummary", {
86
+ min: String(hpa.spec?.minReplicas ?? "?"),
87
+ max: String(hpa.spec?.maxReplicas ?? "?")
88
+ }) }) }),
89
+ /* @__PURE__ */ jsx(Grid, { item: true, children: /* @__PURE__ */ jsx(Typography, { variant: "subtitle2", children: t("hpa.currentCpuUsageLabel", {
90
+ value: String(cpuUtil ?? "?")
91
+ }) }) }),
92
+ /* @__PURE__ */ jsx(Grid, { item: true, children: /* @__PURE__ */ jsx(Typography, { variant: "subtitle2", children: t("hpa.targetCpuUsageLabel", {
93
+ value: String(specCpuUtil ?? "?")
94
+ }) }) })
99
95
  ]
100
96
  }
101
97
  ) }) }),
@@ -110,16 +106,8 @@ const DeploymentSummary = ({
110
106
  alignItems: "flex-end",
111
107
  spacing: 0,
112
108
  children: [
113
- /* @__PURE__ */ jsx(Grid, { item: true, children: /* @__PURE__ */ jsxs(StatusOK, { children: [
114
- numberOfCurrentPods,
115
- " pods"
116
- ] }) }),
117
- /* @__PURE__ */ jsx(Grid, { item: true, children: numberOfPodsWithErrors > 0 ? /* @__PURE__ */ jsxs(StatusError, { children: [
118
- numberOfPodsWithErrors,
119
- " pod",
120
- numberOfPodsWithErrors > 1 ? "s" : "",
121
- " with errors"
122
- ] }) : /* @__PURE__ */ jsx(StatusOK, { children: "No pods with errors" }) })
109
+ /* @__PURE__ */ jsx(Grid, { item: true, children: /* @__PURE__ */ jsx(StatusOK, { children: t("pods.pods", { count: numberOfCurrentPods }) }) }),
110
+ /* @__PURE__ */ jsx(Grid, { item: true, children: numberOfPodsWithErrors > 0 ? /* @__PURE__ */ jsx(StatusError, { children: t("cluster.podsWithErrors", { count: numberOfPodsWithErrors }) }) : /* @__PURE__ */ jsx(StatusOK, { children: t("cluster.noPodsWithErrors") }) })
123
111
  ]
124
112
  }
125
113
  )
@@ -1 +1 @@
1
- {"version":3,"file":"DeploymentsAccordions.esm.js","sources":["../../../src/components/DeploymentsAccordions/DeploymentsAccordions.tsx"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { ReactNode, useContext } from 'react';\nimport Accordion from '@material-ui/core/Accordion';\nimport AccordionDetails from '@material-ui/core/AccordionDetails';\nimport AccordionSummary from '@material-ui/core/AccordionSummary';\nimport Grid from '@material-ui/core/Grid';\nimport Typography from '@material-ui/core/Typography';\nimport ExpandMoreIcon from '@material-ui/icons/ExpandMore';\nimport type {\n V1Deployment,\n V1Pod,\n V2HorizontalPodAutoscaler,\n} from '@kubernetes/client-node';\nimport { PodsTable } from '../Pods';\nimport { DeploymentDrawer } from './DeploymentDrawer';\nimport { HorizontalPodAutoscalerDrawer } from '../HorizontalPodAutoscalers';\nimport {\n getOwnedPodsThroughReplicaSets,\n getMatchingHpa,\n} from '../../utils/owner';\nimport {\n GroupedResponsesContext,\n PodNamesWithErrorsContext,\n} from '../../hooks';\nimport { StatusError, StatusOK } from '@backstage/core-components';\nimport { READY_COLUMNS, RESOURCE_COLUMNS } from '../Pods/PodsTable';\n\ntype DeploymentsAccordionsProps = {\n children?: ReactNode;\n};\n\ntype DeploymentAccordionProps = {\n deployment: V1Deployment;\n ownedPods: V1Pod[];\n matchingHpa?: V2HorizontalPodAutoscaler;\n children?: ReactNode;\n};\n\ntype DeploymentSummaryProps = {\n deployment: V1Deployment;\n numberOfCurrentPods: number;\n numberOfPodsWithErrors: number;\n hpa?: V2HorizontalPodAutoscaler;\n children?: ReactNode;\n};\n\nconst DeploymentSummary = ({\n deployment,\n numberOfCurrentPods,\n numberOfPodsWithErrors,\n hpa,\n}: DeploymentSummaryProps) => {\n const specCpuUtil = hpa?.spec?.metrics?.find(\n metric => metric.type === 'Resource' && metric.resource?.name === 'cpu',\n )?.resource?.target.averageUtilization;\n\n const cpuUtil = hpa?.status?.currentMetrics?.find(\n metric => metric.type === 'Resource' && metric.resource?.name === 'cpu',\n )?.resource?.current.averageUtilization;\n\n return (\n <Grid\n container\n direction=\"row\"\n justifyContent=\"space-between\"\n alignItems=\"center\"\n spacing={0}\n >\n <Grid xs={4} item>\n <DeploymentDrawer deployment={deployment} />\n </Grid>\n {hpa && (\n <Grid item xs={4}>\n <HorizontalPodAutoscalerDrawer hpa={hpa}>\n <Grid\n item\n container\n direction=\"column\"\n justifyContent=\"flex-start\"\n alignItems=\"flex-start\"\n spacing={0}\n >\n <Grid item>\n <Typography variant=\"subtitle2\">\n min replicas {hpa.spec?.minReplicas ?? '?'} / max replicas{' '}\n {hpa.spec?.maxReplicas ?? '?'}\n </Typography>\n </Grid>\n <Grid item>\n <Typography variant=\"subtitle2\">\n current CPU usage: {cpuUtil ?? '?'}%\n </Typography>\n </Grid>\n <Grid item>\n <Typography variant=\"subtitle2\">\n target CPU usage: {specCpuUtil ?? '?'}%\n </Typography>\n </Grid>\n </Grid>\n </HorizontalPodAutoscalerDrawer>\n </Grid>\n )}\n <Grid\n item\n container\n xs={4}\n direction=\"column\"\n justifyContent=\"flex-start\"\n alignItems=\"flex-end\"\n spacing={0}\n >\n <Grid item>\n <StatusOK>{numberOfCurrentPods} pods</StatusOK>\n </Grid>\n <Grid item>\n {numberOfPodsWithErrors > 0 ? (\n <StatusError>\n {numberOfPodsWithErrors} pod\n {numberOfPodsWithErrors > 1 ? 's' : ''} with errors\n </StatusError>\n ) : (\n <StatusOK>No pods with errors</StatusOK>\n )}\n </Grid>\n </Grid>\n </Grid>\n );\n};\n\nconst DeploymentAccordion = ({\n deployment,\n ownedPods,\n matchingHpa,\n}: DeploymentAccordionProps) => {\n const podNamesWithErrors = useContext(PodNamesWithErrorsContext);\n\n const podsWithErrors = ownedPods.filter(p =>\n podNamesWithErrors.has(p.metadata?.name ?? ''),\n );\n\n return (\n <Accordion TransitionProps={{ unmountOnExit: true }} variant=\"outlined\">\n <AccordionSummary expandIcon={<ExpandMoreIcon />}>\n <DeploymentSummary\n deployment={deployment}\n numberOfCurrentPods={ownedPods.length}\n numberOfPodsWithErrors={podsWithErrors.length}\n hpa={matchingHpa}\n />\n </AccordionSummary>\n <AccordionDetails>\n <PodsTable\n pods={ownedPods}\n extraColumns={[READY_COLUMNS, RESOURCE_COLUMNS]}\n />\n </AccordionDetails>\n </Accordion>\n );\n};\n\nexport const DeploymentsAccordions = ({}: DeploymentsAccordionsProps) => {\n const groupedResponses = useContext(GroupedResponsesContext);\n\n return (\n <Grid\n container\n direction=\"column\"\n justifyContent=\"flex-start\"\n alignItems=\"flex-start\"\n >\n {groupedResponses.deployments.map((deployment, i) => (\n <Grid container item key={i} xs>\n <Grid item xs>\n <DeploymentAccordion\n matchingHpa={getMatchingHpa(\n {\n name: deployment.metadata?.name,\n namespace: deployment.metadata?.namespace,\n kind: 'deployment',\n },\n groupedResponses.horizontalPodAutoscalers,\n )}\n ownedPods={getOwnedPodsThroughReplicaSets(\n deployment,\n groupedResponses.replicaSets,\n groupedResponses.pods,\n )}\n deployment={deployment}\n />\n </Grid>\n </Grid>\n ))}\n </Grid>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6DA,MAAM,oBAAoB,CAAC;AAAA,EACzB,UAAA;AAAA,EACA,mBAAA;AAAA,EACA,sBAAA;AAAA,EACA;AACF,CAAA,KAA8B;AAC5B,EAAA,MAAM,WAAA,GAAc,GAAA,EAAK,IAAA,EAAM,OAAA,EAAS,IAAA;AAAA,IACtC,YAAU,MAAA,CAAO,IAAA,KAAS,UAAA,IAAc,MAAA,CAAO,UAAU,IAAA,KAAS;AAAA,GACpE,EAAG,UAAU,MAAA,CAAO,kBAAA;AAEpB,EAAA,MAAM,OAAA,GAAU,GAAA,EAAK,MAAA,EAAQ,cAAA,EAAgB,IAAA;AAAA,IAC3C,YAAU,MAAA,CAAO,IAAA,KAAS,UAAA,IAAc,MAAA,CAAO,UAAU,IAAA,KAAS;AAAA,GACpE,EAAG,UAAU,OAAA,CAAQ,kBAAA;AAErB,EAAA,uBACE,IAAA;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AAE,IAAA,EAC7B,QAAA,kBAAA,GAAA,CAAC,QAAK,IAAA,EAAI,IAAA,EAAC,IAAE,IAAA,EACX,QAAA,kBAAA,GAAA;AAAA,QAAC,mBAAA;AAAA,QAAA;AAAA,UACC,WAAA,EAAa,cAAA;AAAA,YACX;AAAA,cACE,IAAA,EAAM,WAAW,QAAA,EAAU,IAAA;AAAA,cAC3B,SAAA,EAAW,WAAW,QAAA,EAAU,SAAA;AAAA,cAChC,IAAA,EAAM;AAAA,aACR;AAAA,YACA,gBAAA,CAAiB;AAAA,WACnB;AAAA,UACA,SAAA,EAAW,8BAAA;AAAA,YACT,UAAA;AAAA,YACA,gBAAA,CAAiB,WAAA;AAAA,YACjB,gBAAA,CAAiB;AAAA,WACnB;AAAA,UACA;AAAA;AAAA,OACF,EACF,CAAA,EAAA,EAlBwB,CAmB1B,CACD;AAAA;AAAA,GACH;AAEJ;;;;"}
1
+ {"version":3,"file":"DeploymentsAccordions.esm.js","sources":["../../../src/components/DeploymentsAccordions/DeploymentsAccordions.tsx"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { ReactNode, useContext } from 'react';\nimport Accordion from '@material-ui/core/Accordion';\nimport AccordionDetails from '@material-ui/core/AccordionDetails';\nimport AccordionSummary from '@material-ui/core/AccordionSummary';\nimport Grid from '@material-ui/core/Grid';\nimport Typography from '@material-ui/core/Typography';\nimport ExpandMoreIcon from '@material-ui/icons/ExpandMore';\nimport type {\n V1Deployment,\n V1Pod,\n V2HorizontalPodAutoscaler,\n} from '@kubernetes/client-node';\nimport { PodsTable } from '../Pods';\nimport { DeploymentDrawer } from './DeploymentDrawer';\nimport { HorizontalPodAutoscalerDrawer } from '../HorizontalPodAutoscalers';\nimport {\n getOwnedPodsThroughReplicaSets,\n getMatchingHpa,\n} from '../../utils/owner';\nimport {\n GroupedResponsesContext,\n PodNamesWithErrorsContext,\n} from '../../hooks';\nimport { StatusError, StatusOK } from '@backstage/core-components';\nimport { READY_COLUMNS, RESOURCE_COLUMNS } from '../Pods/PodsTable';\nimport { useTranslationRef } from '@backstage/core-plugin-api/alpha';\nimport { kubernetesReactTranslationRef } from '../../translation';\n\ntype DeploymentsAccordionsProps = {\n children?: ReactNode;\n};\n\ntype DeploymentAccordionProps = {\n deployment: V1Deployment;\n ownedPods: V1Pod[];\n matchingHpa?: V2HorizontalPodAutoscaler;\n children?: ReactNode;\n};\n\ntype DeploymentSummaryProps = {\n deployment: V1Deployment;\n numberOfCurrentPods: number;\n numberOfPodsWithErrors: number;\n hpa?: V2HorizontalPodAutoscaler;\n children?: ReactNode;\n};\n\nconst DeploymentSummary = ({\n deployment,\n numberOfCurrentPods,\n numberOfPodsWithErrors,\n hpa,\n}: DeploymentSummaryProps) => {\n const { t } = useTranslationRef(kubernetesReactTranslationRef);\n const specCpuUtil = hpa?.spec?.metrics?.find(\n metric => metric.type === 'Resource' && metric.resource?.name === 'cpu',\n )?.resource?.target.averageUtilization;\n\n const cpuUtil = hpa?.status?.currentMetrics?.find(\n metric => metric.type === 'Resource' && metric.resource?.name === 'cpu',\n )?.resource?.current.averageUtilization;\n\n return (\n <Grid\n container\n direction=\"row\"\n justifyContent=\"space-between\"\n alignItems=\"center\"\n spacing={0}\n >\n <Grid xs={4} item>\n <DeploymentDrawer deployment={deployment} />\n </Grid>\n {hpa && (\n <Grid item xs={4}>\n <HorizontalPodAutoscalerDrawer hpa={hpa}>\n <Grid\n item\n container\n direction=\"column\"\n justifyContent=\"flex-start\"\n alignItems=\"flex-start\"\n spacing={0}\n >\n <Grid item>\n <Typography variant=\"subtitle2\">\n {t('hpa.replicasSummary', {\n min: String(hpa.spec?.minReplicas ?? '?'),\n max: String(hpa.spec?.maxReplicas ?? '?'),\n })}\n </Typography>\n </Grid>\n <Grid item>\n <Typography variant=\"subtitle2\">\n {t('hpa.currentCpuUsageLabel', {\n value: String(cpuUtil ?? '?'),\n })}\n </Typography>\n </Grid>\n <Grid item>\n <Typography variant=\"subtitle2\">\n {t('hpa.targetCpuUsageLabel', {\n value: String(specCpuUtil ?? '?'),\n })}\n </Typography>\n </Grid>\n </Grid>\n </HorizontalPodAutoscalerDrawer>\n </Grid>\n )}\n <Grid\n item\n container\n xs={4}\n direction=\"column\"\n justifyContent=\"flex-start\"\n alignItems=\"flex-end\"\n spacing={0}\n >\n <Grid item>\n <StatusOK>{t('pods.pods', { count: numberOfCurrentPods })}</StatusOK>\n </Grid>\n <Grid item>\n {numberOfPodsWithErrors > 0 ? (\n <StatusError>\n {t('cluster.podsWithErrors', { count: numberOfPodsWithErrors })}\n </StatusError>\n ) : (\n <StatusOK>{t('cluster.noPodsWithErrors')}</StatusOK>\n )}\n </Grid>\n </Grid>\n </Grid>\n );\n};\n\nconst DeploymentAccordion = ({\n deployment,\n ownedPods,\n matchingHpa,\n}: DeploymentAccordionProps) => {\n const podNamesWithErrors = useContext(PodNamesWithErrorsContext);\n\n const podsWithErrors = ownedPods.filter(p =>\n podNamesWithErrors.has(p.metadata?.name ?? ''),\n );\n\n return (\n <Accordion TransitionProps={{ unmountOnExit: true }} variant=\"outlined\">\n <AccordionSummary expandIcon={<ExpandMoreIcon />}>\n <DeploymentSummary\n deployment={deployment}\n numberOfCurrentPods={ownedPods.length}\n numberOfPodsWithErrors={podsWithErrors.length}\n hpa={matchingHpa}\n />\n </AccordionSummary>\n <AccordionDetails>\n <PodsTable\n pods={ownedPods}\n extraColumns={[READY_COLUMNS, RESOURCE_COLUMNS]}\n />\n </AccordionDetails>\n </Accordion>\n );\n};\n\nexport const DeploymentsAccordions = ({}: DeploymentsAccordionsProps) => {\n const groupedResponses = useContext(GroupedResponsesContext);\n\n return (\n <Grid\n container\n direction=\"column\"\n justifyContent=\"flex-start\"\n alignItems=\"flex-start\"\n >\n {groupedResponses.deployments.map((deployment, i) => (\n <Grid container item key={i} xs>\n <Grid item xs>\n <DeploymentAccordion\n matchingHpa={getMatchingHpa(\n {\n name: deployment.metadata?.name,\n namespace: deployment.metadata?.namespace,\n kind: 'deployment',\n },\n groupedResponses.horizontalPodAutoscalers,\n )}\n ownedPods={getOwnedPodsThroughReplicaSets(\n deployment,\n groupedResponses.replicaSets,\n groupedResponses.pods,\n )}\n deployment={deployment}\n />\n </Grid>\n </Grid>\n ))}\n </Grid>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+DA,MAAM,oBAAoB,CAAC;AAAA,EACzB,UAAA;AAAA,EACA,mBAAA;AAAA,EACA,sBAAA;AAAA,EACA;AACF,CAAA,KAA8B;AAC5B,EAAA,MAAM,EAAE,CAAA,EAAE,GAAI,iBAAA,CAAkB,6BAA6B,CAAA;AAC7D,EAAA,MAAM,WAAA,GAAc,GAAA,EAAK,IAAA,EAAM,OAAA,EAAS,IAAA;AAAA,IACtC,YAAU,MAAA,CAAO,IAAA,KAAS,UAAA,IAAc,MAAA,CAAO,UAAU,IAAA,KAAS;AAAA,GACpE,EAAG,UAAU,MAAA,CAAO,kBAAA;AAEpB,EAAA,MAAM,OAAA,GAAU,GAAA,EAAK,MAAA,EAAQ,cAAA,EAAgB,IAAA;AAAA,IAC3C,YAAU,MAAA,CAAO,IAAA,KAAS,UAAA,IAAc,MAAA,CAAO,UAAU,IAAA,KAAS;AAAA,GACpE,EAAG,UAAU,OAAA,CAAQ,kBAAA;AAErB,EAAA,uBACE,IAAA;AAAA,IAAC,IAAA;AAAA,IAAA;AAAA,MACC,SAAA,EAAS,IAAA;AAAA,MACT,SAAA,EAAU,KAAA;AAAA,MACV,cAAA,EAAe,eAAA;AAAA,MACf,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;AAAA,UACC,WAAA,EAAa,cAAA;AAAA,YACX;AAAA,cACE,IAAA,EAAM,WAAW,QAAA,EAAU,IAAA;AAAA,cAC3B,SAAA,EAAW,WAAW,QAAA,EAAU,SAAA;AAAA,cAChC,IAAA,EAAM;AAAA,aACR;AAAA,YACA,gBAAA,CAAiB;AAAA,WACnB;AAAA,UACA,SAAA,EAAW,8BAAA;AAAA,YACT,UAAA;AAAA,YACA,gBAAA,CAAiB,WAAA;AAAA,YACjB,gBAAA,CAAiB;AAAA,WACnB;AAAA,UACA;AAAA;AAAA,OACF,EACF,CAAA,EAAA,EAlBwB,CAmB1B,CACD;AAAA;AAAA,GACH;AAEJ;;;;"}
@@ -1,13 +1,24 @@
1
1
  import { jsxs, jsx } from 'react/jsx-runtime';
2
2
  import Typography from '@material-ui/core/Typography';
3
3
  import { WarningPanel } from '@backstage/core-components';
4
+ import { useTranslationRef } from '@backstage/core-plugin-api/alpha';
5
+ import { kubernetesReactTranslationRef } from '../../translation.esm.js';
4
6
 
5
- const clustersWithErrorsToErrorMessage = (clustersWithErrors) => {
7
+ const clustersWithErrorsToErrorMessage = (clustersWithErrors, t) => {
6
8
  return clustersWithErrors.map((c, i) => {
7
9
  return /* @__PURE__ */ jsxs("div", { children: [
8
- /* @__PURE__ */ jsx(Typography, { variant: "body2", children: `Cluster: ${c.cluster.title || c.cluster.name}` }),
10
+ /* @__PURE__ */ jsx(Typography, { variant: "body2", children: t("errorPanel.clusterLabelValue", {
11
+ cluster: c.cluster.title || c.cluster.name
12
+ }) }),
9
13
  c.errors.map((e, j) => {
10
- return /* @__PURE__ */ jsx(Typography, { variant: "body2", children: e.errorType === "FETCH_ERROR" ? `Error communicating with Kubernetes: ${e.errorType}, message: ${e.message}` : `Error fetching Kubernetes resource: '${e.resourcePath}', error: ${e.errorType}, status code: ${e.statusCode}` }, j);
14
+ return /* @__PURE__ */ jsx(Typography, { variant: "body2", children: e.errorType === "FETCH_ERROR" ? t("errorPanel.fetchError", {
15
+ errorType: e.errorType,
16
+ message: e.message
17
+ }) : t("errorPanel.resourceError", {
18
+ resourcePath: e.resourcePath ?? "",
19
+ errorType: e.errorType,
20
+ statusCode: String(e.statusCode ?? "")
21
+ }) }, j);
11
22
  }),
12
23
  /* @__PURE__ */ jsx("br", {})
13
24
  ] }, i);
@@ -17,23 +28,29 @@ const ErrorPanel = ({
17
28
  entityName,
18
29
  errorMessage,
19
30
  clustersWithErrors
20
- }) => /* @__PURE__ */ jsxs(
21
- WarningPanel,
22
- {
23
- title: "There was a problem retrieving Kubernetes objects",
24
- message: `There was a problem retrieving some Kubernetes resources for the entity: ${entityName}. This could mean that the Error Reporting card is not completely accurate.`,
25
- children: [
26
- clustersWithErrors && /* @__PURE__ */ jsxs("div", { children: [
27
- "Errors: ",
28
- clustersWithErrorsToErrorMessage(clustersWithErrors)
29
- ] }),
30
- errorMessage && /* @__PURE__ */ jsxs(Typography, { variant: "body2", children: [
31
- "Errors: ",
32
- errorMessage
33
- ] })
34
- ]
35
- }
36
- );
31
+ }) => {
32
+ const { t } = useTranslationRef(kubernetesReactTranslationRef);
33
+ return /* @__PURE__ */ jsxs(
34
+ WarningPanel,
35
+ {
36
+ title: t("errorPanel.title"),
37
+ message: t("errorPanel.message", { entityName }),
38
+ children: [
39
+ clustersWithErrors && /* @__PURE__ */ jsxs("div", { children: [
40
+ t("errorPanel.errorsLabel"),
41
+ ":",
42
+ " ",
43
+ clustersWithErrorsToErrorMessage(clustersWithErrors, t)
44
+ ] }),
45
+ errorMessage && /* @__PURE__ */ jsxs(Typography, { variant: "body2", children: [
46
+ t("errorPanel.errorsLabel"),
47
+ ": ",
48
+ errorMessage
49
+ ] })
50
+ ]
51
+ }
52
+ );
53
+ };
37
54
 
38
55
  export { ErrorPanel };
39
56
  //# sourceMappingURL=ErrorPanel.esm.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ErrorPanel.esm.js","sources":["../../../src/components/ErrorPanel/ErrorPanel.tsx"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { ReactNode } from 'react';\nimport Typography from '@material-ui/core/Typography';\nimport { ClusterObjects } from '@backstage/plugin-kubernetes-common';\nimport { WarningPanel } from '@backstage/core-components';\n\nconst clustersWithErrorsToErrorMessage = (\n clustersWithErrors: ClusterObjects[],\n): ReactNode => {\n return clustersWithErrors.map((c, i) => {\n return (\n <div key={i}>\n <Typography variant=\"body2\">{`Cluster: ${\n c.cluster.title || c.cluster.name\n }`}</Typography>\n {c.errors.map((e, j) => {\n return (\n <Typography variant=\"body2\" key={j}>\n {e.errorType === 'FETCH_ERROR'\n ? `Error communicating with Kubernetes: ${e.errorType}, message: ${e.message}`\n : `Error fetching Kubernetes resource: '${e.resourcePath}', error: ${e.errorType}, status code: ${e.statusCode}`}\n </Typography>\n );\n })}\n <br />\n </div>\n );\n });\n};\n\n/**\n *\n *\n * @public\n */\nexport type ErrorPanelProps = {\n entityName: string;\n errorMessage?: string;\n clustersWithErrors?: ClusterObjects[];\n children?: ReactNode;\n};\n\n/**\n *\n *\n * @public\n */\nexport const ErrorPanel = ({\n entityName,\n errorMessage,\n clustersWithErrors,\n}: ErrorPanelProps) => (\n <WarningPanel\n title=\"There was a problem retrieving Kubernetes objects\"\n message={`There was a problem retrieving some Kubernetes resources for the entity: ${entityName}. This could mean that the Error Reporting card is not completely accurate.`}\n >\n {clustersWithErrors && (\n <div>Errors: {clustersWithErrorsToErrorMessage(clustersWithErrors)}</div>\n )}\n {errorMessage && (\n <Typography variant=\"body2\">Errors: {errorMessage}</Typography>\n )}\n </WarningPanel>\n);\n"],"names":[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AAAA,QAAS,iCAAiC,kBAAkB;AAAA,OAAA,EAAE,CAAA;AAAA,MAEpE,YAAA,oBACC,IAAA,CAAC,UAAA,EAAA,EAAW,OAAA,EAAQ,OAAA,EAAQ,QAAA,EAAA;AAAA,QAAA,UAAA;AAAA,QAAS;AAAA,OAAA,EAAa;AAAA;AAAA;AAEtD;;;;"}
1
+ {"version":3,"file":"ErrorPanel.esm.js","sources":["../../../src/components/ErrorPanel/ErrorPanel.tsx"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { ReactNode } from 'react';\nimport Typography from '@material-ui/core/Typography';\nimport { ClusterObjects } from '@backstage/plugin-kubernetes-common';\nimport { WarningPanel } from '@backstage/core-components';\nimport {\n useTranslationRef,\n TranslationFunction,\n} from '@backstage/core-plugin-api/alpha';\nimport { kubernetesReactTranslationRef } from '../../translation';\n\nconst clustersWithErrorsToErrorMessage = (\n clustersWithErrors: ClusterObjects[],\n t: TranslationFunction<typeof kubernetesReactTranslationRef.T>,\n): ReactNode => {\n return clustersWithErrors.map((c, i) => {\n return (\n <div key={i}>\n <Typography variant=\"body2\">\n {t('errorPanel.clusterLabelValue', {\n cluster: c.cluster.title || c.cluster.name,\n })}\n </Typography>\n {c.errors.map((e, j) => {\n return (\n <Typography variant=\"body2\" key={j}>\n {e.errorType === 'FETCH_ERROR'\n ? t('errorPanel.fetchError', {\n errorType: e.errorType,\n message: e.message,\n })\n : t('errorPanel.resourceError', {\n resourcePath: e.resourcePath ?? '',\n errorType: e.errorType,\n statusCode: String(e.statusCode ?? ''),\n })}\n </Typography>\n );\n })}\n <br />\n </div>\n );\n });\n};\n\n/**\n *\n *\n * @public\n */\nexport type ErrorPanelProps = {\n entityName: string;\n errorMessage?: string;\n clustersWithErrors?: ClusterObjects[];\n children?: ReactNode;\n};\n\n/**\n *\n *\n * @public\n */\nexport const ErrorPanel = ({\n entityName,\n errorMessage,\n clustersWithErrors,\n}: ErrorPanelProps) => {\n const { t } = useTranslationRef(kubernetesReactTranslationRef);\n return (\n <WarningPanel\n title={t('errorPanel.title')}\n message={t('errorPanel.message', { entityName })}\n >\n {clustersWithErrors && (\n <div>\n {t('errorPanel.errorsLabel')}:{' '}\n {clustersWithErrorsToErrorMessage(clustersWithErrors, t)}\n </div>\n )}\n {errorMessage && (\n <Typography variant=\"body2\">\n {t('errorPanel.errorsLabel')}: {errorMessage}\n </Typography>\n )}\n </WarningPanel>\n );\n};\n"],"names":[],"mappings":";;;;;;AA0BA,MAAM,gCAAA,GAAmC,CACvC,kBAAA,EACA,CAAA,KACc;AACd,EAAA,OAAO,kBAAA,CAAmB,GAAA,CAAI,CAAC,CAAA,EAAG,CAAA,KAAM;AACtC,IAAA,4BACG,KAAA,EAAA,EACC,QAAA,EAAA;AAAA,sBAAA,GAAA,CAAC,UAAA,EAAA,EAAW,OAAA,EAAQ,OAAA,EACjB,QAAA,EAAA,CAAA,CAAE,8BAAA,EAAgC;AAAA,QACjC,OAAA,EAAS,CAAA,CAAE,OAAA,CAAQ,KAAA,IAAS,EAAE,OAAA,CAAQ;AAAA,OACvC,CAAA,EACH,CAAA;AAAA,MACC,CAAA,CAAE,MAAA,CAAO,GAAA,CAAI,CAAC,GAAG,CAAA,KAAM;AACtB,QAAA,uBACE,GAAA,CAAC,cAAW,OAAA,EAAQ,OAAA,EACjB,YAAE,SAAA,KAAc,aAAA,GACb,EAAE,uBAAA,EAAyB;AAAA,UACzB,WAAW,CAAA,CAAE,SAAA;AAAA,UACb,SAAS,CAAA,CAAE;AAAA,SACZ,CAAA,GACD,CAAA,CAAE,0BAAA,EAA4B;AAAA,UAC5B,YAAA,EAAc,EAAE,YAAA,IAAgB,EAAA;AAAA,UAChC,WAAW,CAAA,CAAE,SAAA;AAAA,UACb,UAAA,EAAY,MAAA,CAAO,CAAA,CAAE,UAAA,IAAc,EAAE;AAAA,SACtC,KAV0B,CAWjC,CAAA;AAAA,MAEJ,CAAC,CAAA;AAAA,0BACA,IAAA,EAAA,EAAG;AAAA,KAAA,EAAA,EAtBI,CAuBV,CAAA;AAAA,EAEJ,CAAC,CAAA;AACH,CAAA;AAmBO,MAAM,aAAa,CAAC;AAAA,EACzB,UAAA;AAAA,EACA,YAAA;AAAA,EACA;AACF,CAAA,KAAuB;AACrB,EAAA,MAAM,EAAE,CAAA,EAAE,GAAI,iBAAA,CAAkB,6BAA6B,CAAA;AAC7D,EAAA,uBACE,IAAA;AAAA,IAAC,YAAA;AAAA,IAAA;AAAA,MACC,KAAA,EAAO,EAAE,kBAAkB,CAAA;AAAA,MAC3B,OAAA,EAAS,CAAA,CAAE,oBAAA,EAAsB,EAAE,YAAY,CAAA;AAAA,MAE9C,QAAA,EAAA;AAAA,QAAA,kBAAA,yBACE,KAAA,EAAA,EACE,QAAA,EAAA;AAAA,UAAA,CAAA,CAAE,wBAAwB,CAAA;AAAA,UAAE,GAAA;AAAA,UAAE,GAAA;AAAA,UAC9B,gCAAA,CAAiC,oBAAoB,CAAC;AAAA,SAAA,EACzD,CAAA;AAAA,QAED,YAAA,oBACC,IAAA,CAAC,UAAA,EAAA,EAAW,OAAA,EAAQ,OAAA,EACjB,QAAA,EAAA;AAAA,UAAA,CAAA,CAAE,wBAAwB,CAAA;AAAA,UAAE,IAAA;AAAA,UAAG;AAAA,SAAA,EAClC;AAAA;AAAA;AAAA,GAEJ;AAEJ;;;;"}
@@ -1,38 +1,9 @@
1
- import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
1
+ import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
2
+ import { useMemo } from 'react';
2
3
  import { Table } from '@backstage/core-components';
4
+ import { useTranslationRef } from '@backstage/core-plugin-api/alpha';
5
+ import { kubernetesReactTranslationRef } from '../../translation.esm.js';
3
6
 
4
- const columns = [
5
- {
6
- title: "cluster",
7
- width: "10%",
8
- render: (row) => row.cluster.title || row.cluster.name
9
- },
10
- {
11
- title: "namespace",
12
- width: "10%",
13
- render: (row) => row.error.sourceRef.namespace
14
- },
15
- {
16
- title: "kind",
17
- width: "10%",
18
- render: (row) => row.error.sourceRef.kind
19
- },
20
- {
21
- title: "name",
22
- width: "30%",
23
- render: (row) => {
24
- return /* @__PURE__ */ jsxs(Fragment, { children: [
25
- row.error.sourceRef.name,
26
- " "
27
- ] });
28
- }
29
- },
30
- {
31
- title: "messages",
32
- width: "40%",
33
- render: (row) => row.error.message
34
- }
35
- ];
36
7
  const sortBySeverity = (a, b) => {
37
8
  if (a.error.severity < b.error.severity) {
38
9
  return 1;
@@ -45,16 +16,52 @@ const ErrorReporting = ({
45
16
  detectedErrors,
46
17
  clusters
47
18
  }) => {
19
+ const { t } = useTranslationRef(kubernetesReactTranslationRef);
48
20
  const errors = Array.from(detectedErrors.entries()).flatMap(([clusterName, resourceErrors]) => {
49
21
  return resourceErrors.map((e) => ({
50
22
  cluster: clusters.find((c) => c.name === clusterName),
51
23
  error: e
52
24
  }));
53
25
  }).sort(sortBySeverity);
26
+ const columns = useMemo(
27
+ () => [
28
+ {
29
+ title: String(t("errorReporting.columns.cluster")),
30
+ width: "10%",
31
+ render: (row) => row.cluster.title || row.cluster.name
32
+ },
33
+ {
34
+ title: String(t("errorReporting.columns.namespace")),
35
+ width: "10%",
36
+ render: (row) => row.error.sourceRef.namespace
37
+ },
38
+ {
39
+ title: String(t("errorReporting.columns.kind")),
40
+ width: "10%",
41
+ render: (row) => row.error.sourceRef.kind
42
+ },
43
+ {
44
+ title: String(t("errorReporting.columns.name")),
45
+ width: "30%",
46
+ render: (row) => {
47
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
48
+ row.error.sourceRef.name,
49
+ " "
50
+ ] });
51
+ }
52
+ },
53
+ {
54
+ title: String(t("errorReporting.columns.messages")),
55
+ width: "40%",
56
+ render: (row) => row.error.message
57
+ }
58
+ ],
59
+ [t]
60
+ );
54
61
  return /* @__PURE__ */ jsx(Fragment, { children: errors.length !== 0 && /* @__PURE__ */ jsx(
55
62
  Table,
56
63
  {
57
- title: "Error Reporting",
64
+ title: t("errorReporting.title"),
58
65
  data: errors,
59
66
  columns,
60
67
  options: { paging: true, search: false, emptyRowsWhenPaging: false }
@@ -1 +1 @@
1
- {"version":3,"file":"ErrorReporting.esm.js","sources":["../../../src/components/ErrorReporting/ErrorReporting.tsx"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport {\n ClusterAttributes,\n DetectedError,\n DetectedErrorsByCluster,\n} from '@backstage/plugin-kubernetes-common';\nimport { Table, TableColumn } from '@backstage/core-components';\n\n/**\n *\n *\n * @public\n */\nexport type ErrorReportingProps = {\n detectedErrors: DetectedErrorsByCluster;\n clusters: ClusterAttributes[];\n};\n\nconst columns: TableColumn<Row>[] = [\n {\n title: 'cluster',\n width: '10%',\n render: (row: Row) => row.cluster.title || row.cluster.name,\n },\n {\n title: 'namespace',\n width: '10%',\n render: (row: Row) => row.error.sourceRef.namespace,\n },\n {\n title: 'kind',\n width: '10%',\n render: (row: Row) => row.error.sourceRef.kind,\n },\n {\n title: 'name',\n width: '30%',\n render: (row: Row) => {\n return <>{row.error.sourceRef.name} </>;\n },\n },\n {\n title: 'messages',\n width: '40%',\n render: (row: Row) => row.error.message,\n },\n];\n\ninterface Row {\n cluster: ClusterAttributes;\n error: DetectedError;\n}\n\nconst sortBySeverity = (a: Row, b: Row) => {\n if (a.error.severity < b.error.severity) {\n return 1;\n } else if (b.error.severity < a.error.severity) {\n return -1;\n }\n return 0;\n};\n\n/**\n *\n *\n * @public\n */\nexport const ErrorReporting = ({\n detectedErrors,\n clusters,\n}: ErrorReportingProps) => {\n const errors = Array.from(detectedErrors.entries())\n .flatMap(([clusterName, resourceErrors]) => {\n return resourceErrors.map(e => ({\n cluster: clusters.find(c => c.name === clusterName)!,\n error: e,\n }));\n })\n .sort(sortBySeverity);\n\n return (\n <>\n {errors.length !== 0 && (\n <Table\n title=\"Error Reporting\"\n data={errors}\n columns={columns}\n options={{ paging: true, search: false, emptyRowsWhenPaging: false }}\n />\n )}\n </>\n );\n};\n"],"names":[],"mappings":";;;AAgCA,MAAM,OAAA,GAA8B;AAAA,EAClC;AAAA,IACE,KAAA,EAAO,SAAA;AAAA,IACP,KAAA,EAAO,KAAA;AAAA,IACP,QAAQ,CAAC,GAAA,KAAa,IAAI,OAAA,CAAQ,KAAA,IAAS,IAAI,OAAA,CAAQ;AAAA,GACzD;AAAA,EACA;AAAA,IACE,KAAA,EAAO,WAAA;AAAA,IACP,KAAA,EAAO,KAAA;AAAA,IACP,MAAA,EAAQ,CAAC,GAAA,KAAa,GAAA,CAAI,MAAM,SAAA,CAAU;AAAA,GAC5C;AAAA,EACA;AAAA,IACE,KAAA,EAAO,MAAA;AAAA,IACP,KAAA,EAAO,KAAA;AAAA,IACP,MAAA,EAAQ,CAAC,GAAA,KAAa,GAAA,CAAI,MAAM,SAAA,CAAU;AAAA,GAC5C;AAAA,EACA;AAAA,IACE,KAAA,EAAO,MAAA;AAAA,IACP,KAAA,EAAO,KAAA;AAAA,IACP,MAAA,EAAQ,CAAC,GAAA,KAAa;AACpB,MAAA,uBAAO,IAAA,CAAA,QAAA,EAAA,EAAG,QAAA,EAAA;AAAA,QAAA,GAAA,CAAI,MAAM,SAAA,CAAU,IAAA;AAAA,QAAK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,MAAM,MAAA,EAAQ,KAAA,EAAO,qBAAqB,KAAA;AAAM;AAAA,GACrE,EAEJ,CAAA;AAEJ;;;;"}
1
+ {"version":3,"file":"ErrorReporting.esm.js","sources":["../../../src/components/ErrorReporting/ErrorReporting.tsx"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { useMemo } from 'react';\nimport {\n ClusterAttributes,\n DetectedError,\n DetectedErrorsByCluster,\n} from '@backstage/plugin-kubernetes-common';\nimport { Table, TableColumn } from '@backstage/core-components';\nimport { useTranslationRef } from '@backstage/core-plugin-api/alpha';\nimport { kubernetesReactTranslationRef } from '../../translation';\n\n/**\n *\n *\n * @public\n */\nexport type ErrorReportingProps = {\n detectedErrors: DetectedErrorsByCluster;\n clusters: ClusterAttributes[];\n};\n\ninterface Row {\n cluster: ClusterAttributes;\n error: DetectedError;\n}\n\nconst sortBySeverity = (a: Row, b: Row) => {\n if (a.error.severity < b.error.severity) {\n return 1;\n } else if (b.error.severity < a.error.severity) {\n return -1;\n }\n return 0;\n};\n\n/**\n *\n *\n * @public\n */\nexport const ErrorReporting = ({\n detectedErrors,\n clusters,\n}: ErrorReportingProps) => {\n const { t } = useTranslationRef(kubernetesReactTranslationRef);\n const errors = Array.from(detectedErrors.entries())\n .flatMap(([clusterName, resourceErrors]) => {\n return resourceErrors.map(e => ({\n cluster: clusters.find(c => c.name === clusterName)!,\n error: e,\n }));\n })\n .sort(sortBySeverity);\n\n const columns: TableColumn<Row>[] = useMemo(\n () => [\n {\n title: String(t('errorReporting.columns.cluster')),\n width: '10%',\n render: (row: Row) => row.cluster.title || row.cluster.name,\n },\n {\n title: String(t('errorReporting.columns.namespace')),\n width: '10%',\n render: (row: Row) => row.error.sourceRef.namespace,\n },\n {\n title: String(t('errorReporting.columns.kind')),\n width: '10%',\n render: (row: Row) => row.error.sourceRef.kind,\n },\n {\n title: String(t('errorReporting.columns.name')),\n width: '30%',\n render: (row: Row) => {\n return <>{row.error.sourceRef.name} </>;\n },\n },\n {\n title: String(t('errorReporting.columns.messages')),\n width: '40%',\n render: (row: Row) => row.error.message,\n },\n ],\n [t],\n );\n\n return (\n <>\n {errors.length !== 0 && (\n <Table\n title={t('errorReporting.title')}\n data={errors}\n columns={columns}\n options={{ paging: true, search: false, emptyRowsWhenPaging: false }}\n />\n )}\n </>\n );\n};\n"],"names":[],"mappings":";;;;;;AAwCA,MAAM,cAAA,GAAiB,CAAC,CAAA,EAAQ,CAAA,KAAW;AACzC,EAAA,IAAI,CAAA,CAAE,KAAA,CAAM,QAAA,GAAW,CAAA,CAAE,MAAM,QAAA,EAAU;AACvC,IAAA,OAAO,CAAA;AAAA,EACT,WAAW,CAAA,CAAE,KAAA,CAAM,QAAA,GAAW,CAAA,CAAE,MAAM,QAAA,EAAU;AAC9C,IAAA,OAAO,EAAA;AAAA,EACT;AACA,EAAA,OAAO,CAAA;AACT,CAAA;AAOO,MAAM,iBAAiB,CAAC;AAAA,EAC7B,cAAA;AAAA,EACA;AACF,CAAA,KAA2B;AACzB,EAAA,MAAM,EAAE,CAAA,EAAE,GAAI,iBAAA,CAAkB,6BAA6B,CAAA;AAC7D,EAAA,MAAM,MAAA,GAAS,KAAA,CAAM,IAAA,CAAK,cAAA,CAAe,OAAA,EAAS,CAAA,CAC/C,OAAA,CAAQ,CAAC,CAAC,WAAA,EAAa,cAAc,CAAA,KAAM;AAC1C,IAAA,OAAO,cAAA,CAAe,IAAI,CAAA,CAAA,MAAM;AAAA,MAC9B,SAAS,QAAA,CAAS,IAAA,CAAK,CAAA,CAAA,KAAK,CAAA,CAAE,SAAS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AAa,GAAA,CAAI,KAAA,CAAM;AAAA;AAClC,KACF;AAAA,IACA,CAAC,CAAC;AAAA,GACJ;AAEA,EAAA,uBACE,GAAA,CAAA,QAAA,EAAA,EACG,QAAA,EAAA,MAAA,CAAO,MAAA,KAAW,CAAA,oBACjB,GAAA;AAAA,IAAC,KAAA;AAAA,IAAA;AAAA,MACC,KAAA,EAAO,EAAE,sBAAsB,CAAA;AAAA,MAC/B,IAAA,EAAM,MAAA;AAAA,MACN,OAAA;AAAA,MACA,SAAS,EAAE,MAAA,EAAQ,MAAM,MAAA,EAAQ,KAAA,EAAO,qBAAqB,KAAA;AAAM;AAAA,GACrE,EAEJ,CAAA;AAEJ;;;;"}
@@ -6,6 +6,8 @@ import '@material-ui/core/FormControlLabel';
6
6
  import '@material-ui/core/Switch';
7
7
  import 'js-yaml';
8
8
  import 'react';
9
+ import '@backstage/core-plugin-api/alpha';
10
+ import '../../translation.esm.js';
9
11
 
10
12
  const HorizontalPodAutoscalerDrawer = (props) => {
11
13
  const { hpa, expanded, children } = props;
@@ -1 +1 @@
1
- {"version":3,"file":"HorizontalPodAutoscalerDrawer.esm.js","sources":["../../../src/components/HorizontalPodAutoscalers/HorizontalPodAutoscalerDrawer.tsx"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { ReactNode } from 'react';\nimport type { V2HorizontalPodAutoscaler } from '@kubernetes/client-node';\nimport { KubernetesStructuredMetadataTableDrawer } from '../KubernetesDrawer';\n\n/** @public */\nexport const HorizontalPodAutoscalerDrawer = (props: {\n hpa: V2HorizontalPodAutoscaler;\n expanded?: boolean;\n children?: ReactNode;\n}) => {\n const { hpa, expanded, children } = props;\n\n const specCpuUtil = hpa?.spec?.metrics?.find(\n metric => metric.type === 'Resource' && metric.resource?.name === 'cpu',\n )?.resource?.target.averageUtilization;\n\n const cpuUtil = hpa?.status?.currentMetrics?.find(\n metric => metric.type === 'Resource' && metric.resource?.name === 'cpu',\n )?.resource?.current.averageUtilization;\n\n return (\n <KubernetesStructuredMetadataTableDrawer\n kind=\"HorizontalPodAutoscaler\"\n object={hpa}\n expanded={expanded}\n renderObject={(hpaObject: V2HorizontalPodAutoscaler) => {\n return {\n targetCPUUtilizationPercentage: specCpuUtil,\n currentCPUUtilizationPercentage: cpuUtil,\n minReplicas: hpaObject.spec?.minReplicas,\n maxReplicas: hpaObject.spec?.maxReplicas,\n currentReplicas: hpaObject.status?.currentReplicas,\n desiredReplicas: hpaObject.status?.desiredReplicas,\n lastScaleTime: hpa?.status?.lastScaleTime,\n };\n }}\n >\n {children}\n </KubernetesStructuredMetadataTableDrawer>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;AAqBO,MAAM,6BAAA,GAAgC,CAAC,KAAA,KAIxC;AACJ,EAAA,MAAM,EAAE,GAAA,EAAK,QAAA,EAAU,QAAA,EAAS,GAAI,KAAA;AAEpC,EAAA,MAAM,WAAA,GAAc,GAAA,EAAK,IAAA,EAAM,OAAA,EAAS,IAAA;AAAA,IACtC,YAAU,MAAA,CAAO,IAAA,KAAS,UAAA,IAAc,MAAA,CAAO,UAAU,IAAA,KAAS;AAAA,GACpE,EAAG,UAAU,MAAA,CAAO,kBAAA;AAEpB,EAAA,MAAM,OAAA,GAAU,GAAA,EAAK,MAAA,EAAQ,cAAA,EAAgB,IAAA;AAAA,IAC3C,YAAU,MAAA,CAAO,IAAA,KAAS,UAAA,IAAc,MAAA,CAAO,UAAU,IAAA,KAAS;AAAA,GACpE,EAAG,UAAU,OAAA,CAAQ,kBAAA;AAErB,EAAA,uBACE,GAAA;AAAA,IAAC,uCAAA;AAAA,IAAA;AAAA,MACC,IAAA,EAAK,yBAAA;AAAA,MACL,MAAA,EAAQ,GAAA;AAAA,MACR,QAAA;AAAA,MACA,YAAA,EAAc,CAAC,SAAA,KAAyC;AACtD,QAAA,OAAO;AAAA,UACL,8BAAA,EAAgC,WAAA;AAAA,UAChC,+BAAA,EAAiC,OAAA;AAAA,UACjC,WAAA,EAAa,UAAU,IAAA,EAAM,WAAA;AAAA,UAC7B,WAAA,EAAa,UAAU,IAAA,EAAM,WAAA;AAAA,UAC7B,eAAA,EAAiB,UAAU,MAAA,EAAQ,eAAA;AAAA,UACnC,eAAA,EAAiB,UAAU,MAAA,EAAQ,eAAA;AAAA,UACnC,aAAA,EAAe,KAAK,MAAA,EAAQ;AAAA,SAC9B;AAAA,MACF,CAAA;AAAA,MAEC;AAAA;AAAA,GACH;AAEJ;;;;"}
1
+ {"version":3,"file":"HorizontalPodAutoscalerDrawer.esm.js","sources":["../../../src/components/HorizontalPodAutoscalers/HorizontalPodAutoscalerDrawer.tsx"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { ReactNode } from 'react';\nimport type { V2HorizontalPodAutoscaler } from '@kubernetes/client-node';\nimport { KubernetesStructuredMetadataTableDrawer } from '../KubernetesDrawer';\n\n/** @public */\nexport const HorizontalPodAutoscalerDrawer = (props: {\n hpa: V2HorizontalPodAutoscaler;\n expanded?: boolean;\n children?: ReactNode;\n}) => {\n const { hpa, expanded, children } = props;\n\n const specCpuUtil = hpa?.spec?.metrics?.find(\n metric => metric.type === 'Resource' && metric.resource?.name === 'cpu',\n )?.resource?.target.averageUtilization;\n\n const cpuUtil = hpa?.status?.currentMetrics?.find(\n metric => metric.type === 'Resource' && metric.resource?.name === 'cpu',\n )?.resource?.current.averageUtilization;\n\n return (\n <KubernetesStructuredMetadataTableDrawer\n kind=\"HorizontalPodAutoscaler\"\n object={hpa}\n expanded={expanded}\n renderObject={(hpaObject: V2HorizontalPodAutoscaler) => {\n return {\n targetCPUUtilizationPercentage: specCpuUtil,\n currentCPUUtilizationPercentage: cpuUtil,\n minReplicas: hpaObject.spec?.minReplicas,\n maxReplicas: hpaObject.spec?.maxReplicas,\n currentReplicas: hpaObject.status?.currentReplicas,\n desiredReplicas: hpaObject.status?.desiredReplicas,\n lastScaleTime: hpa?.status?.lastScaleTime,\n };\n }}\n >\n {children}\n </KubernetesStructuredMetadataTableDrawer>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;AAqBO,MAAM,6BAAA,GAAgC,CAAC,KAAA,KAIxC;AACJ,EAAA,MAAM,EAAE,GAAA,EAAK,QAAA,EAAU,QAAA,EAAS,GAAI,KAAA;AAEpC,EAAA,MAAM,WAAA,GAAc,GAAA,EAAK,IAAA,EAAM,OAAA,EAAS,IAAA;AAAA,IACtC,YAAU,MAAA,CAAO,IAAA,KAAS,UAAA,IAAc,MAAA,CAAO,UAAU,IAAA,KAAS;AAAA,GACpE,EAAG,UAAU,MAAA,CAAO,kBAAA;AAEpB,EAAA,MAAM,OAAA,GAAU,GAAA,EAAK,MAAA,EAAQ,cAAA,EAAgB,IAAA;AAAA,IAC3C,YAAU,MAAA,CAAO,IAAA,KAAS,UAAA,IAAc,MAAA,CAAO,UAAU,IAAA,KAAS;AAAA,GACpE,EAAG,UAAU,OAAA,CAAQ,kBAAA;AAErB,EAAA,uBACE,GAAA;AAAA,IAAC,uCAAA;AAAA,IAAA;AAAA,MACC,IAAA,EAAK,yBAAA;AAAA,MACL,MAAA,EAAQ,GAAA;AAAA,MACR,QAAA;AAAA,MACA,YAAA,EAAc,CAAC,SAAA,KAAyC;AACtD,QAAA,OAAO;AAAA,UACL,8BAAA,EAAgC,WAAA;AAAA,UAChC,+BAAA,EAAiC,OAAA;AAAA,UACjC,WAAA,EAAa,UAAU,IAAA,EAAM,WAAA;AAAA,UAC7B,WAAA,EAAa,UAAU,IAAA,EAAM,WAAA;AAAA,UAC7B,eAAA,EAAiB,UAAU,MAAA,EAAQ,eAAA;AAAA,UACnC,eAAA,EAAiB,UAAU,MAAA,EAAQ,eAAA;AAAA,UACnC,aAAA,EAAe,KAAK,MAAA,EAAQ;AAAA,SAC9B;AAAA,MACF,CAAA;AAAA,MAEC;AAAA;AAAA,GACH;AAEJ;;;;"}
@@ -6,6 +6,8 @@ import '@material-ui/core/FormControlLabel';
6
6
  import '@material-ui/core/Switch';
7
7
  import 'js-yaml';
8
8
  import 'react';
9
+ import { useTranslationRef } from '@backstage/core-plugin-api/alpha';
10
+ import { kubernetesReactTranslationRef } from '../../translation.esm.js';
9
11
  import Typography from '@material-ui/core/Typography';
10
12
  import Grid from '@material-ui/core/Grid';
11
13
  import Chip from '@material-ui/core/Chip';
@@ -14,6 +16,7 @@ const IngressDrawer = ({
14
16
  ingress,
15
17
  expanded
16
18
  }) => {
19
+ const { t } = useTranslationRef(kubernetesReactTranslationRef);
17
20
  const namespace = ingress.metadata?.namespace;
18
21
  return /* @__PURE__ */ jsx(
19
22
  KubernetesStructuredMetadataTableDrawer,
@@ -35,7 +38,7 @@ const IngressDrawer = ({
35
38
  children: [
36
39
  /* @__PURE__ */ jsx(Grid, { item: true, children: /* @__PURE__ */ jsx(Typography, { variant: "body1", children: ingress.metadata?.name ?? "unknown object" }) }),
37
40
  /* @__PURE__ */ jsx(Grid, { item: true, children: /* @__PURE__ */ jsx(Typography, { color: "textSecondary", variant: "subtitle1", children: "Ingress" }) }),
38
- namespace && /* @__PURE__ */ jsx(Grid, { item: true, children: /* @__PURE__ */ jsx(Chip, { size: "small", label: `namespace: ${namespace}` }) })
41
+ namespace && /* @__PURE__ */ jsx(Grid, { item: true, children: /* @__PURE__ */ jsx(Chip, { size: "small", label: `${t("namespace.label")} ${namespace}` }) })
39
42
  ]
40
43
  }
41
44
  )
@@ -1 +1 @@
1
- {"version":3,"file":"IngressDrawer.esm.js","sources":["../../../src/components/IngressesAccordions/IngressDrawer.tsx"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { V1Ingress } from '@kubernetes/client-node';\nimport { KubernetesStructuredMetadataTableDrawer } from '../KubernetesDrawer';\nimport Typography from '@material-ui/core/Typography';\nimport Grid from '@material-ui/core/Grid';\nimport Chip from '@material-ui/core/Chip';\n\nexport const IngressDrawer = ({\n ingress,\n expanded,\n}: {\n ingress: V1Ingress;\n expanded?: boolean;\n}) => {\n const namespace = ingress.metadata?.namespace;\n return (\n <KubernetesStructuredMetadataTableDrawer\n object={ingress}\n expanded={expanded}\n kind=\"Ingress\"\n renderObject={(ingressObject: V1Ingress) => {\n return ingressObject.spec || {};\n }}\n >\n <Grid\n container\n direction=\"column\"\n justifyContent=\"flex-start\"\n alignItems=\"flex-start\"\n spacing={0}\n >\n <Grid item>\n <Typography variant=\"body1\">\n {ingress.metadata?.name ?? 'unknown object'}\n </Typography>\n </Grid>\n <Grid item>\n <Typography color=\"textSecondary\" variant=\"subtitle1\">\n Ingress\n </Typography>\n </Grid>\n {namespace && (\n <Grid item>\n <Chip size=\"small\" label={`namespace: ${namespace}`} />\n </Grid>\n )}\n </Grid>\n </KubernetesStructuredMetadataTableDrawer>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;AAsBO,MAAM,g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AAEJ;;;;"}
1
+ {"version":3,"file":"IngressDrawer.esm.js","sources":["../../../src/components/IngressesAccordions/IngressDrawer.tsx"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { V1Ingress } from '@kubernetes/client-node';\nimport { KubernetesStructuredMetadataTableDrawer } from '../KubernetesDrawer';\nimport Typography from '@material-ui/core/Typography';\nimport Grid from '@material-ui/core/Grid';\nimport Chip from '@material-ui/core/Chip';\nimport { useTranslationRef } from '@backstage/core-plugin-api/alpha';\nimport { kubernetesReactTranslationRef } from '../../translation';\n\nexport const IngressDrawer = ({\n ingress,\n expanded,\n}: {\n ingress: V1Ingress;\n expanded?: boolean;\n}) => {\n const { t } = useTranslationRef(kubernetesReactTranslationRef);\n const namespace = ingress.metadata?.namespace;\n return (\n <KubernetesStructuredMetadataTableDrawer\n object={ingress}\n expanded={expanded}\n kind=\"Ingress\"\n renderObject={(ingressObject: V1Ingress) => {\n return ingressObject.spec || {};\n }}\n >\n <Grid\n container\n direction=\"column\"\n justifyContent=\"flex-start\"\n alignItems=\"flex-start\"\n spacing={0}\n >\n <Grid item>\n <Typography variant=\"body1\">\n {ingress.metadata?.name ?? 'unknown object'}\n </Typography>\n </Grid>\n <Grid item>\n <Typography color=\"textSecondary\" variant=\"subtitle1\">\n Ingress\n </Typography>\n </Grid>\n {namespace && (\n <Grid item>\n <Chip size=\"small\" label={`${t('namespace.label')} ${namespace}`} />\n </Grid>\n )}\n </Grid>\n </KubernetesStructuredMetadataTableDrawer>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;A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