diff --git a/.changeset/eight-pumas-rule.md b/.changeset/eight-pumas-rule.md new file mode 100644 index 0000000000..57e6b4433b --- /dev/null +++ b/.changeset/eight-pumas-rule.md @@ -0,0 +1,5 @@ +--- +'@backstage/plugin-kubernetes-react': patch +--- + +The `PodAndErrors` type now includes the full `ClusterAttributes` rather than just the name. diff --git a/plugins/kubernetes-react/api-report.md b/plugins/kubernetes-react/api-report.md index 8a0ec4de8f..93086efde7 100644 --- a/plugins/kubernetes-react/api-report.md +++ b/plugins/kubernetes-react/api-report.md @@ -653,7 +653,7 @@ export interface PendingPodContentProps { // @public export interface PodAndErrors { // (undocumented) - clusterName: string; + cluster: ClusterAttributes; // (undocumented) errors: DetectedError[]; // (undocumented) diff --git a/plugins/kubernetes-react/src/components/Pods/ErrorList/ErrorList.test.tsx b/plugins/kubernetes-react/src/components/Pods/ErrorList/ErrorList.test.tsx index 2423654cc3..998ef4b4d0 100644 --- a/plugins/kubernetes-react/src/components/Pods/ErrorList/ErrorList.test.tsx +++ b/plugins/kubernetes-react/src/components/Pods/ErrorList/ErrorList.test.tsx @@ -26,7 +26,7 @@ describe('ErrorList', () => { { diff --git a/plugins/kubernetes-react/src/components/Pods/PodDrawer/PodDrawer.test.tsx b/plugins/kubernetes-react/src/components/Pods/PodDrawer/PodDrawer.test.tsx index 0822aeb060..066fa0f874 100644 --- a/plugins/kubernetes-react/src/components/Pods/PodDrawer/PodDrawer.test.tsx +++ b/plugins/kubernetes-react/src/components/Pods/PodDrawer/PodDrawer.test.tsx @@ -37,7 +37,7 @@ describe('PodDrawer', () => { {...({ open: true, podAndErrors: { - clusterName: 'some-cluster-1', + cluster: { name: 'some-cluster-1' }, pod: { metadata: { name: 'some-pod', diff --git a/plugins/kubernetes-react/src/components/Pods/PodDrawer/PodDrawer.tsx b/plugins/kubernetes-react/src/components/Pods/PodDrawer/PodDrawer.tsx index 1b98237d5a..8f52bb9a7f 100644 --- a/plugins/kubernetes-react/src/components/Pods/PodDrawer/PodDrawer.tsx +++ b/plugins/kubernetes-react/src/components/Pods/PodDrawer/PodDrawer.tsx @@ -79,7 +79,7 @@ export interface PodDrawerProps { */ export const PodDrawer = ({ podAndErrors, open }: PodDrawerProps) => { const classes = useDrawerContentStyles(); - const podMetrics = usePodMetrics(podAndErrors.clusterName, podAndErrors.pod); + const podMetrics = usePodMetrics(podAndErrors.cluster.name, podAndErrors.pod); return ( { podName: podAndErrors.pod.metadata?.name ?? 'unknown', podNamespace: podAndErrors.pod.metadata?.namespace ?? 'unknown', - clusterName: podAndErrors.clusterName, + clusterName: podAndErrors.cluster.name, }} containerSpec={containerSpec} containerStatus={containerStatus} diff --git a/plugins/kubernetes-react/src/components/Pods/PodsTable.tsx b/plugins/kubernetes-react/src/components/Pods/PodsTable.tsx index d83aebb210..d9a7657367 100644 --- a/plugins/kubernetes-react/src/components/Pods/PodsTable.tsx +++ b/plugins/kubernetes-react/src/components/Pods/PodsTable.tsx @@ -80,7 +80,6 @@ const READY: TableColumn[] = [ ]; const PodDrawerTrigger = ({ pod }: { pod: Pod }) => { - const cluster = useContext(ClusterContext); const errors = useMatchingErrors({ kind: 'Pod', apiVersion: 'v1', @@ -90,7 +89,7 @@ const PodDrawerTrigger = ({ pod }: { pod: Pod }) => { diff --git a/plugins/kubernetes-react/src/components/Pods/types.ts b/plugins/kubernetes-react/src/components/Pods/types.ts index 847e6d63bc..ee3ab5153a 100644 --- a/plugins/kubernetes-react/src/components/Pods/types.ts +++ b/plugins/kubernetes-react/src/components/Pods/types.ts @@ -14,15 +14,18 @@ * limitations under the License. */ import { Pod } from 'kubernetes-models/v1'; -import { DetectedError } from '@backstage/plugin-kubernetes-common'; +import { + ClusterAttributes, + DetectedError, +} from '@backstage/plugin-kubernetes-common'; /** - * Wraps a pod with the associated detected errors and cluster name + * Wraps a pod with the associated detected errors and cluster * * @public */ export interface PodAndErrors { - clusterName: string; + cluster: ClusterAttributes; pod: Pod; errors: DetectedError[]; }