From 9f7dc10fbe7fae2d2aa774091a4dabfc232a933e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fredrik=20Adel=C3=B6w?= Date: Fri, 5 Mar 2021 15:13:52 +0100 Subject: [PATCH] Show a Not Found message when navigating to a nonexistent entity MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Fredrik Adelöw --- .changeset/rotten-beds-itch.md | 5 ++++ .../EntityPageLayout/EntityPageLayout.tsx | 30 +++++++++++++++++-- 2 files changed, 33 insertions(+), 2 deletions(-) create mode 100644 .changeset/rotten-beds-itch.md diff --git a/.changeset/rotten-beds-itch.md b/.changeset/rotten-beds-itch.md new file mode 100644 index 0000000000..c046e71572 --- /dev/null +++ b/.changeset/rotten-beds-itch.md @@ -0,0 +1,5 @@ +--- +'@backstage/plugin-catalog': patch +--- + +Show a Not Found message when navigating to a nonexistent entity diff --git a/plugins/catalog/src/components/EntityPageLayout/EntityPageLayout.tsx b/plugins/catalog/src/components/EntityPageLayout/EntityPageLayout.tsx index 34378d5496..6f9899ff82 100644 --- a/plugins/catalog/src/components/EntityPageLayout/EntityPageLayout.tsx +++ b/plugins/catalog/src/components/EntityPageLayout/EntityPageLayout.tsx @@ -18,7 +18,15 @@ import { ENTITY_DEFAULT_NAMESPACE, RELATION_OWNED_BY, } from '@backstage/catalog-model'; -import { Content, Header, HeaderLabel, Page, Progress } from '@backstage/core'; +import { + Content, + Header, + HeaderLabel, + Link, + Page, + Progress, + WarningPanel, +} from '@backstage/core'; import { EntityContext, EntityRefLinks, @@ -125,7 +133,11 @@ export const EntityPageLayout = ({ children }: PropsWithChildren<{}>) => { )} - {loading && } + {loading && ( + + + + )} {entity && {children}} @@ -134,6 +146,19 @@ export const EntityPageLayout = ({ children }: PropsWithChildren<{}>) => { {error.toString()} )} + + {!loading && !error && !entity && ( + + + There is no {kind} with the requested{' '} + + kind, namespace, and name + + . + + + )} + ) => { ); }; + EntityPageLayout.Content = Tabbed.Content;