From 27032df2d18da6aa821a9eae933f0096a4069a36 Mon Sep 17 00:00:00 2001 From: "shahar.shmaram" Date: Thu, 21 Apr 2022 12:55:16 +0300 Subject: [PATCH] added supoprt for a custom component when entity not found Signed-off-by: shahar.shmaram --- .../src/components/EntityLayout/EntityLayout.tsx | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/plugins/catalog/src/components/EntityLayout/EntityLayout.tsx b/plugins/catalog/src/components/EntityLayout/EntityLayout.tsx index d4244419cb..f76690c010 100644 --- a/plugins/catalog/src/components/EntityLayout/EntityLayout.tsx +++ b/plugins/catalog/src/components/EntityLayout/EntityLayout.tsx @@ -152,6 +152,7 @@ export interface EntityLayoutProps { UNSTABLE_extraContextMenuItems?: ExtraContextMenuItem[]; UNSTABLE_contextMenuOptions?: contextMenuOptions; children?: React.ReactNode; + NotFoundComponent?: React.ReactNode; } /** @@ -176,6 +177,7 @@ export const EntityLayout = (props: EntityLayoutProps) => { UNSTABLE_extraContextMenuItems, UNSTABLE_contextMenuOptions, children, + NotFoundComponent, } = props; const { kind, namespace, name } = useRouteRefParams(entityRouteRef); const { entity, loading, error } = useAsyncEntity(); @@ -259,7 +261,17 @@ export const EntityLayout = (props: EntityLayoutProps) => { {error && ( - {error.toString()} + {NotFoundComponent ? ( + NotFoundComponent + ) : ( + + There is no {kind} with the requested{' '} + + kind, namespace, and name + + . + + )} )}