@backstage/plugin-kubernetes-react 0.5.6-next.0 → 0.5.6

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 (99) hide show
  1. package/CHANGELOG.md +32 -0
  2. package/dist/components/Cluster/Cluster.esm.js +64 -39
  3. package/dist/components/Cluster/Cluster.esm.js.map +1 -1
  4. package/dist/components/CronJobsAccordions/CronJobsAccordions.esm.js +44 -32
  5. package/dist/components/CronJobsAccordions/CronJobsAccordions.esm.js.map +1 -1
  6. package/dist/components/CronJobsAccordions/CronJobsDrawer.esm.js +20 -17
  7. package/dist/components/CronJobsAccordions/CronJobsDrawer.esm.js.map +1 -1
  8. package/dist/components/CustomResources/ArgoRollouts/Rollout.esm.js +149 -100
  9. package/dist/components/CustomResources/ArgoRollouts/Rollout.esm.js.map +1 -1
  10. package/dist/components/CustomResources/ArgoRollouts/RolloutDrawer.esm.js +20 -17
  11. package/dist/components/CustomResources/ArgoRollouts/RolloutDrawer.esm.js.map +1 -1
  12. package/dist/components/CustomResources/ArgoRollouts/StepsProgress.esm.js +8 -5
  13. package/dist/components/CustomResources/ArgoRollouts/StepsProgress.esm.js.map +1 -1
  14. package/dist/components/CustomResources/CustomResources.esm.js +8 -7
  15. package/dist/components/CustomResources/CustomResources.esm.js.map +1 -1
  16. package/dist/components/CustomResources/DefaultCustomResource.esm.js +41 -39
  17. package/dist/components/CustomResources/DefaultCustomResource.esm.js.map +1 -1
  18. package/dist/components/CustomResources/DefaultCustomResourceDrawer.esm.js +19 -16
  19. package/dist/components/CustomResources/DefaultCustomResourceDrawer.esm.js.map +1 -1
  20. package/dist/components/DaemonSetsAccordions/DaemonSetsAccordions.esm.js +59 -43
  21. package/dist/components/DaemonSetsAccordions/DaemonSetsAccordions.esm.js.map +1 -1
  22. package/dist/components/DaemonSetsAccordions/DaemonSetsDrawer.esm.js +19 -16
  23. package/dist/components/DaemonSetsAccordions/DaemonSetsDrawer.esm.js.map +1 -1
  24. package/dist/components/DeploymentsAccordions/DeploymentDrawer.esm.js +19 -16
  25. package/dist/components/DeploymentsAccordions/DeploymentDrawer.esm.js.map +1 -1
  26. package/dist/components/DeploymentsAccordions/DeploymentsAccordions.esm.js +102 -70
  27. package/dist/components/DeploymentsAccordions/DeploymentsAccordions.esm.js.map +1 -1
  28. package/dist/components/ErrorPanel/ErrorPanel.esm.js +21 -9
  29. package/dist/components/ErrorPanel/ErrorPanel.esm.js.map +1 -1
  30. package/dist/components/ErrorReporting/ErrorReporting.esm.js +7 -4
  31. package/dist/components/ErrorReporting/ErrorReporting.esm.js.map +1 -1
  32. package/dist/components/HorizontalPodAutoscalers/HorizontalPodAutoscalerDrawer.esm.js +6 -5
  33. package/dist/components/HorizontalPodAutoscalers/HorizontalPodAutoscalerDrawer.esm.js.map +1 -1
  34. package/dist/components/IngressesAccordions/IngressDrawer.esm.js +19 -16
  35. package/dist/components/IngressesAccordions/IngressDrawer.esm.js.map +1 -1
  36. package/dist/components/IngressesAccordions/IngressesAccordions.esm.js +15 -11
  37. package/dist/components/IngressesAccordions/IngressesAccordions.esm.js.map +1 -1
  38. package/dist/components/JobsAccordions/JobsAccordions.esm.js +49 -31
  39. package/dist/components/JobsAccordions/JobsAccordions.esm.js.map +1 -1
  40. package/dist/components/JobsAccordions/JobsDrawer.esm.js +18 -15
  41. package/dist/components/JobsAccordions/JobsDrawer.esm.js.map +1 -1
  42. package/dist/components/KubernetesDialog/KubernetesDialog.esm.js +40 -31
  43. package/dist/components/KubernetesDialog/KubernetesDialog.esm.js.map +1 -1
  44. package/dist/components/KubernetesDrawer/KubernetesDrawer.esm.js +57 -42
  45. package/dist/components/KubernetesDrawer/KubernetesDrawer.esm.js.map +1 -1
  46. package/dist/components/KubernetesDrawer/KubernetesStructuredMetadataTableDrawer.esm.js +95 -75
  47. package/dist/components/KubernetesDrawer/KubernetesStructuredMetadataTableDrawer.esm.js.map +1 -1
  48. package/dist/components/KubernetesDrawer/ManifestYaml.esm.js +36 -32
  49. package/dist/components/KubernetesDrawer/ManifestYaml.esm.js.map +1 -1
  50. package/dist/components/PodExecTerminal/PodExecTerminal.esm.js +4 -3
  51. package/dist/components/PodExecTerminal/PodExecTerminal.esm.js.map +1 -1
  52. package/dist/components/PodExecTerminal/PodExecTerminalDialog.esm.js +7 -6
  53. package/dist/components/PodExecTerminal/PodExecTerminalDialog.esm.js.map +1 -1
  54. package/dist/components/Pods/ErrorList/ErrorList.esm.js +27 -21
  55. package/dist/components/Pods/ErrorList/ErrorList.esm.js.map +1 -1
  56. package/dist/components/Pods/Events/Events.esm.js +30 -23
  57. package/dist/components/Pods/Events/Events.esm.js.map +1 -1
  58. package/dist/components/Pods/FixDialog/FixDialog.esm.js +85 -51
  59. package/dist/components/Pods/FixDialog/FixDialog.esm.js.map +1 -1
  60. package/dist/components/Pods/PodDelete/PodDeleteButton.esm.js +25 -21
  61. package/dist/components/Pods/PodDelete/PodDeleteButton.esm.js.map +1 -1
  62. package/dist/components/Pods/PodDrawer/ContainerCard.esm.js +137 -95
  63. package/dist/components/Pods/PodDrawer/ContainerCard.esm.js.map +1 -1
  64. package/dist/components/Pods/PodDrawer/PendingPodContent.esm.js +36 -9
  65. package/dist/components/Pods/PodDrawer/PendingPodContent.esm.js.map +1 -1
  66. package/dist/components/Pods/PodDrawer/PodDrawer.esm.js +89 -64
  67. package/dist/components/Pods/PodDrawer/PodDrawer.esm.js.map +1 -1
  68. package/dist/components/Pods/PodLogs/PodLogs.esm.js +30 -25
  69. package/dist/components/Pods/PodLogs/PodLogs.esm.js.map +1 -1
  70. package/dist/components/Pods/PodLogs/PodLogsDialog.esm.js +6 -6
  71. package/dist/components/Pods/PodLogs/PodLogsDialog.esm.js.map +1 -1
  72. package/dist/components/Pods/PodsTable.esm.js +12 -11
  73. package/dist/components/Pods/PodsTable.esm.js.map +1 -1
  74. package/dist/components/ResourceUtilization/ResourceUtilization.esm.js +24 -15
  75. package/dist/components/ResourceUtilization/ResourceUtilization.esm.js.map +1 -1
  76. package/dist/components/ServicesAccordions/ServiceDrawer.esm.js +19 -16
  77. package/dist/components/ServicesAccordions/ServiceDrawer.esm.js.map +1 -1
  78. package/dist/components/ServicesAccordions/ServicesAccordions.esm.js +21 -12
  79. package/dist/components/ServicesAccordions/ServicesAccordions.esm.js.map +1 -1
  80. package/dist/components/StatefulSetsAccordions/StatefulSetDrawer.esm.js +19 -16
  81. package/dist/components/StatefulSetsAccordions/StatefulSetDrawer.esm.js.map +1 -1
  82. package/dist/components/StatefulSetsAccordions/StatefulSetsAccordions.esm.js +98 -66
  83. package/dist/components/StatefulSetsAccordions/StatefulSetsAccordions.esm.js.map +1 -1
  84. package/dist/hooks/Cluster.esm.js +2 -2
  85. package/dist/hooks/Cluster.esm.js.map +1 -1
  86. package/dist/hooks/GroupedResponses.esm.js +2 -2
  87. package/dist/hooks/GroupedResponses.esm.js.map +1 -1
  88. package/dist/hooks/PodNamesWithErrors.esm.js +2 -2
  89. package/dist/hooks/PodNamesWithErrors.esm.js.map +1 -1
  90. package/dist/hooks/PodNamesWithMetrics.esm.js +2 -2
  91. package/dist/hooks/PodNamesWithMetrics.esm.js.map +1 -1
  92. package/dist/hooks/useMatchingErrors.esm.js +2 -2
  93. package/dist/hooks/useMatchingErrors.esm.js.map +1 -1
  94. package/dist/hooks/usePodMetrics.esm.js +4 -2
  95. package/dist/hooks/usePodMetrics.esm.js.map +1 -1
  96. package/dist/index.d.ts +47 -46
  97. package/dist/utils/pod.esm.js +25 -15
  98. package/dist/utils/pod.esm.js.map +1 -1
  99. package/package.json +13 -13
@@ -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 React from 'react';\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":["React"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqCA,MAAM,sBAAyB,GAAA,UAAA;AAAA,EAAW,CAAC,WACzC,YAAa,CAAA;AAAA,IACX,MAAQ,EAAA;AAAA,MACN,OAAS,EAAA,MAAA;AAAA,MACT,aAAe,EAAA,KAAA;AAAA,MACf,cAAgB,EAAA;AAAA,KAClB;AAAA,IACA,OAAS,EAAA;AAAA,MACP,MAAQ,EAAA;AAAA,KACV;AAAA,IACA,IAAM,EAAA;AAAA,MACJ,QAAU,EAAA;AAAA,KACZ;AAAA,IACA,SAAW,EAAA;AAAA,MACT,KAAO,EAAA,MAAA;AAAA,MACP,QAAU,EAAA,GAAA;AAAA,MACV,SAAW,EAAA;AAAA;AACb,GACD;AACH,CAAA;AAEA,SAAS,sBAAA,CAAuB,KAAU,aAAuB,EAAA;AAC/D,EAAA,OAAO,IAAI,IAAM,EAAA,UAAA,CAAW,KAAK,CAAK,CAAA,KAAA,CAAA,CAAE,SAAS,aAAa,CAAA;AAChE;AAiBO,MAAM,SAAY,GAAA,CAAC,EAAE,YAAA,EAAc,MAA2B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AA,YAAA,CAAa,IAAI,QAAU,EAAA,IAAI,IAAI,CAAC,CAAA,CAAA;AAAA,YAC3D,gBAAA;AAAA,YACA,QAAU,EAAA;AAAA,cACR,OAAS,EAAA,YAAA,CAAa,GAAI,CAAA,QAAA,EAAU,IAAQ,IAAA,SAAA;AAAA,cAC5C,YACE,EAAA,YAAA,CAAa,GAAI,CAAA,QAAA,EAAU,SAAa,IAAA,SAAA;AAAA,cAC1C,SAAS,YAAa,CAAA;AAAA,aACxB;AAAA,YACA,aAAA;AAAA,YACA;AAAA;AAAA,SACF;AAAA;AAEJ,KAEJ,CACF,CAAA,EACC,YAAa,CAAA,MAAA,CAAO,SAAS,CAC5B,oBAAAA,cAAA,CAAA,aAAA,CAAC,IAAK,EAAA,EAAA,IAAA,EAAI,MAAC,EAAI,EAAA,EAAA,EAAA,+CACZ,UAAW,EAAA,EAAA,OAAA,EAAQ,QAAK,QAAM,CACjC,CAED,EAAA,YAAA,CAAa,OAAO,MAAS,GAAA,CAAA,oBAC3BA,cAAA,CAAA,aAAA,CAAA,IAAA,EAAA,EAAK,MAAI,IAAC,EAAA,EAAA,EAAI,EACb,EAAA,kBAAAA,cAAA,CAAA,aAAA,CAAC,aAAU,YAAc,EAAA,CAAC,YAAY,CAAG,EAAA,CAC3C,CAEJ,CAEJ;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';\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,sBAAyB,GAAA,UAAA;AAAA,EAAW,CAAC,WACzC,YAAa,CAAA;AAAA,IACX,MAAQ,EAAA;AAAA,MACN,OAAS,EAAA,MAAA;AAAA,MACT,aAAe,EAAA,KAAA;AAAA,MACf,cAAgB,EAAA;AAAA,KAClB;AAAA,IACA,OAAS,EAAA;AAAA,MACP,MAAQ,EAAA;AAAA,KACV;AAAA,IACA,IAAM,EAAA;AAAA,MACJ,QAAU,EAAA;AAAA,KACZ;AAAA,IACA,SAAW,EAAA;AAAA,MACT,KAAO,EAAA,MAAA;AAAA,MACP,QAAU,EAAA,GAAA;AAAA,MACV,SAAW,EAAA;AAAA;AACb,GACD;AACH,CAAA;AAEA,SAAS,sBAAA,CAAuB,KAAU,aAAuB,EAAA;AAC/D,EAAA,OAAO,IAAI,IAAM,EAAA,UAAA,CAAW,KAAK,CAAK,CAAA,KAAA,CAAA,CAAE,SAAS,aAAa,CAAA;AAChE;AAiBO,MAAM,SAAY,GAAA,CAAC,EAAE,YAAA,EAAc,MAA2B,KAAA;AACnE,EAAA,MAAM,UAAU,sBAAuB,EAAA;AACvC,EAAA,MAAM,aAAa,aAAc,CAAA,YAAA,CAAa,OAAQ,CAAA,IAAA,EAAM,aAAa,GAAG,CAAA;AAC5E,EAAA,MAAM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;AAAA,oBAC5C,YACE,EAAA,YAAA,CAAa,GAAI,CAAA,QAAA,EAAU,SAAa,IAAA,SAAA;AAAA,oBAC1C,SAAS,YAAa,CAAA;AAAA,mBACxB;AAAA,kBACA,aAAA;AAAA,kBACA;AAAA,iBAAA;AAAA,gBATK,kBAAkB,YAAa,CAAA,GAAA,CAAI,QAAU,EAAA,IAAI,IAAI,CAAC,CAAA;AAAA,eAU7D;AAAA;AAEJ,aAEJ,CACF,EAAA,CAAA;AAAA,UACC,YAAa,CAAA,MAAA,CAAO,MAAS,GAAA,CAAA,wBAC3B,IAAK,EAAA,EAAA,IAAA,EAAI,IAAC,EAAA,EAAA,EAAI,IACb,QAAC,kBAAA,GAAA,CAAA,UAAA,EAAA,EAAW,OAAQ,EAAA,IAAA,EAAK,oBAAM,CACjC,EAAA,CAAA;AAAA,UAED,aAAa,MAAO,CAAA,MAAA,GAAS,CAC5B,oBAAA,GAAA,CAAC,QAAK,IAAI,EAAA,IAAA,EAAC,EAAI,EAAA,EAAA,EACb,8BAAC,SAAU,EAAA,EAAA,YAAA,EAAc,CAAC,YAAY,GAAG,CAC3C,EAAA;AAAA,SAEJ,EAAA;AAAA,OAEJ,EAAA;AAAA;AAAA,GACF;AAEJ;;;;"}
@@ -1,4 +1,4 @@
1
- import React__default from 'react';
1
+ import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
2
2
  import { DismissableBanner, EmptyState, LogViewer } from '@backstage/core-components';
3
3
  import Paper from '@material-ui/core/Paper';
4
4
  import Skeleton from '@material-ui/lab/Skeleton';
@@ -12,32 +12,37 @@ const PodLogs = ({
12
12
  containerScope,
13
13
  previous
14
14
  });
15
- return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, error && /* @__PURE__ */ React__default.createElement(
16
- DismissableBanner,
17
- {
18
- ...{
19
- message: error.message,
20
- variant: "error",
21
- fixed: false
22
- },
23
- id: "pod-logs"
24
- }
25
- ), /* @__PURE__ */ React__default.createElement(
26
- Paper,
27
- {
28
- elevation: 1,
29
- style: { height: "100%", width: "100%", minHeight: "55rem" }
30
- },
31
- loading && /* @__PURE__ */ React__default.createElement(Skeleton, { variant: "rect", width: "100%", height: "100%" }),
32
- !loading && value !== void 0 && (value.text === "" ? /* @__PURE__ */ React__default.createElement(
33
- EmptyState,
15
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
16
+ error && /* @__PURE__ */ jsx(
17
+ DismissableBanner,
34
18
  {
35
- missing: "data",
36
- title: "No logs emitted",
37
- description: "No logs were emitted by the container"
19
+ ...{
20
+ message: error.message,
21
+ variant: "error",
22
+ fixed: false
23
+ },
24
+ id: "pod-logs"
38
25
  }
39
- ) : /* @__PURE__ */ React__default.createElement(LogViewer, { text: value.text }))
40
- ));
26
+ ),
27
+ /* @__PURE__ */ jsxs(
28
+ Paper,
29
+ {
30
+ elevation: 1,
31
+ style: { height: "100%", width: "100%", minHeight: "55rem" },
32
+ children: [
33
+ loading && /* @__PURE__ */ jsx(Skeleton, { variant: "rect", width: "100%", height: "100%" }),
34
+ !loading && value !== void 0 && (value.text === "" ? /* @__PURE__ */ jsx(
35
+ EmptyState,
36
+ {
37
+ missing: "data",
38
+ title: "No logs emitted",
39
+ description: "No logs were emitted by the container"
40
+ }
41
+ ) : /* @__PURE__ */ jsx(LogViewer, { text: value.text }))
42
+ ]
43
+ }
44
+ )
45
+ ] });
41
46
  };
42
47
 
43
48
  export { PodLogs };
@@ -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 React 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: React.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":["React"],"mappings":";;;;;;AA2CO,MAAM,UAAkC,CAAC;AAAA,EAC9C,cAAA;AAAA,EACA;AACF,CAAoB,KAAA;AAClB,EAAA,MAAM,EAAE,KAAA,EAAO,KAAO,EAAA,OAAA,KAAY,UAAW,CAAA;AAAA,IAC3C,cAAA;AAAA,IACA;AAAA,GACD,CAAA;AAED,EAAA,mFAEK,KACC,oBAAAA,cAAA,CAAA,aAAA;AAAA,IAAC,iBAAA;AAAA,IAAA;AAAA,MACE,GAAG;AAAA,QACF,SAAS,KAAM,CAAA,OAAA;AAAA,QACf,OAAS,EAAA,OAAA;AAAA,QACT,KAAO,EAAA;AAAA,OACT;AAAA,MACA,EAAG,EAAA;AAAA;AAAA,GAGP,kBAAAA,cAAA,CAAA,aAAA;AAAA,IAAC,KAAA;AAAA,IAAA;AAAA,MACC,SAAW,EAAA,CAAA;AAAA,MACX,OAAO,EAAE,MAAA,EAAQ,QAAQ,KAAO,EAAA,MAAA,EAAQ,WAAW,OAAQ;AAAA,KAAA;AAAA,IAE1D,OAAA,iDAAY,QAAS,EAAA,EAAA,OAAA,EAAQ,QAAO,KAAM,EAAA,MAAA,EAAO,QAAO,MAAO,EAAA,CAAA;AAAA,IAC/D,CAAC,OACA,IAAA,KAAA,KAAU,KACT,CAAA,KAAA,KAAA,CAAM,SAAS,EACd,mBAAAA,cAAA,CAAA,aAAA;AAAA,MAAC,UAAA;AAAA,MAAA;AAAA,QACC,OAAQ,EAAA,MAAA;AAAA,QACR,KAAM,EAAA,iBAAA;AAAA,QACN,WAAY,EAAA;AAAA;AAAA,KAGd,mBAAAA,cAAA,CAAA,aAAA,CAAC,SAAU,EAAA,EAAA,IAAA,EAAM,MAAM,IAAM,EAAA,CAAA;AAAA,GAGrC,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';\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,CAAoB,KAAA;AAClB,EAAA,MAAM,EAAE,KAAA,EAAO,KAAO,EAAA,OAAA,KAAY,UAAW,CAAA;AAAA,IAC3C,cAAA;AAAA,IACA;AAAA,GACD,CAAA;AAED,EAAA,uBAEK,IAAA,CAAA,QAAA,EAAA,EAAA,QAAA,EAAA;AAAA,IACC,KAAA,oBAAA,GAAA;AAAA,MAAC,iBAAA;AAAA,MAAA;AAAA,QACE,GAAG;AAAA,UACF,SAAS,KAAM,CAAA,OAAA;AAAA,UACf,OAAS,EAAA,OAAA;AAAA,UACT,KAAO,EAAA;AAAA,SACT;AAAA,QACA,EAAG,EAAA;AAAA;AAAA,KACL;AAAA,oBAEF,IAAA;AAAA,MAAC,KAAA;AAAA,MAAA;AAAA,QACC,SAAW,EAAA,CAAA;AAAA,QACX,OAAO,EAAE,MAAA,EAAQ,QAAQ,KAAO,EAAA,MAAA,EAAQ,WAAW,OAAQ,EAAA;AAAA,QAE1D,QAAA,EAAA;AAAA,UAAA,OAAA,wBAAY,QAAS,EAAA,EAAA,OAAA,EAAQ,QAAO,KAAM,EAAA,MAAA,EAAO,QAAO,MAAO,EAAA,CAAA;AAAA,UAC/D,CAAC,OACA,IAAA,KAAA,KAAU,KACT,CAAA,KAAA,KAAA,CAAM,SAAS,EACd,mBAAA,GAAA;AAAA,YAAC,UAAA;AAAA,YAAA;AAAA,cACC,OAAQ,EAAA,MAAA;AAAA,cACR,KAAM,EAAA,iBAAA;AAAA,cACN,WAAY,EAAA;AAAA;AAAA,WAGd,mBAAA,GAAA,CAAC,SAAU,EAAA,EAAA,IAAA,EAAM,MAAM,IAAM,EAAA,CAAA;AAAA;AAAA;AAAA;AAEnC,GACF,EAAA,CAAA;AAEJ;;;;"}
@@ -1,19 +1,19 @@
1
- import React__default from 'react';
1
+ 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
5
 
6
6
  const PodLogsDialog = ({ containerScope }) => {
7
- return /* @__PURE__ */ React__default.createElement(
7
+ return /* @__PURE__ */ jsx(
8
8
  KubernetesDialog,
9
9
  {
10
10
  buttonAriaLabel: "get logs",
11
- buttonIcon: /* @__PURE__ */ React__default.createElement(SubjectIcon, null),
11
+ buttonIcon: /* @__PURE__ */ jsx(SubjectIcon, {}),
12
12
  buttonText: "Logs",
13
13
  disabled: false,
14
- title: `${containerScope.podName} - ${containerScope.containerName} logs on cluster ${containerScope.cluster.title || containerScope.cluster.name}`
15
- },
16
- /* @__PURE__ */ React__default.createElement(PodLogs, { containerScope })
14
+ title: `${containerScope.podName} - ${containerScope.containerName} logs on cluster ${containerScope.cluster.title || containerScope.cluster.name}`,
15
+ children: /* @__PURE__ */ jsx(PodLogs, { containerScope })
16
+ }
17
17
  );
18
18
  };
19
19
 
@@ -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 React from 'react';\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":["React"],"mappings":";;;;;AAqCO,MAAM,aAAgB,GAAA,CAAC,EAAE,cAAA,EAAyC,KAAA;AACvE,EACE,uBAAAA,cAAA,CAAA,aAAA;AAAA,IAAC,gBAAA;AAAA,IAAA;AAAA,MACC,eAAgB,EAAA,UAAA;AAAA,MAChB,UAAA,+CAAa,WAAY,EAAA,IAAA,CAAA;AAAA,MACzB,UAAW,EAAA,MAAA;AAAA,MACX,QAAU,EAAA,KAAA;AAAA,MACV,KAAO,EAAA,CAAA,EAAG,cAAe,CAAA,OAAO,CAC9B,GAAA,EAAA,cAAA,CAAe,aACjB,CAAA,iBAAA,EACE,cAAe,CAAA,OAAA,CAAQ,KAAS,IAAA,cAAA,CAAe,QAAQ,IACzD,CAAA;AAAA,KAAA;AAAA,oBAEAA,cAAA,CAAA,aAAA,CAAC,WAAQ,cAAgC,EAAA;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';\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,aAAgB,GAAA,CAAC,EAAE,cAAA,EAAyC,KAAA;AACvE,EACE,uBAAA,GAAA;AAAA,IAAC,gBAAA;AAAA,IAAA;AAAA,MACC,eAAgB,EAAA,UAAA;AAAA,MAChB,UAAA,sBAAa,WAAY,EAAA,EAAA,CAAA;AAAA,MACzB,UAAW,EAAA,MAAA;AAAA,MACX,QAAU,EAAA,KAAA;AAAA,MACV,KAAO,EAAA,CAAA,EAAG,cAAe,CAAA,OAAO,CAC9B,GAAA,EAAA,cAAA,CAAe,aACjB,CAAA,iBAAA,EACE,cAAe,CAAA,OAAA,CAAQ,KAAS,IAAA,cAAA,CAAe,QAAQ,IACzD,CAAA,CAAA;AAAA,MAEA,QAAA,kBAAA,GAAA,CAAC,WAAQ,cAAgC,EAAA;AAAA;AAAA,GAC3C;AAEJ;;;;"}
@@ -1,4 +1,5 @@
1
- import React__default, { useContext } from 'react';
1
+ import { jsx, Fragment } from 'react/jsx-runtime';
2
+ import { useContext } from 'react';
2
3
  import { PodDrawer } from './PodDrawer/PodDrawer.esm.js';
3
4
  import { Table } from '@backstage/core-components';
4
5
  import '@material-ui/core/Card';
@@ -53,7 +54,7 @@ const PodDrawerTrigger = ({ pod }) => {
53
54
  apiVersion: "v1",
54
55
  metadata: pod.metadata
55
56
  });
56
- return /* @__PURE__ */ React__default.createElement(
57
+ return /* @__PURE__ */ jsx(
57
58
  PodDrawer,
58
59
  {
59
60
  podAndErrors: {
@@ -67,16 +68,16 @@ const PodDrawerTrigger = ({ pod }) => {
67
68
  const Cpu = ({ clusterName, pod }) => {
68
69
  const metrics = usePodMetrics(clusterName, pod);
69
70
  if (!metrics) {
70
- return /* @__PURE__ */ React__default.createElement(Typography, null, "unknown");
71
+ return /* @__PURE__ */ jsx(Typography, { children: "unknown" });
71
72
  }
72
- return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, podStatusToCpuUtil(metrics));
73
+ return /* @__PURE__ */ jsx(Fragment, { children: podStatusToCpuUtil(metrics) });
73
74
  };
74
75
  const Memory = ({ clusterName, pod }) => {
75
76
  const metrics = usePodMetrics(clusterName, pod);
76
77
  if (!metrics) {
77
- return /* @__PURE__ */ React__default.createElement(Typography, null, "unknown");
78
+ return /* @__PURE__ */ jsx(Typography, { children: "unknown" });
78
79
  }
79
- return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, podStatusToMemoryUtil(metrics));
80
+ return /* @__PURE__ */ jsx(Fragment, { children: podStatusToMemoryUtil(metrics) });
80
81
  };
81
82
  const PodsTable = ({ pods, extraColumns = [] }) => {
82
83
  const cluster = useContext(ClusterContext);
@@ -90,7 +91,7 @@ const PodsTable = ({ pods, extraColumns = [] }) => {
90
91
  title: "name",
91
92
  highlight: true,
92
93
  render: (pod) => {
93
- return /* @__PURE__ */ React__default.createElement(PodDrawerTrigger, { pod });
94
+ return /* @__PURE__ */ jsx(PodDrawerTrigger, { pod });
94
95
  }
95
96
  },
96
97
  {
@@ -112,14 +113,14 @@ const PodsTable = ({ pods, extraColumns = [] }) => {
112
113
  {
113
114
  title: "CPU usage %",
114
115
  render: (pod) => {
115
- return /* @__PURE__ */ React__default.createElement(Cpu, { clusterName: cluster.name, pod });
116
+ return /* @__PURE__ */ jsx(Cpu, { clusterName: cluster.name, pod });
116
117
  },
117
118
  width: "auto"
118
119
  },
119
120
  {
120
121
  title: "Memory usage %",
121
122
  render: (pod) => {
122
- return /* @__PURE__ */ React__default.createElement(Memory, { clusterName: cluster.name, pod });
123
+ return /* @__PURE__ */ jsx(Memory, { clusterName: cluster.name, pod });
123
124
  },
124
125
  width: "auto"
125
126
  }
@@ -130,7 +131,7 @@ const PodsTable = ({ pods, extraColumns = [] }) => {
130
131
  minWidth: "0",
131
132
  width: "100%"
132
133
  };
133
- return /* @__PURE__ */ React__default.createElement("div", { style: tableStyle }, /* @__PURE__ */ React__default.createElement(
134
+ return /* @__PURE__ */ jsx("div", { style: tableStyle, children: /* @__PURE__ */ jsx(
134
135
  Table,
135
136
  {
136
137
  options: { paging: true, search: false, emptyRowsWhenPaging: false },
@@ -140,7 +141,7 @@ const PodsTable = ({ pods, extraColumns = [] }) => {
140
141
  })),
141
142
  columns
142
143
  }
143
- ));
144
+ ) });
144
145
  };
145
146
 
146
147
  export { PodsTable, READY_COLUMNS, RESOURCE_COLUMNS };
@@ -1 +1 @@
1
- {"version":3,"file":"PodsTable.esm.js","sources":["../../../src/components/Pods/PodsTable.tsx"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React, { useContext } from 'react';\nimport { PodDrawer } from './PodDrawer';\nimport {\n containersReady,\n containerStatuses,\n podStatusToCpuUtil,\n podStatusToMemoryUtil,\n totalRestarts,\n} from '../../utils/pod';\nimport { Table, TableColumn } from '@backstage/core-components';\nimport { ClusterContext } from '../../hooks/Cluster';\nimport { useMatchingErrors } from '../../hooks/useMatchingErrors';\nimport { Pod } from 'kubernetes-models/v1/Pod';\nimport { V1Pod } from '@kubernetes/client-node';\nimport { usePodMetrics } from '../../hooks/usePodMetrics';\nimport Typography from '@material-ui/core/Typography';\n\n/**\n *\n *\n * @public\n */\nexport const READY_COLUMNS: PodColumns = 'READY';\n\n/**\n *\n *\n * @public\n */\nexport const RESOURCE_COLUMNS: PodColumns = 'RESOURCE';\n\n/**\n *\n *\n * @public\n */\nexport type PodColumns = 'READY' | 'RESOURCE';\n\n/**\n *\n *\n * @public\n */\nexport type PodsTablesProps = {\n pods: Pod | V1Pod[];\n extraColumns?: PodColumns[];\n children?: React.ReactNode;\n};\n\nconst READY: TableColumn<Pod>[] = [\n {\n title: 'containers ready',\n align: 'center',\n render: containersReady,\n width: 'auto',\n },\n {\n title: 'total restarts',\n align: 'center',\n render: totalRestarts,\n type: 'numeric',\n width: 'auto',\n },\n];\n\nconst PodDrawerTrigger = ({ pod }: { pod: Pod }) => {\n const errors = useMatchingErrors({\n kind: 'Pod',\n apiVersion: 'v1',\n metadata: pod.metadata,\n });\n return (\n <PodDrawer\n podAndErrors={{\n pod: pod as any,\n cluster: useContext(ClusterContext),\n errors: errors,\n }}\n />\n );\n};\n\nconst Cpu = ({ clusterName, pod }: { clusterName: string; pod: Pod }) => {\n const metrics = usePodMetrics(clusterName, pod);\n\n if (!metrics) {\n return <Typography>unknown</Typography>;\n }\n\n return <>{podStatusToCpuUtil(metrics)}</>;\n};\n\nconst Memory = ({ clusterName, pod }: { clusterName: string; pod: Pod }) => {\n const metrics = usePodMetrics(clusterName, pod);\n\n if (!metrics) {\n return <Typography>unknown</Typography>;\n }\n\n return <>{podStatusToMemoryUtil(metrics)}</>;\n};\n\n/**\n *\n *\n * @public\n */\nexport const PodsTable = ({ pods, extraColumns = [] }: PodsTablesProps) => {\n const cluster = useContext(ClusterContext);\n const defaultColumns: TableColumn<Pod>[] = [\n {\n title: 'ID',\n field: 'metadata.uid',\n hidden: true,\n },\n {\n title: 'name',\n highlight: true,\n render: (pod: Pod) => {\n return <PodDrawerTrigger pod={pod} />;\n },\n },\n {\n title: 'phase',\n render: (pod: Pod) => pod.status?.phase ?? 'unknown',\n width: 'auto',\n },\n {\n title: 'status',\n render: containerStatuses,\n },\n ];\n const columns: TableColumn<Pod>[] = [...defaultColumns];\n\n if (extraColumns.includes(READY_COLUMNS)) {\n columns.push(...READY);\n }\n if (extraColumns.includes(RESOURCE_COLUMNS)) {\n const resourceColumns: TableColumn<Pod>[] = [\n {\n title: 'CPU usage %',\n render: (pod: Pod) => {\n return <Cpu clusterName={cluster.name} pod={pod} />;\n },\n width: 'auto',\n },\n {\n title: 'Memory usage %',\n render: (pod: Pod) => {\n return <Memory clusterName={cluster.name} pod={pod} />;\n },\n width: 'auto',\n },\n ];\n columns.push(...resourceColumns);\n }\n\n const tableStyle = {\n minWidth: '0',\n width: '100%',\n };\n\n return (\n <div style={tableStyle}>\n <Table\n options={{ paging: true, search: false, emptyRowsWhenPaging: false }}\n // It was observed that in some instances the pod drawer closes when new data (like CPU usage) is available and the table reloads.\n // Mapping the metadata UID to the tables ID fixes this problem.\n data={\n (pods as Pod[]).map((pod: Pod) => ({\n ...pod,\n id: pod?.metadata?.uid,\n })) as any as Pod[]\n }\n columns={columns}\n />\n </div>\n );\n};\n"],"names":["React"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsCO,MAAM,aAA4B,GAAA;AAOlC,MAAM,gBAA+B,GAAA;AAoB5C,MAAM,KAA4B,GAAA;AAAA,EAChC;AAAA,IACE,KAAO,EAAA,kBAAA;AAAA,IACP,KAAO,EAAA,QAAA;AAAA,IACP,MAAQ,EAAA,eAAA;AAAA,IACR,KAAO,EAAA;AAAA,GACT;AAAA,EACA;AAAA,IACE,KAAO,EAAA,gBAAA;AAAA,IACP,KAAO,EAAA,QAAA;AAAA,IACP,MAAQ,EAAA,aAAA;AAAA,IACR,IAAM,EAAA,SAAA;AAAA,IACN,KAAO,EAAA;AAAA;AAEX,CAAA;AAEA,MAAM,gBAAmB,GAAA,CAAC,EAAE,GAAA,EAAwB,KAAA;AAClD,EAAA,MAAM,SAAS,iBAAkB,CAAA;AAAA,IAC/B,IAAM,EAAA,KAAA;AAAA,IACN,UAAY,EAAA,IAAA;AAAA,IACZ,UAAU,GAAI,CAAA;AAAA,GACf,CAAA;AACD,EACE,uBAAAA,cAAA,CAAA,aAAA;AAAA,IAAC,SAAA;AAAA,IAAA;AAAA,MACC,YAAc,EAAA;AAAA,QACZ,GAAA;AAAA,QACA,OAAA,EAAS,WAAW,cAAc,CAAA;AAAA,QAClC;AAAA;AACF;AAAA,GACF;AAEJ,CAAA;AAEA,MAAM,GAAM,GAAA,CAAC,EAAE,WAAA,EAAa,KAA6C,KAAA;AACvE,EAAM,MAAA,OAAA,GAAU,aAAc,CAAA,WAAA,EAAa,GAAG,CAAA;AAE9C,EAAA,IAAI,CAAC,OAAS,EAAA;AACZ,IAAO,uBAAAA,cAAA,CAAA,aAAA,CAAC,kBAAW,SAAO,CAAA;AAAA;AA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AA;AAAA,MAEJ;AAAA;AAAA,GAEJ,CAAA;AAEJ;;;;"}
1
+ {"version":3,"file":"PodsTable.esm.js","sources":["../../../src/components/Pods/PodsTable.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 { PodDrawer } from './PodDrawer';\nimport {\n containersReady,\n containerStatuses,\n podStatusToCpuUtil,\n podStatusToMemoryUtil,\n totalRestarts,\n} from '../../utils/pod';\nimport { Table, TableColumn } from '@backstage/core-components';\nimport { ClusterContext } from '../../hooks/Cluster';\nimport { useMatchingErrors } from '../../hooks/useMatchingErrors';\nimport { Pod } from 'kubernetes-models/v1/Pod';\nimport { V1Pod } from '@kubernetes/client-node';\nimport { usePodMetrics } from '../../hooks/usePodMetrics';\nimport Typography from '@material-ui/core/Typography';\n\n/**\n *\n *\n * @public\n */\nexport const READY_COLUMNS: PodColumns = 'READY';\n\n/**\n *\n *\n * @public\n */\nexport const RESOURCE_COLUMNS: PodColumns = 'RESOURCE';\n\n/**\n *\n *\n * @public\n */\nexport type PodColumns = 'READY' | 'RESOURCE';\n\n/**\n *\n *\n * @public\n */\nexport type PodsTablesProps = {\n pods: Pod | V1Pod[];\n extraColumns?: PodColumns[];\n children?: ReactNode;\n};\n\nconst READY: TableColumn<Pod>[] = [\n {\n title: 'containers ready',\n align: 'center',\n render: containersReady,\n width: 'auto',\n },\n {\n title: 'total restarts',\n align: 'center',\n render: totalRestarts,\n type: 'numeric',\n width: 'auto',\n },\n];\n\nconst PodDrawerTrigger = ({ pod }: { pod: Pod }) => {\n const errors = useMatchingErrors({\n kind: 'Pod',\n apiVersion: 'v1',\n metadata: pod.metadata,\n });\n return (\n <PodDrawer\n podAndErrors={{\n pod: pod as any,\n cluster: useContext(ClusterContext),\n errors: errors,\n }}\n />\n );\n};\n\nconst Cpu = ({ clusterName, pod }: { clusterName: string; pod: Pod }) => {\n const metrics = usePodMetrics(clusterName, pod);\n\n if (!metrics) {\n return <Typography>unknown</Typography>;\n }\n\n return <>{podStatusToCpuUtil(metrics)}</>;\n};\n\nconst Memory = ({ clusterName, pod }: { clusterName: string; pod: Pod }) => {\n const metrics = usePodMetrics(clusterName, pod);\n\n if (!metrics) {\n return <Typography>unknown</Typography>;\n }\n\n return <>{podStatusToMemoryUtil(metrics)}</>;\n};\n\n/**\n *\n *\n * @public\n */\nexport const PodsTable = ({ pods, extraColumns = [] }: PodsTablesProps) => {\n const cluster = useContext(ClusterContext);\n const defaultColumns: TableColumn<Pod>[] = [\n {\n title: 'ID',\n field: 'metadata.uid',\n hidden: true,\n },\n {\n title: 'name',\n highlight: true,\n render: (pod: Pod) => {\n return <PodDrawerTrigger pod={pod} />;\n },\n },\n {\n title: 'phase',\n render: (pod: Pod) => pod.status?.phase ?? 'unknown',\n width: 'auto',\n },\n {\n title: 'status',\n render: containerStatuses,\n },\n ];\n const columns: TableColumn<Pod>[] = [...defaultColumns];\n\n if (extraColumns.includes(READY_COLUMNS)) {\n columns.push(...READY);\n }\n if (extraColumns.includes(RESOURCE_COLUMNS)) {\n const resourceColumns: TableColumn<Pod>[] = [\n {\n title: 'CPU usage %',\n render: (pod: Pod) => {\n return <Cpu clusterName={cluster.name} pod={pod} />;\n },\n width: 'auto',\n },\n {\n title: 'Memory usage %',\n render: (pod: Pod) => {\n return <Memory clusterName={cluster.name} pod={pod} />;\n },\n width: 'auto',\n },\n ];\n columns.push(...resourceColumns);\n }\n\n const tableStyle = {\n minWidth: '0',\n width: '100%',\n };\n\n return (\n <div style={tableStyle}>\n <Table\n options={{ paging: true, search: false, emptyRowsWhenPaging: false }}\n // It was observed that in some instances the pod drawer closes when new data (like CPU usage) is available and the table reloads.\n // Mapping the metadata UID to the tables ID fixes this problem.\n data={\n (pods as Pod[]).map((pod: Pod) => ({\n ...pod,\n id: pod?.metadata?.uid,\n })) as any as Pod[]\n }\n columns={columns}\n />\n </div>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsCO,MAAM,aAA4B,GAAA;AAOlC,MAAM,gBAA+B,GAAA;AAoB5C,MAAM,KAA4B,GAAA;AAAA,EAChC;AAAA,IACE,KAAO,EAAA,kBAAA;AAAA,IACP,KAAO,EAAA,QAAA;AAAA,IACP,MAAQ,EAAA,eAAA;AAAA,IACR,KAAO,EAAA;AAAA,GACT;AAAA,EACA;AAAA,IACE,KAAO,EAAA,gBAAA;AAAA,IACP,KAAO,EAAA,QAAA;AAAA,IACP,MAAQ,EAAA,aAAA;AAAA,IACR,IAAM,EAAA,SAAA;AAAA,IACN,KAAO,EAAA;AAAA;AAEX,CAAA;AAEA,MAAM,gBAAmB,GAAA,CAAC,EAAE,GAAA,EAAwB,KAAA;AAClD,EAAA,MAAM,SAAS,iBAAkB,CAAA;AAAA,IAC/B,IAAM,EAAA,KAAA;AAAA,IACN,UAAY,EAAA,IAAA;AAAA,IACZ,UAAU,GAAI,CAAA;AAAA,GACf,CAAA;AACD,EACE,uBAAA,GAAA;AAAA,IAAC,SAAA;AAAA,IAAA;AAAA,MACC,YAAc,EAAA;AAAA,QACZ,GAAA;AAAA,QACA,OAAA,EAAS,WAAW,cAAc,CAAA;AAAA,QAClC;AAAA;AACF;AAAA,GACF;AAEJ,CAAA;AAEA,MAAM,GAAM,GAAA,CAAC,EAAE,WAAA,EAAa,KAA6C,KAAA;AACvE,EAAM,MAAA,OAAA,GAAU,aAAc,CAAA,WAAA,EAAa,GAAG,CAAA;AAE9C,EAAA,IAAI,CAAC,OAAS,EAAA;AACZ,IAAO,uBAAA,GAAA,CAAC,cAAW,Q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A;AAEJ;;;;"}
@@ -1,6 +1,6 @@
1
+ import { jsxs, jsx } from 'react/jsx-runtime';
1
2
  import Grid from '@material-ui/core/Grid';
2
3
  import Typography from '@material-ui/core/Typography';
3
- import React__default from 'react';
4
4
  import { LinearGauge } from '@backstage/core-components';
5
5
  import { currentToDeclaredResourceToPerc } from '../../utils/resources.esm.js';
6
6
 
@@ -30,20 +30,29 @@ const ResourceUtilization = ({
30
30
  totalFormatted
31
31
  }) => {
32
32
  const utilization = currentToDeclaredResourceToPerc(usage, total);
33
- return /* @__PURE__ */ React__default.createElement(Grid, { container: true, spacing: 0 }, /* @__PURE__ */ React__default.createElement(Grid, { item: true, xs: 12 }, /* @__PURE__ */ React__default.createElement(
34
- Typography,
35
- {
36
- variant: compressed ? "caption" : "subtitle2"
37
- },
38
- `${title}: ${totalFormatted}`
39
- )), /* @__PURE__ */ React__default.createElement(Grid, { item: true, xs: 12 }, /* @__PURE__ */ React__default.createElement(
40
- LinearGauge,
41
- {
42
- getColor: getProgressColor,
43
- width: compressed ? "thin" : "thick",
44
- value: utilization / 100
45
- }
46
- ), !compressed && /* @__PURE__ */ React__default.createElement(Typography, { variant: "caption" }, "usage: ", `${utilization}%`)));
33
+ return /* @__PURE__ */ jsxs(Grid, { container: true, spacing: 0, children: [
34
+ /* @__PURE__ */ jsx(Grid, { item: true, xs: 12, children: /* @__PURE__ */ jsx(
35
+ Typography,
36
+ {
37
+ variant: compressed ? "caption" : "subtitle2",
38
+ children: `${title}: ${totalFormatted}`
39
+ }
40
+ ) }),
41
+ /* @__PURE__ */ jsxs(Grid, { item: true, xs: 12, children: [
42
+ /* @__PURE__ */ jsx(
43
+ LinearGauge,
44
+ {
45
+ getColor: getProgressColor,
46
+ width: compressed ? "thin" : "thick",
47
+ value: utilization / 100
48
+ }
49
+ ),
50
+ !compressed && /* @__PURE__ */ jsxs(Typography, { variant: "caption", children: [
51
+ "usage: ",
52
+ `${utilization}%`
53
+ ] })
54
+ ] })
55
+ ] });
47
56
  };
48
57
 
49
58
  export { ResourceUtilization };
@@ -1 +1 @@
1
- {"version":3,"file":"ResourceUtilization.esm.js","sources":["../../../src/components/ResourceUtilization/ResourceUtilization.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 Grid from '@material-ui/core/Grid';\nimport Typography from '@material-ui/core/Typography';\n\nimport React from 'react';\nimport { GaugePropsGetColor, LinearGauge } from '@backstage/core-components';\nimport { currentToDeclaredResourceToPerc } from '../../utils/resources';\n\n/**\n * Context for Pod Metrics\n *\n * @public\n */\nexport interface ResourceUtilizationProps {\n compressed?: boolean;\n title: string;\n usage: number | string;\n total: number | string;\n totalFormatted: string;\n}\n\nconst getProgressColor: GaugePropsGetColor = ({\n palette,\n value,\n inverse,\n max,\n}) => {\n if (isNaN(value)) {\n return palette.status.pending;\n }\n const actualMax = max ? max : 100;\n const actualValue = inverse ? actualMax - value : value;\n\n if (actualValue >= actualMax) {\n return palette.status.error;\n } else if (actualValue > 90 || actualValue < 40) {\n return palette.status.warning;\n }\n\n return palette.status.ok;\n};\n\n/**\n * Context for Pod Metrics\n *\n * @public\n */\nexport const ResourceUtilization = ({\n compressed = false,\n title,\n usage,\n total,\n totalFormatted,\n}: ResourceUtilizationProps) => {\n const utilization = currentToDeclaredResourceToPerc(usage, total);\n return (\n <Grid container spacing={0}>\n <Grid item xs={12}>\n <Typography\n variant={compressed ? 'caption' : 'subtitle2'}\n >{`${title}: ${totalFormatted}`}</Typography>\n </Grid>\n <Grid item xs={12}>\n <LinearGauge\n getColor={getProgressColor}\n width={compressed ? 'thin' : 'thick'}\n value={utilization / 100}\n />\n {!compressed && (\n <Typography variant=\"caption\">usage: {`${utilization}%`}</Typography>\n )}\n </Grid>\n </Grid>\n );\n};\n"],"names":["React"],"mappings":";;;;;;AAmCA,MAAM,mBAAuC,CAAC;AAAA,EAC5C,OAAA;AAAA,EACA,KAAA;AAAA,EACA,OAAA;AAAA,EACA;AACF,CAAM,KAAA;AACJ,EAAI,IAAA,KAAA,CAAM,KAAK,CAAG,EAAA;AAChB,IAAA,OAAO,QAAQ,MAAO,CAAA,OAAA;AAAA;AAExB,EAAM,MAAA,SAAA,GAAY,MAAM,GAAM,GAAA,GAAA;AAC9B,EAAM,MAAA,WAAA,GAAc,OAAU,GAAA,SAAA,GAAY,KAAQ,GAAA,KAAA;AAElD,EAAA,IAAI,eAAe,SAAW,EAAA;AAC5B,IAAA,OAAO,QAAQ,MAAO,CAAA,KAAA;AAAA,GACb,MAAA,IAAA,WAAA,GAAc,EAAM,IAAA,WAAA,GAAc,EAAI,EAAA;AAC/C,IAAA,OAAO,QAAQ,MAAO,CAAA,OAAA;AAAA;AAGxB,EAAA,OAAO,QAAQ,MAAO,CAAA,EAAA;AACxB,CAAA;AAOO,MAAM,sBAAsB,CAAC;AAAA,EAClC,UAAa,GAAA,KAAA;AAAA,EACb,KAAA;AAAA,EACA,KAAA;AAAA,EACA,KAAA;AAAA,EACA;AACF,CAAgC,KAAA;AAC9B,EAAM,MAAA,WAAA,GAAc,+BAAgC,CAAA,KAAA,EAAO,KAAK,CAAA;AAChE,EACE,uBAAAA,cAAA,CAAA,aAAA,CAAC,IAAK,EAAA,EAAA,SAAA,EAAS,IAAC,EAAA,OAAA,EAAS,CACvB,EAAA,kBAAAA,cAAA,CAAA,aAAA,CAAC,IAAK,EAAA,EAAA,IAAA,EAAI,IAAC,EAAA,EAAA,EAAI,EACb,EAAA,kBAAAA,cAAA,CAAA,aAAA;AAAA,IAAC,UAAA;AAAA,IAAA;AAAA,MACC,OAAA,EAAS,aAAa,SAAY,GAAA;AAAA,KAAA;AAAA,IAClC,CAAA,EAAG,KAAK,CAAA,EAAA,EAAK,cAAc,CAAA;AAAA,GAC/B,CACA,kBAAAA,cAAA,CAAA,aAAA,CAAC,QAAK,IAAI,EAAA,IAAA,EAAC,IAAI,EACb,EAAA,kBAAAA,cAAA,CAAA,aAAA;AAAA,IAAC,WAAA;AAAA,IAAA;AAAA,MACC,QAAU,EAAA,gBAAA;AAAA,MACV,KAAA,EAAO,aAAa,MAAS,GAAA,OAAA;AAAA,MAC7B,OAAO,WAAc,GAAA;AAAA;AAAA,GAEtB,EAAA,CAAC,UACA,oBAAAA,cAAA,CAAA,aAAA,CAAC,UAAW,EAAA,EAAA,OAAA,EAAQ,SAAU,EAAA,EAAA,SAAA,EAAQ,CAAG,EAAA,WAAW,CAAI,CAAA,CAAA,CAE5D,CACF,CAAA;AAEJ;;;;"}
1
+ {"version":3,"file":"ResourceUtilization.esm.js","sources":["../../../src/components/ResourceUtilization/ResourceUtilization.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 Grid from '@material-ui/core/Grid';\nimport Typography from '@material-ui/core/Typography';\n\nimport { GaugePropsGetColor, LinearGauge } from '@backstage/core-components';\nimport { currentToDeclaredResourceToPerc } from '../../utils/resources';\n\n/**\n * Context for Pod Metrics\n *\n * @public\n */\nexport interface ResourceUtilizationProps {\n compressed?: boolean;\n title: string;\n usage: number | string;\n total: number | string;\n totalFormatted: string;\n}\n\nconst getProgressColor: GaugePropsGetColor = ({\n palette,\n value,\n inverse,\n max,\n}) => {\n if (isNaN(value)) {\n return palette.status.pending;\n }\n const actualMax = max ? max : 100;\n const actualValue = inverse ? actualMax - value : value;\n\n if (actualValue >= actualMax) {\n return palette.status.error;\n } else if (actualValue > 90 || actualValue < 40) {\n return palette.status.warning;\n }\n\n return palette.status.ok;\n};\n\n/**\n * Context for Pod Metrics\n *\n * @public\n */\nexport const ResourceUtilization = ({\n compressed = false,\n title,\n usage,\n total,\n totalFormatted,\n}: ResourceUtilizationProps) => {\n const utilization = currentToDeclaredResourceToPerc(usage, total);\n return (\n <Grid container spacing={0}>\n <Grid item xs={12}>\n <Typography\n variant={compressed ? 'caption' : 'subtitle2'}\n >{`${title}: ${totalFormatted}`}</Typography>\n </Grid>\n <Grid item xs={12}>\n <LinearGauge\n getColor={getProgressColor}\n width={compressed ? 'thin' : 'thick'}\n value={utilization / 100}\n />\n {!compressed && (\n <Typography variant=\"caption\">usage: {`${utilization}%`}</Typography>\n )}\n </Grid>\n </Grid>\n );\n};\n"],"names":[],"mappings":";;;;;;AAkCA,MAAM,mBAAuC,CAAC;AAAA,EAC5C,OAAA;AAAA,EACA,KAAA;AAAA,EACA,OAAA;AAAA,EACA;AACF,CAAM,KAAA;AACJ,EAAI,IAAA,KAAA,CAAM,KAAK,CAAG,EAAA;AAChB,IAAA,OAAO,QAAQ,MAAO,CAAA,OAAA;AAAA;AAExB,EAAM,MAAA,SAAA,GAAY,MAAM,GAAM,GAAA,GAAA;AAC9B,EAAM,MAAA,WAAA,GAAc,OAAU,GAAA,SAAA,GAAY,KAAQ,GAAA,KAAA;AAElD,EAAA,IAAI,eAAe,SAAW,EAAA;AAC5B,IAAA,OAAO,QAAQ,MAAO,CAAA,KAAA;AAAA,GACb,MAAA,IAAA,WAAA,GAAc,EAAM,IAAA,WAAA,GAAc,EAAI,EAAA;AAC/C,IAAA,OAAO,QAAQ,MAAO,CAAA,OAAA;AAAA;AAGxB,EAAA,OAAO,QAAQ,MAAO,CAAA,EAAA;AACxB,CAAA;AAOO,MAAM,sBAAsB,CAAC;AAAA,EAClC,UAAa,GAAA,KAAA;AAAA,EACb,KAAA;AAAA,EACA,KAAA;AAAA,EACA,KAAA;AAAA,EACA;AACF,CAAgC,KAAA;AAC9B,EAAM,MAAA,WAAA,GAAc,+BAAgC,CAAA,KAAA,EAAO,KAAK,CAAA;AAChE,EAAA,uBACG,IAAA,CAAA,IAAA,EAAA,EAAK,SAAS,EAAA,IAAA,EAAC,SAAS,CACvB,EAAA,QAAA,EAAA;AAAA,oBAAA,GAAA,CAAC,IAAK,EAAA,EAAA,IAAA,EAAI,IAAC,EAAA,EAAA,EAAI,EACb,EAAA,QAAA,kBAAA,GAAA;AAAA,MAAC,UAAA;AAAA,MAAA;AAAA,QACC,OAAA,EAAS,aAAa,SAAY,GAAA,WAAA;AAAA,QAClC,QAAA,EAAA,CAAA,EAAG,KAAK,CAAA,EAAA,EAAK,cAAc,CAAA;AAAA;AAAA,KAC/B,EAAA,CAAA;AAAA,oBACC,IAAA,CAAA,IAAA,EAAA,EAAK,IAAI,EAAA,IAAA,EAAC,IAAI,EACb,EAAA,QAAA,EAAA;AAAA,sBAAA,GAAA;AAAA,QAAC,WAAA;AAAA,QAAA;AAAA,UACC,QAAU,EAAA,gBAAA;AAAA,UACV,KAAA,EAAO,aAAa,MAAS,GAAA,OAAA;AAAA,UAC7B,OAAO,WAAc,GAAA;AAAA;AAAA,OACvB;AAAA,MACC,CAAC,UAAA,oBACC,IAAA,CAAA,UAAA,EAAA,EAAW,SAAQ,SAAU,EAAA,QAAA,EAAA;AAAA,QAAA,SAAA;AAAA,QAAQ,GAAG,WAAW,CAAA,CAAA;AAAA,OAAI,EAAA;AAAA,KAE5D,EAAA;AAAA,GACF,EAAA,CAAA;AAEJ;;;;"}
@@ -1,10 +1,11 @@
1
- import React__default from 'react';
1
+ import { jsx, jsxs } from 'react/jsx-runtime';
2
2
  import { KubernetesStructuredMetadataTableDrawer } from '../KubernetesDrawer/KubernetesStructuredMetadataTableDrawer.esm.js';
3
3
  import '../KubernetesDrawer/KubernetesDrawer.esm.js';
4
4
  import '@backstage/core-components';
5
5
  import '@material-ui/core/FormControlLabel';
6
6
  import '@material-ui/core/Switch';
7
7
  import 'js-yaml';
8
+ import 'react';
8
9
  import Typography from '@material-ui/core/Typography';
9
10
  import Grid from '@material-ui/core/Grid';
10
11
  import Chip from '@material-ui/core/Chip';
@@ -14,7 +15,7 @@ const ServiceDrawer = ({
14
15
  expanded
15
16
  }) => {
16
17
  const namespace = service.metadata?.namespace;
17
- return /* @__PURE__ */ React__default.createElement(
18
+ return /* @__PURE__ */ jsx(
18
19
  KubernetesStructuredMetadataTableDrawer,
19
20
  {
20
21
  object: service,
@@ -22,21 +23,23 @@ const ServiceDrawer = ({
22
23
  kind: "Service",
23
24
  renderObject: (serviceObject) => {
24
25
  return serviceObject.spec || {};
25
- }
26
- },
27
- /* @__PURE__ */ React__default.createElement(
28
- Grid,
29
- {
30
- container: true,
31
- direction: "column",
32
- justifyContent: "flex-start",
33
- alignItems: "flex-start",
34
- spacing: 0
35
26
  },
36
- /* @__PURE__ */ React__default.createElement(Grid, { item: true }, /* @__PURE__ */ React__default.createElement(Typography, { variant: "body1" }, service.metadata?.name ?? "unknown object")),
37
- /* @__PURE__ */ React__default.createElement(Grid, { item: true }, /* @__PURE__ */ React__default.createElement(Typography, { color: "textSecondary", variant: "subtitle1" }, "Service")),
38
- namespace && /* @__PURE__ */ React__default.createElement(Grid, { item: true }, /* @__PURE__ */ React__default.createElement(Chip, { size: "small", label: `namespace: ${namespace}` }))
39
- )
27
+ children: /* @__PURE__ */ jsxs(
28
+ Grid,
29
+ {
30
+ container: true,
31
+ direction: "column",
32
+ justifyContent: "flex-start",
33
+ alignItems: "flex-start",
34
+ spacing: 0,
35
+ children: [
36
+ /* @__PURE__ */ jsx(Grid, { item: true, children: /* @__PURE__ */ jsx(Typography, { variant: "body1", children: service.metadata?.name ?? "unknown object" }) }),
37
+ /* @__PURE__ */ jsx(Grid, { item: true, children: /* @__PURE__ */ jsx(Typography, { color: "textSecondary", variant: "subtitle1", children: "Service" }) }),
38
+ namespace && /* @__PURE__ */ jsx(Grid, { item: true, children: /* @__PURE__ */ jsx(Chip, { size: "small", label: `namespace: ${namespace}` }) })
39
+ ]
40
+ }
41
+ )
42
+ }
40
43
  );
41
44
  };
42
45
 
@@ -1 +1 @@
1
- {"version":3,"file":"ServiceDrawer.esm.js","sources":["../../../src/components/ServicesAccordions/ServiceDrawer.tsx"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React from 'react';\nimport { V1Service } 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 ServiceDrawer = ({\n service,\n expanded,\n}: {\n service: V1Service;\n expanded?: boolean;\n}) => {\n const namespace = service.metadata?.namespace;\n return (\n <KubernetesStructuredMetadataTableDrawer\n object={service}\n expanded={expanded}\n kind=\"Service\"\n renderObject={(serviceObject: V1Service) => {\n return serviceObject.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 {service.metadata?.name ?? 'unknown object'}\n </Typography>\n </Grid>\n <Grid item>\n <Typography color=\"textSecondary\" variant=\"subtitle1\">\n Service\n </Typography>\n </Grid>\n {namespace && (\n <Grid item>\n <Chip size=\"small\" label={`namespace: ${namespace}`} />\n </Grid>\n )}\n </Grid>\n </KubernetesStructuredMetadataTable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AO,CAAc,WAAA,EAAA,SAAS,IAAI,CACvD;AAAA;AAEJ,GACF;AAEJ;;;;"}
1
+ {"version":3,"file":"ServiceDrawer.esm.js","sources":["../../../src/components/ServicesAccordions/ServiceDrawer.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 { V1Service } 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 ServiceDrawer = ({\n service,\n expanded,\n}: {\n service: V1Service;\n expanded?: boolean;\n}) => {\n const namespace = service.metadata?.namespace;\n return (\n <KubernetesStructuredMetadataTableDrawer\n object={service}\n expanded={expanded}\n kind=\"Service\"\n renderObject={(serviceObject: V1Service) => {\n return serviceObject.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 {service.metadata?.name ?? 'unknown object'}\n </Typography>\n </Grid>\n <Grid item>\n <Typography color=\"textSecondary\" variant=\"subtitle1\">\n Service\n </Typography>\n </Grid>\n {namespace && (\n <Grid item>\n <Chip size=\"small\" label={`namespace: ${namespace}`} />\n </Grid>\n )}\n </Grid>\n </KubernetesStructuredMetadataTableDrawer>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;AAsBO,MAAM,gBAAgB,CAAC;AAAA,EAC5B,OAAA;AAAA,EACA;AACF,CAGM,KAAA;AACJ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xs } from 'react/jsx-runtime';
2
+ import { useContext } from 'react';
2
3
  import Accordion from '@material-ui/core/Accordion';
3
4
  import AccordionDetails from '@material-ui/core/AccordionDetails';
4
5
  import AccordionSummary from '@material-ui/core/AccordionSummary';
@@ -21,17 +22,22 @@ import '../../hooks/useMatchingErrors.esm.js';
21
22
  import { StructuredMetadataTable } from '@backstage/core-components';
22
23
 
23
24
  const ServiceSummary = ({ service }) => {
24
- return /* @__PURE__ */ React__default.createElement(
25
+ return /* @__PURE__ */ jsxs(
25
26
  Grid,
26
27
  {
27
28
  container: true,
28
29
  direction: "row",
29
30
  justifyContent: "space-between",
30
31
  alignItems: "center",
31
- spacing: 0
32
- },
33
- /* @__PURE__ */ React__default.createElement(Grid, { xs: 8, item: true }, /* @__PURE__ */ React__default.createElement(ServiceDrawer, { service })),
34
- /* @__PURE__ */ React__default.createElement(Grid, { item: true }, /* @__PURE__ */ React__default.createElement(Typography, { variant: "subtitle2" }, "Type: ", service.spec?.type ?? "?"))
32
+ spacing: 0,
33
+ children: [
34
+ /* @__PURE__ */ jsx(Grid, { xs: 8, item: true, children: /* @__PURE__ */ jsx(ServiceDrawer, { service }) }),
35
+ /* @__PURE__ */ jsx(Grid, { item: true, children: /* @__PURE__ */ jsxs(Typography, { variant: "subtitle2", children: [
36
+ "Type: ",
37
+ service.spec?.type ?? "?"
38
+ ] }) })
39
+ ]
40
+ }
35
41
  );
36
42
  };
37
43
  const ServiceCard = ({ service }) => {
@@ -45,7 +51,7 @@ const ServiceCard = ({ service }) => {
45
51
  if (service.spec?.type === "ExternalName") {
46
52
  metadata.externalName = service.spec.externalName;
47
53
  }
48
- return /* @__PURE__ */ React__default.createElement(
54
+ return /* @__PURE__ */ jsx(
49
55
  StructuredMetadataTable,
50
56
  {
51
57
  metadata: {
@@ -58,19 +64,22 @@ const ServiceCard = ({ service }) => {
58
64
  );
59
65
  };
60
66
  const ServiceAccordion = ({ service }) => {
61
- return /* @__PURE__ */ React__default.createElement(Accordion, { TransitionProps: { unmountOnExit: true }, variant: "outlined" }, /* @__PURE__ */ React__default.createElement(AccordionSummary, { expandIcon: /* @__PURE__ */ React__default.createElement(ExpandMoreIcon, null) }, /* @__PURE__ */ React__default.createElement(ServiceSummary, { service })), /* @__PURE__ */ React__default.createElement(AccordionDetails, null, /* @__PURE__ */ React__default.createElement(ServiceCard, { service })));
67
+ return /* @__PURE__ */ jsxs(Accordion, { TransitionProps: { unmountOnExit: true }, variant: "outlined", children: [
68
+ /* @__PURE__ */ jsx(AccordionSummary, { expandIcon: /* @__PURE__ */ jsx(ExpandMoreIcon, {}), children: /* @__PURE__ */ jsx(ServiceSummary, { service }) }),
69
+ /* @__PURE__ */ jsx(AccordionDetails, { children: /* @__PURE__ */ jsx(ServiceCard, { service }) })
70
+ ] });
62
71
  };
63
72
  const ServicesAccordions = ({}) => {
64
73
  const groupedResponses = useContext(GroupedResponsesContext);
65
- return /* @__PURE__ */ React__default.createElement(
74
+ return /* @__PURE__ */ jsx(
66
75
  Grid,
67
76
  {
68
77
  container: true,
69
78
  direction: "row",
70
79
  justifyContent: "flex-start",
71
- alignItems: "flex-start"
72
- },
73
- groupedResponses.services.map((service, i) => /* @__PURE__ */ React__default.createElement(Grid, { item: true, key: i, xs: true }, /* @__PURE__ */ React__default.createElement(ServiceAccordion, { service })))
80
+ alignItems: "flex-start",
81
+ children: groupedResponses.services.map((service, i) => /* @__PURE__ */ jsx(Grid, { item: true, xs: true, children: /* @__PURE__ */ jsx(ServiceAccordion, { service }) }, i))
82
+ }
74
83
  );
75
84
  };
76
85
 
@@ -1 +1 @@
1
- {"version":3,"file":"ServicesAccordions.esm.js","sources":["../../../src/components/ServicesAccordions/ServicesAccordions.tsx"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React, { useContext } from 'react';\nimport Accordion from '@material-ui/core/Accordion';\nimport AccordionDetails from '@material-ui/core/AccordionDetails';\nimport AccordionSummary from '@material-ui/core/AccordionSummary';\nimport Grid from '@material-ui/core/Grid';\nimport Typography from '@material-ui/core/Typography';\nimport ExpandMoreIcon from '@material-ui/icons/ExpandMore';\nimport { V1Service } from '@kubernetes/client-node';\nimport { ServiceDrawer } from './ServiceDrawer';\nimport { GroupedResponsesContext } from '../../hooks';\nimport { StructuredMetadataTable } from '@backstage/core-components';\n\ntype ServiceSummaryProps = {\n service: V1Service;\n};\n\nconst ServiceSummary = ({ service }: ServiceSummaryProps) => {\n return (\n <Grid\n container\n direction=\"row\"\n justifyContent=\"space-between\"\n alignItems=\"center\"\n spacing={0}\n >\n <Grid xs={8} item>\n <ServiceDrawer service={service} />\n </Grid>\n\n <Grid item>\n <Typography variant=\"subtitle2\">\n Type: {service.spec?.type ?? '?'}\n </Typography>\n </Grid>\n </Grid>\n );\n};\n\ntype ServiceCardProps = {\n service: V1Service;\n};\n\nconst ServiceCard = ({ service }: ServiceCardProps) => {\n const metadata: any = {};\n\n if (service.status?.loadBalancer?.ingress?.length ?? -1 > 0) {\n metadata.loadbalancer = service.status?.loadBalancer;\n }\n\n if (service.spec?.type === 'ClusterIP') {\n metadata.clusterIP = service.spec.clusterIP;\n }\n if (service.spec?.type === 'ExternalName') {\n metadata.externalName = service.spec.externalName;\n }\n\n return (\n <StructuredMetadataTable\n metadata={{\n type: service.spec?.type,\n ports: service.spec?.ports,\n ...metadata,\n }}\n options={{ nestedValuesAsYaml: true }}\n />\n );\n};\n\n/**\n *\n *\n * @public\n */\nexport type ServicesAccordionsProps = {};\n\ntype ServiceAccordionProps = {\n service: V1Service;\n};\n\nconst ServiceAccordion = ({ service }: ServiceAccordionProps) => {\n return (\n <Accordion TransitionProps={{ unmountOnExit: true }} variant=\"outlined\">\n <AccordionSummary expandIcon={<ExpandMoreIcon />}>\n <ServiceSummary service={service} />\n </AccordionSummary>\n <AccordionDetails>\n <ServiceCard service={service} />\n </AccordionDetails>\n </Accordion>\n );\n};\n\n/**\n *\n *\n * @public\n */\nexport const ServicesAccordions = ({}: ServicesAccordionsProps) => {\n const groupedResponses = useContext(GroupedResponsesContext);\n return (\n <Grid\n container\n direction=\"row\"\n justifyContent=\"flex-start\"\n alignItems=\"flex-start\"\n >\n {groupedResponses.services.map((service, i) => (\n <Grid item key={i} xs>\n <ServiceAccordion service={service} />\n </Grid>\n ))}\n </Grid>\n );\n};\n"],"names":["React"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAgCA,MAAM,cAAiB,GAAA,CAAC,EAAE,OAAA,EAAmC,KAAA;AAC3D,EACE,uBAAAA,cAAA,CAAA,aAAA;AAAA,IAAC,IAAA;AAAA,IAAA;AAAA,MACC,SAAS,EAAA,IAAA;AAAA,MACT,SAAU,EAAA,KAAA;AAAA,MACV,cAAe,EAAA,eAAA;AAAA,MACf,UAAW,EAAA,QAAA;AAAA,MACX,OAAS,EAAA;AAAA,KAAA;AAAA,oBAETA,cAAA,CAAA,aAAA,CAAC,QAAK,EAAI,EAAA,CAAA,EAAG,MAAI,IACf,EAAA,kBAAAA,cAAA,CAAA,aAAA,CAAC,aAAc,EAAA,EAAA,OAAA,EAAkB,CACnC,CAAA;AAAA,oBAECA,cAAA,CAAA,aAAA,CAAA,IAAA,EAAA,EAAK,IAAI,EAAA,IAAA,EAAA,kBACPA,cAAA,CAAA,aAAA,CAAA,UAAA,EAAA,EAAW,OAAQ,EAAA,WAAA,EAAA,EAAY,QACvB,EAAA,OAAA,CAAQ,IAAM,EAAA,IAAA,IAAQ,GAC/B,CACF;AAAA,GACF;AAEJ,CAAA;AAMA,MAAM,WAAc,GAAA,CAAC,EAAE,OAAA,EAAgC,KAAA;AACrD,EAAA,MAAM,W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OAAkB,EAAA,CACjC,CACF,CAAA;AAEJ,CAAA;AAOa,MAAA,kBAAA,GAAqB,CAAC,EAAgC,KAAA;AACjE,EAAM,MAAA,gBAAA,GAAmB,WAAW,uBAAuB,CAAA;AAC3D,EACE,uBAAAA,cAAA,CAAA,aAAA;AAAA,IAAC,IAAA;AAAA,IAAA;AAAA,MACC,SAAS,EAAA,IAAA;AAAA,MACT,SAAU,EAAA,KAAA;AAAA,MACV,cAAe,EAAA,YAAA;AAAA,MACf,UAAW,EAAA;AAAA,KAAA;AAAA,IAEV,iBAAiB,QAAS,CAAA,GAAA,CAAI,CAAC,OAAS,EAAA,CAAA,kDACtC,IAAK,EAAA,EAAA,IAAA,EAAI,IAAC,EAAA,GAAA,EAAK,GAAG,EAAE,EAAA,IAAA,EAAA,+CAClB,gBAAiB,EAAA,EAAA,OAAA,EAAkB,CACtC,CACD;AAAA,GACH;AAEJ;;;;"}
1
+ {"version":3,"file":"ServicesAccordions.esm.js","sources":["../../../src/components/ServicesAccordions/ServicesAccordions.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 { 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 { V1Service } from '@kubernetes/client-node';\nimport { ServiceDrawer } from './ServiceDrawer';\nimport { GroupedResponsesContext } from '../../hooks';\nimport { StructuredMetadataTable } from '@backstage/core-components';\n\ntype ServiceSummaryProps = {\n service: V1Service;\n};\n\nconst ServiceSummary = ({ service }: ServiceSummaryProps) => {\n return (\n <Grid\n container\n direction=\"row\"\n justifyContent=\"space-between\"\n alignItems=\"center\"\n spacing={0}\n >\n <Grid xs={8} item>\n <ServiceDrawer service={service} />\n </Grid>\n\n <Grid item>\n <Typography variant=\"subtitle2\">\n Type: {service.spec?.type ?? '?'}\n </Typography>\n </Grid>\n </Grid>\n );\n};\n\ntype ServiceCardProps = {\n service: V1Service;\n};\n\nconst ServiceCard = ({ service }: ServiceCardProps) => {\n const metadata: any = {};\n\n if (service.status?.loadBalancer?.ingress?.length ?? -1 > 0) {\n metadata.loadbalancer = service.status?.loadBalancer;\n }\n\n if (service.spec?.type === 'ClusterIP') {\n metadata.clusterIP = service.spec.clusterIP;\n }\n if (service.spec?.type === 'ExternalName') {\n metadata.externalName = service.spec.externalName;\n }\n\n return (\n <StructuredMetadataTable\n metadata={{\n type: service.spec?.type,\n ports: service.spec?.ports,\n ...metadata,\n }}\n options={{ nestedValuesAsYaml: true }}\n />\n );\n};\n\n/**\n *\n *\n * @public\n */\nexport type ServicesAccordionsProps = {};\n\ntype ServiceAccordionProps = {\n service: V1Service;\n};\n\nconst ServiceAccordion = ({ service }: ServiceAccordionProps) => {\n return (\n <Accordion TransitionProps={{ unmountOnExit: true }} variant=\"outlined\">\n <AccordionSummary expandIcon={<ExpandMoreIcon />}>\n <ServiceSummary service={service} />\n </AccordionSummary>\n <AccordionDetails>\n <ServiceCard service={service} />\n </AccordionDetails>\n </Accordion>\n );\n};\n\n/**\n *\n *\n * @public\n */\nexport const ServicesAccordions = ({}: ServicesAccordionsProps) => {\n const groupedResponses = useContext(GroupedResponsesContext);\n return (\n <Grid\n container\n direction=\"row\"\n justifyContent=\"flex-start\"\n alignItems=\"flex-start\"\n >\n {groupedResponses.services.map((service, i) => (\n <Grid item key={i} xs>\n <ServiceAccordion service={service} />\n </Grid>\n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