@backstage/plugin-kubernetes-react 0.5.9 → 0.5.10
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 +19 -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.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/HeadlampClusterLinksFormatter.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.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.map +1 -1
- package/dist/components/Pods/PodDelete/usePodDelete.esm.js.map +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.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/PodNamesWithMetrics.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.map +1 -1
- 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/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.map +1 -1
- 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 +4 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PendingPodContent.esm.js","sources":["../../../../src/components/Pods/PodDrawer/PendingPodContent.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 List from '@material-ui/core/List';\nimport ListItem from '@material-ui/core/ListItem';\nimport Typography from '@material-ui/core/Typography';\nimport { IPodCondition, Pod } from 'kubernetes-models/v1';\nimport {\n StatusError,\n StatusOK,\n StatusWarning,\n} from '@backstage/core-components';\nimport { DateTime } from 'luxon';\n\ninterface PodConditionProps {\n condition: IPodCondition;\n}\n\nconst PodCondition = ({ condition }: PodConditionProps) => {\n return (\n <>\n {condition.status === 'False' && (\n <StatusError>\n {condition.type} - ({condition.reason}{' '}\n {condition.lastTransitionTime &&\n DateTime.fromISO(condition.lastTransitionTime).toRelative({\n locale: 'en',\n })}\n ) - {condition.message}{' '}\n </StatusError>\n )}\n {condition.status === 'True' && (\n <StatusOK>\n {condition.type} - (\n {condition.lastTransitionTime &&\n DateTime.fromISO(condition.lastTransitionTime).toRelative({\n locale: 'en',\n })}\n )\n </StatusOK>\n )}\n {condition.status === 'Unknown' && (\n <StatusWarning>\n {condition.type} - (\n {condition.lastTransitionTime &&\n DateTime.fromISO(condition.lastTransitionTime).toRelative({\n locale: 'en',\n })}\n ) {condition.message}\n </StatusWarning>\n )}\n </>\n );\n};\n\n/**\n * Props for PendingPodContent\n *\n * @public\n */\nexport interface PendingPodContentProps {\n pod: Pod;\n}\n\n/**\n * Shows details about pod's conditions as it starts\n *\n * @public\n */\nexport const PendingPodContent = ({ pod }: PendingPodContentProps) => {\n // TODO add PodHasNetwork when it's out of alpha\n // https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/#pod-conditions\n const startupConditions = [\n pod.status?.conditions?.find(c => c.type === 'PodScheduled'),\n pod.status?.conditions?.find(c => c.type === 'Initialized'),\n pod.status?.conditions?.find(c => c.type === 'ContainersReady'),\n pod.status?.conditions?.find(c => c.type === 'Ready'),\n ].filter((c): c is IPodCondition => !!c); // filter out undefined\n return (\n <Grid container spacing={2}>\n <Grid item xs={12}>\n <Typography variant=\"h5\">Pod is Pending. Conditions:</Typography>\n <List>\n {startupConditions.map(c => (\n <ListItem key={c.type}>\n <PodCondition condition={c} />\n </ListItem>\n ))}\n </List>\n </Grid>\n </Grid>\n );\n};\n"],"names":[],"mappings":";;;;;;;;AA+BA,MAAM,
|
|
1
|
+
{"version":3,"file":"PendingPodContent.esm.js","sources":["../../../../src/components/Pods/PodDrawer/PendingPodContent.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 List from '@material-ui/core/List';\nimport ListItem from '@material-ui/core/ListItem';\nimport Typography from '@material-ui/core/Typography';\nimport { IPodCondition, Pod } from 'kubernetes-models/v1';\nimport {\n StatusError,\n StatusOK,\n StatusWarning,\n} from '@backstage/core-components';\nimport { DateTime } from 'luxon';\n\ninterface PodConditionProps {\n condition: IPodCondition;\n}\n\nconst PodCondition = ({ condition }: PodConditionProps) => {\n return (\n <>\n {condition.status === 'False' && (\n <StatusError>\n {condition.type} - ({condition.reason}{' '}\n {condition.lastTransitionTime &&\n DateTime.fromISO(condition.lastTransitionTime).toRelative({\n locale: 'en',\n })}\n ) - {condition.message}{' '}\n </StatusError>\n )}\n {condition.status === 'True' && (\n <StatusOK>\n {condition.type} - (\n {condition.lastTransitionTime &&\n DateTime.fromISO(condition.lastTransitionTime).toRelative({\n locale: 'en',\n })}\n )\n </StatusOK>\n )}\n {condition.status === 'Unknown' && (\n <StatusWarning>\n {condition.type} - (\n {condition.lastTransitionTime &&\n DateTime.fromISO(condition.lastTransitionTime).toRelative({\n locale: 'en',\n })}\n ) {condition.message}\n </StatusWarning>\n )}\n </>\n );\n};\n\n/**\n * Props for PendingPodContent\n *\n * @public\n */\nexport interface PendingPodContentProps {\n pod: Pod;\n}\n\n/**\n * Shows details about pod's conditions as it starts\n *\n * @public\n */\nexport const PendingPodContent = ({ pod }: PendingPodContentProps) => {\n // TODO add PodHasNetwork when it's out of alpha\n // https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/#pod-conditions\n const startupConditions = [\n pod.status?.conditions?.find(c => c.type === 'PodScheduled'),\n pod.status?.conditions?.find(c => c.type === 'Initialized'),\n pod.status?.conditions?.find(c => c.type === 'ContainersReady'),\n pod.status?.conditions?.find(c => c.type === 'Ready'),\n ].filter((c): c is IPodCondition => !!c); // filter out undefined\n return (\n <Grid container spacing={2}>\n <Grid item xs={12}>\n <Typography variant=\"h5\">Pod is Pending. Conditions:</Typography>\n <List>\n {startupConditions.map(c => (\n <ListItem key={c.type}>\n <PodCondition condition={c} />\n </ListItem>\n ))}\n </List>\n </Grid>\n </Grid>\n );\n};\n"],"names":[],"mappings":";;;;;;;;AA+BA,MAAM,YAAA,GAAe,CAAC,EAAE,SA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B;AAAA,IACxB,IAAI,MAAA,EAAQ,UAAA,EAAY,KAAK,CAAA,CAAA,KAAK,CAAA,CAAE,SAAS,cAAc,CAAA;AAAA,IAC3D,IAAI,MAAA,EAAQ,UAAA,EAAY,KAAK,CAAA,CAAA,KAAK,CAAA,CAAE,SAAS,aAAa,CAAA;AAAA,IAC1D,IAAI,MAAA,EAAQ,UAAA,EAAY,KAAK,CAAA,CAAA,KAAK,CAAA,CAAE,SAAS,iBAAiB,CAAA;AAAA,IAC9D,IAAI,MAAA,EAAQ,UAAA,EAAY,KAAK,CAAA,CAAA,KAAK,CAAA,CAAE,SAAS,OAAO;AAAA,IACpD,MAAA,CAAO,CAAC,CAAA,KAA0B,CAAC,CAAC,CAAC,CAAA;AACvC,EAAA,uBACE,GAAA,CAAC,IAAA,EAAA,EAAK,SAAA,EAAS,IAAA,EAAC,OAAA,EAAS,CAAA,EACvB,QAAA,kBAAA,IAAA,CAAC,IAAA,EAAA,EAAK,IAAA,EAAI,IAAA,EAAC,EAAA,EAAI,EAAA,EACb,QAAA,EAAA;AAAA,oBAAA,GAAA,CAAC,UAAA,EAAA,EAAW,OAAA,EAAQ,IAAA,EAAK,QAAA,EAAA,6BAAA,EAA2B,CAAA;AAAA,oBACpD,GAAA,CAAC,IAAA,EAAA,EACE,QAAA,EAAA,iBAAA,CAAkB,GAAA,CAAI,uBACrB,GAAA,CAAC,QAAA,EAAA,EACC,QAAA,kBAAA,GAAA,CAAC,YAAA,EAAA,EAAa,WAAW,CAAA,EAAG,CAAA,EAAA,EADf,CAAA,CAAE,IAEjB,CACD,CAAA,EACH;AAAA,GAAA,EACF,CAAA,EACF,CAAA;AAEJ;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PodDrawer.esm.js","sources":["../../../../src/components/Pods/PodDrawer/PodDrawer.tsx"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { ItemCardGrid } from '@backstage/core-components';\nimport Grid from '@material-ui/core/Grid';\nimport Typography from '@material-ui/core/Typography';\nimport { createStyles, makeStyles, Theme } from '@material-ui/core/styles';\n\nimport { Pod } from 'kubernetes-models/v1';\n\nimport { ContainerCard } from './ContainerCard';\n\nimport { PodAndErrors } from '../types';\nimport { KubernetesDrawer } from '../../KubernetesDrawer';\nimport { PodDeleteButton } from '../PodDelete/PodDeleteButton';\nimport { PendingPodContent } from './PendingPodContent';\nimport { ErrorList } from '../ErrorList';\nimport { usePodMetrics } from '../../../hooks/usePodMetrics';\nimport { ResourceUtilization } from '../../ResourceUtilization';\nimport { bytesToMiB, formatMillicores } from '../../../utils/resources';\nimport { useIsPodDeleteEnabled } from '../../../hooks';\n\nconst useDrawerContentStyles = makeStyles((_theme: Theme) =>\n createStyles({\n header: {\n display: 'flex',\n flexDirection: 'row',\n justifyContent: 'space-between',\n },\n content: {\n height: '80%',\n },\n icon: {\n fontSize: 20,\n },\n podoklist: {\n width: '100%',\n maxWidth: 360,\n maxHeight: 360,\n },\n }),\n);\n\nfunction getContainerSpecByName(pod: Pod, containerName: string) {\n return pod.spec?.containers.find(c => c.name === containerName);\n}\n\n/**\n * Props for PodDrawer\n *\n * @public\n */\nexport interface PodDrawerProps {\n open?: boolean;\n podAndErrors: PodAndErrors;\n}\n\n/**\n * A Drawer for Kubernetes Pods\n *\n * @public\n */\nexport const PodDrawer = ({ podAndErrors, open }: PodDrawerProps) => {\n const classes = useDrawerContentStyles();\n const podMetrics = usePodMetrics(podAndErrors.cluster.name, podAndErrors.pod);\n const isPodDeleteEnabled = useIsPodDeleteEnabled();\n\n return (\n <KubernetesDrawer\n open={open}\n drawerContentsHeader={\n <Typography variant=\"subtitle1\">\n Pod{' '}\n {podAndErrors.pod.status?.podIP &&\n `(${podAndErrors.pod.status?.podIP})`}\n </Typography>\n }\n kubernetesObject={podAndErrors.pod}\n label={\n <Typography variant=\"subtitle1\">\n {podAndErrors.pod.metadata?.name ?? 'unknown'}\n </Typography>\n }\n >\n <div className={classes.content}>\n {isPodDeleteEnabled && (\n <PodDeleteButton\n podScope={{\n podName: podAndErrors.pod.metadata?.name ?? 'unknown',\n podNamespace: podAndErrors.pod.metadata?.namespace ?? 'default',\n cluster: podAndErrors.cluster,\n }}\n />\n )}\n {podMetrics && (\n <Grid container item xs={12}>\n <Grid item xs={12}>\n <Typography variant=\"h5\">Resource utilization</Typography>\n </Grid>\n <Grid item xs={6}>\n <ResourceUtilization\n title=\"CPU requests\"\n usage={podMetrics.cpu.currentUsage}\n total={podMetrics.cpu.requestTotal}\n totalFormatted={formatMillicores(podMetrics.cpu.requestTotal)}\n />\n <ResourceUtilization\n title=\"CPU limits\"\n usage={podMetrics.cpu.currentUsage}\n total={podMetrics.cpu.limitTotal}\n totalFormatted={formatMillicores(podMetrics.cpu.limitTotal)}\n />\n </Grid>\n <Grid item xs={6}>\n <ResourceUtilization\n title=\"Memory requests\"\n usage={podMetrics.memory.currentUsage}\n total={podMetrics.memory.requestTotal}\n totalFormatted={bytesToMiB(podMetrics.memory.requestTotal)}\n />\n <ResourceUtilization\n title=\"Memory limits\"\n usage={podMetrics.memory.currentUsage}\n total={podMetrics.memory.limitTotal}\n totalFormatted={bytesToMiB(podMetrics.memory.limitTotal)}\n />\n </Grid>\n </Grid>\n )}\n {podAndErrors.pod.status?.phase === 'Pending' && (\n <PendingPodContent pod={podAndErrors.pod} />\n )}\n {podAndErrors.pod.status?.containerStatuses?.length && (\n <Grid container spacing={2}>\n <Grid item xs={12}>\n <Typography variant=\"h5\">Containers</Typography>\n </Grid>\n <Grid item xs={12}>\n <ItemCardGrid>\n {podAndErrors.pod.status?.containerStatuses?.map(\n (containerStatus, i) => {\n const containerSpec = getContainerSpecByName(\n podAndErrors.pod,\n containerStatus.name,\n );\n const containerMetrics = (\n podMetrics?.containers ?? []\n ).find(c => c.container === containerStatus.name);\n return (\n <ContainerCard\n key={`container-card-${podAndErrors.pod.metadata?.name}-${i}`}\n containerMetrics={containerMetrics}\n podScope={{\n podName: podAndErrors.pod.metadata?.name ?? 'unknown',\n podNamespace:\n podAndErrors.pod.metadata?.namespace ?? 'unknown',\n cluster: podAndErrors.cluster,\n }}\n containerSpec={containerSpec}\n containerStatus={containerStatus}\n />\n );\n },\n )}\n </ItemCardGrid>\n </Grid>\n {podAndErrors.errors.length > 0 && (\n <Grid item xs={12}>\n <Typography variant=\"h5\">Errors</Typography>\n </Grid>\n )}\n {podAndErrors.errors.length > 0 && (\n <Grid item xs={12}>\n <ErrorList podAndErrors={[podAndErrors]} />\n </Grid>\n )}\n </Grid>\n )}\n </div>\n </KubernetesDrawer>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmCA,MAAM,sBAAyB,GAAA,UAAA;AAAA,EAAW,CAAC,WACzC,YAAa,CAAA;AAAA,IACX,MAAQ,EAAA;AAAA,MACN,OAAS,EAAA,MAAA;AAAA,MACT,aAAe,EAAA,KAAA;AAAA,MACf,cAAgB,EAAA;AAAA,KAClB;AAAA,IACA,OAAS,EAAA;AAAA,MACP,MAAQ,EAAA;AAAA,KACV;AAAA,IACA,IAAM,EAAA;AAAA,MACJ,QAAU,EAAA;AAAA,KACZ;AAAA,IACA,SAAW,EAAA;AAAA,MACT,KAAO,EAAA,MAAA;AAAA,MACP,QAAU,EAAA,GAAA;AAAA,MACV,SAAW,EAAA;AAAA;AACb,GACD;AACH,CAAA;AAEA,SAAS,sBAAA,CAAuB,KAAU,aAAuB,EAAA;AAC/D,EAAA,OAAO,IAAI,IAAM,EAAA,UAAA,CAAW,KAAK,CAAK,CAAA,KAAA,CAAA,CAAE,SAA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A,CAAA,CAAE,SAAc,KAAA,eAAA,CAAgB,IAAI,CAAA;AAChD,cACE,uBAAA,GAAA;AAAA,gBAAC,aAAA;AAAA,gBAAA;AAAA,kBAEC,gBAAA;AAAA,kBACA,QAAU,EAAA;AAAA,oBACR,OAAS,EAAA,YAAA,CAAa,GAAI,CAAA,QAAA,EAAU,IAAQ,IAAA,SAAA;AAAA,oBAC5C,YACE,EAAA,YAAA,CAAa,GAAI,CAAA,QAAA,EAAU,SAAa,IAAA,SAAA;AAAA,oBAC1C,SAAS,YAAa,CAAA;AAAA,mBACxB;AAAA,kBACA,aAAA;AAAA,kBACA;AAAA,iBAAA;AAAA,gBATK,kBAAkB,YAAa,CAAA,GAAA,CAAI,QAAU,EAAA,IAAI,IAAI,CAAC,CAAA;AAAA,eAU7D;AAAA;AAEJ,aAEJ,CACF,EAAA,CAAA;AAAA,UACC,YAAa,CAAA,MAAA,CAAO,MAAS,GAAA,CAAA,wBAC3B,IAAK,EAAA,EAAA,IAAA,EAAI,IAAC,EAAA,EAAA,EAAI,IACb,QAAC,kBAAA,GAAA,CAAA,UAAA,EAAA,EAAW,OAAQ,EAAA,IAAA,EAAK,oBAAM,CACjC,EAAA,CAAA;AAAA,UAED,aAAa,MAAO,CAAA,MAAA,GAAS,CAC5B,oBAAA,GAAA,CAAC,QAAK,IAAI,EAAA,IAAA,EAAC,EAAI,EAAA,EAAA,EACb,8BAAC,SAAU,EAAA,EAAA,YAAA,EAAc,CAAC,YAAY,GAAG,CAC3C,EAAA;AAAA,SAEJ,EAAA;AAAA,OAEJ,EAAA;AAAA;AAAA,GACF;AAEJ;;;;"}
|
|
1
|
+
{"version":3,"file":"PodDrawer.esm.js","sources":["../../../../src/components/Pods/PodDrawer/PodDrawer.tsx"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { ItemCardGrid } from '@backstage/core-components';\nimport Grid from '@material-ui/core/Grid';\nimport Typography from '@material-ui/core/Typography';\nimport { createStyles, makeStyles, Theme } from '@material-ui/core/styles';\n\nimport { Pod } from 'kubernetes-models/v1';\n\nimport { ContainerCard } from './ContainerCard';\n\nimport { PodAndErrors } from '../types';\nimport { KubernetesDrawer } from '../../KubernetesDrawer';\nimport { PodDeleteButton } from '../PodDelete/PodDeleteButton';\nimport { PendingPodContent } from './PendingPodContent';\nimport { ErrorList } from '../ErrorList';\nimport { usePodMetrics } from '../../../hooks/usePodMetrics';\nimport { ResourceUtilization } from '../../ResourceUtilization';\nimport { bytesToMiB, formatMillicores } from '../../../utils/resources';\nimport { useIsPodDeleteEnabled } from '../../../hooks';\n\nconst useDrawerContentStyles = makeStyles((_theme: Theme) =>\n createStyles({\n header: {\n display: 'flex',\n flexDirection: 'row',\n justifyContent: 'space-between',\n },\n content: {\n height: '80%',\n },\n icon: {\n fontSize: 20,\n },\n podoklist: {\n width: '100%',\n maxWidth: 360,\n maxHeight: 360,\n },\n }),\n);\n\nfunction getContainerSpecByName(pod: Pod, containerName: string) {\n return pod.spec?.containers.find(c => c.name === containerName);\n}\n\n/**\n * Props for PodDrawer\n *\n * @public\n */\nexport interface PodDrawerProps {\n open?: boolean;\n podAndErrors: PodAndErrors;\n}\n\n/**\n * A Drawer for Kubernetes Pods\n *\n * @public\n */\nexport const PodDrawer = ({ podAndErrors, open }: PodDrawerProps) => {\n const classes = useDrawerContentStyles();\n const podMetrics = usePodMetrics(podAndErrors.cluster.name, podAndErrors.pod);\n const isPodDeleteEnabled = useIsPodDeleteEnabled();\n\n return (\n <KubernetesDrawer\n open={open}\n drawerContentsHeader={\n <Typography variant=\"subtitle1\">\n Pod{' '}\n {podAndErrors.pod.status?.podIP &&\n `(${podAndErrors.pod.status?.podIP})`}\n </Typography>\n }\n kubernetesObject={podAndErrors.pod}\n label={\n <Typography variant=\"subtitle1\">\n {podAndErrors.pod.metadata?.name ?? 'unknown'}\n </Typography>\n }\n >\n <div className={classes.content}>\n {isPodDeleteEnabled && (\n <PodDeleteButton\n podScope={{\n podName: podAndErrors.pod.metadata?.name ?? 'unknown',\n podNamespace: podAndErrors.pod.metadata?.namespace ?? 'default',\n cluster: podAndErrors.cluster,\n }}\n />\n )}\n {podMetrics && (\n <Grid container item xs={12}>\n <Grid item xs={12}>\n <Typography variant=\"h5\">Resource utilization</Typography>\n </Grid>\n <Grid item xs={6}>\n <ResourceUtilization\n title=\"CPU requests\"\n usage={podMetrics.cpu.currentUsage}\n total={podMetrics.cpu.requestTotal}\n totalFormatted={formatMillicores(podMetrics.cpu.requestTotal)}\n />\n <ResourceUtilization\n title=\"CPU limits\"\n usage={podMetrics.cpu.currentUsage}\n total={podMetrics.cpu.limitTotal}\n totalFormatted={formatMillicores(podMetrics.cpu.limitTotal)}\n />\n </Grid>\n <Grid item xs={6}>\n <ResourceUtilization\n title=\"Memory requests\"\n usage={podMetrics.memory.currentUsage}\n total={podMetrics.memory.requestTotal}\n totalFormatted={bytesToMiB(podMetrics.memory.requestTotal)}\n />\n <ResourceUtilization\n title=\"Memory limits\"\n usage={podMetrics.memory.currentUsage}\n total={podMetrics.memory.limitTotal}\n totalFormatted={bytesToMiB(podMetrics.memory.limitTotal)}\n />\n </Grid>\n </Grid>\n )}\n {podAndErrors.pod.status?.phase === 'Pending' && (\n <PendingPodContent pod={podAndErrors.pod} />\n )}\n {podAndErrors.pod.status?.containerStatuses?.length && (\n <Grid container spacing={2}>\n <Grid item xs={12}>\n <Typography variant=\"h5\">Containers</Typography>\n </Grid>\n <Grid item xs={12}>\n <ItemCardGrid>\n {podAndErrors.pod.status?.containerStatuses?.map(\n (containerStatus, i) => {\n const containerSpec = getContainerSpecByName(\n podAndErrors.pod,\n containerStatus.name,\n );\n const containerMetrics = (\n podMetrics?.containers ?? []\n ).find(c => c.container === containerStatus.name);\n return (\n <ContainerCard\n key={`container-card-${podAndErrors.pod.metadata?.name}-${i}`}\n containerMetrics={containerMetrics}\n podScope={{\n podName: podAndErrors.pod.metadata?.name ?? 'unknown',\n podNamespace:\n podAndErrors.pod.metadata?.namespace ?? 'unknown',\n cluster: podAndErrors.cluster,\n }}\n containerSpec={containerSpec}\n containerStatus={containerStatus}\n />\n );\n },\n )}\n </ItemCardGrid>\n </Grid>\n {podAndErrors.errors.length > 0 && (\n <Grid item xs={12}>\n <Typography variant=\"h5\">Errors</Typography>\n </Grid>\n )}\n {podAndErrors.errors.length > 0 && (\n <Grid item xs={12}>\n <ErrorList podAndErrors={[podAndErrors]} />\n </Grid>\n )}\n </Grid>\n )}\n </div>\n </KubernetesDrawer>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmCA,MAAM,sBAAA,GAAyB,UAAA;AAAA,EAAW,CAAC,WACzC,YAAA,CAAa;AAAA,IACX,MAAA,EAAQ;AAAA,MACN,OAAA,EAAS,MAAA;AAAA,MACT,aAAA,EAAe,KAAA;AAAA,MACf,cAAA,EAAgB;AAAA,KAClB;AAAA,IACA,OAAA,EAAS;AAAA,MACP,MAAA,EAAQ;AAAA,KACV;AAAA,IACA,IAAA,EAAM;AAAA,MACJ,QAAA,EAAU;AAAA,KACZ;AAAA,IACA,SAAA,EAAW;AAAA,MACT,KAAA,EAAO,MAAA;AAAA,MACP,QAAA,EAAU,GAAA;AAAA,MACV,SAAA,EAAW;AAAA;AACb,GACD;AACH,CAAA;AAEA,SAAS,sBAAA,CAAuB,KAAU,aAAA,EAAuB;AAC/D,EAAA,OAAO,IAAI,IAAA,EAAM,UAAA,CAAW,KAAK,CAAA,CAAA,KAAK,CAAA,CAAE,SAAS,aAAa,CAAA;AAChE;AAiBO,MAAM,SAAA,GAAY,CAAC,EA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ChD,cAAA,uBACE,GAAA;AAAA,gBAAC,aAAA;AAAA,gBAAA;AAAA,kBAEC,gBAAA;AAAA,kBACA,QAAA,EAAU;AAAA,oBACR,OAAA,EAAS,YAAA,CAAa,GAAA,CAAI,QAAA,EAAU,IAAA,IAAQ,SAAA;AAAA,oBAC5C,YAAA,EACE,YAAA,CAAa,GAAA,CAAI,QAAA,EAAU,SAAA,IAAa,SAAA;AAAA,oBAC1C,SAAS,YAAA,CAAa;AAAA,mBACxB;AAAA,kBACA,aAAA;AAAA,kBACA;AAAA,iBAAA;AAAA,gBATK,kBAAkB,YAAA,CAAa,GAAA,CAAI,QAAA,EAAU,IAAI,IAAI,CAAC,CAAA;AAAA,eAU7D;AAAA,YAEJ;AAAA,aAEJ,CAAA,EACF,CAAA;AAAA,UACC,YAAA,CAAa,MAAA,CAAO,MAAA,GAAS,CAAA,wBAC3B,IAAA,EAAA,EAAK,IAAA,EAAI,IAAA,EAAC,EAAA,EAAI,IACb,QAAA,kBAAA,GAAA,CAAC,UAAA,EAAA,EAAW,OAAA,EAAQ,IAAA,EAAK,oBAAM,CAAA,EACjC,CAAA;AAAA,UAED,aAAa,MAAA,CAAO,MAAA,GAAS,CAAA,oBAC5B,GAAA,CAAC,QAAK,IAAA,EAAI,IAAA,EAAC,EAAA,EAAI,EAAA,EACb,8BAAC,SAAA,EAAA,EAAU,YAAA,EAAc,CAAC,YAAY,GAAG,CAAA,EAC3C;AAAA,SAAA,EAEJ;AAAA,OAAA,EAEJ;AAAA;AAAA,GACF;AAEJ;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PodLogs.esm.js","sources":["../../../../src/components/Pods/PodLogs/PodLogs.tsx"],"sourcesContent":["/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { FC } from 'react';\n\nimport {\n DismissableBanner,\n EmptyState,\n LogViewer,\n} from '@backstage/core-components';\nimport Paper from '@material-ui/core/Paper';\nimport Skeleton from '@material-ui/lab/Skeleton';\n\nimport { ContainerScope } from './types';\nimport { usePodLogs } from './usePodLogs';\n\n/**\n * Props for PodLogs\n *\n * @public\n */\nexport interface PodLogsProps {\n containerScope: ContainerScope;\n previous?: boolean;\n}\n\n/**\n * Shows the logs for the given pod\n *\n * @public\n */\nexport const PodLogs: FC<PodLogsProps> = ({\n containerScope,\n previous,\n}: PodLogsProps) => {\n const { value, error, loading } = usePodLogs({\n containerScope,\n previous,\n });\n\n return (\n <>\n {error && (\n <DismissableBanner\n {...{\n message: error.message,\n variant: 'error',\n fixed: false,\n }}\n id=\"pod-logs\"\n />\n )}\n <Paper\n elevation={1}\n style={{ height: '100%', width: '100%', minHeight: '55rem' }}\n >\n {loading && <Skeleton variant=\"rect\" width=\"100%\" height=\"100%\" />}\n {!loading &&\n value !== undefined &&\n (value.text === '' ? (\n <EmptyState\n missing=\"data\"\n title=\"No logs emitted\"\n description=\"No logs were emitted by the container\"\n />\n ) : (\n <LogViewer text={value.text} />\n ))}\n </Paper>\n </>\n );\n};\n"],"names":[],"mappings":";;;;;;AA2CO,MAAM,UAA4B,CAAC;AAAA,EACxC,cAAA;AAAA,EACA;AACF,
|
|
1
|
+
{"version":3,"file":"PodLogs.esm.js","sources":["../../../../src/components/Pods/PodLogs/PodLogs.tsx"],"sourcesContent":["/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { FC } from 'react';\n\nimport {\n DismissableBanner,\n EmptyState,\n LogViewer,\n} from '@backstage/core-components';\nimport Paper from '@material-ui/core/Paper';\nimport Skeleton from '@material-ui/lab/Skeleton';\n\nimport { ContainerScope } from './types';\nimport { usePodLogs } from './usePodLogs';\n\n/**\n * Props for PodLogs\n *\n * @public\n */\nexport interface PodLogsProps {\n containerScope: ContainerScope;\n previous?: boolean;\n}\n\n/**\n * Shows the logs for the given pod\n *\n * @public\n */\nexport const PodLogs: FC<PodLogsProps> = ({\n containerScope,\n previous,\n}: PodLogsProps) => {\n const { value, error, loading } = usePodLogs({\n containerScope,\n previous,\n });\n\n return (\n <>\n {error && (\n <DismissableBanner\n {...{\n message: error.message,\n variant: 'error',\n fixed: false,\n }}\n id=\"pod-logs\"\n />\n )}\n <Paper\n elevation={1}\n style={{ height: '100%', width: '100%', minHeight: '55rem' }}\n >\n {loading && <Skeleton variant=\"rect\" width=\"100%\" height=\"100%\" />}\n {!loading &&\n value !== undefined &&\n (value.text === '' ? (\n <EmptyState\n missing=\"data\"\n title=\"No logs emitted\"\n description=\"No logs were emitted by the container\"\n />\n ) : (\n <LogViewer text={value.text} />\n ))}\n </Paper>\n </>\n );\n};\n"],"names":[],"mappings":";;;;;;AA2CO,MAAM,UAA4B,CAAC;AAAA,EACxC,cAAA;AAAA,EACA;AACF,CAAA,KAAoB;AAClB,EAAA,MAAM,EAAE,KAAA,EAAO,KAAA,EAAO,OAAA,KAAY,UAAA,CAAW;AAAA,IAC3C,cAAA;AAAA,IACA;AAAA,GACD,CAAA;AAED,EAAA,uBACE,IAAA,CAAA,QAAA,EAAA,EACG,QAAA,EAAA;AAAA,IAAA,KAAA,oBACC,GAAA;AAAA,MAAC,iBAAA;AAAA,MAAA;AAAA,QACE,GAAG;AAAA,UACF,SAAS,KAAA,CAAM,OAAA;AAAA,UACf,OAAA,EAAS,OAAA;AAAA,UACT,KAAA,EAAO;AAAA,SACT;AAAA,QACA,EAAA,EAAG;AAAA;AAAA,KACL;AAAA,oBAEF,IAAA;AAAA,MAAC,KAAA;AAAA,MAAA;AAAA,QACC,SAAA,EAAW,CAAA;AAAA,QACX,OAAO,EAAE,MAAA,EAAQ,QAAQ,KAAA,EAAO,MAAA,EAAQ,WAAW,OAAA,EAAQ;AAAA,QAE1D,QAAA,EAAA;AAAA,UAAA,OAAA,wBAAY,QAAA,EAAA,EAAS,OAAA,EAAQ,QAAO,KAAA,EAAM,MAAA,EAAO,QAAO,MAAA,EAAO,CAAA;AAAA,UAC/D,CAAC,OAAA,IACA,KAAA,KAAU,MAAA,KACT,KAAA,CAAM,SAAS,EAAA,mBACd,GAAA;AAAA,YAAC,UAAA;AAAA,YAAA;AAAA,cACC,OAAA,EAAQ,MAAA;AAAA,cACR,KAAA,EAAM,iBAAA;AAAA,cACN,WAAA,EAAY;AAAA;AAAA,WACd,mBAEA,GAAA,CAAC,SAAA,EAAA,EAAU,IAAA,EAAM,MAAM,IAAA,EAAM,CAAA;AAAA;AAAA;AAAA;AAEnC,GAAA,EACF,CAAA;AAEJ;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PodLogsDialog.esm.js","sources":["../../../../src/components/Pods/PodLogs/PodLogsDialog.tsx"],"sourcesContent":["/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport SubjectIcon from '@material-ui/icons/Subject';\n\nimport { KubernetesDialog } from '../../KubernetesDialog';\nimport { PodLogs } from './PodLogs';\nimport { ContainerScope } from './types';\n\n/**\n * Props for PodLogsDialog\n *\n * @public\n */\nexport interface PodLogsDialogProps {\n containerScope: ContainerScope;\n}\n\n/**\n * Shows the logs for the given pod in a Dialog\n *\n * @public\n */\nexport const PodLogsDialog = ({ containerScope }: PodLogsDialogProps) => {\n return (\n <KubernetesDialog\n buttonAriaLabel=\"get logs\"\n buttonIcon={<SubjectIcon />}\n buttonText=\"Logs\"\n disabled={false}\n title={`${containerScope.podName} - ${\n containerScope.containerName\n } logs on cluster ${\n containerScope.cluster.title || containerScope.cluster.name\n }`}\n >\n <PodLogs containerScope={containerScope} />\n </KubernetesDialog>\n );\n};\n"],"names":[],"mappings":";;;;;AAmCO,MAAM,
|
|
1
|
+
{"version":3,"file":"PodLogsDialog.esm.js","sources":["../../../../src/components/Pods/PodLogs/PodLogsDialog.tsx"],"sourcesContent":["/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport SubjectIcon from '@material-ui/icons/Subject';\n\nimport { KubernetesDialog } from '../../KubernetesDialog';\nimport { PodLogs } from './PodLogs';\nimport { ContainerScope } from './types';\n\n/**\n * Props for PodLogsDialog\n *\n * @public\n */\nexport interface PodLogsDialogProps {\n containerScope: ContainerScope;\n}\n\n/**\n * Shows the logs for the given pod in a Dialog\n *\n * @public\n */\nexport const PodLogsDialog = ({ containerScope }: PodLogsDialogProps) => {\n return (\n <KubernetesDialog\n buttonAriaLabel=\"get logs\"\n buttonIcon={<SubjectIcon />}\n buttonText=\"Logs\"\n disabled={false}\n title={`${containerScope.podName} - ${\n containerScope.containerName\n } logs on cluster ${\n containerScope.cluster.title || containerScope.cluster.name\n }`}\n >\n <PodLogs containerScope={containerScope} />\n </KubernetesDialog>\n );\n};\n"],"names":[],"mappings":";;;;;AAmCO,MAAM,aAAA,GAAgB,CAAC,EAAE,cAAA,EAAe,KAA0B;AACvE,EAAA,uBACE,GAAA;AAAA,IAAC,gBAAA;AAAA,IAAA;AAAA,MACC,eAAA,EAAgB,UAAA;AAAA,MAChB,UAAA,sBAAa,WAAA,EAAA,EAAY,CAAA;AAAA,MACzB,UAAA,EAAW,MAAA;AAAA,MACX,QAAA,EAAU,KAAA;AAAA,MACV,KAAA,EAAO,CAAA,EAAG,cAAA,CAAe,OAAO,CAAA,GAAA,EAC9B,cAAA,CAAe,aACjB,CAAA,iBAAA,EACE,cAAA,CAAe,OAAA,CAAQ,KAAA,IAAS,cAAA,CAAe,QAAQ,IACzD,CAAA,CAAA;AAAA,MAEA,QAAA,kBAAA,GAAA,CAAC,WAAQ,cAAA,EAAgC;AAAA;AAAA,GAC3C;AAEJ;;;;"}
|
|
@@ -1 +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,
|
|
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,UAAS,KAAsB;AAC1E,EAAA,MAAM,kBAAA,GAAqB,OAAO,qBAAqB,CAAA;AACvD,EAAA,OAAO,SAAS,YAAY;AAC1B,IAAA,OAAO,MAAM,mBAAmB,UAAA,CAAW;AAAA,MACzC,SAAS,cAAA,CAAe,OAAA;AAAA,MACxB,WAAW,cAAA,CAAe,YAAA;AAAA,MAC1B,eAAe,cAAA,CAAe,aAAA;AAAA,MAC9B,WAAA,EAAa,eAAe,OAAA,CAAQ,IAAA;AAAA,MACpC;AAAA,KACD,CAAA;AAAA,EACH,GAAG,CAAC,IAAA,CAAK,SAAA,CAAU,cAAc,CAAC,CAAC,CAAA;AACrC;;;;"}
|
|
@@ -29,7 +29,7 @@ import '@material-ui/lab/Skeleton';
|
|
|
29
29
|
import '@material-ui/icons/Subject';
|
|
30
30
|
import '@material-ui/core/List';
|
|
31
31
|
import '@material-ui/core/ListItem';
|
|
32
|
-
import { containersReady, totalRestarts,
|
|
32
|
+
import { containerStatuses, containersReady, totalRestarts, podStatusToCpuUtil, podStatusToMemoryUtil } from '../../utils/pod.esm.js';
|
|
33
33
|
|
|
34
34
|
const READY_COLUMNS = "READY";
|
|
35
35
|
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 { ReactNode, useContext } from 'react';\nimport { PodDrawer } from './PodDrawer';\nimport {\n containersReady,\n containerStatuses,\n podStatusToCpuUtil,\n podStatusToMemoryUtil,\n totalRestarts,\n} from '../../utils/pod';\nimport { Table, TableColumn } from '@backstage/core-components';\nimport { ClusterContext } from '../../hooks/Cluster';\nimport { useMatchingErrors } from '../../hooks/useMatchingErrors';\nimport { Pod } from 'kubernetes-models/v1/Pod';\nimport type { V1Pod } from '@kubernetes/client-node';\nimport { usePodMetrics } from '../../hooks/usePodMetrics';\nimport Typography from '@material-ui/core/Typography';\n\n/**\n *\n *\n * @public\n */\nexport const READY_COLUMNS: PodColumns = 'READY';\n\n/**\n *\n *\n * @public\n */\nexport const RESOURCE_COLUMNS: PodColumns = 'RESOURCE';\n\n/**\n *\n *\n * @public\n */\nexport type PodColumns = 'READY' | 'RESOURCE';\n\n/**\n *\n *\n * @public\n */\nexport type PodsTablesProps = {\n pods: Pod | V1Pod[];\n extraColumns?: PodColumns[];\n children?: ReactNode;\n};\n\nconst READY: TableColumn<Pod>[] = [\n {\n title: 'containers ready',\n align: 'center',\n render: containersReady,\n width: 'auto',\n },\n {\n title: 'total restarts',\n align: 'center',\n render: totalRestarts,\n type: 'numeric',\n width: 'auto',\n },\n];\n\nconst PodDrawerTrigger = ({ pod }: { pod: Pod }) => {\n const errors = useMatchingErrors({\n kind: 'Pod',\n apiVersion: 'v1',\n metadata: pod.metadata,\n });\n return (\n <PodDrawer\n podAndErrors={{\n pod: pod as any,\n cluster: useContext(ClusterContext),\n errors: errors,\n }}\n />\n );\n};\n\nconst Cpu = ({ clusterName, pod }: { clusterName: string; pod: Pod }) => {\n const metrics = usePodMetrics(clusterName, pod);\n\n if (!metrics) {\n return <Typography>unknown</Typography>;\n }\n\n return <>{podStatusToCpuUtil(metrics)}</>;\n};\n\nconst Memory = ({ clusterName, pod }: { clusterName: string; pod: Pod }) => {\n const metrics = usePodMetrics(clusterName, pod);\n\n if (!metrics) {\n return <Typography>unknown</Typography>;\n }\n\n return <>{podStatusToMemoryUtil(metrics)}</>;\n};\n\n/**\n *\n *\n * @public\n */\nexport const PodsTable = ({ pods, extraColumns = [] }: PodsTablesProps) => {\n const cluster = useContext(ClusterContext);\n const defaultColumns: TableColumn<Pod>[] = [\n {\n title: 'ID',\n field: 'metadata.uid',\n hidden: true,\n },\n {\n title: 'name',\n highlight: true,\n render: (pod: Pod) => {\n return <PodDrawerTrigger pod={pod} />;\n },\n },\n {\n title: 'phase',\n render: (pod: Pod) => pod.status?.phase ?? 'unknown',\n width: 'auto',\n },\n {\n title: 'status',\n render: containerStatuses,\n },\n ];\n const columns: TableColumn<Pod>[] = [...defaultColumns];\n\n if (extraColumns.includes(READY_COLUMNS)) {\n columns.push(...READY);\n }\n if (extraColumns.includes(RESOURCE_COLUMNS)) {\n const resourceColumns: TableColumn<Pod>[] = [\n {\n title: 'CPU usage %',\n render: (pod: Pod) => {\n return <Cpu clusterName={cluster.name} pod={pod} />;\n },\n width: 'auto',\n },\n {\n title: 'Memory usage %',\n render: (pod: Pod) => {\n return <Memory clusterName={cluster.name} pod={pod} />;\n },\n width: 'auto',\n },\n ];\n columns.push(...resourceColumns);\n }\n\n const tableStyle = {\n minWidth: '0',\n width: '100%',\n };\n\n return (\n <div style={tableStyle}>\n <Table\n options={{ paging: true, search: false, emptyRowsWhenPaging: false }}\n // It was observed that in some instances the pod drawer closes when new data (like CPU usage) is available and the table reloads.\n // Mapping the metadata UID to the tables ID fixes this problem.\n data={\n (pods as Pod[]).map((pod: Pod) => ({\n ...pod,\n id: pod?.metadata?.uid,\n })) as any as Pod[]\n }\n columns={columns}\n />\n </div>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsCO,MAAM,
|
|
1
|
+
{"version":3,"file":"PodsTable.esm.js","sources":["../../../src/components/Pods/PodsTable.tsx"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { ReactNode, useContext } from 'react';\nimport { PodDrawer } from './PodDrawer';\nimport {\n containersReady,\n containerStatuses,\n podStatusToCpuUtil,\n podStatusToMemoryUtil,\n totalRestarts,\n} from '../../utils/pod';\nimport { Table, TableColumn } from '@backstage/core-components';\nimport { ClusterContext } from '../../hooks/Cluster';\nimport { useMatchingErrors } from '../../hooks/useMatchingErrors';\nimport { Pod } from 'kubernetes-models/v1/Pod';\nimport type { V1Pod } from '@kubernetes/client-node';\nimport { usePodMetrics } from '../../hooks/usePodMetrics';\nimport Typography from '@material-ui/core/Typography';\n\n/**\n *\n *\n * @public\n */\nexport const READY_COLUMNS: PodColumns = 'READY';\n\n/**\n *\n *\n * @public\n */\nexport const RESOURCE_COLUMNS: PodColumns = 'RESOURCE';\n\n/**\n *\n *\n * @public\n */\nexport type PodColumns = 'READY' | 'RESOURCE';\n\n/**\n *\n *\n * @public\n */\nexport type PodsTablesProps = {\n pods: Pod | V1Pod[];\n extraColumns?: PodColumns[];\n children?: ReactNode;\n};\n\nconst READY: TableColumn<Pod>[] = [\n {\n title: 'containers ready',\n align: 'center',\n render: containersReady,\n width: 'auto',\n },\n {\n title: 'total restarts',\n align: 'center',\n render: totalRestarts,\n type: 'numeric',\n width: 'auto',\n },\n];\n\nconst PodDrawerTrigger = ({ pod }: { pod: Pod }) => {\n const errors = useMatchingErrors({\n kind: 'Pod',\n apiVersion: 'v1',\n metadata: pod.metadata,\n });\n return (\n <PodDrawer\n podAndErrors={{\n pod: pod as any,\n cluster: useContext(ClusterContext),\n errors: errors,\n }}\n />\n );\n};\n\nconst Cpu = ({ clusterName, pod }: { clusterName: string; pod: Pod }) => {\n const metrics = usePodMetrics(clusterName, pod);\n\n if (!metrics) {\n return <Typography>unknown</Typography>;\n }\n\n return <>{podStatusToCpuUtil(metrics)}</>;\n};\n\nconst Memory = ({ clusterName, pod }: { clusterName: string; pod: Pod }) => {\n const metrics = usePodMetrics(clusterName, pod);\n\n if (!metrics) {\n return <Typography>unknown</Typography>;\n }\n\n return <>{podStatusToMemoryUtil(metrics)}</>;\n};\n\n/**\n *\n *\n * @public\n */\nexport const PodsTable = ({ pods, extraColumns = [] }: PodsTablesProps) => {\n const cluster = useContext(ClusterContext);\n const defaultColumns: TableColumn<Pod>[] = [\n {\n title: 'ID',\n field: 'metadata.uid',\n hidden: true,\n },\n {\n title: 'name',\n highlight: true,\n render: (pod: Pod) => {\n return <PodDrawerTrigger pod={pod} />;\n },\n },\n {\n title: 'phase',\n render: (pod: Pod) => pod.status?.phase ?? 'unknown',\n width: 'auto',\n },\n {\n title: 'status',\n render: containerStatuses,\n },\n ];\n const columns: TableColumn<Pod>[] = [...defaultColumns];\n\n if (extraColumns.includes(READY_COLUMNS)) {\n columns.push(...READY);\n }\n if (extraColumns.includes(RESOURCE_COLUMNS)) {\n const resourceColumns: TableColumn<Pod>[] = [\n {\n title: 'CPU usage %',\n render: (pod: Pod) => {\n return <Cpu clusterName={cluster.name} pod={pod} />;\n },\n width: 'auto',\n },\n {\n title: 'Memory usage %',\n render: (pod: Pod) => {\n return <Memory clusterName={cluster.name} pod={pod} />;\n },\n width: 'auto',\n },\n ];\n columns.push(...resourceColumns);\n }\n\n const tableStyle = {\n minWidth: '0',\n width: '100%',\n };\n\n return (\n <div style={tableStyle}>\n <Table\n options={{ paging: true, search: false, emptyRowsWhenPaging: false }}\n // It was observed that in some instances the pod drawer closes when new data (like CPU usage) is available and the table reloads.\n // Mapping the metadata UID to the tables ID fixes this problem.\n data={\n (pods as Pod[]).map((pod: Pod) => ({\n ...pod,\n id: pod?.metadata?.uid,\n })) as any as Pod[]\n }\n columns={columns}\n />\n </div>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsCO,MAAM,aAAA,GAA4B;AAO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,EAAQ,CAAC,GAAA,KAAa;AACpB,UAAA,uBAAO,GAAA,CAAC,GAAA,EAAA,EAAI,WAAA,EAAa,OAAA,CAAQ,MAAM,GAAA,EAAU,CAAA;AAAA,QACnD,CAAA;AAAA,QACA,KAAA,EAAO;AAAA,OACT;AAAA,MACA;AAAA,QACE,KAAA,EAAO,gBAAA;AAAA,QACP,MAAA,EAAQ,CAAC,GAAA,KAAa;AACpB,UAAA,uBAAO,GAAA,CAAC,MAAA,EAAA,EAAO,WAAA,EAAa,OAAA,CAAQ,MAAM,GAAA,EAAU,CAAA;AAAA,QACtD,CAAA;AAAA,QACA,KAAA,EAAO;AAAA;AACT,KACF;AACA,IAAA,OAAA,CAAQ,IAAA,CAAK,GAAG,eAAe,CAAA;AAAA,EACjC;AAEA,EAAA,MAAM,UAAA,GAAa;AAAA,IACjB,QAAA,EAAU,GAAA;AAAA,IACV,KAAA,EAAO;AAAA,GACT;AAEA,EAAA,uBACE,GAAA,CAAC,KAAA,EAAA,EAAI,KAAA,EAAO,UAAA,EACV,QAAA,kBAAA,GAAA;AAAA,IAAC,KAAA;AAAA,IAAA;AAAA,MACC,SAAS,EAAE,MAAA,EAAQ,MAAM,MAAA,EAAQ,KAAA,EAAO,qBAAqB,KAAA,EAAM;AAAA,MAGnE,IAAA,EACG,IAAA,CAAe,GAAA,CAAI,CAAC,GAAA,MAAc;AAAA,QACjC,GAAG,GAAA;AAAA,QACH,EAAA,EAAI,KAAK,QAAA,EAAU;AAAA,OACrB,CAAE,CAAA;AAAA,MAEJ;AAAA;AAAA,GACF,EACF,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 { GaugePropsGetColor, LinearGauge } from '@backstage/core-components';\nimport { currentToDeclaredResourceToPerc } from '../../utils/resources';\n\n/**\n * Context for Pod Metrics\n *\n * @public\n */\nexport interface ResourceUtilizationProps {\n compressed?: boolean;\n title: string;\n usage: number | string;\n total: number | string;\n totalFormatted: string;\n}\n\nconst getProgressColor: GaugePropsGetColor = ({\n palette,\n value,\n inverse,\n max,\n}) => {\n if (isNaN(value)) {\n return palette.status.pending;\n }\n const actualMax = max ? max : 100;\n const actualValue = inverse ? actualMax - value : value;\n\n if (actualValue >= actualMax) {\n return palette.status.error;\n } else if (actualValue > 90 || actualValue < 40) {\n return palette.status.warning;\n }\n\n return palette.status.ok;\n};\n\n/**\n * Context for Pod Metrics\n *\n * @public\n */\nexport const ResourceUtilization = ({\n compressed = false,\n title,\n usage,\n total,\n totalFormatted,\n}: ResourceUtilizationProps) => {\n const utilization = currentToDeclaredResourceToPerc(usage, total);\n return (\n <Grid container spacing={0}>\n <Grid item xs={12}>\n <Typography\n variant={compressed ? 'caption' : 'subtitle2'}\n >{`${title}: ${totalFormatted}`}</Typography>\n </Grid>\n <Grid item xs={12}>\n <LinearGauge\n getColor={getProgressColor}\n width={compressed ? 'thin' : 'thick'}\n value={utilization / 100}\n />\n {!compressed && (\n <Typography variant=\"caption\">usage: {`${utilization}%`}</Typography>\n )}\n </Grid>\n </Grid>\n );\n};\n"],"names":[],"mappings":";;;;;;AAkCA,MAAM,mBAAuC,CAAC;AAAA,EAC5C,OAAA;AAAA,EACA,KAAA;AAAA,EACA,OAAA;AAAA,EACA;AACF,
|
|
1
|
+
{"version":3,"file":"ResourceUtilization.esm.js","sources":["../../../src/components/ResourceUtilization/ResourceUtilization.tsx"],"sourcesContent":["/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport Grid from '@material-ui/core/Grid';\nimport Typography from '@material-ui/core/Typography';\n\nimport { GaugePropsGetColor, LinearGauge } from '@backstage/core-components';\nimport { currentToDeclaredResourceToPerc } from '../../utils/resources';\n\n/**\n * Context for Pod Metrics\n *\n * @public\n */\nexport interface ResourceUtilizationProps {\n compressed?: boolean;\n title: string;\n usage: number | string;\n total: number | string;\n totalFormatted: string;\n}\n\nconst getProgressColor: GaugePropsGetColor = ({\n palette,\n value,\n inverse,\n max,\n}) => {\n if (isNaN(value)) {\n return palette.status.pending;\n }\n const actualMax = max ? max : 100;\n const actualValue = inverse ? actualMax - value : value;\n\n if (actualValue >= actualMax) {\n return palette.status.error;\n } else if (actualValue > 90 || actualValue < 40) {\n return palette.status.warning;\n }\n\n return palette.status.ok;\n};\n\n/**\n * Context for Pod Metrics\n *\n * @public\n */\nexport const ResourceUtilization = ({\n compressed = false,\n title,\n usage,\n total,\n totalFormatted,\n}: ResourceUtilizationProps) => {\n const utilization = currentToDeclaredResourceToPerc(usage, total);\n return (\n <Grid container spacing={0}>\n <Grid item xs={12}>\n <Typography\n variant={compressed ? 'caption' : 'subtitle2'}\n >{`${title}: ${totalFormatted}`}</Typography>\n </Grid>\n <Grid item xs={12}>\n <LinearGauge\n getColor={getProgressColor}\n width={compressed ? 'thin' : 'thick'}\n value={utilization / 100}\n />\n {!compressed && (\n <Typography variant=\"caption\">usage: {`${utilization}%`}</Typography>\n )}\n </Grid>\n </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ClC,CAAA;AAAA,oBACA,IAAA,CAAC,IAAA,EAAA,EAAK,IAAA,EAAI,IAAA,EAAC,IAAI,EAAA,EACb,QAAA,EAAA;AAAA,sBAAA,GAAA;AAAA,QAAC,WAAA;AAAA,QAAA;AAAA,UACC,QAAA,EAAU,gBAAA;AAAA,UACV,KAAA,EAAO,aAAa,MAAA,GAAS,OAAA;AAAA,UAC7B,OAAO,WAAA,GAAc;AAAA;AAAA,OACvB;AAAA,MACC,CAAC,UAAA,oBACA,IAAA,CAAC,UAAA,EAAA,EAAW,SAAQ,SAAA,EAAU,QAAA,EAAA;AAAA,QAAA,SAAA;AAAA,QAAQ,GAAG,WAAW,CAAA,CAAA;AAAA,OAAA,EAAI;AAAA,KAAA,EAE5D;AAAA,GAAA,EACF,CAAA;AAEJ;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ServiceDrawer.esm.js","sources":["../../../src/components/ServicesAccordions/ServiceDrawer.tsx"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { V1Service } from '@kubernetes/client-node';\nimport { KubernetesStructuredMetadataTableDrawer } from '../KubernetesDrawer';\nimport Typography from '@material-ui/core/Typography';\nimport Grid from '@material-ui/core/Grid';\nimport Chip from '@material-ui/core/Chip';\n\nexport const ServiceDrawer = ({\n service,\n expanded,\n}: {\n service: V1Service;\n expanded?: boolean;\n}) => {\n const namespace = service.metadata?.namespace;\n return (\n <KubernetesStructuredMetadataTableDrawer\n object={service}\n expanded={expanded}\n kind=\"Service\"\n renderObject={(serviceObject: V1Service) => {\n return serviceObject.spec || {};\n }}\n >\n <Grid\n container\n direction=\"column\"\n justifyContent=\"flex-start\"\n alignItems=\"flex-start\"\n spacing={0}\n >\n <Grid item>\n <Typography variant=\"body1\">\n {service.metadata?.name ?? 'unknown object'}\n </Typography>\n </Grid>\n <Grid item>\n <Typography color=\"textSecondary\" variant=\"subtitle1\">\n Service\n </Typography>\n </Grid>\n {namespace && (\n <Grid item>\n <Chip size=\"small\" label={`namespace: ${namespace}`} />\n </Grid>\n )}\n </Grid>\n </KubernetesStructuredMetadataTableDrawer>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;AAsBO,MAAM,gBAAgB,CAAC;AAAA,EAC5B,OAAA;AAAA,EACA;AACF,
|
|
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 type { V1Service } from '@kubernetes/client-node';\nimport { KubernetesStructuredMetadataTableDrawer } from '../KubernetesDrawer';\nimport Typography from '@material-ui/core/Typography';\nimport Grid from '@material-ui/core/Grid';\nimport Chip from '@material-ui/core/Chip';\n\nexport const ServiceDrawer = ({\n service,\n expanded,\n}: {\n service: V1Service;\n expanded?: boolean;\n}) => {\n const namespace = service.metadata?.namespace;\n return (\n <KubernetesStructuredMetadataTableDrawer\n object={service}\n expanded={expanded}\n kind=\"Service\"\n renderObject={(serviceObject: V1Service) => {\n return serviceObject.spec || {};\n }}\n >\n <Grid\n container\n direction=\"column\"\n justifyContent=\"flex-start\"\n alignItems=\"flex-start\"\n spacing={0}\n >\n <Grid item>\n <Typography variant=\"body1\">\n {service.metadata?.name ?? 'unknown object'}\n </Typography>\n </Grid>\n <Grid item>\n <Typography color=\"textSecondary\" variant=\"subtitle1\">\n Service\n </Typography>\n </Grid>\n {namespace && (\n <Grid item>\n <Chip size=\"small\" label={`namespace: ${namespace}`} />\n </Grid>\n )}\n </Grid>\n </KubernetesStructuredMetadataTableDrawer>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;AAsBO,MAAM,gBAAgB,CAAC;AAAA,EAC5B,OAAA;AAAA,EACA;AACF,CAAA,KAGM;AACJ,EAAA,MAAM,SAAA,GAAY,QAAQ,QAAA,EAAU,SAAA;AACpC,EAAA,uBACE,GAAA;AAAA,IAAC,uCAAA;AAAA,IAAA;AAAA,MACC,MAAA,EAAQ,OAAA;AAAA,MACR,QAAA;AAAA,MACA,IAAA,EAAK,SAAA;AAAA,MACL,YAAA,EAAc,CAAC,aAAA,KAA6B;AAC1C,QAAA,OAAO,aAAA,CAAc,QAAQ,EAAC;AAAA,MAChC,CAAA;AAAA,MAEA,QAAA,kBAAA,IAAA;AAAA,QAAC,IAAA;AAAA,QAAA;AAAA,UACC,SAAA,EAAS,IAAA;AAAA,UACT,SAAA,EAAU,QAAA;AAAA,UACV,cAAA,EAAe,YAAA;AAAA,UACf,UAAA,EAAW,YAAA;AAAA,UACX,OAAA,EAAS,CAAA;AAAA,UAET,QAAA,EAAA;AAAA,4BAAA,GAAA,CAAC,IAAA,EAAA,EAAK,IAAA,EAAI,IAAA,EACR,QAAA,kBAAA,GAAA,CAAC,UAAA,EAAA,EAAW,OAAA,EAAQ,OAAA,EACjB,QAAA,EAAA,OAAA,CAAQ,QAAA,EAAU,IAAA,IAAQ,gBAAA,EAC7B,CAAA,EACF,CAAA;AAAA,4BACA,GAAA,CAAC,IAAA,EAAA,EAAK,IAAA,EAAI,IAAA,EACR,QAAA,kBAAA,GAAA,CAAC,UAAA,EAAA,EAAW,KAAA,EAAM,eAAA,EAAgB,OAAA,EAAQ,WAAA,EAAY,QAAA,EAAA,SAAA,EAEtD,CAAA,EACF,CAAA;AAAA,YACC,SAAA,oBACC,GAAA,CAAC,IAAA,EAAA,EAAK,IAAA,EAAI,IAAA,EACR,QAAA,kBAAA,GAAA,CAAC,IAAA,EAAA,EAAK,IAAA,EAAK,OAAA,EAAQ,KAAA,EAAO,CAAA,WAAA,EAAc,SAAS,IAAI,CAAA,EACvD;AAAA;AAAA;AAAA;AAEJ;AAAA,GACF;AAEJ;;;;"}
|
|
@@ -1 +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 { useContext } from 'react';\nimport Accordion from '@material-ui/core/Accordion';\nimport AccordionDetails from '@material-ui/core/AccordionDetails';\nimport AccordionSummary from '@material-ui/core/AccordionSummary';\nimport Grid from '@material-ui/core/Grid';\nimport Typography from '@material-ui/core/Typography';\nimport ExpandMoreIcon from '@material-ui/icons/ExpandMore';\nimport type { V1Service } from '@kubernetes/client-node';\nimport { ServiceDrawer } from './ServiceDrawer';\nimport { GroupedResponsesContext } from '../../hooks';\nimport { StructuredMetadataTable } from '@backstage/core-components';\n\ntype ServiceSummaryProps = {\n service: V1Service;\n};\n\nconst ServiceSummary = ({ service }: ServiceSummaryProps) => {\n return (\n <Grid\n container\n direction=\"row\"\n justifyContent=\"space-between\"\n alignItems=\"center\"\n spacing={0}\n >\n <Grid xs={8} item>\n <ServiceDrawer service={service} />\n </Grid>\n\n <Grid item>\n <Typography variant=\"subtitle2\">\n Type: {service.spec?.type ?? '?'}\n </Typography>\n </Grid>\n </Grid>\n );\n};\n\ntype ServiceCardProps = {\n service: V1Service;\n};\n\nconst ServiceCard = ({ service }: ServiceCardProps) => {\n const metadata: any = {};\n\n if (service.status?.loadBalancer?.ingress?.length ?? -1 > 0) {\n metadata.loadbalancer = service.status?.loadBalancer;\n }\n\n if (service.spec?.type === 'ClusterIP') {\n metadata.clusterIP = service.spec.clusterIP;\n }\n if (service.spec?.type === 'ExternalName') {\n metadata.externalName = service.spec.externalName;\n }\n\n return (\n <StructuredMetadataTable\n metadata={{\n type: service.spec?.type,\n ports: service.spec?.ports,\n ...metadata,\n }}\n options={{ nestedValuesAsYaml: true }}\n />\n );\n};\n\n/**\n *\n *\n * @public\n */\nexport type ServicesAccordionsProps = {};\n\ntype ServiceAccordionProps = {\n service: V1Service;\n};\n\nconst ServiceAccordion = ({ service }: ServiceAccordionProps) => {\n return (\n <Accordion TransitionProps={{ unmountOnExit: true }} variant=\"outlined\">\n <AccordionSummary expandIcon={<ExpandMoreIcon />}>\n <ServiceSummary service={service} />\n </AccordionSummary>\n <AccordionDetails>\n <ServiceCard service={service} />\n </AccordionDetails>\n </Accordion>\n );\n};\n\n/**\n *\n *\n * @public\n */\nexport const ServicesAccordions = ({}: ServicesAccordionsProps) => {\n const groupedResponses = useContext(GroupedResponsesContext);\n return (\n <Grid\n container\n direction=\"row\"\n justifyContent=\"flex-start\"\n alignItems=\"flex-start\"\n >\n {groupedResponses.services.map((service, i) => (\n <Grid item key={i} xs>\n <ServiceAccordion service={service} />\n </Grid>\n ))}\n </Grid>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAgCA,MAAM,
|
|
1
|
+
{"version":3,"file":"ServicesAccordions.esm.js","sources":["../../../src/components/ServicesAccordions/ServicesAccordions.tsx"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { useContext } from 'react';\nimport Accordion from '@material-ui/core/Accordion';\nimport AccordionDetails from '@material-ui/core/AccordionDetails';\nimport AccordionSummary from '@material-ui/core/AccordionSummary';\nimport Grid from '@material-ui/core/Grid';\nimport Typography from '@material-ui/core/Typography';\nimport ExpandMoreIcon from '@material-ui/icons/ExpandMore';\nimport type { V1Service } from '@kubernetes/client-node';\nimport { ServiceDrawer } from './ServiceDrawer';\nimport { GroupedResponsesContext } from '../../hooks';\nimport { StructuredMetadataTable } from '@backstage/core-components';\n\ntype ServiceSummaryProps = {\n service: V1Service;\n};\n\nconst ServiceSummary = ({ service }: ServiceSummaryProps) => {\n return (\n <Grid\n container\n direction=\"row\"\n justifyContent=\"space-between\"\n alignItems=\"center\"\n spacing={0}\n >\n <Grid xs={8} item>\n <ServiceDrawer service={service} />\n </Grid>\n\n <Grid item>\n <Typography variant=\"subtitle2\">\n Type: {service.spec?.type ?? '?'}\n </Typography>\n </Grid>\n </Grid>\n );\n};\n\ntype ServiceCardProps = {\n service: V1Service;\n};\n\nconst ServiceCard = ({ service }: ServiceCardProps) => {\n const metadata: any = {};\n\n if (service.status?.loadBalancer?.ingress?.length ?? -1 > 0) {\n metadata.loadbalancer = service.status?.loadBalancer;\n }\n\n if (service.spec?.type === 'ClusterIP') {\n metadata.clusterIP = service.spec.clusterIP;\n }\n if (service.spec?.type === 'ExternalName') {\n metadata.externalName = service.spec.externalName;\n }\n\n return (\n <StructuredMetadataTable\n metadata={{\n type: service.spec?.type,\n ports: service.spec?.ports,\n ...metadata,\n }}\n options={{ nestedValuesAsYaml: true }}\n />\n );\n};\n\n/**\n *\n *\n * @public\n */\nexport type ServicesAccordionsProps = {};\n\ntype ServiceAccordionProps = {\n service: V1Service;\n};\n\nconst ServiceAccordion = ({ service }: ServiceAccordionProps) => {\n return (\n <Accordion TransitionProps={{ unmountOnExit: true }} variant=\"outlined\">\n <AccordionSummary expandIcon={<ExpandMoreIcon />}>\n <ServiceSummary service={service} />\n </AccordionSummary>\n <AccordionDetails>\n <ServiceCard service={service} />\n </AccordionDetails>\n </Accordion>\n );\n};\n\n/**\n *\n *\n * @public\n */\nexport const ServicesAccordions = ({}: ServicesAccordionsProps) => {\n const groupedResponses = useContext(GroupedResponsesContext);\n return (\n <Grid\n container\n direction=\"row\"\n justifyContent=\"flex-start\"\n alignItems=\"flex-start\"\n >\n {groupedResponses.services.map((service, i) => (\n <Grid item key={i} xs>\n <ServiceAccordion service={service} />\n </Grid>\n ))}\n </Grid>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAgCA,MAAM,cAAA,GAAiB,CAAC,EAAE,OAAA,EAAQ,KAA2B;AAC3D,EAAA,uBACE,IAAA;AAAA,IAAC,IAAA;AAAA,IAAA;AAAA,MACC,SAAA,EAAS,IAAA;AAAA,MACT,SAAA,EAAU,KAAA;AAAA,MACV,cAAA,EAAe,eAAA;AAAA,MACf,UAAA,EAAW,QAAA;AAAA,MACX,OAAA,EAAS,CAAA;AAAA,MAET,QAAA,EAAA;AAAA,wBAAA,GAAA,CAAC,IAAA,EAAA,EAAK,IAAI,CAAA,EAAG,IAAA,EAAI,MACf,QAAA,kBAAA,GAAA,CAAC,aAAA,EAAA,EAAc,SAAkB,CAAA,EACnC,CAAA;AAAA,4BAEC,IAAA,EAAA,EAAK,IAAA,EAAI,MACR,QAAA,kBAAA,IAAA,CAAC,UAAA,EAAA,EAAW,SAAQ,WAAA,EAAY,QAAA,EAAA;AAAA,UAAA,QAAA;AAAA,UACvB,OAAA,CAAQ,MAAM,IAAA,IAAQ;AAAA,SAAA,EAC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BAAA,EAAA,EACC,QAAA,kBAAA,GAAA,CAAC,WAAA,EAAA,EAAY,SAAkB,CAAA,EACjC;AAAA,GAAA,EACF,CAAA;AAEJ,CAAA;AAOO,MAAM,kBAAA,GAAqB,CAAC,EAAC,KAA+B;AACjE,EAAA,MAAM,gBAAA,GAAmB,WAAW,uBAAuB,CAAA;AAC3D,EAAA,uBACE,GAAA;AAAA,IAAC,IAAA;AAAA,IAAA;AAAA,MACC,SAAA,EAAS,IAAA;AAAA,MACT,SAAA,EAAU,KAAA;AAAA,MACV,cAAA,EAAe,YAAA;AAAA,MACf,UAAA,EAAW,YAAA;AAAA,MAEV,2BAAiB,QAAA,CAAS,GAAA,CAAI,CAAC,OAAA,EAAS,sBACvC,GAAA,CAAC,IAAA,EAAA,EAAK,IAAA,EAAI,IAAA,EAAS,IAAE,IAAA,EACnB,QAAA,kBAAA,GAAA,CAAC,oBAAiB,OAAA,EAAkB,CAAA,EAAA,EADtB,CAEhB,CACD;AAAA;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 { ReactNode } from 'react';\nimport type { 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]: 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":[],"mappings":";;;;;;;;;;;;;AAwBO,MAAM,oBAAoB,CAAC;AAAA,EAChC,WAAA;AAAA,EACA;AACF,
|
|
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 { ReactNode } from 'react';\nimport type { 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]: 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":[],"mappings":";;;;;;;;;;;;;AAwB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AAA,4BAAA,GAAA,CAAC,IAAA,EAAA,EAAK,IAAA,EAAI,IAAA,EACR,QAAA,kBAAA,GAAA,CAAC,UAAA,EAAA,EAAW,OAAA,EAAQ,OAAA,EACjB,QAAA,EAAA,WAAA,CAAY,QAAA,EAAU,IAAA,IAAQ,gBAAA,EACjC,CAAA,EACF,CAAA;AAAA,4BACA,GAAA,CAAC,IAAA,EAAA,EAAK,IAAA,EAAI,IAAA,EACR,QAAA,kBAAA,GAAA,CAAC,UAAA,EAAA,EAAW,KAAA,EAAM,eAAA,EAAgB,OAAA,EAAQ,WAAA,EAAY,QAAA,EAAA,cAAA,EAEtD,CAAA,EACF,CAAA;AAAA,YACC,SAAA,oBACC,GAAA,CAAC,IAAA,EAAA,EAAK,IAAA,EAAI,IAAA,EACR,QAAA,kBAAA,GAAA,CAAC,IAAA,EAAA,EAAK,IAAA,EAAK,OAAA,EAAQ,KAAA,EAAO,CAAA,WAAA,EAAc,SAAS,IAAI,CAAA,EACvD;AAAA;AAAA;AAAA;AAEJ;AAAA,GACF;AAEJ;;;;"}
|
|
@@ -45,7 +45,7 @@ import '../Pods/ErrorList/ErrorList.esm.js';
|
|
|
45
45
|
import { PodsTable, READY_COLUMNS, RESOURCE_COLUMNS } from '../Pods/PodsTable.esm.js';
|
|
46
46
|
import { StatefulSetDrawer } from './StatefulSetDrawer.esm.js';
|
|
47
47
|
import { HorizontalPodAutoscalerDrawer } from '../HorizontalPodAutoscalers/HorizontalPodAutoscalerDrawer.esm.js';
|
|
48
|
-
import {
|
|
48
|
+
import { getOwnedResources, getMatchingHpa } from '../../utils/owner.esm.js';
|
|
49
49
|
|
|
50
50
|
const StatefulSetSummary = ({
|
|
51
51
|
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 { ReactNode, useContext } from 'react';\nimport Accordion from '@material-ui/core/Accordion';\nimport AccordionDetails from '@material-ui/core/AccordionDetails';\nimport AccordionSummary from '@material-ui/core/AccordionSummary';\nimport Grid from '@material-ui/core/Grid';\nimport Typography from '@material-ui/core/Typography';\nimport ExpandMoreIcon from '@material-ui/icons/ExpandMore';\nimport type {\n 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?: ReactNode;\n};\n\ntype StatefulSetAccordionProps = {\n statefulset: V1StatefulSet;\n ownedPods: V1Pod[];\n matchingHpa?: V2HorizontalPodAutoscaler;\n children?: ReactNode;\n};\n\ntype StatefulSetSummaryProps = {\n statefulset: V1StatefulSet;\n numberOfCurrentPods: number;\n numberOfPodsWithErrors: number;\n hpa?: V2HorizontalPodAutoscaler;\n children?: 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":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0DA,MAAM,qBAAqB,CAAC;AAAA,EAC1B,WAAA;AAAA,EACA,mBAAA;AAAA,EACA,sBAAA;AAAA,EACA;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;AAAA,GACpE,EAAG,UAAU,MAAO,CAAA,kBAAA;AAEpB,EAAM,MAAA,OAAA,GAAU,GAAK,EAAA,MAAA,EAAQ,cAAgB,EAAA,IAAA;AAAA,IAC3C,YAAU,MA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A,MAEV,2BAAiB,YAAa,CAAA,GAAA,CAAI,CAAC,WAAa,EAAA,CAAA,yBAC9C,IAAK,EAAA,EAAA,SAAA,EAAS,MAAC,IAAI,EAAA,IAAA,EAAS,IAAE,IAC7B,EAAA,QAAA,kBAAA,GAAA,CAAC,QAAK,IAAI,EAAA,IAAA,EAAC,IAAE,IACX,EAAA,QAAA,kBAAA,GAAA;AAAA,QAAC,oBAAA;AAAA,QAAA;AAAA,UACC,WAAa,EAAA,cAAA;AAAA,YACX;AAAA,cACE,IAAA,EAAM,YAAY,QAAU,EAAA,IAAA;AAAA,cAC5B,SAAA,EAAW,YAAY,QAAU,EAAA,SAAA;AAAA,cACjC,IAAM,EAAA;AAAA,aACR;AAAA,YACA,gBAAiB,CAAA;AAAA,WACnB;AAAA,UACA,SAAW,EAAA,iBAAA,CAAkB,WAAa,EAAA,gBAAA,CAAiB,IAAI,CAAA;AAAA,UAC/D;AAAA;AAAA,OACF,EACF,CAdwB,EAAA,EAAA,CAe1B,CACD;AAAA;AAAA,GACH;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 { ReactNode, useContext } from 'react';\nimport Accordion from '@material-ui/core/Accordion';\nimport AccordionDetails from '@material-ui/core/AccordionDetails';\nimport AccordionSummary from '@material-ui/core/AccordionSummary';\nimport Grid from '@material-ui/core/Grid';\nimport Typography from '@material-ui/core/Typography';\nimport ExpandMoreIcon from '@material-ui/icons/ExpandMore';\nimport type {\n 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?: ReactNode;\n};\n\ntype StatefulSetAccordionProps = {\n statefulset: V1StatefulSet;\n ownedPods: V1Pod[];\n matchingHpa?: V2HorizontalPodAutoscaler;\n children?: ReactNode;\n};\n\ntype StatefulSetSummaryProps = {\n statefulset: V1StatefulSet;\n numberOfCurrentPods: number;\n numberOfPodsWithErrors: number;\n hpa?: V2HorizontalPodAutoscaler;\n children?: 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":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0DA,MAAM,qBAAqB,CAAC;AAAA,EAC1B,WAAA;AAAA,EACA,mBAAA;AAAA,EACA,sBAAA;AAAA,EACA;AACF,CAAA,KAA+B;AAC7B,EAAA,MAAM,WAAA,GAAc,GAAA,EAAK,IAAA,EAAM,OAAA,EAAS,IAAA;AAAA,IACtC,YAAU,MAAA,CAAO,IAAA,KAAS,UAAA,IAAc,MAAA,CAAO,UAAU,IAAA,KAAS;AAAA,GACpE,EAAG,UAAU,MAAA,CAAO,kBAAA;AAEpB,EAAA,MAAM,OAAA,GAAU,GAAA,EAAK,MAAA,EAAQ,cAAA,EAAgB,IAAA;AAAA,IAC3C,YAAU,MAAA,CAAO,IAAA,KAAS,UAAA,IAAc,MAAA,CAAO,UAAU,IAAA,KAAS;AAAA,GACpE,EAAG,UAAU,OAAA,CAAQ,kBAAA;AAErB,EAAA,uBACE,IAAA;AAAA,IAAC,IAAA;AAAA,IAAA;AAAA,MACC,SAAA,EAAS,IAAA;AAAA,MACT,SAAA,EAAU,KAAA;AAAA,MACV,cAAA,EAAe,eAAA;AAAA,MACf,UAAA,EAAW,QAAA;AAAA,MACX,OAAA,EAAS,CAAA;AAAA,MAET,QAAA,EAAA;AAAA,wBAAA,GAAA,CAAC,IAAA,EAAA,EAAK,IAAI,CAAA,EAAG,IAAA,EAAI,MACf,QAAA,kBAAA,GA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AA,EAAM;AAAA,aACR;AAAA,YACA,gBAAA,CAAiB;AAAA,WACnB;AAAA,UACA,SAAA,EAAW,iBAAA,CAAkB,WAAA,EAAa,gBAAA,CAAiB,IAAI,CAAA;AAAA,UAC/D;AAAA;AAAA,OACF,EACF,CAAA,EAAA,EAdwB,CAe1B,CACD;AAAA;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 { createContext } from 'react';\nimport { ClusterAttributes } from '@backstage/plugin-kubernetes-common';\n\n/**\n * @public\n */\nexport const ClusterContext = createContext<ClusterAttributes>({\n name: '',\n});\n"],"names":[],"mappings":";;AAqBO,MAAM,iBAAiB,
|
|
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 { createContext } from 'react';\nimport { ClusterAttributes } from '@backstage/plugin-kubernetes-common';\n\n/**\n * @public\n */\nexport const ClusterContext = createContext<ClusterAttributes>({\n name: '',\n});\n"],"names":[],"mappings":";;AAqBO,MAAM,iBAAiB,aAAA,CAAiC;AAAA,EAC7D,IAAA,EAAM;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 { createContext } from 'react';\nimport { GroupedResponses } from '@backstage/plugin-kubernetes-common';\n\n/**\n *\n *\n * @public\n */\nexport const GroupedResponsesContext = 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":[],"mappings":";;AAuBO,MAAM,0BAA0B,
|
|
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 { createContext } from 'react';\nimport { GroupedResponses } from '@backstage/plugin-kubernetes-common';\n\n/**\n *\n *\n * @public\n */\nexport const GroupedResponsesContext = 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":[],"mappings":";;AAuBO,MAAM,0BAA0B,aAAA,CAAgC;AAAA,EACrE,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 { createContext } from 'react';\n\n/**\n * @public\n */\nexport const PodNamesWithErrorsContext = createContext<Set<string>>(\n new Set<string>(),\n);\n"],"names":[],"mappings":";;AAoBO,MAAM,
|
|
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 { createContext } from 'react';\n\n/**\n * @public\n */\nexport const PodNamesWithErrorsContext = createContext<Set<string>>(\n new Set<string>(),\n);\n"],"names":[],"mappings":";;AAoBO,MAAM,yBAAA,GAA4B,aAAA;AAAA,sBACnC,GAAA;AACN;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PodNamesWithMetrics.esm.js","sources":["../../src/hooks/PodNamesWithMetrics.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 { createContext } from 'react';\nimport { ClientPodStatus } from '@backstage/plugin-kubernetes-common';\n\n/**\n * @public\n */\nexport const PodNamesWithMetricsContext = createContext<\n Map<string, ClientPodStatus>\n>(new Map<string, ClientPodStatus>());\n"],"names":[],"mappings":";;AAqBO,MAAM,
|
|
1
|
+
{"version":3,"file":"PodNamesWithMetrics.esm.js","sources":["../../src/hooks/PodNamesWithMetrics.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 { createContext } from 'react';\nimport { ClientPodStatus } from '@backstage/plugin-kubernetes-common';\n\n/**\n * @public\n */\nexport const PodNamesWithMetricsContext = createContext<\n Map<string, ClientPodStatus>\n>(new Map<string, ClientPodStatus>());\n"],"names":[],"mappings":";;AAqBO,MAAM,0BAAA,GAA6B,aAAA,iBAExC,IAAI,GAAA,EAA8B;;;;"}
|
|
@@ -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,
|
|
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,YAAA,GAAe,OAC1B,MAAA,EACA,aAAA,EACA,0BAAA,KACG;AACH,EAAA,MAAM,QAAA,GAAW,MAAM,aAAA,CAAc,WAAA,EAAY;AAEjD,EAAA,MAAM,aAAA,GAA0B;AAAA,IAC9B,GAAG,IAAI,GAAA;AAAA,MACL,QAAA,CAAS,GAAA;AAAA,QACP,CAAA,CAAA,KACE,CAAA,EAAG,CAAA,CAAE,YAAY,CAAA,EACf,CAAA,CAAE,iBAAA,GAAoB,CAAA,CAAA,EAAI,CAAA,CAAE,iBAAiB,CAAA,CAAA,GAAK,EACpD,CAAA;AAAA;AACJ;AACF,GACF;AAEA,EAAA,IAAI,WAAA,GAAqC;AAAA,IACvC;AAAA,GACF;AACA,EAAA,KAAA,MAAW,mBAAmB,aAAA,EAAe;AAC3C,IAAA,WAAA,GAAc,MAAM,0BAAA,CAA2B,0BAAA;AAAA,MAC7C,eAAA;AAAA,MACA;AAAA,KACF;AAAA,EACF;AACA,EAAA,OAAO,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,
|
|
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,kBAAA,GAAqB,CAChC,MAAA,EACA,sBAAA,EACA,aAAqB,GAAA,KACC;AACtB,EAAA,MAAM,aAAA,GAAgB,OAAO,gBAAgB,CAAA;AAC7C,EAAA,MAAM,0BAAA,GAA6B,OAAO,6BAA6B,CAAA;AACvE,EAAA,MAAM,cAAA,GAAiB,IAAA,CAAK,SAAA,CAAU,sBAAsB,CAAA;AAC5D,EAAA,MAAM,gBAAA,GAAmB,WAAA;AAAA,IACvB,YAA8C;AAC5C,MAAA,MAAM,OAAO,MAAM,YAAA;AAAA,QACjB,MAAA;AAAA,QACA,aAAA;AAAA,QACA;AAAA,OACF;AACA,MAAA,OAAO,MAAM,cAAc,wBAAA,CAAyB;AAAA,QAClD,IAAA;AAAA,QACA,eAAA,EAAiB,sBAAA;AAAA,QACjB;AAAA,OACD,CAAA;AAAA,IACH,CAAA;AAAA;AAAA,IAEA,CAAC,aAAA,EAAe,MAAA,EAAQ,0BAAA,EAA4B,cAAc;AAAA,GACpE;AAEA,EAAA,MAAM,EAAE,KAAA,EAAO,OAAA,EAAS,KAAA,EAAO,OAAM,GAAI,aAAA;AAAA,IACvC,MAAM,gBAAA,EAAiB;AAAA,IACvB,CAAC,gBAAgB;AAAA,GACnB;AAEA,EAAA,WAAA,CAAY,MAAM,KAAA,EAAM,EAAG,UAAU,CAAA;AAErC,EAAA,OAAO;AAAA,IACL,iBAAA,EAAmB,KAAA;AAAA,IACnB,OAAA;AAAA,IACA,OAAO,KAAA,EAAO;AAAA,GAChB;AACF;;;;"}
|
|
@@ -1 +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,
|
|
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,EAAA,MAAM,SAAA,GAAY,OAAO,YAAY,CAAA;AAErC,EAAA,OAAO,SAAA,CACJ,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,
|
|
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,EAAA,MAAM,SAAA,GAAY,OAAO,YAAY,CAAA;AAErC,EAAA,OAAO,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,
|
|
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,EAAA,MAAM,aAAA,GAAgB,OAAO,gBAAgB,CAAA;AAE7C,EAAA,OAAO,SAAS,YAAY;AAC1B,IAAA,MAAM,QAAA,GAAW,MAAM,aAAA,CAAc,WAAA,EAAY;AAEjD,IAAA,IAAI,QAAA,CAAS,WAAW,CAAA,EAAG;AACzB,MAAA,OAAO,KAAA;AAAA,IACT;AAEA,IAAA,MAAM,EAAE,YAAA,EAAa,GAAI,QAAA,CAAS,CAAC,CAAA;AACnC,IAAA,MAAM,oBAAA,GAAuB,CAAC,KAAA,EAAO,QAAA,EAAU,MAAM,CAAA,CAAE,IAAA;AAAA,MACrD,CAAA,gBAAA,KAAoB,YAAA,CAAa,QAAA,CAAS,gBAAgB;AAAA,KAC5D;AAEA,IAAA,OAAO,CAAC,oBAAA;AAAA,EACV,CAAC,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,
|
|
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,oBAAA,GAAuB,CAClC,MAAA,EACA,UAAA,GAAqB,GAAA,KACC;AACtB,EAAA,MAAM,aAAA,GAAgB,OAAO,gBAAgB,CAAA;AAC7C,EAAA,MAAM,0BAAA,GAA6B,OAAO,6BAA6B,CAAA;AACvE,EAAA,MAAM,UAAA,GAAa,YAAY,YAA8C;AAC3E,IAAA,MAAM,OAAO,MAAM,YAAA;AAAA,MACjB,MAAA;AAAA,MACA,aAAA;AAAA,MACA;AAAA,KACF;AACA,IAAA,OAAO,MAAM,cAAc,kBAAA,CAAmB;AAAA,MAC5C,IAAA;AAAA,MACA;AAAA,KACD,CAAA;AAAA,EACH,CAAA,EAAG,CAAC,aAAA,EAAe,MAAA,EAAQ,0BAA0B,CAAC,CAAA;AAEtD,EAAA,MAAM,EAAE,KAAA,EAAO,OAAA,EAAS,KAAA,EAAO,OAAM,GAAI,aAAA;AAAA,IACvC,MAAM,UAAA,EAAW;AAAA,IACjB,CAAC,UAAU;AAAA,GACb;AAEA,EAAA,WAAA,CAAY,MAAM,KAAA,EAAM,EAAG,UAAU,CAAA;AAErC,EAAA,OAAO;AAAA,IACL,iBAAA,EAAmB,KAAA;AAAA,IACnB,OAAA;AAAA,IACA,OAAO,KAAA,EAAO;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 { createContext, useContext } from 'react';\nimport {\n DetectedError,\n ResourceRef,\n} from '@backstage/plugin-kubernetes-common';\nimport type { TypeMeta } from '@kubernetes-models/base';\nimport type { 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 = 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":[],"mappings":";;
|
|
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 { createContext, useContext } from 'react';\nimport {\n DetectedError,\n ResourceRef,\n} from '@backstage/plugin-kubernetes-common';\nimport type { TypeMeta } from '@kubernetes-models/base';\nimport type { 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 = 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":[],"mappings":";;AA4BO,MAAM,qBAAA,GAAwB,aAAA,CAA+B,EAAE;AAe/D,MAAM,iBAAA,GAAoB,CAAC,OAAA,KAA2C;AAC3E,EAAA,MAAM,SAAA,GAAyB;AAAA,IAC7B,IAAA,EAAM,OAAA,CAAQ,QAAA,EAAU,IAAA,IAAQ,EAAA;AAAA,IAChC,SAAA,EAAW,OAAA,CAAQ,QAAA,EAAU,SAAA,IAAa,EAAA;AAAA,IAC1C,MAAM,OAAA,CAAQ,IAAA;AAAA,IACd,UAAU,OAAA,CAAQ;AAAA,GACpB;AAEA,EAAA,MAAM,MAAA,GAAS,WAAW,qBAAqB,CAAA;AAE/C,EAAA,OAAO,MAAA,CAAO,OAAO,CAAA,CAAA,KAAK;AACxB,IAAA,MAAM,IAAI,CAAA,CAAE,SAAA;AACZ,IAAA,OACE,SAAA,CAAU,QAAA,KAAa,CAAA,CAAE,QAAA,IACzB,UAAU,IAAA,KAAS,CAAA,CAAE,IAAA,IACrB,SAAA,CAAU,IAAA,KAAS,CAAA,CAAE,IAAA,IACrB,SAAA,CAAU,cAAc,CAAA,CAAE,SAAA;AAAA,EAE9B,CAAC,CAAA;AACH;;;;"}
|