@backstage/plugin-kubernetes-react 0.4.5-next.0 → 0.5.0-next.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (95) hide show
  1. package/CHANGELOG.md +29 -0
  2. package/config.d.ts +15 -0
  3. package/dist/alpha.d.ts +8 -0
  4. package/dist/alpha.esm.js +2 -0
  5. package/dist/alpha.esm.js.map +1 -0
  6. package/dist/api/KubernetesBackendClient.esm.js.map +1 -1
  7. package/dist/api/KubernetesClusterLinkFormatter.esm.js.map +1 -1
  8. package/dist/api/KubernetesProxyClient.esm.js +13 -0
  9. package/dist/api/KubernetesProxyClient.esm.js.map +1 -1
  10. package/dist/api/formatters/AksClusterLinksFormatter.esm.js.map +1 -1
  11. package/dist/api/formatters/EksClusterLinksFormatter.esm.js.map +1 -1
  12. package/dist/api/formatters/GkeClusterLinksFormatter.esm.js.map +1 -1
  13. package/dist/api/formatters/OpenshiftClusterLinksFormatter.esm.js.map +1 -1
  14. package/dist/api/formatters/RancherClusterLinksFormatter.esm.js.map +1 -1
  15. package/dist/api/formatters/StandardClusterLinksFormatter.esm.js.map +1 -1
  16. package/dist/api/formatters/index.esm.js.map +1 -1
  17. package/dist/api/types.esm.js.map +1 -1
  18. package/dist/components/Cluster/Cluster.esm.js.map +1 -1
  19. package/dist/components/CronJobsAccordions/CronJobsAccordions.esm.js.map +1 -1
  20. package/dist/components/CronJobsAccordions/CronJobsDrawer.esm.js.map +1 -1
  21. package/dist/components/CustomResources/ArgoRollouts/Rollout.esm.js.map +1 -1
  22. package/dist/components/CustomResources/ArgoRollouts/RolloutDrawer.esm.js.map +1 -1
  23. package/dist/components/CustomResources/ArgoRollouts/StepsProgress.esm.js.map +1 -1
  24. package/dist/components/CustomResources/CustomResources.esm.js.map +1 -1
  25. package/dist/components/CustomResources/DefaultCustomResource.esm.js.map +1 -1
  26. package/dist/components/CustomResources/DefaultCustomResourceDrawer.esm.js.map +1 -1
  27. package/dist/components/DaemonSetsAccordions/DaemonSetsAccordions.esm.js.map +1 -1
  28. package/dist/components/DaemonSetsAccordions/DaemonSetsDrawer.esm.js.map +1 -1
  29. package/dist/components/DeploymentsAccordions/DeploymentDrawer.esm.js.map +1 -1
  30. package/dist/components/DeploymentsAccordions/DeploymentsAccordions.esm.js.map +1 -1
  31. package/dist/components/ErrorPanel/ErrorPanel.esm.js.map +1 -1
  32. package/dist/components/ErrorReporting/ErrorReporting.esm.js.map +1 -1
  33. package/dist/components/HorizontalPodAutoscalers/HorizontalPodAutoscalerDrawer.esm.js.map +1 -1
  34. package/dist/components/IngressesAccordions/IngressDrawer.esm.js.map +1 -1
  35. package/dist/components/IngressesAccordions/IngressesAccordions.esm.js.map +1 -1
  36. package/dist/components/JobsAccordions/JobsAccordions.esm.js.map +1 -1
  37. package/dist/components/JobsAccordions/JobsDrawer.esm.js.map +1 -1
  38. package/dist/components/KubernetesDialog/KubernetesDialog.esm.js.map +1 -1
  39. package/dist/components/KubernetesDrawer/KubernetesDrawer.esm.js.map +1 -1
  40. package/dist/components/KubernetesDrawer/KubernetesStructuredMetadataTableDrawer.esm.js.map +1 -1
  41. package/dist/components/KubernetesDrawer/ManifestYaml.esm.js.map +1 -1
  42. package/dist/components/PodExecTerminal/PodExecTerminal.esm.js.map +1 -1
  43. package/dist/components/PodExecTerminal/PodExecTerminalAttachAddon.esm.js.map +1 -1
  44. package/dist/components/PodExecTerminal/PodExecTerminalDialog.esm.js.map +1 -1
  45. package/dist/components/Pods/ErrorList/ErrorList.esm.js.map +1 -1
  46. package/dist/components/Pods/Events/Events.esm.js +2 -2
  47. package/dist/components/Pods/Events/Events.esm.js.map +1 -1
  48. package/dist/components/Pods/Events/useEvents.esm.js.map +1 -1
  49. package/dist/components/Pods/FixDialog/FixDialog.esm.js.map +1 -1
  50. package/dist/components/Pods/PodDelete/PodDeleteButton.esm.js +50 -0
  51. package/dist/components/Pods/PodDelete/PodDeleteButton.esm.js.map +1 -0
  52. package/dist/components/Pods/PodDelete/usePodDelete.esm.js +21 -0
  53. package/dist/components/Pods/PodDelete/usePodDelete.esm.js.map +1 -0
  54. package/dist/components/Pods/PodDrawer/ContainerCard.esm.js +1 -1
  55. package/dist/components/Pods/PodDrawer/ContainerCard.esm.js.map +1 -1
  56. package/dist/components/Pods/PodDrawer/PendingPodContent.esm.js.map +1 -1
  57. package/dist/components/Pods/PodDrawer/PodDrawer.esm.js +24 -1
  58. package/dist/components/Pods/PodDrawer/PodDrawer.esm.js.map +1 -1
  59. package/dist/components/Pods/PodLogs/PodLogs.esm.js.map +1 -1
  60. package/dist/components/Pods/PodLogs/PodLogsDialog.esm.js.map +1 -1
  61. package/dist/components/Pods/PodLogs/usePodLogs.esm.js.map +1 -1
  62. package/dist/components/Pods/PodsTable.esm.js.map +1 -1
  63. package/dist/components/ResourceUtilization/ResourceUtilization.esm.js.map +1 -1
  64. package/dist/components/ServicesAccordions/ServiceDrawer.esm.js.map +1 -1
  65. package/dist/components/ServicesAccordions/ServicesAccordions.esm.js.map +1 -1
  66. package/dist/components/StatefulSetsAccordions/StatefulSetDrawer.esm.js.map +1 -1
  67. package/dist/components/StatefulSetsAccordions/StatefulSetsAccordions.esm.js.map +1 -1
  68. package/dist/hooks/Cluster.esm.js.map +1 -1
  69. package/dist/hooks/GroupedResponses.esm.js.map +1 -1
  70. package/dist/hooks/PodNamesWithErrors.esm.js.map +1 -1
  71. package/dist/hooks/auth.esm.js.map +1 -1
  72. package/dist/hooks/useCustomResources.esm.js.map +1 -1
  73. package/dist/hooks/useIsPodDeleteEnabled.esm.js +9 -0
  74. package/dist/hooks/useIsPodDeleteEnabled.esm.js.map +1 -0
  75. package/dist/hooks/useIsPodExecTerminalEnabled.esm.js.map +1 -1
  76. package/dist/hooks/useIsPodExecTerminalSupported.esm.js.map +1 -1
  77. package/dist/hooks/useKubernetesObjects.esm.js.map +1 -1
  78. package/dist/hooks/useMatchingErrors.esm.js.map +1 -1
  79. package/dist/hooks/usePodMetrics.esm.js.map +1 -1
  80. package/dist/index.d.ts +14 -0
  81. package/dist/index.esm.js +1 -0
  82. package/dist/index.esm.js.map +1 -1
  83. package/dist/kubernetes-auth-provider/AksKubernetesAuthProvider.esm.js.map +1 -1
  84. package/dist/kubernetes-auth-provider/GoogleKubernetesAuthProvider.esm.js.map +1 -1
  85. package/dist/kubernetes-auth-provider/KubernetesAuthProviders.esm.js.map +1 -1
  86. package/dist/kubernetes-auth-provider/OidcKubernetesAuthProvider.esm.js.map +1 -1
  87. package/dist/kubernetes-auth-provider/ServerSideAuthProvider.esm.js.map +1 -1
  88. package/dist/kubernetes-auth-provider/types.esm.js.map +1 -1
  89. package/dist/translation.esm.js +15 -0
  90. package/dist/translation.esm.js.map +1 -0
  91. package/dist/utils/crons.esm.js.map +1 -1
  92. package/dist/utils/owner.esm.js.map +1 -1
  93. package/dist/utils/pod.esm.js.map +1 -1
  94. package/dist/utils/resources.esm.js.map +1 -1
  95. package/package.json +32 -11
@@ -1 +1 @@
1
- {"version":3,"file":"crons.esm.js","sources":["../../src/utils/crons.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 cronstrue from 'cronstrue';\n\n// Defined at https://kubernetes.io/docs/concepts/workloads/controllers/cron-jobs/\nconst k8sCronAliases = new Map([\n ['@yearly', '0 0 1 1 *'],\n ['@annually', '0 0 1 1 *'],\n ['@monthly', '0 0 1 * *'],\n ['@weekly', '0 0 * * 0'],\n ['@daily', '0 0 * * *'],\n ['@midnight', '0 0 * * *'],\n ['@hourly', '0 * * * *'],\n]);\n\n// humanizeCron takes into account the aliases provided by kubernetes before\n// calling cronstrue. In an effort to not throw an error, it will return the\n// original cron formatted schedule if the cronstrue call fails.\nexport const humanizeCron = (schedule: string): string => {\n const deAliasedSchedule = k8sCronAliases.get(schedule) || schedule;\n try {\n return cronstrue.toString(deAliasedSchedule);\n } catch (e) {\n return deAliasedSchedule;\n }\n};\n"],"names":[],"mappings":";;AAmBA,MAAM,cAAA,uBAAqB,GAAI,CAAA;AAAA,EAC7B,CAAC,WAAW,WAAW,CAAA;AAAA,EACvB,CAAC,aAAa,WAAW,CAAA;AAAA,EACzB,CAAC,YAAY,WAAW,CAAA;AAAA,EACxB,CAAC,WAAW,WAAW,CAAA;AAAA,EACvB,CAAC,UAAU,WAAW,CAAA;AAAA,EACtB,CAAC,aAAa,WAAW,CAAA;AAAA,EACzB,CAAC,WAAW,WAAW,CAAA;AACzB,CAAC,CAAA,CAAA;AAKY,MAAA,YAAA,GAAe,CAAC,QAA6B,KAAA;AACxD,EAAA,MAAM,iBAAoB,GAAA,cAAA,CAAe,GAAI,CAAA,QAAQ,CAAK,IAAA,QAAA,CAAA;AAC1D,EAAI,IAAA;AACF,IAAO,OAAA,SAAA,CAAU,SAAS,iBAAiB,CAAA,CAAA;AAAA,WACpC,CAAG,EAAA;AACV,IAAO,OAAA,iBAAA,CAAA;AAAA,GACT;AACF;;;;"}
1
+ {"version":3,"file":"crons.esm.js","sources":["../../src/utils/crons.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 cronstrue from 'cronstrue';\n\n// Defined at https://kubernetes.io/docs/concepts/workloads/controllers/cron-jobs/\nconst k8sCronAliases = new Map([\n ['@yearly', '0 0 1 1 *'],\n ['@annually', '0 0 1 1 *'],\n ['@monthly', '0 0 1 * *'],\n ['@weekly', '0 0 * * 0'],\n ['@daily', '0 0 * * *'],\n ['@midnight', '0 0 * * *'],\n ['@hourly', '0 * * * *'],\n]);\n\n// humanizeCron takes into account the aliases provided by kubernetes before\n// calling cronstrue. In an effort to not throw an error, it will return the\n// original cron formatted schedule if the cronstrue call fails.\nexport const humanizeCron = (schedule: string): string => {\n const deAliasedSchedule = k8sCronAliases.get(schedule) || schedule;\n try {\n return cronstrue.toString(deAliasedSchedule);\n } catch (e) {\n return deAliasedSchedule;\n }\n};\n"],"names":[],"mappings":";;AAmBA,MAAM,cAAA,uBAAqB,GAAI,CAAA;AAAA,EAC7B,CAAC,WAAW,WAAW,CAAA;AAAA,EACvB,CAAC,aAAa,WAAW,CAAA;AAAA,EACzB,CAAC,YAAY,WAAW,CAAA;AAAA,EACxB,CAAC,WAAW,WAAW,CAAA;AAAA,EACvB,CAAC,UAAU,WAAW,CAAA;AAAA,EACtB,CAAC,aAAa,WAAW,CAAA;AAAA,EACzB,CAAC,WAAW,WAAW;AACzB,CAAC,CAAA;AAKY,MAAA,YAAA,GAAe,CAAC,QAA6B,KAAA;AACxD,EAAA,MAAM,iBAAoB,GAAA,cAAA,CAAe,GAAI,CAAA,QAAQ,CAAK,IAAA,QAAA;AAC1D,EAAI,IAAA;AACF,IAAO,OAAA,SAAA,CAAU,SAAS,iBAAiB,CAAA;AAAA,WACpC,CAAG,EAAA;AACV,IAAO,OAAA,iBAAA;AAAA;AAEX;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"owner.esm.js","sources":["../../src/utils/owner.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 { V1ObjectMeta } from '@kubernetes/client-node/dist/gen/model/v1ObjectMeta';\nimport {\n V2HorizontalPodAutoscaler,\n V1Pod,\n V1ReplicaSet,\n} from '@kubernetes/client-node';\n\ninterface CanOwn {\n metadata?: V1ObjectMeta;\n}\n\ninterface CanBeOwned {\n metadata?: V1ObjectMeta;\n}\n\nexport function getOwnedResources<R extends CanBeOwned>(\n potentialOwner: CanOwn,\n possiblyOwned: R[],\n): R[] {\n return possiblyOwned.filter(\n p =>\n p.metadata?.ownerReferences?.some(\n o => o.uid === potentialOwner.metadata?.uid,\n ) ?? false,\n );\n}\n\nexport const getOwnedPodsThroughReplicaSets = (\n potentialOwner: CanOwn,\n replicaSets: V1ReplicaSet[],\n pods: V1Pod[],\n) => {\n return getOwnedResources(\n potentialOwner,\n replicaSets.filter(rs => rs.status && rs.status.replicas > 0),\n ).reduce((accum, rs) => {\n return accum.concat(getOwnedResources(rs, pods));\n }, [] as V1Pod[]);\n};\n\ninterface ResourceRef {\n kind: string;\n namespace?: string;\n name?: string;\n}\n\nexport const getMatchingHpa = (\n owner: ResourceRef,\n hpas: V2HorizontalPodAutoscaler[],\n): V2HorizontalPodAutoscaler | undefined => {\n return hpas.find(hpa => {\n return (\n (hpa.spec?.scaleTargetRef?.kind ?? '').toLocaleLowerCase('en-US') ===\n owner.kind.toLocaleLowerCase('en-US') &&\n (hpa.metadata?.namespace ?? '') ===\n (owner.namespace ?? 'unknown-namespace') &&\n (hpa.spec?.scaleTargetRef?.name ?? '') ===\n (owner.name ?? 'unknown-deployment')\n );\n });\n};\n"],"names":[],"mappings":"AA+BgB,SAAA,iBAAA,CACd,gBACA,aACK,EAAA;AACL,EAAA,OAAO,aAAc,CAAA,MAAA;AAAA,IACnB,CAAA,CAAA,KACE,CAAE,CAAA,QAAA,EAAU,eAAiB,EAAA,IAAA;AAAA,MAC3B,CAAK,CAAA,KAAA,CAAA,CAAE,GAAQ,KAAA,cAAA,CAAe,QAAU,EAAA,GAAA;AAAA,KACrC,IAAA,KAAA;AAAA,GACT,CAAA;AACF,CAAA;AAEO,MAAM,8BAAiC,GAAA,CAC5C,cACA,EAAA,WAAA,EACA,IACG,KAAA;AACH,EAAO,OAAA,iBAAA;AAAA,IACL,cAAA;AAAA,IACA,WAAA,CAAY,OAAO,CAAM,EAAA,KAAA,EAAA,CAAG,UAAU,EAAG,CAAA,MAAA,CAAO,WAAW,CAAC,CAAA;AAAA,GAC5D,CAAA,MAAA,CAAO,CAAC,KAAA,EAAO,EAAO,KAAA;AACtB,IAAA,OAAO,KAAM,CAAA,MAAA,CAAO,iBAAkB,CAAA,EAAA,EAAI,IAAI,CAAC,CAAA,CAAA;AAAA,GACjD,EAAG,EAAa,CAAA,CAAA;AAClB,EAAA;AAQa,MAAA,cAAA,GAAiB,CAC5B,KAAA,EACA,IAC0C,KAAA;AAC1C,EAAO,OAAA,IAAA,CAAK,KAAK,CAAO,GAAA,KAAA;AACtB,IACG,OAAA,CAAA,GAAA,CAAI,IAAM,EAAA,cAAA,EAAgB,IAAQ,IAAA,EAAA,EAAI,iBAAkB,CAAA,OAAO,CAC9D,KAAA,KAAA,CAAM,IAAK,CAAA,iBAAA,CAAkB,OAAO,CAAA,IAAA,CACrC,IAAI,QAAU,EAAA,SAAA,IAAa,EACzB,OAAA,KAAA,CAAM,SAAa,IAAA,mBAAA,CAAA,IAAA,CACrB,GAAI,CAAA,IAAA,EAAM,cAAgB,EAAA,IAAA,IAAQ,EAChC,OAAA,KAAA,CAAM,IAAQ,IAAA,oBAAA,CAAA,CAAA;AAAA,GAEpB,CAAA,CAAA;AACH;;;;"}
1
+ {"version":3,"file":"owner.esm.js","sources":["../../src/utils/owner.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 {\n V1ObjectMeta,\n V2HorizontalPodAutoscaler,\n V1Pod,\n V1ReplicaSet,\n} from '@kubernetes/client-node';\n\ninterface CanOwn {\n metadata?: V1ObjectMeta;\n}\n\ninterface CanBeOwned {\n metadata?: V1ObjectMeta;\n}\n\nexport function getOwnedResources<R extends CanBeOwned>(\n potentialOwner: CanOwn,\n possiblyOwned: R[],\n): R[] {\n return possiblyOwned.filter(\n p =>\n p.metadata?.ownerReferences?.some(\n o => o.uid === potentialOwner.metadata?.uid,\n ) ?? false,\n );\n}\n\nexport const getOwnedPodsThroughReplicaSets = (\n potentialOwner: CanOwn,\n replicaSets: V1ReplicaSet[],\n pods: V1Pod[],\n) => {\n return getOwnedResources(\n potentialOwner,\n replicaSets.filter(rs => rs.status && rs.status.replicas > 0),\n ).reduce((accum, rs) => {\n return accum.concat(getOwnedResources(rs, pods));\n }, [] as V1Pod[]);\n};\n\ninterface ResourceRef {\n kind: string;\n namespace?: string;\n name?: string;\n}\n\nexport const getMatchingHpa = (\n owner: ResourceRef,\n hpas: V2HorizontalPodAutoscaler[],\n): V2HorizontalPodAutoscaler | undefined => {\n return hpas.find(hpa => {\n return (\n (hpa.spec?.scaleTargetRef?.kind ?? '').toLocaleLowerCase('en-US') ===\n owner.kind.toLocaleLowerCase('en-US') &&\n (hpa.metadata?.namespace ?? '') ===\n (owner.namespace ?? 'unknown-namespace') &&\n (hpa.spec?.scaleTargetRef?.name ?? '') ===\n (owner.name ?? 'unknown-deployment')\n );\n });\n};\n"],"names":[],"mappings":"AA+BgB,SAAA,iBAAA,CACd,gBACA,aACK,EAAA;AACL,EAAA,OA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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 {\n V1Pod,\n V1PodCondition,\n V1DeploymentCondition,\n} from '@kubernetes/client-node';\nimport React, { Fragment, ReactNode } from 'react';\nimport Chip from '@material-ui/core/Chip';\nimport {\n StatusAborted,\n StatusError,\n StatusOK,\n SubvalueCell,\n} from '@backstage/core-components';\nimport { ClientPodStatus } from '@backstage/plugin-kubernetes-common';\nimport { Pod } from 'kubernetes-models/v1/Pod';\nimport { bytesToMiB, formatMillicores } from './resources';\n\nexport const imageChips = (pod: V1Pod): ReactNode => {\n const containerStatuses = pod.status?.containerStatuses ?? [];\n const images = containerStatuses.map((cs, i) => {\n return <Chip key={i} label={`${cs.name}=${cs.image}`} size=\"small\" />;\n });\n\n return <div>{images}</div>;\n};\n\nexport const containersReady = (pod: Pod): string => {\n const containerStatuses = pod.status?.containerStatuses ?? [];\n const containersReadyItem = containerStatuses.filter(cs => cs.ready).length;\n\n return `${containersReadyItem}/${containerStatuses.length}`;\n};\n\nexport const totalRestarts = (pod: Pod): number => {\n const containerStatuses = pod.status?.containerStatuses ?? [];\n return containerStatuses?.reduce((a, b) => a + b.restartCount, 0);\n};\n\nexport const containerStatuses = (pod: Pod): ReactNode => {\n const containerStatusesItem = pod.status?.containerStatuses ?? [];\n const errors = containerStatusesItem.reduce((accum, next) => {\n if (next.state === undefined) {\n return accum;\n }\n\n const waiting = next.state.waiting;\n const terminated = next.state.terminated;\n\n const renderCell = (reason: string | undefined) => (\n <Fragment key={`${pod.metadata?.name}-${next.name}`}>\n <SubvalueCell\n value={\n reason === 'Completed' ? (\n <StatusOK>Container: {next.name}</StatusOK>\n ) : (\n <StatusError>Container: {next.name}</StatusError>\n )\n }\n subvalue={reason}\n />\n <br />\n </Fragment>\n );\n\n if (waiting) {\n accum.push(renderCell(waiting.reason));\n }\n\n if (terminated) {\n accum.push(renderCell(terminated.reason));\n }\n\n return accum;\n }, [] as React.ReactNode[]);\n\n if (errors.length === 0) {\n return <StatusOK>OK</StatusOK>;\n }\n\n return errors;\n};\n\nexport const renderCondition = (\n condition: V1PodCondition | V1DeploymentCondition,\n): [string, ReactNode] => {\n const status = condition.status;\n\n if (status === 'True') {\n return [condition.type, <StatusOK>True</StatusOK>];\n } else if (status === 'False') {\n return [\n condition.type,\n <SubvalueCell\n value={<StatusError>False</StatusError>}\n subvalue={condition.message ?? ''}\n />,\n ];\n }\n return [condition.type, <StatusAborted />];\n};\n\n// visible for testing\nexport const currentToDeclaredResourceToPerc = (\n current: number | string,\n resource: number | string,\n): string => {\n if (Number(resource) === 0) return `0%`;\n\n if (typeof current === 'number' && typeof resource === 'number') {\n return `${Math.round((current / resource) * 100)}%`;\n }\n\n const numerator: bigint = BigInt(\n typeof current === 'number' ? Math.round(current) : current,\n );\n const denominator: bigint = BigInt(\n typeof resource === 'number' ? Math.round(resource) : resource,\n );\n\n return `${(numerator * BigInt(100)) / denominator}%`;\n};\n\nexport const podStatusToCpuUtil = (podStatus: ClientPodStatus): ReactNode => {\n const cpuUtil = podStatus.cpu;\n\n let currentUsage: number | string = cpuUtil.currentUsage;\n\n // current usage number for CPU is a different unit than request/limit total\n // this might be a bug in the k8s library\n if (typeof cpuUtil.currentUsage === 'number') {\n currentUsage = cpuUtil.currentUsage / 10;\n }\n\n return (\n <SubvalueCell\n value={`requests: ${currentToDeclaredResourceToPerc(\n currentUsage,\n cpuUtil.requestTotal,\n )} of ${formatMillicores(cpuUtil.requestTotal)}`}\n subvalue={`limits: ${currentToDeclaredResourceToPerc(\n currentUsage,\n cpuUtil.limitTotal,\n )} of ${formatMillicores(cpuUtil.limitTotal)}`}\n />\n );\n};\n\nexport const podStatusToMemoryUtil = (\n podStatus: ClientPodStatus,\n): ReactNode => {\n const memUtil = podStatus.memory;\n\n return (\n <SubvalueCell\n value={`requests: ${currentToDeclaredResourceToPerc(\n memUtil.currentUsage,\n memUtil.requestTotal,\n )} of ${bytesToMiB(memUtil.requestTotal)}`}\n subvalue={`limits: ${currentToDeclaredResourceToPerc(\n memUtil.currentUsage,\n memUtil.limitTotal,\n )} of ${bytesToMiB(memUtil.limitTotal)}`}\n />\n );\n};\n"],"names":["containerStatuses","React"],"mappings":";;;;;AA0Ca,MAAA,eAAA,GAAkB,CAAC,GAAqB,KAAA;AACnD,EAAA,MAAMA,kBAAoB,GAAA,GAAA,CAAI,MAAQ,EAAA,iBAAA,IAAqB,EAAC,CAAA;AAC5D,EAAA,MAAM,sBAAsBA,kBAAkB,CAAA,MAAA,CAAO,CAAM,EAAA,KAAA,EAAA,CAAG,KAAK,CAAE,CAAA,MAAA,CAAA;AAErE,EAAA,OAAO,CAAG,EAAA,mBAAmB,CAAIA,CAAAA,EAAAA,kBAAAA,CAAkB,MAAM,CAAA,CAAA,CAAA;AAC3D,EAAA;AAEa,MAAA,aAAA,GAAgB,CAAC,GAAqB,KAAA;AACjD,EAAA,MAAMA,kBAAoB,GAAA,GAAA,CAAI,MAAQ,EAAA,iBAAA,IAAqB,EAAC,CAAA;AAC5D,EAAOA,OAAAA,kBAAAA,EAAmB,OAAO,CAAC,CAAA,EAAG,MAAM,CAAI,GAAA,CAAA,CAAE,cAAc,CAAC,CAAA,CAAA;AAClE,EAAA;AAEa,MAAA,iBAAA,GAAoB,CAAC,GAAwB,KAAA;AACxD,EAAA,MAAM,qBAAwB,GAAA,GAAA,CAAI,MAAQ,EAAA,iBAAA,IAAqB,EAAC,CAAA;AAChE,EAAA,MAAM,MAAS,GAAA,qBAAA,CAAsB,MAAO,CAAA,CAAC,OAAO,IAAS,KAAA;AAC3D,IAAI,IAAA,IAAA,CAAK,UAAU,KAAW,CAAA,EAAA;AAC5B,MAAO,OAAA,KAAA,CA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,UAAW,CAAA,OAAA,CAAQ,YAAY,CAAC,CAAA,CAAA;AAAA,MACxC,UAAU,CAAW,QAAA,EAAA,+BAAA;AAAA,QACnB,OAAQ,CAAA,YAAA;AAAA,QACR,OAAQ,CAAA,UAAA;AAAA,OACT,CAAA,IAAA,EAAO,UAAW,CAAA,OAAA,CAAQ,UAAU,CAAC,CAAA,CAAA;AAAA,KAAA;AAAA,GACxC,CAAA;AAEJ;;;;"}
1
+ {"version":3,"file":"pod.esm.js","sources":["../../src/utils/pod.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 {\n V1Pod,\n V1PodCondition,\n V1DeploymentCondition,\n} from '@kubernetes/client-node';\nimport React, { Fragment, ReactNode } from 'react';\nimport Chip from '@material-ui/core/Chip';\nimport {\n StatusAborted,\n StatusError,\n StatusOK,\n SubvalueCell,\n} from '@backstage/core-components';\nimport { ClientPodStatus } from '@backstage/plugin-kubernetes-common';\nimport { Pod } from 'kubernetes-models/v1/Pod';\nimport { bytesToMiB, formatMillicores } from './resources';\n\nexport const imageChips = (pod: V1Pod): ReactNode => {\n const containerStatuses = pod.status?.containerStatuses ?? [];\n const images = containerStatuses.map((cs, i) => {\n return <Chip key={i} label={`${cs.name}=${cs.image}`} size=\"small\" />;\n });\n\n return <div>{images}</div>;\n};\n\nexport const containersReady = (pod: Pod): string => {\n const containerStatuses = pod.status?.containerStatuses ?? [];\n const containersReadyItem = containerStatuses.filter(cs => cs.ready).length;\n\n return `${containersReadyItem}/${containerStatuses.length}`;\n};\n\nexport const totalRestarts = (pod: Pod): number => {\n const containerStatuses = pod.status?.containerStatuses ?? [];\n return containerStatuses?.reduce((a, b) => a + b.restartCount, 0);\n};\n\nexport const containerStatuses = (pod: Pod): ReactNode => {\n const containerStatusesItem = pod.status?.containerStatuses ?? [];\n const errors = containerStatusesItem.reduce((accum, next) => {\n if (next.state === undefined) {\n return accum;\n }\n\n const waiting = next.state.waiting;\n const terminated = next.state.terminated;\n\n const renderCell = (reason: string | undefined) => (\n <Fragment key={`${pod.metadata?.name}-${next.name}`}>\n <SubvalueCell\n value={\n reason === 'Completed' ? (\n <StatusOK>Container: {next.name}</StatusOK>\n ) : (\n <StatusError>Container: {next.name}</StatusError>\n )\n }\n subvalue={reason}\n />\n <br />\n </Fragment>\n );\n\n if (waiting) {\n accum.push(renderCell(waiting.reason));\n }\n\n if (terminated) {\n accum.push(renderCell(terminated.reason));\n }\n\n return accum;\n }, [] as React.ReactNode[]);\n\n if (errors.length === 0) {\n return <StatusOK>OK</StatusOK>;\n }\n\n return errors;\n};\n\nexport const renderCondition = (\n condition: V1PodCondition | V1DeploymentCondition,\n): [string, ReactNode] => {\n const status = condition.status;\n\n if (status === 'True') {\n return [condition.type, <StatusOK>True</StatusOK>];\n } else if (status === 'False') {\n return [\n condition.type,\n <SubvalueCell\n value={<StatusError>False</StatusError>}\n subvalue={condition.message ?? ''}\n />,\n ];\n }\n return [condition.type, <StatusAborted />];\n};\n\n// visible for testing\nexport const currentToDeclaredResourceToPerc = (\n current: number | string,\n resource: number | string,\n): string => {\n if (Number(resource) === 0) return `0%`;\n\n if (typeof current === 'number' && typeof resource === 'number') {\n return `${Math.round((current / resource) * 100)}%`;\n }\n\n const numerator: bigint = BigInt(\n typeof current === 'number' ? Math.round(current) : current,\n );\n const denominator: bigint = BigInt(\n typeof resource === 'number' ? Math.round(resource) : resource,\n );\n\n return `${(numerator * BigInt(100)) / denominator}%`;\n};\n\nexport const podStatusToCpuUtil = (podStatus: ClientPodStatus): ReactNode => {\n const cpuUtil = podStatus.cpu;\n\n let currentUsage: number | string = cpuUtil.currentUsage;\n\n // current usage number for CPU is a different unit than request/limit total\n // this might be a bug in the k8s library\n if (typeof cpuUtil.currentUsage === 'number') {\n currentUsage = cpuUtil.currentUsage / 10;\n }\n\n return (\n <SubvalueCell\n value={`requests: ${currentToDeclaredResourceToPerc(\n currentUsage,\n cpuUtil.requestTotal,\n )} of ${formatMillicores(cpuUtil.requestTotal)}`}\n subvalue={`limits: ${currentToDeclaredResourceToPerc(\n currentUsage,\n cpuUtil.limitTotal,\n )} of ${formatMillicores(cpuUtil.limitTotal)}`}\n />\n );\n};\n\nexport const podStatusToMemoryUtil = (\n podStatus: ClientPodStatus,\n): ReactNode => {\n const memUtil = podStatus.memory;\n\n return (\n <SubvalueCell\n value={`requests: ${currentToDeclaredResourceToPerc(\n memUtil.currentUsage,\n memUtil.requestTotal,\n )} of ${bytesToMiB(memUtil.requestTotal)}`}\n subvalue={`limits: ${currentToDeclaredResourceToPerc(\n memUtil.currentUsage,\n memUtil.limitTotal,\n )} of ${bytesToMiB(memUtil.limitTotal)}`}\n />\n );\n};\n"],"names":["containerStatuses","React"],"mappings":";;;;;AA0Ca,MAAA,eAAA,GAAkB,CAAC,GAAqB,KAAA;AACnD,EAAA,MAAMA,kBAAoB,GAAA,GAAA,CAAI,MAAQ,EAAA,iBAAA,IAAqB,EAAC;AAC5D,EAAA,MAAM,sBAAsBA,kBAAkB,CAAA,MAAA,CAAO,CAAM,EAAA,KAAA,EAAA,CAAG,KAAK,CAAE,CAAA,MAAA;AAErE,EAAA,OAAO,CAAG,EAAA,mBAAmB,CAAIA,CAAAA,EAAAA,kBAAAA,CAAkB,MAAM,CAAA,CAAA;AAC3D;AAEa,MAAA,aAAA,GAAgB,CAAC,GAAqB,KAAA;AACjD,EAAA,MAAMA,kBAAoB,GAAA,GAAA,CAAI,MAAQ,EAAA,iBAAA,IAAqB,EAAC;AAC5D,EAAOA,OAAAA,kBAAAA,EAAmB,OAAO,CAAC,CAAA,EAAG,MAAM,CAAI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AAA;AAAA,QACR,OAAQ,CAAA;AAAA,OACT,CAAA,IAAA,EAAO,UAAW,CAAA,OAAA,CAAQ,YAAY,CAAC,CAAA,CAAA;AAAA,MACxC,UAAU,CAAW,QAAA,EAAA,+BAAA;AAAA,QACnB,OAAQ,CAAA,YAAA;AAAA,QACR,OAAQ,CAAA;AAAA,OACT,CAAA,IAAA,EAAO,UAAW,CAAA,OAAA,CAAQ,UAAU,CAAC,CAAA;AAAA;AAAA,GACxC;AAEJ;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"resources.esm.js","sources":["../../src/utils/resources.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 */\nexport const currentToDeclaredResourceToPerc = (\n current: number | string,\n resource: number | string,\n): number => {\n if (Number(resource) === 0) return 0;\n\n if (typeof current === 'number' && typeof resource === 'number') {\n return Math.round((current / resource) * 100);\n }\n\n const numerator: bigint = BigInt(current);\n const denominator: bigint = BigInt(resource);\n\n return Number((numerator * BigInt(100)) / denominator);\n};\n\nexport const bytesToMiB = (value: string | number): string => {\n return `${(parseFloat(value.toString()) / 1024 / 1024).toFixed(0)}MiB`;\n};\n\nexport const formatMillicores = (value: string | number): string => {\n return `${(parseFloat(value.toString()) * 1000).toFixed(0)}m`;\n};\n"],"names":[],"mappings":"AAea,MAAA,+BAAA,GAAkC,CAC7C,OAAA,EACA,QACW,KAAA;AACX,EAAA,IAAI,MAAO,CAAA,QAAQ,CAAM,KAAA,CAAA,EAAU,OAAA,CAAA,CAAA;AAEnC,EAAA,IAAI,OAAO,OAAA,KAAY,QAAY,IAAA,OAAO,aAAa,QAAU,EAAA;AAC/D,IAAA,OAAO,IAAK,CAAA,KAAA,CAAO,OAAU,GAAA,QAAA,GAAY,GAAG,CAAA,CAAA;AAAA,GAC9C;AAEA,EAAM,MAAA,SAAA,GAAoB,OAAO,OAAO,CAAA,CAAA;AACxC,EAAM,MAAA,WAAA,GAAsB,OAAO,QAAQ,CAAA,CAAA;AAE3C,EAAA,OAAO,MAAQ,CAAA,SAAA,GAAY,MAAO,CAAA,GAAG,IAAK,WAAW,CAAA,CAAA;AACvD,EAAA;AAEa,MAAA,UAAA,GAAa,CAAC,KAAmC,KAAA;AAC5D,EAAO,OAAA,CAAA,EAAA,CAAI,UAAW,CAAA,KAAA,CAAM,QAAS,EAAC,IAAI,IAAO,GAAA,IAAA,EAAM,OAAQ,CAAA,CAAC,CAAC,CAAA,GAAA,CAAA,CAAA;AACnE,EAAA;AAEa,MAAA,gBAAA,GAAmB,CAAC,KAAmC,KAAA;AAClE,EAAO,OAAA,CAAA,EAAA,CAAI,WAAW,KAAM,CAAA,QAAA,EAAU,CAAI,GAAA,GAAA,EAAM,OAAQ,CAAA,CAAC,CAAC,CAAA,CAAA,CAAA,CAAA;AAC5D;;;;"}
1
+ {"version":3,"file":"resources.esm.js","sources":["../../src/utils/resources.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 */\nexport const currentToDeclaredResourceToPerc = (\n current: number | string,\n resource: number | string,\n): number => {\n if (Number(resource) === 0) return 0;\n\n if (typeof current === 'number' && typeof resource === 'number') {\n return Math.round((current / resource) * 100);\n }\n\n const numerator: bigint = BigInt(current);\n const denominator: bigint = BigInt(resource);\n\n return Number((numerator * BigInt(100)) / denominator);\n};\n\nexport const bytesToMiB = (value: string | number): string => {\n return `${(parseFloat(value.toString()) / 1024 / 1024).toFixed(0)}MiB`;\n};\n\nexport const formatMillicores = (value: string | number): string => {\n return `${(parseFloat(value.toString()) * 1000).toFixed(0)}m`;\n};\n"],"names":[],"mappings":"AAea,MAAA,+BAAA,GAAkC,CAC7C,OAAA,EACA,QACW,KAAA;AACX,EAAA,IAAI,MAAO,CAAA,QAAQ,CAAM,KAAA,CAAA,EAAU,OAAA,CAAA;AAEnC,EAAA,IAAI,OAAO,OAAA,KAAY,QAAY,IAAA,OAAO,aAAa,QAAU,EAAA;AAC/D,IAAA,OAAO,IAAK,CAAA,KAAA,CAAO,OAAU,GAAA,QAAA,GAAY,GAAG,CAAA;AAAA;AAG9C,EAAM,MAAA,SAAA,GAAoB,OAAO,OAAO,CAAA;AACxC,EAAM,MAAA,WAAA,GAAsB,OAAO,QAAQ,CAAA;AAE3C,EAAA,OAAO,MAAQ,CAAA,SAAA,GAAY,MAAO,CAAA,GAAG,IAAK,WAAW,CAAA;AACvD;AAEa,MAAA,UAAA,GAAa,CAAC,KAAmC,KAAA;AAC5D,EAAO,OAAA,CAAA,EAAA,CAAI,UAAW,CAAA,KAAA,CAAM,QAAS,EAAC,IAAI,IAAO,GAAA,IAAA,EAAM,OAAQ,CAAA,CAAC,CAAC,CAAA,GAAA,CAAA;AACnE;AAEa,MAAA,gBAAA,GAAmB,CAAC,KAAmC,KAAA;AAClE,EAAO,OAAA,CAAA,EAAA,CAAI,WAAW,KAAM,CAAA,QAAA,EAAU,CAAI,GAAA,GAAA,EAAM,OAAQ,CAAA,CAAC,CAAC,CAAA,CAAA,CAAA;AAC5D;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@backstage/plugin-kubernetes-react",
3
- "version": "0.4.5-next.0",
3
+ "version": "0.5.0-next.2",
4
4
  "description": "Web library for the kubernetes-react plugin",
5
5
  "backstage": {
6
6
  "role": "web-library",
@@ -14,9 +14,7 @@
14
14
  ]
15
15
  },
16
16
  "publishConfig": {
17
- "access": "public",
18
- "main": "dist/index.esm.js",
19
- "types": "dist/index.d.ts"
17
+ "access": "public"
20
18
  },
21
19
  "repository": {
22
20
  "type": "git",
@@ -25,8 +23,31 @@
25
23
  },
26
24
  "license": "Apache-2.0",
27
25
  "sideEffects": false,
28
- "main": "dist/index.esm.js",
29
- "types": "dist/index.d.ts",
26
+ "exports": {
27
+ ".": {
28
+ "import": "./dist/index.esm.js",
29
+ "types": "./dist/index.d.ts",
30
+ "default": "./dist/index.esm.js"
31
+ },
32
+ "./alpha": {
33
+ "import": "./dist/alpha.esm.js",
34
+ "types": "./dist/alpha.d.ts",
35
+ "default": "./dist/alpha.esm.js"
36
+ },
37
+ "./package.json": "./package.json"
38
+ },
39
+ "main": "./dist/index.esm.js",
40
+ "types": "./dist/index.d.ts",
41
+ "typesVersions": {
42
+ "*": {
43
+ "index": [
44
+ "dist/index.d.ts"
45
+ ],
46
+ "alpha": [
47
+ "dist/alpha.d.ts"
48
+ ]
49
+ }
50
+ },
30
51
  "files": [
31
52
  "dist",
32
53
  "config.d.ts"
@@ -42,14 +63,14 @@
42
63
  },
43
64
  "dependencies": {
44
65
  "@backstage/catalog-model": "1.7.0",
45
- "@backstage/core-components": "0.16.0-next.0",
66
+ "@backstage/core-components": "0.16.0-next.2",
46
67
  "@backstage/core-plugin-api": "1.10.0",
47
68
  "@backstage/errors": "1.2.4",
48
- "@backstage/plugin-kubernetes-common": "0.8.3",
69
+ "@backstage/plugin-kubernetes-common": "0.9.0-next.0",
49
70
  "@backstage/types": "1.1.1",
50
71
  "@kubernetes-models/apimachinery": "^2.0.0",
51
72
  "@kubernetes-models/base": "^5.0.0",
52
- "@kubernetes/client-node": "^0.20.0",
73
+ "@kubernetes/client-node": "1.0.0-rc7",
53
74
  "@material-ui/core": "^4.9.13",
54
75
  "@material-ui/icons": "^4.11.3",
55
76
  "@material-ui/lab": "^4.0.0-alpha.61",
@@ -64,9 +85,9 @@
64
85
  "xterm-addon-fit": "^0.8.0"
65
86
  },
66
87
  "devDependencies": {
67
- "@backstage/cli": "0.29.0-next.0",
88
+ "@backstage/cli": "0.29.0-next.3",
68
89
  "@backstage/core-app-api": "1.15.1",
69
- "@backstage/test-utils": "1.7.0",
90
+ "@backstage/test-utils": "1.7.1-next.0",
70
91
  "@testing-library/jest-dom": "^6.0.0",
71
92
  "@testing-library/react": "^16.0.0",
72
93
  "@types/react": "^18.0.0",