From b6dbf423b16b8c89b479e844856be512cbc4aa4a Mon Sep 17 00:00:00 2001 From: Simon Lyttle Date: Mon, 9 Sep 2024 15:08:26 +0100 Subject: [PATCH] feat: [IAC-2429]: IACM plugin unauthourized message --- .../src/components/WorkspaceList/index.tsx | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/plugins/harness-iacm/src/components/WorkspaceList/index.tsx b/plugins/harness-iacm/src/components/WorkspaceList/index.tsx index d5fa727..edb9dc9 100644 --- a/plugins/harness-iacm/src/components/WorkspaceList/index.tsx +++ b/plugins/harness-iacm/src/components/WorkspaceList/index.tsx @@ -18,6 +18,7 @@ import useGetResources from '../../hooks/useGetResources'; import useProjectUrlSlugEntity from '../../hooks/useProjectUrlEntity'; import { useResourceSlugFromEntity } from './useResourceSlugFromEntity'; import ResourceTable from '../ResourceTable'; +import { EmptyState } from '@backstage/core-components'; const useStyles = makeStyles(theme => ({ container: { @@ -48,6 +49,16 @@ const useStyles = makeStyles(theme => ({ alignItems: 'center', gap: '5px', }, + noAccess: { + padding: theme.spacing(2), + display: 'flex', + + textAlign: 'center', + }, + workspaceList: { + marginTop: '-40px', + }, + workspaceItem: { padding: '0.75rem', fontSize: '1rem' }, })); export interface Workspace { @@ -153,6 +164,33 @@ function WorkspaceList() { ); + if (state === AsyncStatus.Unauthorized) { + const urls = Object.values(harnessWorkspaceUrlObject).map(url => + url.replace('|', ''), + ); + return ( + <> + + {urls.map(workspace => ( +
  • + {workspace} +
  • + ))} + + } + /> + + ); + } + if (state === AsyncStatus.Init || state === AsyncStatus.Loading) { return (