@backstage/plugin-kubernetes-react 0.5.0-next.1 → 0.5.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.
- package/CHANGELOG.md +30 -0
- package/config.d.ts +15 -0
- package/dist/alpha.d.ts +8 -0
- package/dist/alpha.esm.js +2 -0
- package/dist/alpha.esm.js.map +1 -0
- package/dist/api/KubernetesBackendClient.esm.js.map +1 -1
- package/dist/api/KubernetesClusterLinkFormatter.esm.js.map +1 -1
- package/dist/api/KubernetesProxyClient.esm.js +13 -0
- package/dist/api/KubernetesProxyClient.esm.js.map +1 -1
- package/dist/api/formatters/AksClusterLinksFormatter.esm.js.map +1 -1
- package/dist/api/formatters/EksClusterLinksFormatter.esm.js.map +1 -1
- package/dist/api/formatters/GkeClusterLinksFormatter.esm.js.map +1 -1
- package/dist/api/formatters/OpenshiftClusterLinksFormatter.esm.js.map +1 -1
- package/dist/api/formatters/RancherClusterLinksFormatter.esm.js.map +1 -1
- package/dist/api/formatters/StandardClusterLinksFormatter.esm.js.map +1 -1
- package/dist/api/formatters/index.esm.js.map +1 -1
- package/dist/api/types.esm.js.map +1 -1
- package/dist/components/Cluster/Cluster.esm.js.map +1 -1
- package/dist/components/CronJobsAccordions/CronJobsAccordions.esm.js.map +1 -1
- package/dist/components/CronJobsAccordions/CronJobsDrawer.esm.js.map +1 -1
- package/dist/components/CustomResources/ArgoRollouts/Rollout.esm.js +1 -1
- package/dist/components/CustomResources/ArgoRollouts/Rollout.esm.js.map +1 -1
- package/dist/components/CustomResources/ArgoRollouts/RolloutDrawer.esm.js.map +1 -1
- package/dist/components/CustomResources/ArgoRollouts/StepsProgress.esm.js.map +1 -1
- package/dist/components/CustomResources/CustomResources.esm.js.map +1 -1
- package/dist/components/CustomResources/DefaultCustomResource.esm.js.map +1 -1
- package/dist/components/CustomResources/DefaultCustomResourceDrawer.esm.js.map +1 -1
- package/dist/components/DaemonSetsAccordions/DaemonSetsAccordions.esm.js.map +1 -1
- package/dist/components/DaemonSetsAccordions/DaemonSetsDrawer.esm.js.map +1 -1
- package/dist/components/DeploymentsAccordions/DeploymentDrawer.esm.js.map +1 -1
- package/dist/components/DeploymentsAccordions/DeploymentsAccordions.esm.js +1 -1
- package/dist/components/DeploymentsAccordions/DeploymentsAccordions.esm.js.map +1 -1
- package/dist/components/ErrorPanel/ErrorPanel.esm.js.map +1 -1
- package/dist/components/ErrorReporting/ErrorReporting.esm.js.map +1 -1
- package/dist/components/HorizontalPodAutoscalers/HorizontalPodAutoscalerDrawer.esm.js.map +1 -1
- package/dist/components/IngressesAccordions/IngressDrawer.esm.js.map +1 -1
- package/dist/components/IngressesAccordions/IngressesAccordions.esm.js.map +1 -1
- package/dist/components/JobsAccordions/JobsAccordions.esm.js.map +1 -1
- package/dist/components/JobsAccordions/JobsDrawer.esm.js.map +1 -1
- package/dist/components/KubernetesDialog/KubernetesDialog.esm.js.map +1 -1
- package/dist/components/KubernetesDrawer/KubernetesDrawer.esm.js.map +1 -1
- package/dist/components/KubernetesDrawer/KubernetesStructuredMetadataTableDrawer.esm.js.map +1 -1
- package/dist/components/KubernetesDrawer/ManifestYaml.esm.js.map +1 -1
- package/dist/components/PodExecTerminal/PodExecTerminal.esm.js.map +1 -1
- package/dist/components/PodExecTerminal/PodExecTerminalAttachAddon.esm.js.map +1 -1
- package/dist/components/PodExecTerminal/PodExecTerminalDialog.esm.js.map +1 -1
- package/dist/components/Pods/ErrorList/ErrorList.esm.js.map +1 -1
- package/dist/components/Pods/Events/Events.esm.js +2 -2
- package/dist/components/Pods/Events/Events.esm.js.map +1 -1
- package/dist/components/Pods/Events/useEvents.esm.js.map +1 -1
- package/dist/components/Pods/FixDialog/FixDialog.esm.js.map +1 -1
- package/dist/components/Pods/PodDelete/PodDeleteButton.esm.js +50 -0
- package/dist/components/Pods/PodDelete/PodDeleteButton.esm.js.map +1 -0
- package/dist/components/Pods/PodDelete/usePodDelete.esm.js +21 -0
- package/dist/components/Pods/PodDelete/usePodDelete.esm.js.map +1 -0
- package/dist/components/Pods/PodDrawer/ContainerCard.esm.js +1 -1
- package/dist/components/Pods/PodDrawer/ContainerCard.esm.js.map +1 -1
- package/dist/components/Pods/PodDrawer/PendingPodContent.esm.js.map +1 -1
- package/dist/components/Pods/PodDrawer/PodDrawer.esm.js +24 -1
- package/dist/components/Pods/PodDrawer/PodDrawer.esm.js.map +1 -1
- package/dist/components/Pods/PodLogs/PodLogs.esm.js.map +1 -1
- package/dist/components/Pods/PodLogs/PodLogsDialog.esm.js.map +1 -1
- package/dist/components/Pods/PodLogs/usePodLogs.esm.js.map +1 -1
- package/dist/components/Pods/PodsTable.esm.js +1 -1
- package/dist/components/Pods/PodsTable.esm.js.map +1 -1
- package/dist/components/ResourceUtilization/ResourceUtilization.esm.js.map +1 -1
- package/dist/components/ServicesAccordions/ServiceDrawer.esm.js.map +1 -1
- package/dist/components/ServicesAccordions/ServicesAccordions.esm.js.map +1 -1
- package/dist/components/StatefulSetsAccordions/StatefulSetDrawer.esm.js.map +1 -1
- package/dist/components/StatefulSetsAccordions/StatefulSetsAccordions.esm.js +1 -1
- package/dist/components/StatefulSetsAccordions/StatefulSetsAccordions.esm.js.map +1 -1
- package/dist/hooks/Cluster.esm.js.map +1 -1
- package/dist/hooks/GroupedResponses.esm.js.map +1 -1
- package/dist/hooks/PodNamesWithErrors.esm.js.map +1 -1
- package/dist/hooks/auth.esm.js.map +1 -1
- package/dist/hooks/useCustomResources.esm.js.map +1 -1
- package/dist/hooks/useIsPodDeleteEnabled.esm.js +9 -0
- package/dist/hooks/useIsPodDeleteEnabled.esm.js.map +1 -0
- package/dist/hooks/useIsPodExecTerminalEnabled.esm.js.map +1 -1
- package/dist/hooks/useIsPodExecTerminalSupported.esm.js.map +1 -1
- package/dist/hooks/useKubernetesObjects.esm.js.map +1 -1
- package/dist/hooks/useMatchingErrors.esm.js.map +1 -1
- package/dist/hooks/usePodMetrics.esm.js.map +1 -1
- package/dist/index.d.ts +14 -0
- package/dist/index.esm.js +1 -0
- package/dist/index.esm.js.map +1 -1
- package/dist/kubernetes-auth-provider/AksKubernetesAuthProvider.esm.js.map +1 -1
- package/dist/kubernetes-auth-provider/GoogleKubernetesAuthProvider.esm.js.map +1 -1
- package/dist/kubernetes-auth-provider/KubernetesAuthProviders.esm.js.map +1 -1
- package/dist/kubernetes-auth-provider/OidcKubernetesAuthProvider.esm.js.map +1 -1
- package/dist/kubernetes-auth-provider/ServerSideAuthProvider.esm.js.map +1 -1
- package/dist/kubernetes-auth-provider/types.esm.js.map +1 -1
- package/dist/translation.esm.js +15 -0
- package/dist/translation.esm.js.map +1 -0
- package/dist/utils/crons.esm.js.map +1 -1
- package/dist/utils/owner.esm.js.map +1 -1
- package/dist/utils/pod.esm.js +1 -1
- package/dist/utils/pod.esm.js.map +1 -1
- package/dist/utils/resources.esm.js.map +1 -1
- package/package.json +36 -15
|
@@ -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 { PendingPodContent } from './PendingPodContent';\nimport { ErrorList } from '../ErrorList';\nimport { usePodMetrics } from '../../../hooks/usePodMetrics';\nimport { ResourceUtilization } from '../../ResourceUtilization';\nimport { bytesToMiB, formatMillicores } from '../../../utils/resources';\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\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 {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":";;;;;;;;;;;;;;;;;AAmCA,MAAM,sBAAyB,GAAA,UAAA;AAAA,EAAW,CAAC,WACzC,YAAa,CAAA;AAAA,IACX,MAAQ,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awer.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;A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MAAA,gBAAA,GAAA,CACJ,UAAY,EAAA,UAAA,IAAc,EAAC,EAC3B,KAAK,CAAK,CAAA,KAAA,CAAA,CAAE,SAAc,KAAA,eAAA,CAAgB,IAAI,CAAA;AAChD,QACE,uBAAAA,cAAA,CAAA,aAAA;AAAA,UAAC,aAAA;AAAA,UAAA;AAAA,YACC,KAAK,CAAkB,eAAA,EAAA,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 +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
|
|
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 +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
|
|
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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"usePodLogs.esm.js","sources":["../../../../src/components/Pods/PodLogs/usePodLogs.ts"],"sourcesContent":["/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport useAsync from 'react-use/esm/useAsync';\n\nimport { ContainerScope } from './types';\nimport { useApi } from '@backstage/core-plugin-api';\nimport { kubernetesProxyApiRef } from '../../../api/types';\n\n/**\n * Arguments for usePodLogs\n *\n * @public\n */\nexport interface PodLogsOptions {\n containerScope: ContainerScope;\n previous?: boolean;\n}\n\n/**\n * Retrieves the logs for the given pod\n *\n * @public\n */\nexport const usePodLogs = ({ containerScope, previous }: PodLogsOptions) => {\n const kubernetesProxyApi = useApi(kubernetesProxyApiRef);\n return useAsync(async () => {\n return await kubernetesProxyApi.getPodLogs({\n podName: containerScope.podName,\n namespace: containerScope.podNamespace,\n containerName: containerScope.containerName,\n clusterName: containerScope.cluster.name,\n previous,\n });\n }, [JSON.stringify(containerScope)]);\n};\n"],"names":[],"mappings":";;;;AAoCO,MAAM,UAAa,GAAA,CAAC,EAAE,cAAA,EAAgB,UAA+B,KAAA;AAC1E,EAAM,MAAA,kBAAA,GAAqB,OAAO,qBAAqB,CAAA
|
|
1
|
+
{"version":3,"file":"usePodLogs.esm.js","sources":["../../../../src/components/Pods/PodLogs/usePodLogs.ts"],"sourcesContent":["/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport useAsync from 'react-use/esm/useAsync';\n\nimport { ContainerScope } from './types';\nimport { useApi } from '@backstage/core-plugin-api';\nimport { kubernetesProxyApiRef } from '../../../api/types';\n\n/**\n * Arguments for usePodLogs\n *\n * @public\n */\nexport interface PodLogsOptions {\n containerScope: ContainerScope;\n previous?: boolean;\n}\n\n/**\n * Retrieves the logs for the given pod\n *\n * @public\n */\nexport const usePodLogs = ({ containerScope, previous }: PodLogsOptions) => {\n const kubernetesProxyApi = useApi(kubernetesProxyApiRef);\n return useAsync(async () => {\n return await kubernetesProxyApi.getPodLogs({\n podName: containerScope.podName,\n namespace: containerScope.podNamespace,\n containerName: containerScope.containerName,\n clusterName: containerScope.cluster.name,\n previous,\n });\n }, [JSON.stringify(containerScope)]);\n};\n"],"names":[],"mappings":";;;;AAoCO,MAAM,UAAa,GAAA,CAAC,EAAE,cAAA,EAAgB,UAA+B,KAAA;AAC1E,EAAM,MAAA,kBAAA,GAAqB,OAAO,qBAAqB,CAAA;AACvD,EAAA,OAAO,SAAS,YAAY;AAC1B,IAAO,OAAA,MAAM,mBAAmB,UAAW,CAAA;AAAA,MACzC,SAAS,cAAe,CAAA,OAAA;AAAA,MACxB,WAAW,cAAe,CAAA,YAAA;AAAA,MAC1B,eAAe,cAAe,CAAA,aAAA;AAAA,MAC9B,WAAA,EAAa,eAAe,OAAQ,CAAA,IAAA;AAAA,MACpC;AAAA,KACD,CAAA;AAAA,KACA,CAAC,IAAA,CAAK,SAAU,CAAA,cAAc,CAAC,CAAC,CAAA;AACrC;;;;"}
|
|
@@ -28,7 +28,7 @@ import '@material-ui/lab/Skeleton';
|
|
|
28
28
|
import '@material-ui/icons/Subject';
|
|
29
29
|
import '@material-ui/core/List';
|
|
30
30
|
import '@material-ui/core/ListItem';
|
|
31
|
-
import { containersReady, totalRestarts,
|
|
31
|
+
import { containerStatuses, containersReady, totalRestarts, podStatusToCpuUtil, podStatusToMemoryUtil } from '../../utils/pod.esm.js';
|
|
32
32
|
|
|
33
33
|
const READY_COLUMNS = "READY";
|
|
34
34
|
const RESOURCE_COLUMNS = "RESOURCE";
|
|
@@ -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
|
|
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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;AAAA,IACV,KAAO,EAAA;AAAA,GACT;AAEA,EACE,uBAAAA,cAAA,CAAA,aAAA,CAAC,KAAI,EAAA,EAAA,KAAA,EAAO,UACV,EAAA,kBAAAA,cAAA,CAAA,aAAA;AAAA,IAAC,KAAA;AAAA,IAAA;AAAA,MACC,SAAS,EAAE,MAAA,EAAQ,MAAM,MAAQ,EAAA,KAAA,EAAO,qBAAqB,KAAM,EAAA;AAAA,MAGnE,IACG,EAAA,IAAA,CAAe,GAAI,CAAA,CAAC,GAAc,MAAA;AAAA,QACjC,GAAG,GAAA;AAAA,QACH,EAAA,EAAI,KAAK,QAAU,EAAA;AAAA,OACnB,CAAA,CAAA;AAAA,MAEJ;AAAA;AAAA,GAEJ,CAAA;AAEJ;;;;"}
|
|
@@ -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
|
|
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,WA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.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 </KubernetesStructuredMetadataTableDrawer>\n );\n};\n"],"names":["React"],"mappings":";;;;;;;;;;;AAuBO,MAAM,gBAAgB,CAAC;AAAA,EAC5B,OAAA;AAAA,EACA
|
|
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 </KubernetesStructuredMetadataTableDrawer>\n );\n};\n"],"names":["React"],"mappings":";;;;;;;;;;;AAuBO,MAAM,gBAAgB,CAAC;AAAA,EAC5B,OAAA;AAAA,EACA;AACF,CAGM,KAAA;AACJ,EAAM,MAAA,SAAA,GAAY,QAAQ,QAAU,EAAA,SAAA;AACpC,EACE,uBAAAA,cAAA,CAAA,aAAA;AAAA,IAAC,uCAAA;AAAA,IAAA;AAAA,MACC,MAAQ,EAAA,OAAA;AAAA,MACR,QAAA;AAAA,MACA,IAAK,EAAA,SAAA;AAAA,MACL,YAAA,EAAc,CAAC,aAA6B,KAAA;AAC1C,QAAO,OAAA,aAAA,CAAc,QAAQ,EAAC;AAAA;AAChC,KAAA;AAAA,oBAEAA,cAAA,CAAA,aAAA;AAAA,MAAC,IAAA;AAAA,MAAA;AAAA,QACC,SAAS,EAAA,IAAA;AAAA,QACT,SAAU,EAAA,QAAA;AAAA,QACV,cAAe,EAAA,YAAA;AAAA,QACf,UAAW,EAAA,YAAA;AAAA,QACX,OAAS,EAAA;AAAA,OAAA;AAAA,sBAERA,cAAA,CAAA,aAAA,CAAA,IAAA,EAAA,EAAK,IAAI,EAAA,IAAA,EAAA,kBACPA,cAAA,CAAA,aAAA,CAAA,UAAA,EAAA,EAAW,OAAQ,EAAA,OAAA,EAAA,EACjB,OAAQ,CAAA,QAAA,EAAU,IAAQ,IAAA,gBAC7B,CACF,CAAA;AAAA,sBACAA,cAAA,CAAA,aAAA,CAAC,IAAK,EAAA,EAAA,IAAA,EAAI,IACR,EAAA,kBAAAA,cAAA,CAAA,aAAA,CAAC,UAAW,EAAA,EAAA,KAAA,EAAM,eAAgB,EAAA,OAAA,EAAQ,WAAY,EAAA,EAAA,SAEtD,CACF,CAAA;AAAA,MACC,SACC,oBAAAA,cAAA,CAAA,aAAA,CAAC,IAAK,EAAA,EAAA,IAAA,EAAI,IACR,EAAA,kBAAAA,cAAA,CAAA,aAAA,CAAC,IAAK,EAAA,EAAA,IAAA,EAAK,OAAQ,EAAA,KAAA,EAAO,CAAc,WAAA,EAAA,SAAS,IAAI,CACvD;AAAA;AAEJ,GACF;AAEJ;;;;"}
|
|
@@ -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 />\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
|
|
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 />\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,WAAgB,EAAC;AAEvB,EAAA,IAAI,QAAQ,MAAQ,EAAA,YAAA,EAAc,OAAS,EAAA,MAAA,IAAU,KAAK,CAAG,EAAA;AAC3D,IAAS,QAAA,CAAA,YAAA,GAAe,QAAQ,MAAQ,EAAA,YAAA;AAAA;AAG1C,EAAI,IAAA,OAAA,CAAQ,IA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;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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StatefulSetDrawer.esm.js","sources":["../../../src/components/StatefulSetsAccordions/StatefulSetDrawer.tsx"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React from 'react';\nimport { V1StatefulSet } from '@kubernetes/client-node';\nimport { KubernetesStructuredMetadataTableDrawer } from '../KubernetesDrawer';\nimport { renderCondition } from '../../utils/pod';\nimport Typography from '@material-ui/core/Typography';\nimport Grid from '@material-ui/core/Grid';\nimport Chip from '@material-ui/core/Chip';\n\nexport const StatefulSetDrawer = ({\n statefulset,\n expanded,\n}: {\n statefulset: V1StatefulSet;\n expanded?: boolean;\n}) => {\n const namespace = statefulset.metadata?.namespace;\n return (\n <KubernetesStructuredMetadataTableDrawer\n object={statefulset}\n expanded={expanded}\n kind=\"StatefulSet\"\n renderObject={(statefulsetObj: V1StatefulSet) => {\n const conditions = (statefulsetObj.status?.conditions ?? [])\n .map(renderCondition)\n .reduce((accum, next) => {\n accum[next[0]] = next[1];\n return accum;\n }, {} as { [key: string]: React.ReactNode });\n\n return {\n updateStrategy: statefulset.spec?.updateStrategy ?? '???',\n podManagementPolicy: statefulset.spec?.podManagementPolicy ?? '???',\n serviceName: statefulset.spec?.serviceName ?? '???',\n selector: statefulset.spec?.selector ?? '???',\n revisionHistoryLimit: statefulset.spec?.revisionHistoryLimit ?? '???',\n ...conditions,\n };\n }}\n >\n <Grid\n container\n direction=\"column\"\n justifyContent=\"flex-start\"\n alignItems=\"flex-start\"\n spacing={0}\n >\n <Grid item>\n <Typography variant=\"body1\">\n {statefulset.metadata?.name ?? 'unknown object'}\n </Typography>\n </Grid>\n <Grid item>\n <Typography color=\"textSecondary\" variant=\"subtitle1\">\n Stateful Set\n </Typography>\n </Grid>\n {namespace && (\n <Grid item>\n <Chip size=\"small\" label={`namespace: ${namespace}`} />\n </Grid>\n )}\n </Grid>\n </KubernetesStructuredMetadataTableDrawer>\n );\n};\n"],"names":["React"],"mappings":";;;;;;;;;;;;AAwBO,MAAM,oBAAoB,CAAC;AAAA,EAChC,WAAA;AAAA,EACA
|
|
1
|
+
{"version":3,"file":"StatefulSetDrawer.esm.js","sources":["../../../src/components/StatefulSetsAccordions/StatefulSetDrawer.tsx"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React from 'react';\nimport { V1StatefulSet } from '@kubernetes/client-node';\nimport { KubernetesStructuredMetadataTableDrawer } from '../KubernetesDrawer';\nimport { renderCondition } from '../../utils/pod';\nimport Typography from '@material-ui/core/Typography';\nimport Grid from '@material-ui/core/Grid';\nimport Chip from '@material-ui/core/Chip';\n\nexport const StatefulSetDrawer = ({\n statefulset,\n expanded,\n}: {\n statefulset: V1StatefulSet;\n expanded?: boolean;\n}) => {\n const namespace = statefulset.metadata?.namespace;\n return (\n <KubernetesStructuredMetadataTableDrawer\n object={statefulset}\n expanded={expanded}\n kind=\"StatefulSet\"\n renderObject={(statefulsetObj: V1StatefulSet) => {\n const conditions = (statefulsetObj.status?.conditions ?? [])\n .map(renderCondition)\n .reduce((accum, next) => {\n accum[next[0]] = next[1];\n return accum;\n }, {} as { [key: string]: React.ReactNode });\n\n return {\n updateStrategy: statefulset.spec?.updateStrategy ?? '???',\n podManagementPolicy: statefulset.spec?.podManagementPolicy ?? '???',\n serviceName: statefulset.spec?.serviceName ?? '???',\n selector: statefulset.spec?.selector ?? '???',\n revisionHistoryLimit: statefulset.spec?.revisionHistoryLimit ?? '???',\n ...conditions,\n };\n }}\n >\n <Grid\n container\n direction=\"column\"\n justifyContent=\"flex-start\"\n alignItems=\"flex-start\"\n spacing={0}\n >\n <Grid item>\n <Typography variant=\"body1\">\n {statefulset.metadata?.name ?? 'unknown object'}\n </Typography>\n </Grid>\n <Grid item>\n <Typography color=\"textSecondary\" variant=\"subtitle1\">\n Stateful Set\n </Typography>\n </Grid>\n {namespace && (\n <Grid item>\n <Chip size=\"small\" label={`namespace: ${namespace}`} />\n </Grid>\n )}\n </Grid>\n </KubernetesStructuredMetadataTableDrawer>\n );\n};\n"],"names":["React"],"mappings":";;;;;;;;;;;;AAwBO,MAAM,oBAAoB,CAAC;AAAA,EAChC,WAAA;AAAA,EACA;AACF,CAGM,KAAA;AACJ,EAAM,MAAA,SAAA,GAAY,YAAY,QAAU,EAAA,SAAA;AACxC,EACE,uBAAAA,cAAA,CAAA,aAAA;AAAA,IAAC,uCAAA;AAAA,IAAA;AAAA,MACC,MAAQ,EAAA,WAAA;AAAA,MACR,QAAA;AAAA,MACA,IAAK,EAAA,aAAA;AAAA,MACL,YAAA,EAAc,CAAC,cAAkC,KAAA;AAC/C,QAAA,MAAM,UAAc,GAAA,CAAA,cA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AgB,EAAA,OAAA,EAAQ,WAAY,EAAA,EAAA,cAEtD,CACF,CAAA;AAAA,MACC,SACC,oBAAAA,cAAA,CAAA,aAAA,CAAC,IAAK,EAAA,EAAA,IAAA,EAAI,IACR,EAAA,kBAAAA,cAAA,CAAA,aAAA,CAAC,IAAK,EAAA,EAAA,IAAA,EAAK,OAAQ,EAAA,KAAA,EAAO,CAAc,WAAA,EAAA,SAAS,IAAI,CACvD;AAAA;AAEJ,GACF;AAEJ;;;;"}
|
|
@@ -44,7 +44,7 @@ import '../Pods/ErrorList/ErrorList.esm.js';
|
|
|
44
44
|
import { PodsTable, READY_COLUMNS, RESOURCE_COLUMNS } from '../Pods/PodsTable.esm.js';
|
|
45
45
|
import { StatefulSetDrawer } from './StatefulSetDrawer.esm.js';
|
|
46
46
|
import { HorizontalPodAutoscalerDrawer } from '../HorizontalPodAutoscalers/HorizontalPodAutoscalerDrawer.esm.js';
|
|
47
|
-
import {
|
|
47
|
+
import { getOwnedResources, getMatchingHpa } from '../../utils/owner.esm.js';
|
|
48
48
|
|
|
49
49
|
const StatefulSetSummary = ({
|
|
50
50
|
statefulset,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StatefulSetsAccordions.esm.js","sources":["../../../src/components/StatefulSetsAccordions/StatefulSetsAccordions.tsx"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React, { useContext } from 'react';\nimport Accordion from '@material-ui/core/Accordion';\nimport AccordionDetails from '@material-ui/core/AccordionDetails';\nimport AccordionSummary from '@material-ui/core/AccordionSummary';\nimport Grid from '@material-ui/core/Grid';\nimport Typography from '@material-ui/core/Typography';\nimport ExpandMoreIcon from '@material-ui/icons/ExpandMore';\nimport {\n V1Pod,\n V2HorizontalPodAutoscaler,\n V1StatefulSet,\n} from '@kubernetes/client-node';\nimport { PodsTable } from '../Pods';\nimport { StatefulSetDrawer } from './StatefulSetDrawer';\nimport { HorizontalPodAutoscalerDrawer } from '../HorizontalPodAutoscalers';\nimport { getMatchingHpa, getOwnedResources } from '../../utils/owner';\nimport {\n GroupedResponsesContext,\n PodNamesWithErrorsContext,\n} from '../../hooks';\nimport { StatusError, StatusOK } from '@backstage/core-components';\nimport { READY_COLUMNS, RESOURCE_COLUMNS } from '../Pods/PodsTable';\n\ntype StatefulSetsAccordionsProps = {\n children?: React.ReactNode;\n};\n\ntype StatefulSetAccordionProps = {\n statefulset: V1StatefulSet;\n ownedPods: V1Pod[];\n matchingHpa?: V2HorizontalPodAutoscaler;\n children?: React.ReactNode;\n};\n\ntype StatefulSetSummaryProps = {\n statefulset: V1StatefulSet;\n numberOfCurrentPods: number;\n numberOfPodsWithErrors: number;\n hpa?: V2HorizontalPodAutoscaler;\n children?: React.ReactNode;\n};\n\nconst StatefulSetSummary = ({\n statefulset,\n numberOfCurrentPods,\n numberOfPodsWithErrors,\n hpa,\n}: StatefulSetSummaryProps) => {\n const specCpuUtil = hpa?.spec?.metrics?.find(\n metric => metric.type === 'Resource' && metric.resource?.name === 'cpu',\n )?.resource?.target.averageUtilization;\n\n const cpuUtil = hpa?.status?.currentMetrics?.find(\n metric => metric.type === 'Resource' && metric.resource?.name === 'cpu',\n )?.resource?.current.averageUtilization;\n\n return (\n <Grid\n container\n direction=\"row\"\n justifyContent=\"space-between\"\n alignItems=\"center\"\n spacing={0}\n >\n <Grid xs={6} item>\n <StatefulSetDrawer statefulset={statefulset} />\n </Grid>\n {hpa && (\n <Grid item xs={3}>\n <HorizontalPodAutoscalerDrawer hpa={hpa}>\n <Grid\n item\n container\n direction=\"column\"\n justifyContent=\"flex-start\"\n alignItems=\"flex-start\"\n spacing={0}\n >\n <Grid item>\n <Typography variant=\"subtitle2\">\n min replicas {hpa.spec?.minReplicas ?? '?'} / max replicas{' '}\n {hpa.spec?.maxReplicas ?? '?'}\n </Typography>\n </Grid>\n <Grid item>\n <Typography variant=\"subtitle2\">\n current CPU usage: {cpuUtil ?? '?'}%\n </Typography>\n </Grid>\n <Grid item>\n <Typography variant=\"subtitle2\">\n target CPU usage: {specCpuUtil ?? '?'}%\n </Typography>\n </Grid>\n </Grid>\n </HorizontalPodAutoscalerDrawer>\n </Grid>\n )}\n <Grid\n item\n container\n xs={3}\n direction=\"column\"\n justifyContent=\"flex-start\"\n alignItems=\"flex-start\"\n spacing={0}\n >\n <Grid item>\n <StatusOK>{numberOfCurrentPods} pods</StatusOK>\n </Grid>\n <Grid item>\n {numberOfPodsWithErrors > 0 ? (\n <StatusError>\n {numberOfPodsWithErrors} pod\n {numberOfPodsWithErrors > 1 ? 's' : ''} with errors\n </StatusError>\n ) : (\n <StatusOK>No pods with errors</StatusOK>\n )}\n </Grid>\n </Grid>\n </Grid>\n );\n};\n\nconst StatefulSetAccordion = ({\n statefulset,\n ownedPods,\n matchingHpa,\n}: StatefulSetAccordionProps) => {\n const podNamesWithErrors = useContext(PodNamesWithErrorsContext);\n\n const podsWithErrors = ownedPods.filter(p =>\n podNamesWithErrors.has(p.metadata?.name ?? ''),\n );\n\n return (\n <Accordion TransitionProps={{ unmountOnExit: true }} variant=\"outlined\">\n <AccordionSummary expandIcon={<ExpandMoreIcon />}>\n <StatefulSetSummary\n statefulset={statefulset}\n numberOfCurrentPods={ownedPods.length}\n numberOfPodsWithErrors={podsWithErrors.length}\n hpa={matchingHpa}\n />\n </AccordionSummary>\n <AccordionDetails>\n <PodsTable\n pods={ownedPods}\n extraColumns={[READY_COLUMNS, RESOURCE_COLUMNS]}\n />\n </AccordionDetails>\n </Accordion>\n );\n};\n\nexport const StatefulSetsAccordions = ({}: StatefulSetsAccordionsProps) => {\n const groupedResponses = useContext(GroupedResponsesContext);\n\n return (\n <Grid\n container\n direction=\"column\"\n justifyContent=\"flex-start\"\n alignItems=\"flex-start\"\n >\n {groupedResponses.statefulsets.map((statefulset, i) => (\n <Grid container item key={i} xs>\n <Grid item xs>\n <StatefulSetAccordion\n matchingHpa={getMatchingHpa(\n {\n name: statefulset.metadata?.name,\n namespace: statefulset.metadata?.namespace,\n kind: 'statefulset',\n },\n groupedResponses.horizontalPodAutoscalers,\n )}\n ownedPods={getOwnedResources(statefulset, groupedResponses.pods)}\n statefulset={statefulset}\n />\n </Grid>\n </Grid>\n ))}\n </Grid>\n );\n};\n"],"names":["React"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0DA,MAAM,qBAAqB,CAAC;AAAA,EAC1B,WAAA;AAAA,EACA,mBAAA;AAAA,EACA,sBAAA;AAAA,EACA,GAAA;AACF,CAA+B,KAAA;AAC7B,EAAM,MAAA,WAAA,GAAc,GAAK,EAAA,IAAA,EAAM,OAAS,EAAA,IAAA;AAAA,IACtC,YAAU,MAAO,CAAA,IAAA,KAAS,UAAc,IAAA,MAAA,CAAO,UAAU,IAAS,KAAA,KAAA;AAAA,GACpE,EAAG,UAAU,MAAO,CAAA,kBAAA,CAAA;AAEpB,EAAM,MAAA,OAAA,GAAU,GAAK,EAAA,MAAA,EAAQ,cAAgB,EAAA,IAAA;AAAA,IAC3C,YAAU,MAAO,CAAA,IAAA,KAAS,UAAc,IAAA,MAAA,CAAO,UAAU,IAAS,KAAA,KAAA;AAAA,GACpE,EAAG,UAAU,OAAQ,CAAA,kBAAA,CAAA;AAErB,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,CAAA;AAAA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W,YAAY,QAAU,EAAA,SAAA;AAAA,YACjC,IAAM,EAAA,aAAA;AAAA,WACR;AAAA,UACA,gBAAiB,CAAA,wBAAA;AAAA,SACnB;AAAA,QACA,SAAW,EAAA,iBAAA,CAAkB,WAAa,EAAA,gBAAA,CAAiB,IAAI,CAAA;AAAA,QAC/D,WAAA;AAAA,OAAA;AAAA,KAEJ,CACF,CACD,CAAA;AAAA,GACH,CAAA;AAEJ;;;;"}
|
|
1
|
+
{"version":3,"file":"StatefulSetsAccordions.esm.js","sources":["../../../src/components/StatefulSetsAccordions/StatefulSetsAccordions.tsx"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React, { useContext } from 'react';\nimport Accordion from '@material-ui/core/Accordion';\nimport AccordionDetails from '@material-ui/core/AccordionDetails';\nimport AccordionSummary from '@material-ui/core/AccordionSummary';\nimport Grid from '@material-ui/core/Grid';\nimport Typography from '@material-ui/core/Typography';\nimport ExpandMoreIcon from '@material-ui/icons/ExpandMore';\nimport {\n V1Pod,\n V2HorizontalPodAutoscaler,\n V1StatefulSet,\n} from '@kubernetes/client-node';\nimport { PodsTable } from '../Pods';\nimport { StatefulSetDrawer } from './StatefulSetDrawer';\nimport { HorizontalPodAutoscalerDrawer } from '../HorizontalPodAutoscalers';\nimport { getMatchingHpa, getOwnedResources } from '../../utils/owner';\nimport {\n GroupedResponsesContext,\n PodNamesWithErrorsContext,\n} from '../../hooks';\nimport { StatusError, StatusOK } from '@backstage/core-components';\nimport { READY_COLUMNS, RESOURCE_COLUMNS } from '../Pods/PodsTable';\n\ntype StatefulSetsAccordionsProps = {\n children?: React.ReactNode;\n};\n\ntype StatefulSetAccordionProps = {\n statefulset: V1StatefulSet;\n ownedPods: V1Pod[];\n matchingHpa?: V2HorizontalPodAutoscaler;\n children?: React.ReactNode;\n};\n\ntype StatefulSetSummaryProps = {\n statefulset: V1StatefulSet;\n numberOfCurrentPods: number;\n numberOfPodsWithErrors: number;\n hpa?: V2HorizontalPodAutoscaler;\n children?: React.ReactNode;\n};\n\nconst StatefulSetSummary = ({\n statefulset,\n numberOfCurrentPods,\n numberOfPodsWithErrors,\n hpa,\n}: StatefulSetSummaryProps) => {\n const specCpuUtil = hpa?.spec?.metrics?.find(\n metric => metric.type === 'Resource' && metric.resource?.name === 'cpu',\n )?.resource?.target.averageUtilization;\n\n const cpuUtil = hpa?.status?.currentMetrics?.find(\n metric => metric.type === 'Resource' && metric.resource?.name === 'cpu',\n )?.resource?.current.averageUtilization;\n\n return (\n <Grid\n container\n direction=\"row\"\n justifyContent=\"space-between\"\n alignItems=\"center\"\n spacing={0}\n >\n <Grid xs={6} item>\n <StatefulSetDrawer statefulset={statefulset} />\n </Grid>\n {hpa && (\n <Grid item xs={3}>\n <HorizontalPodAutoscalerDrawer hpa={hpa}>\n <Grid\n item\n container\n direction=\"column\"\n justifyContent=\"flex-start\"\n alignItems=\"flex-start\"\n spacing={0}\n >\n <Grid item>\n <Typography variant=\"subtitle2\">\n min replicas {hpa.spec?.minReplicas ?? '?'} / max replicas{' '}\n {hpa.spec?.maxReplicas ?? '?'}\n </Typography>\n </Grid>\n <Grid item>\n <Typography variant=\"subtitle2\">\n current CPU usage: {cpuUtil ?? '?'}%\n </Typography>\n </Grid>\n <Grid item>\n <Typography variant=\"subtitle2\">\n target CPU usage: {specCpuUtil ?? '?'}%\n </Typography>\n </Grid>\n </Grid>\n </HorizontalPodAutoscalerDrawer>\n </Grid>\n )}\n <Grid\n item\n container\n xs={3}\n direction=\"column\"\n justifyContent=\"flex-start\"\n alignItems=\"flex-start\"\n spacing={0}\n >\n <Grid item>\n <StatusOK>{numberOfCurrentPods} pods</StatusOK>\n </Grid>\n <Grid item>\n {numberOfPodsWithErrors > 0 ? (\n <StatusError>\n {numberOfPodsWithErrors} pod\n {numberOfPodsWithErrors > 1 ? 's' : ''} with errors\n </StatusError>\n ) : (\n <StatusOK>No pods with errors</StatusOK>\n )}\n </Grid>\n </Grid>\n </Grid>\n );\n};\n\nconst StatefulSetAccordion = ({\n statefulset,\n ownedPods,\n matchingHpa,\n}: StatefulSetAccordionProps) => {\n const podNamesWithErrors = useContext(PodNamesWithErrorsContext);\n\n const podsWithErrors = ownedPods.filter(p =>\n podNamesWithErrors.has(p.metadata?.name ?? ''),\n );\n\n return (\n <Accordion TransitionProps={{ unmountOnExit: true }} variant=\"outlined\">\n <AccordionSummary expandIcon={<ExpandMoreIcon />}>\n <StatefulSetSummary\n statefulset={statefulset}\n numberOfCurrentPods={ownedPods.length}\n numberOfPodsWithErrors={podsWithErrors.length}\n hpa={matchingHpa}\n />\n </AccordionSummary>\n <AccordionDetails>\n <PodsTable\n pods={ownedPods}\n extraColumns={[READY_COLUMNS, RESOURCE_COLUMNS]}\n />\n </AccordionDetails>\n </Accordion>\n );\n};\n\nexport const StatefulSetsAccordions = ({}: StatefulSetsAccordionsProps) => {\n const groupedResponses = useContext(GroupedResponsesContext);\n\n return (\n <Grid\n container\n direction=\"column\"\n justifyContent=\"flex-start\"\n alignItems=\"flex-start\"\n >\n {groupedResponses.statefulsets.map((statefulset, i) => (\n <Grid container item key={i} xs>\n <Grid item xs>\n <StatefulSetAccordion\n matchingHpa={getMatchingHpa(\n {\n name: statefulset.metadata?.name,\n namespace: statefulset.metadata?.namespace,\n kind: 'statefulset',\n },\n groupedResponses.horizontalPodAutoscalers,\n )}\n ownedPods={getOwnedResources(statefulset, groupedResponses.pods)}\n statefulset={statefulset}\n />\n </Grid>\n </Grid>\n ))}\n </Grid>\n );\n};\n"],"names":["React"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;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WAAW,uBAAuB,CAAA;AAE3D,EACE,uBAAAA,cAAA,CAAA,aAAA;AAAA,IAAC,IAAA;AAAA,IAAA;AAAA,MACC,SAAS,EAAA,IAAA;AAAA,MACT,SAAU,EAAA,QAAA;AAAA,MACV,cAAe,EAAA,YAAA;AAAA,MACf,UAAW,EAAA;AAAA,KAAA;AAAA,IAEV,gBAAA,CAAiB,aAAa,GAAI,CAAA,CAAC,aAAa,CAC/C,qBAAAA,cAAA,CAAA,aAAA,CAAC,QAAK,SAAS,EAAA,IAAA,EAAC,MAAI,IAAC,EAAA,GAAA,EAAK,GAAG,EAAE,EAAA,IAAA,EAAA,+CAC5B,IAAK,EAAA,EAAA,IAAA,EAAI,IAAC,EAAA,EAAA,EAAE,IACX,EAAA,kBAAAA,cAAA,CAAA,aAAA;AAAA,MAAC,oBAAA;AAAA,MAAA;AAAA,QACC,WAAa,EAAA,cAAA;AAAA,UACX;AAAA,YACE,IAAA,EAAM,YAAY,QAAU,EAAA,IAAA;AAAA,YAC5B,SAAA,EAAW,YAAY,QAAU,EAAA,SAAA;AAAA,YACjC,IAAM,EAAA;AAAA,WACR;AAAA,UACA,gBAAiB,CAAA;AAAA,SACnB;AAAA,QACA,SAAW,EAAA,iBAAA,CAAkB,WAAa,EAAA,gBAAA,CAAiB,IAAI,CAAA;AAAA,QAC/D;AAAA;AAAA,KAEJ,CACF,CACD;AAAA,GACH;AAEJ;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Cluster.esm.js","sources":["../../src/hooks/Cluster.ts"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React from 'react';\nimport { ClusterAttributes } from '@backstage/plugin-kubernetes-common';\n\n/**\n * @public\n */\nexport const ClusterContext = React.createContext<ClusterAttributes>({\n name: '',\n});\n"],"names":["React"],"mappings":";;AAqBa,MAAA,cAAA,GAAiBA,eAAM,aAAiC,CAAA;AAAA,EACnE,IAAM,EAAA
|
|
1
|
+
{"version":3,"file":"Cluster.esm.js","sources":["../../src/hooks/Cluster.ts"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React from 'react';\nimport { ClusterAttributes } from '@backstage/plugin-kubernetes-common';\n\n/**\n * @public\n */\nexport const ClusterContext = React.createContext<ClusterAttributes>({\n name: '',\n});\n"],"names":["React"],"mappings":";;AAqBa,MAAA,cAAA,GAAiBA,eAAM,aAAiC,CAAA;AAAA,EACnE,IAAM,EAAA;AACR,CAAC;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GroupedResponses.esm.js","sources":["../../src/hooks/GroupedResponses.ts"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React from 'react';\nimport { GroupedResponses } from '@backstage/plugin-kubernetes-common';\n\n/**\n *\n *\n * @public\n */\nexport const GroupedResponsesContext = React.createContext<GroupedResponses>({\n pods: [],\n replicaSets: [],\n deployments: [],\n daemonSets: [],\n services: [],\n configMaps: [],\n horizontalPodAutoscalers: [],\n ingresses: [],\n jobs: [],\n cronJobs: [],\n customResources: [],\n statefulsets: [],\n});\n"],"names":["React"],"mappings":";;AAuBa,MAAA,uBAAA,GAA0BA,eAAM,aAAgC,CAAA;AAAA,EAC3E,MAAM,EAAC;AAAA,EACP,aAAa,EAAC;AAAA,EACd,aAAa,EAAC;AAAA,EACd,YAAY,EAAC;AAAA,EACb,UAAU,EAAC;AAAA,EACX,YAAY,EAAC;AAAA,EACb,0BAA0B,EAAC;AAAA,EAC3B,WAAW,EAAC;AAAA,EACZ,MAAM,EAAC;AAAA,EACP,UAAU,EAAC;AAAA,EACX,iBAAiB,EAAC;AAAA,EAClB,cAAc
|
|
1
|
+
{"version":3,"file":"GroupedResponses.esm.js","sources":["../../src/hooks/GroupedResponses.ts"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React from 'react';\nimport { GroupedResponses } from '@backstage/plugin-kubernetes-common';\n\n/**\n *\n *\n * @public\n */\nexport const GroupedResponsesContext = React.createContext<GroupedResponses>({\n pods: [],\n replicaSets: [],\n deployments: [],\n daemonSets: [],\n services: [],\n configMaps: [],\n horizontalPodAutoscalers: [],\n ingresses: [],\n jobs: [],\n cronJobs: [],\n customResources: [],\n statefulsets: [],\n});\n"],"names":["React"],"mappings":";;AAuBa,MAAA,uBAAA,GAA0BA,eAAM,aAAgC,CAAA;AAAA,EAC3E,MAAM,EAAC;AAAA,EACP,aAAa,EAAC;AAAA,EACd,aAAa,EAAC;AAAA,EACd,YAAY,EAAC;AAAA,EACb,UAAU,EAAC;AAAA,EACX,YAAY,EAAC;AAAA,EACb,0BAA0B,EAAC;AAAA,EAC3B,WAAW,EAAC;AAAA,EACZ,MAAM,EAAC;AAAA,EACP,UAAU,EAAC;AAAA,EACX,iBAAiB,EAAC;AAAA,EAClB,cAAc;AAChB,CAAC;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PodNamesWithErrors.esm.js","sources":["../../src/hooks/PodNamesWithErrors.ts"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React from 'react';\n\n/**\n * @public\n */\nexport const PodNamesWithErrorsContext = React.createContext<Set<string>>(\n new Set<string>(),\n);\n"],"names":["React"],"mappings":";;AAoBO,MAAM,4BAA4BA,cAAM,CAAA,aAAA;AAAA,sBACzC,GAAY
|
|
1
|
+
{"version":3,"file":"PodNamesWithErrors.esm.js","sources":["../../src/hooks/PodNamesWithErrors.ts"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React from 'react';\n\n/**\n * @public\n */\nexport const PodNamesWithErrorsContext = React.createContext<Set<string>>(\n new Set<string>(),\n);\n"],"names":["React"],"mappings":";;AAoBO,MAAM,4BAA4BA,cAAM,CAAA,aAAA;AAAA,sBACzC,GAAY;AAClB;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth.esm.js","sources":["../../src/hooks/auth.ts"],"sourcesContent":["/*\n * Copyright 2022 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 { Entity } from '@backstage/catalog-model';\nimport { KubernetesRequestBody } from '@backstage/plugin-kubernetes-common';\nimport { KubernetesAuthProvidersApi } from '../kubernetes-auth-provider';\nimport { KubernetesApi } from '../api/types';\n\nexport const generateAuth = async (\n entity: Entity,\n kubernetesApi: KubernetesApi,\n kubernetesAuthProvidersApi: KubernetesAuthProvidersApi,\n) => {\n const clusters = await kubernetesApi.getClusters();\n\n const authProviders: string[] = [\n ...new Set(\n clusters.map(\n c =>\n `${c.authProvider}${\n c.oidcTokenProvider ? `.${c.oidcTokenProvider}` : ''\n }`,\n ),\n ),\n ];\n\n let requestBody: KubernetesRequestBody = {\n entity,\n };\n for (const authProviderStr of authProviders) {\n requestBody = await kubernetesAuthProvidersApi.decorateRequestBodyForAuth(\n authProviderStr,\n requestBody,\n );\n }\n return requestBody.auth ?? {};\n};\n"],"names":[],"mappings":"AAqBO,MAAM,YAAe,GAAA,OAC1B,MACA,EAAA,aAAA,EACA,0BACG,KAAA;AACH,EAAM,MAAA,QAAA,GAAW,MAAM,aAAA,CAAc,WAAY,EAAA
|
|
1
|
+
{"version":3,"file":"auth.esm.js","sources":["../../src/hooks/auth.ts"],"sourcesContent":["/*\n * Copyright 2022 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 { Entity } from '@backstage/catalog-model';\nimport { KubernetesRequestBody } from '@backstage/plugin-kubernetes-common';\nimport { KubernetesAuthProvidersApi } from '../kubernetes-auth-provider';\nimport { KubernetesApi } from '../api/types';\n\nexport const generateAuth = async (\n entity: Entity,\n kubernetesApi: KubernetesApi,\n kubernetesAuthProvidersApi: KubernetesAuthProvidersApi,\n) => {\n const clusters = await kubernetesApi.getClusters();\n\n const authProviders: string[] = [\n ...new Set(\n clusters.map(\n c =>\n `${c.authProvider}${\n c.oidcTokenProvider ? `.${c.oidcTokenProvider}` : ''\n }`,\n ),\n ),\n ];\n\n let requestBody: KubernetesRequestBody = {\n entity,\n };\n for (const authProviderStr of authProviders) {\n requestBody = await kubernetesAuthProvidersApi.decorateRequestBodyForAuth(\n authProviderStr,\n requestBody,\n );\n }\n return requestBody.auth ?? {};\n};\n"],"names":[],"mappings":"AAqBO,MAAM,YAAe,GAAA,OAC1B,MACA,EAAA,aAAA,EACA,0BACG,KAAA;AACH,EAAM,MAAA,QAAA,GAAW,MAAM,aAAA,CAAc,WAAY,EAAA;AAEjD,EAAA,MAAM,aAA0B,GAAA;AAAA,IAC9B,GAAG,IAAI,GAAA;AAAA,MACL,QAAS,CAAA,GAAA;AAAA,QACP,CAAA,CAAA,KACE,CAAG,EAAA,CAAA,CAAE,YAAY,CAAA,EACf,CAAE,CAAA,iBAAA,GAAoB,CAAI,CAAA,EAAA,CAAA,CAAE,iBAAiB,CAAA,CAAA,GAAK,EACpD,CAAA;AAAA;AACJ;AACF,GACF;AAEA,EAAA,IAAI,WAAqC,GAAA;AAAA,IACvC;AAAA,GACF;AACA,EAAA,KAAA,MAAW,mBAAmB,aAAe,EAAA;AAC3C,IAAA,WAAA,GAAc,MAAM,0BAA2B,CAAA,0BAAA;AAAA,MAC7C,eAAA;AAAA,MACA;AAAA,KACF;AAAA;AAEF,EAAO,OAAA,WAAA,CAAY,QAAQ,EAAC;AAC9B;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useCustomResources.esm.js","sources":["../../src/hooks/useCustomResources.ts"],"sourcesContent":["/*\n * Copyright 2022 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 { Entity } from '@backstage/catalog-model';\nimport { useCallback } from 'react';\nimport useInterval from 'react-use/esm/useInterval';\nimport {\n CustomResourceMatcher,\n ObjectsByEntityResponse,\n} from '@backstage/plugin-kubernetes-common';\nimport { useApi } from '@backstage/core-plugin-api';\nimport { KubernetesObjects } from './useKubernetesObjects';\nimport { generateAuth } from './auth';\nimport useAsyncRetry from 'react-use/esm/useAsyncRetry';\nimport { kubernetesAuthProvidersApiRef } from '../kubernetes-auth-provider';\nimport { kubernetesApiRef } from '../api/types';\n\n/**\n * Retrieves the provided custom resources related to the provided entity, refreshes at an interval.\n *\n * @public\n */\nexport const useCustomResources = (\n entity: Entity,\n customResourceMatchers: CustomResourceMatcher[],\n intervalMs: number = 10000,\n): KubernetesObjects => {\n const kubernetesApi = useApi(kubernetesApiRef);\n const kubernetesAuthProvidersApi = useApi(kubernetesAuthProvidersApiRef);\n const matchersString = JSON.stringify(customResourceMatchers);\n const getCustomObjects = useCallback(\n async (): Promise<ObjectsByEntityResponse> => {\n const auth = await generateAuth(\n entity,\n kubernetesApi,\n kubernetesAuthProvidersApi,\n );\n return await kubernetesApi.getCustomObjectsByEntity({\n auth,\n customResources: customResourceMatchers,\n entity,\n });\n },\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [kubernetesApi, entity, kubernetesAuthProvidersApi, matchersString],\n );\n\n const { value, loading, error, retry } = useAsyncRetry(\n () => getCustomObjects(),\n [getCustomObjects],\n );\n\n useInterval(() => retry(), intervalMs);\n\n return {\n kubernetesObjects: value,\n loading,\n error: error?.message,\n };\n};\n"],"names":[],"mappings":";;;;;;;;AAmCO,MAAM,kBAAqB,GAAA,CAChC,MACA,EAAA,sBAAA,EACA,aAAqB,GACC,KAAA;AACtB,EAAM,MAAA,aAAA,GAAgB,OAAO,gBAAgB,CAAA
|
|
1
|
+
{"version":3,"file":"useCustomResources.esm.js","sources":["../../src/hooks/useCustomResources.ts"],"sourcesContent":["/*\n * Copyright 2022 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 { Entity } from '@backstage/catalog-model';\nimport { useCallback } from 'react';\nimport useInterval from 'react-use/esm/useInterval';\nimport {\n CustomResourceMatcher,\n ObjectsByEntityResponse,\n} from '@backstage/plugin-kubernetes-common';\nimport { useApi } from '@backstage/core-plugin-api';\nimport { KubernetesObjects } from './useKubernetesObjects';\nimport { generateAuth } from './auth';\nimport useAsyncRetry from 'react-use/esm/useAsyncRetry';\nimport { kubernetesAuthProvidersApiRef } from '../kubernetes-auth-provider';\nimport { kubernetesApiRef } from '../api/types';\n\n/**\n * Retrieves the provided custom resources related to the provided entity, refreshes at an interval.\n *\n * @public\n */\nexport const useCustomResources = (\n entity: Entity,\n customResourceMatchers: CustomResourceMatcher[],\n intervalMs: number = 10000,\n): KubernetesObjects => {\n const kubernetesApi = useApi(kubernetesApiRef);\n const kubernetesAuthProvidersApi = useApi(kubernetesAuthProvidersApiRef);\n const matchersString = JSON.stringify(customResourceMatchers);\n const getCustomObjects = useCallback(\n async (): Promise<ObjectsByEntityResponse> => {\n const auth = await generateAuth(\n entity,\n kubernetesApi,\n kubernetesAuthProvidersApi,\n );\n return await kubernetesApi.getCustomObjectsByEntity({\n auth,\n customResources: customResourceMatchers,\n entity,\n });\n },\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [kubernetesApi, entity, kubernetesAuthProvidersApi, matchersString],\n );\n\n const { value, loading, error, retry } = useAsyncRetry(\n () => getCustomObjects(),\n [getCustomObjects],\n );\n\n useInterval(() => retry(), intervalMs);\n\n return {\n kubernetesObjects: value,\n loading,\n error: error?.message,\n };\n};\n"],"names":[],"mappings":";;;;;;;;AAmCO,MAAM,kBAAqB,GAAA,CAChC,MACA,EAAA,sBAAA,EACA,aAAqB,GACC,KAAA;AACtB,EAAM,MAAA,aAAA,GAAgB,OAAO,gBAAgB,CAAA;AAC7C,EAAM,MAAA,0BAAA,GAA6B,OAAO,6BAA6B,CAAA;AACvE,EAAM,MAAA,cAAA,GAAiB,IAAK,CAAA,SAAA,CAAU,sBAAsB,CAAA;AAC5D,EAAA,MAAM,gBAAmB,GAAA,WAAA;AAAA,IACvB,YAA8C;AAC5C,MAAA,MAAM,OAAO,MAAM,YAAA;AAAA,QACjB,MAAA;AAAA,QACA,aAAA;AAAA,QACA;AAAA,OACF;AACA,MAAO,OAAA,MAAM,cAAc,wBAAyB,CAAA;AAAA,QAClD,IAAA;AAAA,QACA,eAAiB,EAAA,sBAAA;AAAA,QACjB;AAAA,OACD,CAAA;AAAA,KACH;AAAA;AAAA,IAEA,CAAC,aAAA,EAAe,MAAQ,EAAA,0BAAA,EAA4B,cAAc;AAAA,GACpE;AAEA,EAAA,MAAM,EAAE,KAAA,EAAO,OAAS,EAAA,KAAA,EAAO,OAAU,GAAA,aAAA;AAAA,IACvC,MAAM,gBAAiB,EAAA;AAAA,IACvB,CAAC,gBAAgB;AAAA,GACnB;AAEA,EAAY,WAAA,CAAA,MAAM,KAAM,EAAA,EAAG,UAAU,CAAA;AAErC,EAAO,OAAA;AAAA,IACL,iBAAmB,EAAA,KAAA;AAAA,IACnB,OAAA;AAAA,IACA,OAAO,KAAO,EAAA;AAAA,GAChB;AACF;;;;"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { useApi, configApiRef } from '@backstage/core-plugin-api';
|
|
2
|
+
|
|
3
|
+
const useIsPodDeleteEnabled = () => {
|
|
4
|
+
const configApi = useApi(configApiRef);
|
|
5
|
+
return configApi.getOptionalConfig("kubernetes.frontend")?.getOptionalBoolean("podDelete.enabled");
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
export { useIsPodDeleteEnabled };
|
|
9
|
+
//# sourceMappingURL=useIsPodDeleteEnabled.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useIsPodDeleteEnabled.esm.js","sources":["../../src/hooks/useIsPodDeleteEnabled.ts"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { configApiRef, useApi } from '@backstage/core-plugin-api';\n\n/**\n * Check if conditions for a pod delete call through the proxy endpoint are met\n *\n * @internal\n */\nexport const useIsPodDeleteEnabled = (): boolean | undefined => {\n const configApi = useApi(configApiRef);\n\n return configApi\n .getOptionalConfig('kubernetes.frontend')\n ?.getOptionalBoolean('podDelete.enabled');\n};\n"],"names":[],"mappings":";;AAsBO,MAAM,wBAAwB,MAA2B;AAC9D,EAAM,MAAA,SAAA,GAAY,OAAO,YAAY,CAAA;AAErC,EAAA,OAAO,SACJ,CAAA,iBAAA,CAAkB,qBAAqB,CAAA,EACtC,mBAAmB,mBAAmB,CAAA;AAC5C;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useIsPodExecTerminalEnabled.esm.js","sources":["../../src/hooks/useIsPodExecTerminalEnabled.ts"],"sourcesContent":["/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { configApiRef, useApi } from '@backstage/core-plugin-api';\n\n/**\n * Check if conditions for a pod exec call through the proxy endpoint are met\n *\n * @internal\n */\nexport const useIsPodExecTerminalEnabled = (): boolean | undefined => {\n const configApi = useApi(configApiRef);\n\n return configApi.getOptionalBoolean('kubernetes.podExecTerminal.enabled');\n};\n"],"names":[],"mappings":";;AAsBO,MAAM,8BAA8B,MAA2B;AACpE,EAAM,MAAA,SAAA,GAAY,OAAO,YAAY,CAAA
|
|
1
|
+
{"version":3,"file":"useIsPodExecTerminalEnabled.esm.js","sources":["../../src/hooks/useIsPodExecTerminalEnabled.ts"],"sourcesContent":["/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { configApiRef, useApi } from '@backstage/core-plugin-api';\n\n/**\n * Check if conditions for a pod exec call through the proxy endpoint are met\n *\n * @internal\n */\nexport const useIsPodExecTerminalEnabled = (): boolean | undefined => {\n const configApi = useApi(configApiRef);\n\n return configApi.getOptionalBoolean('kubernetes.podExecTerminal.enabled');\n};\n"],"names":[],"mappings":";;AAsBO,MAAM,8BAA8B,MAA2B;AACpE,EAAM,MAAA,SAAA,GAAY,OAAO,YAAY,CAAA;AAErC,EAAO,OAAA,SAAA,CAAU,mBAAmB,oCAAoC,CAAA;AAC1E;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useIsPodExecTerminalSupported.esm.js","sources":["../../src/hooks/useIsPodExecTerminalSupported.ts"],"sourcesContent":["/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { useApi } from '@backstage/core-plugin-api';\nimport useAsync, { AsyncState } from 'react-use/esm/useAsync';\n\nimport { kubernetesApiRef } from '../api/types';\n\n/**\n * Check if conditions for a pod exec call through the proxy endpoint are met\n *\n * @internal\n */\nexport const useIsPodExecTerminalSupported = (): AsyncState<boolean> => {\n const kubernetesApi = useApi(kubernetesApiRef);\n\n return useAsync(async () => {\n const clusters = await kubernetesApi.getClusters();\n\n if (clusters.length !== 1) {\n return false;\n }\n\n const { authProvider } = clusters[0];\n const isClientAuthProvider = ['aks', 'google', 'oidc'].some(\n authProviderName => authProvider.includes(authProviderName),\n );\n\n return !isClientAuthProvider;\n });\n};\n"],"names":[],"mappings":";;;;AAyBO,MAAM,gCAAgC,MAA2B;AACtE,EAAM,MAAA,aAAA,GAAgB,OAAO,gBAAgB,CAAA
|
|
1
|
+
{"version":3,"file":"useIsPodExecTerminalSupported.esm.js","sources":["../../src/hooks/useIsPodExecTerminalSupported.ts"],"sourcesContent":["/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { useApi } from '@backstage/core-plugin-api';\nimport useAsync, { AsyncState } from 'react-use/esm/useAsync';\n\nimport { kubernetesApiRef } from '../api/types';\n\n/**\n * Check if conditions for a pod exec call through the proxy endpoint are met\n *\n * @internal\n */\nexport const useIsPodExecTerminalSupported = (): AsyncState<boolean> => {\n const kubernetesApi = useApi(kubernetesApiRef);\n\n return useAsync(async () => {\n const clusters = await kubernetesApi.getClusters();\n\n if (clusters.length !== 1) {\n return false;\n }\n\n const { authProvider } = clusters[0];\n const isClientAuthProvider = ['aks', 'google', 'oidc'].some(\n authProviderName => authProvider.includes(authProviderName),\n );\n\n return !isClientAuthProvider;\n });\n};\n"],"names":[],"mappings":";;;;AAyBO,MAAM,gCAAgC,MAA2B;AACtE,EAAM,MAAA,aAAA,GAAgB,OAAO,gBAAgB,CAAA;AAE7C,EAAA,OAAO,SAAS,YAAY;AAC1B,IAAM,MAAA,QAAA,GAAW,MAAM,aAAA,CAAc,WAAY,EAAA;AAEjD,IAAI,IAAA,QAAA,CAAS,WAAW,CAAG,EAAA;AACzB,MAAO,OAAA,KAAA;AAAA;AAGT,IAAA,MAAM,EAAE,YAAA,EAAiB,GAAA,QAAA,CAAS,CAAC,CAAA;AACnC,IAAA,MAAM,oBAAuB,GAAA,CAAC,KAAO,EAAA,QAAA,EAAU,MAAM,CAAE,CAAA,IAAA;AAAA,MACrD,CAAA,gBAAA,KAAoB,YAAa,CAAA,QAAA,CAAS,gBAAgB;AAAA,KAC5D;AAEA,IAAA,OAAO,CAAC,oBAAA;AAAA,GACT,CAAA;AACH;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useKubernetesObjects.esm.js","sources":["../../src/hooks/useKubernetesObjects.ts"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { Entity } from '@backstage/catalog-model';\nimport { useCallback } from 'react';\nimport useInterval from 'react-use/esm/useInterval';\nimport { ObjectsByEntityResponse } from '@backstage/plugin-kubernetes-common';\nimport { useApi } from '@backstage/core-plugin-api';\nimport { generateAuth } from './auth';\nimport useAsyncRetry from 'react-use/esm/useAsyncRetry';\nimport { kubernetesAuthProvidersApiRef } from '../kubernetes-auth-provider';\nimport { kubernetesApiRef } from '../api/types';\n\n/**\n *\n * @public\n */\nexport interface KubernetesObjects {\n kubernetesObjects?: ObjectsByEntityResponse;\n loading: boolean;\n error?: string;\n}\n\n/**\n *\n * @public\n */\nexport const useKubernetesObjects = (\n entity: Entity,\n intervalMs: number = 10000,\n): KubernetesObjects => {\n const kubernetesApi = useApi(kubernetesApiRef);\n const kubernetesAuthProvidersApi = useApi(kubernetesAuthProvidersApiRef);\n const getObjects = useCallback(async (): Promise<ObjectsByEntityResponse> => {\n const auth = await generateAuth(\n entity,\n kubernetesApi,\n kubernetesAuthProvidersApi,\n );\n return await kubernetesApi.getObjectsByEntity({\n auth,\n entity,\n });\n }, [kubernetesApi, entity, kubernetesAuthProvidersApi]);\n\n const { value, loading, error, retry } = useAsyncRetry(\n () => getObjects(),\n [getObjects],\n );\n\n useInterval(() => retry(), intervalMs);\n\n return {\n kubernetesObjects: value,\n loading,\n error: error?.message,\n };\n};\n"],"names":[],"mappings":";;;;;;;;AAwCO,MAAM,oBAAuB,GAAA,CAClC,MACA,EAAA,UAAA,GAAqB,GACC,KAAA;AACtB,EAAM,MAAA,aAAA,GAAgB,OAAO,gBAAgB,CAAA
|
|
1
|
+
{"version":3,"file":"useKubernetesObjects.esm.js","sources":["../../src/hooks/useKubernetesObjects.ts"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { Entity } from '@backstage/catalog-model';\nimport { useCallback } from 'react';\nimport useInterval from 'react-use/esm/useInterval';\nimport { ObjectsByEntityResponse } from '@backstage/plugin-kubernetes-common';\nimport { useApi } from '@backstage/core-plugin-api';\nimport { generateAuth } from './auth';\nimport useAsyncRetry from 'react-use/esm/useAsyncRetry';\nimport { kubernetesAuthProvidersApiRef } from '../kubernetes-auth-provider';\nimport { kubernetesApiRef } from '../api/types';\n\n/**\n *\n * @public\n */\nexport interface KubernetesObjects {\n kubernetesObjects?: ObjectsByEntityResponse;\n loading: boolean;\n error?: string;\n}\n\n/**\n *\n * @public\n */\nexport const useKubernetesObjects = (\n entity: Entity,\n intervalMs: number = 10000,\n): KubernetesObjects => {\n const kubernetesApi = useApi(kubernetesApiRef);\n const kubernetesAuthProvidersApi = useApi(kubernetesAuthProvidersApiRef);\n const getObjects = useCallback(async (): Promise<ObjectsByEntityResponse> => {\n const auth = await generateAuth(\n entity,\n kubernetesApi,\n kubernetesAuthProvidersApi,\n );\n return await kubernetesApi.getObjectsByEntity({\n auth,\n entity,\n });\n }, [kubernetesApi, entity, kubernetesAuthProvidersApi]);\n\n const { value, loading, error, retry } = useAsyncRetry(\n () => getObjects(),\n [getObjects],\n );\n\n useInterval(() => retry(), intervalMs);\n\n return {\n kubernetesObjects: value,\n loading,\n error: error?.message,\n };\n};\n"],"names":[],"mappings":";;;;;;;;AAwCO,MAAM,oBAAuB,GAAA,CAClC,MACA,EAAA,UAAA,GAAqB,GACC,KAAA;AACtB,EAAM,MAAA,aAAA,GAAgB,OAAO,gBAAgB,CAAA;AAC7C,EAAM,MAAA,0BAAA,GAA6B,OAAO,6BAA6B,CAAA;AACvE,EAAM,MAAA,UAAA,GAAa,YAAY,YAA8C;AAC3E,IAAA,MAAM,OAAO,MAAM,YAAA;AAAA,MACjB,MAAA;AAAA,MACA,aAAA;AAAA,MACA;AAAA,KACF;AACA,IAAO,OAAA,MAAM,cAAc,kBAAmB,CAAA;AAAA,MAC5C,IAAA;AAAA,MACA;AAAA,KACD,CAAA;AAAA,GACA,EAAA,CAAC,aAAe,EAAA,MAAA,EAAQ,0BAA0B,CAAC,CAAA;AAEtD,EAAA,MAAM,EAAE,KAAA,EAAO,OAAS,EAAA,KAAA,EAAO,OAAU,GAAA,aAAA;AAAA,IACvC,MAAM,UAAW,EAAA;AAAA,IACjB,CAAC,UAAU;AAAA,GACb;AAEA,EAAY,WAAA,CAAA,MAAM,KAAM,EAAA,EAAG,UAAU,CAAA;AAErC,EAAO,OAAA;AAAA,IACL,iBAAmB,EAAA,KAAA;AAAA,IACnB,OAAA;AAAA,IACA,OAAO,KAAO,EAAA;AAAA,GAChB;AACF;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useMatchingErrors.esm.js","sources":["../../src/hooks/useMatchingErrors.ts"],"sourcesContent":["/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React, { useContext } from 'react';\nimport {\n DetectedError,\n ResourceRef,\n} from '@backstage/plugin-kubernetes-common';\nimport { TypeMeta } from '@kubernetes-models/base';\nimport { IIoK8sApimachineryPkgApisMetaV1ObjectMeta as V1ObjectMeta } from '@kubernetes-models/apimachinery/apis/meta/v1/ObjectMeta';\n\n/**\n * Context for detected errors\n *\n * @public\n */\nexport const DetectedErrorsContext = React.createContext<DetectedError[]>([]);\n\n/**\n *\n * @public\n */\nexport type ErrorMatcher = {\n metadata?: V1ObjectMeta;\n} & TypeMeta;\n\n/**\n * Find errors which match the resource\n *\n * @public\n */\nexport const useMatchingErrors = (matcher: ErrorMatcher): DetectedError[] => {\n const targetRef: ResourceRef = {\n name: matcher.metadata?.name ?? '',\n namespace: matcher.metadata?.namespace ?? '',\n kind: matcher.kind,\n apiGroup: matcher.apiVersion,\n };\n\n const errors = useContext(DetectedErrorsContext);\n\n return errors.filter(e => {\n const r = e.sourceRef;\n return (\n targetRef.apiGroup === r.apiGroup &&\n targetRef.kind === r.kind &&\n targetRef.name === r.name &&\n targetRef.namespace === r.namespace\n );\n });\n};\n"],"names":["React"],"mappings":";;AA4BO,MAAM,qBAAwB,GAAAA,cAAA,CAAM,aAA+B,CAAA,EAAE
|
|
1
|
+
{"version":3,"file":"useMatchingErrors.esm.js","sources":["../../src/hooks/useMatchingErrors.ts"],"sourcesContent":["/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React, { useContext } from 'react';\nimport {\n DetectedError,\n ResourceRef,\n} from '@backstage/plugin-kubernetes-common';\nimport { TypeMeta } from '@kubernetes-models/base';\nimport { IIoK8sApimachineryPkgApisMetaV1ObjectMeta as V1ObjectMeta } from '@kubernetes-models/apimachinery/apis/meta/v1/ObjectMeta';\n\n/**\n * Context for detected errors\n *\n * @public\n */\nexport const DetectedErrorsContext = React.createContext<DetectedError[]>([]);\n\n/**\n *\n * @public\n */\nexport type ErrorMatcher = {\n metadata?: V1ObjectMeta;\n} & TypeMeta;\n\n/**\n * Find errors which match the resource\n *\n * @public\n */\nexport const useMatchingErrors = (matcher: ErrorMatcher): DetectedError[] => {\n const targetRef: ResourceRef = {\n name: matcher.metadata?.name ?? '',\n namespace: matcher.metadata?.namespace ?? '',\n kind: matcher.kind,\n apiGroup: matcher.apiVersion,\n };\n\n const errors = useContext(DetectedErrorsContext);\n\n return errors.filter(e => {\n const r = e.sourceRef;\n return (\n targetRef.apiGroup === r.apiGroup &&\n targetRef.kind === r.kind &&\n targetRef.name === r.name &&\n targetRef.namespace === r.namespace\n );\n });\n};\n"],"names":["React"],"mappings":";;AA4BO,MAAM,qBAAwB,GAAAA,cAAA,CAAM,aAA+B,CAAA,EAAE;AAe/D,MAAA,iBAAA,GAAoB,CAAC,OAA2C,KAAA;AAC3E,EAAA,MAAM,SAAyB,GAAA;AAAA,IAC7B,IAAA,EAAM,OAAQ,CAAA,QAAA,EAAU,IAAQ,IAAA,EAAA;AAAA,IAChC,SAAA,EAAW,OAAQ,CAAA,QAAA,EAAU,SAAa,IAAA,EAAA;AAAA,IAC1C,MAAM,OAAQ,CAAA,IAAA;AAAA,IACd,UAAU,OAAQ,CAAA;AAAA,GACpB;AAEA,EAAM,MAAA,MAAA,GAAS,WAAW,qBAAqB,CAAA;AAE/C,EAAO,OAAA,MAAA,CAAO,OAAO,CAAK,CAAA,KAAA;AACxB,IAAA,MAAM,IAAI,CAAE,CAAA,SAAA;AACZ,IAAA,OACE,SAAU,CAAA,QAAA,KAAa,CAAE,CAAA,QAAA,IACzB,UAAU,IAAS,KAAA,CAAA,CAAE,IACrB,IAAA,SAAA,CAAU,IAAS,KAAA,CAAA,CAAE,IACrB,IAAA,SAAA,CAAU,cAAc,CAAE,CAAA,SAAA;AAAA,GAE7B,CAAA;AACH;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"usePodMetrics.esm.js","sources":["../../src/hooks/usePodMetrics.ts"],"sourcesContent":["/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React, { useContext } from 'react';\nimport { IObjectMeta } from '@kubernetes-models/apimachinery/apis/meta/v1/ObjectMeta';\nimport { ClientPodStatus } from '@backstage/plugin-kubernetes-common';\n\n/**\n * Context for Pod Metrics\n *\n * @public\n */\nexport const PodMetricsContext = React.createContext<\n Map<string, ClientPodStatus[]>\n>(new Map());\n\n/**\n * @public\n */\nexport type PodMetricsMatcher = {\n metadata?: IObjectMeta;\n};\n\n/**\n * Find metrics matching the provided pod\n *\n * @public\n */\nexport const usePodMetrics = (\n clusterName: string,\n matcher: PodMetricsMatcher,\n): ClientPodStatus | undefined => {\n const targetRef = {\n name: matcher.metadata?.name ?? '',\n namespace: matcher.metadata?.namespace ?? '',\n };\n\n const metricsMap = useContext(PodMetricsContext);\n\n const metrics = metricsMap.get(clusterName);\n\n return metrics?.find(m => {\n const pod = m.pod;\n return (\n targetRef.name === (pod.metadata?.name ?? '') &&\n targetRef.namespace === (pod.metadata?.namespace ?? '')\n );\n });\n};\n"],"names":["React"],"mappings":";;AAwBO,MAAM,iBAAoB,GAAAA,cAAA,CAAM,aAErC,iBAAA,IAAI,KAAK
|
|
1
|
+
{"version":3,"file":"usePodMetrics.esm.js","sources":["../../src/hooks/usePodMetrics.ts"],"sourcesContent":["/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React, { useContext } from 'react';\nimport { IObjectMeta } from '@kubernetes-models/apimachinery/apis/meta/v1/ObjectMeta';\nimport { ClientPodStatus } from '@backstage/plugin-kubernetes-common';\n\n/**\n * Context for Pod Metrics\n *\n * @public\n */\nexport const PodMetricsContext = React.createContext<\n Map<string, ClientPodStatus[]>\n>(new Map());\n\n/**\n * @public\n */\nexport type PodMetricsMatcher = {\n metadata?: IObjectMeta;\n};\n\n/**\n * Find metrics matching the provided pod\n *\n * @public\n */\nexport const usePodMetrics = (\n clusterName: string,\n matcher: PodMetricsMatcher,\n): ClientPodStatus | undefined => {\n const targetRef = {\n name: matcher.metadata?.name ?? '',\n namespace: matcher.metadata?.namespace ?? '',\n };\n\n const metricsMap = useContext(PodMetricsContext);\n\n const metrics = metricsMap.get(clusterName);\n\n return metrics?.find(m => {\n const pod = m.pod;\n return (\n targetRef.name === (pod.metadata?.name ?? '') &&\n targetRef.namespace === (pod.metadata?.namespace ?? '')\n );\n });\n};\n"],"names":["React"],"mappings":";;AAwBO,MAAM,iBAAoB,GAAAA,cAAA,CAAM,aAErC,iBAAA,IAAI,KAAK;AAcE,MAAA,aAAA,GAAgB,CAC3B,WAAA,EACA,OACgC,KAAA;AAChC,EAAA,MAAM,SAAY,GAAA;AAAA,IAChB,IAAA,EAAM,OAAQ,CAAA,QAAA,EAAU,IAAQ,IAAA,EAAA;AAAA,IAChC,SAAA,EAAW,OAAQ,CAAA,QAAA,EAAU,SAAa,IAAA;AAAA,GAC5C;AAEA,EAAM,MAAA,UAAA,GAAa,WAAW,iBAAiB,CAAA;AAE/C,EAAM,MAAA,OAAA,GAAU,UAAW,CAAA,GAAA,CAAI,WAAW,CAAA;AAE1C,EAAO,OAAA,OAAA,EAAS,KAAK,CAAK,CAAA,KAAA;AACxB,IAAA,MAAM,MAAM,CAAE,CAAA,GAAA;AACd,IACE,OAAA,SAAA,CAAU,IAAU,MAAA,GAAA,CAAI,QAAU,EAAA,IAAA,IAAQ,OAC1C,SAAU,CAAA,SAAA,MAAe,GAAI,CAAA,QAAA,EAAU,SAAa,IAAA,EAAA,CAAA;AAAA,GAEvD,CAAA;AACH;;;;"}
|
package/dist/index.d.ts
CHANGED
|
@@ -135,6 +135,13 @@ interface KubernetesProxyApi {
|
|
|
135
135
|
}): Promise<{
|
|
136
136
|
text: string;
|
|
137
137
|
}>;
|
|
138
|
+
deletePod(request: {
|
|
139
|
+
podName: string;
|
|
140
|
+
namespace: string;
|
|
141
|
+
clusterName: string;
|
|
142
|
+
}): Promise<{
|
|
143
|
+
text: string;
|
|
144
|
+
}>;
|
|
138
145
|
getEventsByInvolvedObjectName(request: {
|
|
139
146
|
clusterName: string;
|
|
140
147
|
involvedObjectName: string;
|
|
@@ -317,6 +324,13 @@ declare class KubernetesProxyClient {
|
|
|
317
324
|
}): Promise<{
|
|
318
325
|
text: string;
|
|
319
326
|
}>;
|
|
327
|
+
deletePod({ podName, namespace, clusterName, }: {
|
|
328
|
+
podName: string;
|
|
329
|
+
namespace: string;
|
|
330
|
+
clusterName: string;
|
|
331
|
+
}): Promise<{
|
|
332
|
+
text: string;
|
|
333
|
+
}>;
|
|
320
334
|
}
|
|
321
335
|
|
|
322
336
|
/** @public */
|
package/dist/index.esm.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export { useIsPodDeleteEnabled } from './hooks/useIsPodDeleteEnabled.esm.js';
|
|
1
2
|
export { useIsPodExecTerminalEnabled } from './hooks/useIsPodExecTerminalEnabled.esm.js';
|
|
2
3
|
export { useIsPodExecTerminalSupported } from './hooks/useIsPodExecTerminalSupported.esm.js';
|
|
3
4
|
export { useKubernetesObjects } from './hooks/useKubernetesObjects.esm.js';
|
package/dist/index.esm.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AksKubernetesAuthProvider.esm.js","sources":["../../src/kubernetes-auth-provider/AksKubernetesAuthProvider.ts"],"sourcesContent":["/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { OAuthApi } from '@backstage/core-plugin-api';\nimport { KubernetesRequestBody } from '@backstage/plugin-kubernetes-common';\nimport { KubernetesAuthProvider } from './types';\n\n/** @public */\nexport class AksKubernetesAuthProvider implements KubernetesAuthProvider {\n constructor(private readonly microsoftAuthApi: OAuthApi) {}\n\n async decorateRequestBodyForAuth(\n requestBody: KubernetesRequestBody,\n ): Promise<KubernetesRequestBody> {\n return {\n ...requestBody,\n auth: { ...requestBody.auth, aks: (await this.getCredentials()).token },\n };\n }\n\n async getCredentials(): Promise<{ token?: string }> {\n return {\n token: await this.microsoftAuthApi.getAccessToken(\n '6dae42f8-4368-4678-94ff-3960e28e3630/user.read',\n ),\n };\n }\n}\n"],"names":[],"mappings":"AAoBO,MAAM,yBAA4D,CAAA;AAAA,EACvE,YAA6B,gBAA4B,EAAA;AAA5B,IAAA,IAAA,CAAA,gBAAA,GAAA,gBAAA
|
|
1
|
+
{"version":3,"file":"AksKubernetesAuthProvider.esm.js","sources":["../../src/kubernetes-auth-provider/AksKubernetesAuthProvider.ts"],"sourcesContent":["/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { OAuthApi } from '@backstage/core-plugin-api';\nimport { KubernetesRequestBody } from '@backstage/plugin-kubernetes-common';\nimport { KubernetesAuthProvider } from './types';\n\n/** @public */\nexport class AksKubernetesAuthProvider implements KubernetesAuthProvider {\n constructor(private readonly microsoftAuthApi: OAuthApi) {}\n\n async decorateRequestBodyForAuth(\n requestBody: KubernetesRequestBody,\n ): Promise<KubernetesRequestBody> {\n return {\n ...requestBody,\n auth: { ...requestBody.auth, aks: (await this.getCredentials()).token },\n };\n }\n\n async getCredentials(): Promise<{ token?: string }> {\n return {\n token: await this.microsoftAuthApi.getAccessToken(\n '6dae42f8-4368-4678-94ff-3960e28e3630/user.read',\n ),\n };\n }\n}\n"],"names":[],"mappings":"AAoBO,MAAM,yBAA4D,CAAA;AAAA,EACvE,YAA6B,gBAA4B,EAAA;AAA5B,IAAA,IAAA,CAAA,gBAAA,GAAA,gBAAA;AAAA;AAA6B,EAE1D,MAAM,2BACJ,WACgC,EAAA;AAChC,IAAO,OAAA;AAAA,MACL,GAAG,WAAA;AAAA,MACH,IAAA,EAAM,EAAE,GAAG,WAAY,CAAA,IAAA,EAAM,MAAM,MAAM,IAAA,CAAK,cAAe,EAAA,EAAG,KAAM;AAAA,KACxE;AAAA;AACF,EAEA,MAAM,cAA8C,GAAA;AAClD,IAAO,OAAA;AAAA,MACL,KAAA,EAAO,MAAM,IAAA,CAAK,gBAAiB,CAAA,cAAA;AAAA,QACjC;AAAA;AACF,KACF;AAAA;AAEJ;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GoogleKubernetesAuthProvider.esm.js","sources":["../../src/kubernetes-auth-provider/GoogleKubernetesAuthProvider.ts"],"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 { KubernetesAuthProvider } from './types';\nimport { KubernetesRequestBody } from '@backstage/plugin-kubernetes-common';\nimport { OAuthApi } from '@backstage/core-plugin-api';\n\n/** @public */\nexport class GoogleKubernetesAuthProvider implements KubernetesAuthProvider {\n authProvider: OAuthApi;\n\n constructor(authProvider: OAuthApi) {\n this.authProvider = authProvider;\n }\n\n async decorateRequestBodyForAuth(\n requestBody: KubernetesRequestBody,\n ): Promise<KubernetesRequestBody> {\n const googleAuthToken: string = (await this.getCredentials()).token;\n if ('auth' in requestBody) {\n requestBody.auth!.google = googleAuthToken;\n } else {\n requestBody.auth = { google: googleAuthToken };\n }\n return requestBody;\n }\n async getCredentials(): Promise<{ token: string }> {\n return {\n token: await this.authProvider.getAccessToken(\n 'https://www.googleapis.com/auth/cloud-platform.read-only',\n ),\n };\n }\n}\n"],"names":[],"mappings":"AAqBO,MAAM,4BAA+D,CAAA;AAAA,EAC1E,YAAA
|
|
1
|
+
{"version":3,"file":"GoogleKubernetesAuthProvider.esm.js","sources":["../../src/kubernetes-auth-provider/GoogleKubernetesAuthProvider.ts"],"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 { KubernetesAuthProvider } from './types';\nimport { KubernetesRequestBody } from '@backstage/plugin-kubernetes-common';\nimport { OAuthApi } from '@backstage/core-plugin-api';\n\n/** @public */\nexport class GoogleKubernetesAuthProvider implements KubernetesAuthProvider {\n authProvider: OAuthApi;\n\n constructor(authProvider: OAuthApi) {\n this.authProvider = authProvider;\n }\n\n async decorateRequestBodyForAuth(\n requestBody: KubernetesRequestBody,\n ): Promise<KubernetesRequestBody> {\n const googleAuthToken: string = (await this.getCredentials()).token;\n if ('auth' in requestBody) {\n requestBody.auth!.google = googleAuthToken;\n } else {\n requestBody.auth = { google: googleAuthToken };\n }\n return requestBody;\n }\n async getCredentials(): Promise<{ token: string }> {\n return {\n token: await this.authProvider.getAccessToken(\n 'https://www.googleapis.com/auth/cloud-platform.read-only',\n ),\n };\n }\n}\n"],"names":[],"mappings":"AAqBO,MAAM,4BAA+D,CAAA;AAAA,EAC1E,YAAA;AAAA,EAEA,YAAY,YAAwB,EAAA;AAClC,IAAA,IAAA,CAAK,YAAe,GAAA,YAAA;AAAA;AACtB,EAEA,MAAM,2BACJ,WACgC,EAAA;AAChC,IAAA,MAAM,eAA2B,GAAA,CAAA,MAAM,IAAK,CAAA,cAAA,EAAkB,EAAA,KAAA;AAC9D,IAAA,IAAI,UAAU,WAAa,EAAA;AACzB,MAAA,WAAA,CAAY,KAAM,MAAS,GAAA,eAAA;AAAA,KACtB,MAAA;AACL,MAAY,WAAA,CAAA,IAAA,GAAO,EAAE,MAAA,EAAQ,eAAgB,EAAA;AAAA;AAE/C,IAAO,OAAA,WAAA;AAAA;AACT,EACA,MAAM,cAA6C,GAAA;AACjD,IAAO,OAAA;AAAA,MACL,KAAA,EAAO,MAAM,IAAA,CAAK,YAAa,CAAA,cAAA;AAAA,QAC7B;AAAA;AACF,KACF;AAAA;AAEJ;;;;"}
|