mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-19 20:06:00 +00:00
extracted getConnectionLabel functionality
This commit is contained in:
@@ -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}
|
||||
|
||||
@@ -49,7 +49,7 @@
|
||||
if (tab.props && tab.props.conid && tab.props.database) return tab.props.database;
|
||||
if (tab.props && tab.props.conid) {
|
||||
const connection = connectionList?.find(x => x._id == tab.props.conid);
|
||||
if (connection) return connection.displayName || connection.server;
|
||||
if (connection) return getConnectionLabel(connection.displayName, { allowExplicitDatabase: false });
|
||||
return '???';
|
||||
}
|
||||
if (tab.props && tab.props.archiveFolder) return tab.props.archiveFolder;
|
||||
@@ -124,6 +124,7 @@
|
||||
import tabs from '../tabs';
|
||||
import { setSelectedTab } from '../utility/common';
|
||||
import contextMenu from '../utility/contextMenu';
|
||||
import getConnectionLabel from '../utility/getConnectionLabel';
|
||||
import { getConnectionInfo, useConnectionList } from '../utility/metadataLoaders';
|
||||
import { duplicateTab } from '../utility/openNewTab';
|
||||
|
||||
|
||||
Reference in New Issue
Block a user