ErrorPanel surfaces cluster title

Signed-off-by: Jamie Klassen <jamie.klassen@broadcom.com>
This commit is contained in:
Jamie Klassen
2024-01-23 10:33:19 -05:00
parent 0dfc185829
commit 74770c81ec
3 changed files with 11 additions and 3 deletions
+6
View File
@@ -0,0 +1,6 @@
---
'@backstage/plugin-kubernetes-react': patch
---
The `ErrorPanel` component will display the `title` field (when specified) for
clusters with errors.
@@ -26,7 +26,7 @@ describe('ErrorPanel', () => {
entityName="THIS_ENTITY"
clustersWithErrors={[
{
cluster: { name: 'THIS_CLUSTER' },
cluster: { name: 'THIS_CLUSTER', title: 'This Fine Cluster' },
resources: [],
podMetrics: [],
errors: [
@@ -50,7 +50,7 @@ describe('ErrorPanel', () => {
// message
expect(screen.getByText('Errors:')).toBeInTheDocument();
expect(screen.getByText('Cluster: THIS_CLUSTER')).toBeInTheDocument();
expect(screen.getByText('Cluster: This Fine Cluster')).toBeInTheDocument();
expect(
screen.getByText(
"Error fetching Kubernetes resource: 'some/resource', error: SYSTEM_ERROR, status code: 500",
@@ -25,7 +25,9 @@ const clustersWithErrorsToErrorMessage = (
return clustersWithErrors.map((c, i) => {
return (
<div key={i}>
<Typography variant="body2">{`Cluster: ${c.cluster.name}`}</Typography>
<Typography variant="body2">{`Cluster: ${
c.cluster.title || c.cluster.name
}`}</Typography>
{c.errors.map((e, j) => {
return (
<Typography variant="body2" key={j}>