handle not found connection in ConnectionTab

This commit is contained in:
Jan Prochazka 2024-05-13 09:25:34 +02:00
parent 4fb6b49b86
commit f74e57bec2

View File

@ -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}`);
}
}
});