fixes from testing

This commit is contained in:
Jan Prochazka
2021-03-25 08:39:07 +01:00
parent 4e4447de8a
commit 0d0bd29812
5 changed files with 25 additions and 6 deletions

View File

@@ -111,6 +111,7 @@
import tabs from '../tabs';
import { setSelectedTab } from '../utility/common';
import contextMenu from '../utility/contextMenu';
import { getConnectionInfo } from '../utility/metadataLoaders';
$: currentDbKey =
$currentDatabase && $currentDatabase.name && $currentDatabase.connection
@@ -172,11 +173,27 @@
}
return res;
};
const handleSetDb = async props => {
const { conid, database } = props || {};
if (conid) {
const connection = await getConnectionInfo({ conid, database });
if (connection) {
$currentDatabase = { connection, name: database };
return;
}
}
$currentDatabase = null;
};
</script>
{#each dbKeys as dbKey}
<div class="db-wrapper">
<div class="db-name" class:selected={tabsByDb[dbKey][0].tabDbKey == currentDbKey}>
<div
class="db-name"
class:selected={tabsByDb[dbKey][0].tabDbKey == currentDbKey}
on:click={() => handleSetDb(tabsByDb[dbKey][0].props)}
>
<FontIcon icon={getDbIcon(dbKey)} />
{tabsByDb[dbKey][0].tabDbName}
</div>