extracted getConnectionLabel functionality

This commit is contained in:
Jan Prochazka
2021-05-06 11:08:03 +02:00
parent 3d882f47a7
commit 62cedd23b7
10 changed files with 44 additions and 31 deletions

View File

@@ -15,6 +15,7 @@
import FontIcon from '../icons/FontIcon.svelte';
import { activeTabId, currentDatabase } from '../stores';
import getConnectionLabel from '../utility/getConnectionLabel';
import { useDatabaseServerVersion, useDatabaseStatus } from '../utility/metadataLoaders';
$: databaseName = $currentDatabase && $currentDatabase.name;
@@ -23,6 +24,7 @@
$: serverVersion = useDatabaseServerVersion(connection ? { conid: connection._id, database: databaseName } : {});
$: contextItems = $statusBarTabInfo[$activeTabId] as any[];
$: connectionLabel = getConnectionLabel(connection, { allowExplicitDatabase: false });
</script>
<div class="main">
@@ -33,10 +35,10 @@
{databaseName}
</div>
{/if}
{#if connection && (connection.displayName || connection.server)}
{#if connectionLabel}
<div class="item">
<FontIcon icon="icon server" />
{connection.displayName || connection.server}
{connectionLabel}
</div>
{/if}
{#if connection && connection.user}