ClusterAttributes prop for PodExecTerminal

Signed-off-by: Jamie Klassen <jamie.klassen@broadcom.com>
This commit is contained in:
Jamie Klassen
2024-01-24 11:54:08 -05:00
parent a8e98aa981
commit 2bae1be978
5 changed files with 9 additions and 8 deletions
@@ -32,7 +32,7 @@ global.TextEncoder = require('util').TextEncoder;
const textEncoder = new TextEncoder();
describe('PodExecTerminal', () => {
const clusterName = 'cluster1';
const cluster = { name: 'cluster1' };
const containerName = 'container2';
const podName = 'pod1';
const podNamespace = 'podNamespace';
@@ -45,7 +45,7 @@ describe('PodExecTerminal', () => {
await renderInTestApp(
<TestApiProvider apis={[[discoveryApiRef, mockDiscoveryApi]]}>
<PodExecTerminal
clusterName={clusterName}
cluster={cluster}
containerName={containerName}
podName={podName}
podNamespace={podNamespace}
@@ -68,7 +68,7 @@ describe('PodExecTerminal', () => {
await renderInTestApp(
<TestApiProvider apis={[[discoveryApiRef, mockDiscoveryApi]]}>
<PodExecTerminal
clusterName={clusterName}
cluster={cluster}
containerName={containerName}
podName={podName}
podNamespace={podNamespace}
@@ -16,6 +16,7 @@
import 'xterm/css/xterm.css';
import { discoveryApiRef, useApi } from '@backstage/core-plugin-api';
import { ClusterAttributes } from '@backstage/plugin-kubernetes-common';
import { createStyles, makeStyles, Theme } from '@material-ui/core';
import React, { useEffect, useMemo, useState } from 'react';
import { Terminal } from 'xterm';
@@ -29,7 +30,7 @@ import { PodExecTerminalAttachAddon } from './PodExecTerminalAttachAddon';
* @public
*/
export interface PodExecTerminalProps {
clusterName: string;
cluster: ClusterAttributes;
containerName: string;
podName: string;
podNamespace: string;
@@ -27,7 +27,7 @@ import { PodExecTerminal, PodExecTerminalProps } from './PodExecTerminal';
* @public
*/
export const PodExecTerminalDialog = (props: PodExecTerminalProps) => {
const { clusterName, containerName, podName } = props;
const { cluster, containerName, podName } = props;
const isPodExecTerminalSupported = useIsPodExecTerminalSupported();
@@ -42,7 +42,7 @@ export const PodExecTerminalDialog = (props: PodExecTerminalProps) => {
isPodExecTerminalSupported.loading ||
!isPodExecTerminalSupported.value
}
title={`${podName} - ${containerName} terminal shell on cluster ${clusterName}`}
title={`${podName} - ${containerName} terminal shell on cluster ${cluster.name}`}
>
<PodExecTerminal {...props} />
</KubernetesDialog>
@@ -233,7 +233,7 @@ export const ContainerCard: React.FC<ContainerCardProps> = ({
/>
{isPodExecTerminalEnabled && (
<PodExecTerminalDialog
clusterName={podScope.cluster.name}
cluster={podScope.cluster}
containerName={containerStatus.name}
podName={podScope.podName}
podNamespace={podScope.podNamespace}