From f74e57bec2c9cf331ef2fb23bd047422e416d961 Mon Sep 17 00:00:00 2001 From: Jan Prochazka Date: Mon, 13 May 2024 09:25:34 +0200 Subject: [PATCH] handle not found connection in ConnectionTab --- packages/web/src/tabs/ConnectionTab.svelte | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/packages/web/src/tabs/ConnectionTab.svelte b/packages/web/src/tabs/ConnectionTab.svelte index deff1d03..0e37bd03 100644 --- a/packages/web/src/tabs/ConnectionTab.svelte +++ b/packages/web/src/tabs/ConnectionTab.svelte @@ -26,7 +26,7 @@ } from '../stores'; import _, { Dictionary } from 'lodash'; import { apiCall } from '../utility/api'; - import { showSnackbarSuccess } from '../utility/snackbar'; + import { showSnackbarError, showSnackbarSuccess } from '../utility/snackbar'; import { changeTab } from '../utility/common'; import getConnectionLabel from '../utility/getConnectionLabel'; import { onMount } from 'svelte'; @@ -47,6 +47,9 @@ } ); + // $: console.log('ConnectionTab.$values', $values); + // $: console.log('ConnectionTab.driver', driver); + $: engine = $values.engine; $: driver = $extensions.drivers.find(x => x.engine == engine); @@ -161,7 +164,12 @@ onMount(async () => { if (conid) { - $values = await apiCall('connections/get', { conid }); + const con = await apiCall('connections/get', { conid }); + if (con) { + $values = con; + } else { + showSnackbarError(`Connection not found: ${conid}`); + } } });