From 6be0e5a7cacd0591352a7b348a92117fad24a71f Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Tue, 6 Feb 2024 17:09:46 +0000 Subject: [PATCH] Add redirect with error message if integrations template not found (#1412) Signed-off-by: Simeon Widdis (cherry picked from commit a5434f918dccb5f350971afbd45b3064122201f1) Signed-off-by: github-actions[bot] --- .../components/integrations/components/integration.tsx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/public/components/integrations/components/integration.tsx b/public/components/integrations/components/integration.tsx index c005e98d0..e94fd7e94 100644 --- a/public/components/integrations/components/integration.tsx +++ b/public/components/integrations/components/integration.tsx @@ -53,6 +53,11 @@ export function Integration(props: AvailableIntegrationProps) { async function handleDataRequest() { // TODO fill in ID request here http.get(`${INTEGRATIONS_BASE}/repository/${integrationTemplateId}`).then((exists) => { + if (!exists.data) { + window.location.hash = '#/available'; + setToast(`Template '${integrationTemplateId}' not found`, 'danger'); + return; + } setIntegration(exists.data); }); } @@ -70,7 +75,7 @@ export function Integration(props: AvailableIntegrationProps) { return parsedResponse.data.mappings[integration.type]; }) .then((mapping) => setMapping(mapping)) - .catch((err: any) => { + .catch((err) => { console.error(err.message); }); }, [integration]); @@ -88,7 +93,7 @@ export function Integration(props: AvailableIntegrationProps) { return parsedResponse.data; }) .then((assets) => setAssets(assets)) - .catch((err: any) => { + .catch((err) => { console.error(err.message); }); }, [integration]);