Display title in Cluster accordion
Signed-off-by: Jamie Klassen <jamie.klassen@broadcom.com>
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'@backstage/plugin-kubernetes-react': patch
|
||||
---
|
||||
|
||||
The `Cluster` component now renders the cluster's title, if specified.
|
||||
@@ -56,4 +56,25 @@ describe('Cluster', () => {
|
||||
expect(screen.getByText('cluster-1')).toBeInTheDocument();
|
||||
expect(screen.getByText('10 pods')).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('renders title', async () => {
|
||||
await renderInTestApp(
|
||||
<Cluster
|
||||
{...({
|
||||
clusterObjects: {
|
||||
cluster: {
|
||||
name: 'cluster-1',
|
||||
title: 'Cluster Number One',
|
||||
},
|
||||
resources: [],
|
||||
podMetrics: [],
|
||||
errors: [],
|
||||
},
|
||||
podsWithErrors: new Set<string>(),
|
||||
} as any)}
|
||||
/>,
|
||||
);
|
||||
|
||||
expect(screen.getByText('Cluster Number One')).toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -132,7 +132,9 @@ export const Cluster = ({ clusterObjects, podsWithErrors }: ClusterProps) => {
|
||||
<Accordion TransitionProps={{ unmountOnExit: true }}>
|
||||
<AccordionSummary expandIcon={<ExpandMoreIcon />}>
|
||||
<ClusterSummary
|
||||
clusterName={clusterObjects.cluster.name}
|
||||
clusterName={
|
||||
clusterObjects.cluster.title || clusterObjects.cluster.name
|
||||
}
|
||||
totalNumberOfPods={groupedResponses.pods.length}
|
||||
numberOfPodsWithErrors={podsWithErrors.size}
|
||||
/>
|
||||
|
||||
Reference in New Issue
Block a user