mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-05-02 19:33:59 +00:00
SYNC: cloud connections in tab names
This commit is contained in:
committed by
Diflow
parent
8737ab077b
commit
3eb8863f67
@@ -185,12 +185,13 @@
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
function getTabDbName(tab, connectionList) {
|
function getTabDbName(tab, connectionList, cloudConnectionsStore) {
|
||||||
if (tab.tabComponent == 'ConnectionTab') return _t('common.connections', { defaultMessage: 'Connections' });
|
if (tab.tabComponent == 'ConnectionTab') return _t('common.connections', { defaultMessage: 'Connections' });
|
||||||
if (tab.tabComponent?.startsWith('Admin')) return _t('tab.administration', { defaultMessage: 'Administration' });
|
if (tab.tabComponent?.startsWith('Admin')) return _t('tab.administration', { defaultMessage: 'Administration' });
|
||||||
if (tab.props && tab.props.conid && tab.props.database) return tab.props.database;
|
if (tab.props && tab.props.conid && tab.props.database) return tab.props.database;
|
||||||
if (tab.props && tab.props.conid) {
|
if (tab.props && tab.props.conid) {
|
||||||
const connection = connectionList?.find(x => x._id == tab.props.conid);
|
const connection =
|
||||||
|
connectionList?.find(x => x._id == tab.props.conid) ?? cloudConnectionsStore?.[tab.props.conid];
|
||||||
if (connection) return getConnectionLabel(connection, { allowExplicitDatabase: false });
|
if (connection) return getConnectionLabel(connection, { allowExplicitDatabase: false });
|
||||||
return '???';
|
return '???';
|
||||||
}
|
}
|
||||||
@@ -198,9 +199,10 @@
|
|||||||
return '(no DB)';
|
return '(no DB)';
|
||||||
}
|
}
|
||||||
|
|
||||||
function getTabDbServer(tab, connectionList) {
|
function getTabDbServer(tab, connectionList, cloudConnectionsStore) {
|
||||||
if (tab.props && tab.props.conid && tab.props.database) {
|
if (tab.props && tab.props.conid && tab.props.database) {
|
||||||
const connection = connectionList?.find(x => x._id == tab.props.conid);
|
const connection =
|
||||||
|
connectionList?.find(x => x._id == tab.props.conid) ?? cloudConnectionsStore?.[tab.props.conid];
|
||||||
if (connection) return getConnectionLabel(connection, { allowExplicitDatabase: false });
|
if (connection) return getConnectionLabel(connection, { allowExplicitDatabase: false });
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@@ -336,6 +338,7 @@
|
|||||||
draggingTab,
|
draggingTab,
|
||||||
draggingTabTarget,
|
draggingTabTarget,
|
||||||
getOpenedModals,
|
getOpenedModals,
|
||||||
|
cloudConnectionsStore,
|
||||||
} from '../stores';
|
} from '../stores';
|
||||||
import tabs from '../tabs';
|
import tabs from '../tabs';
|
||||||
import { setSelectedTab, switchCurrentDatabase } from '../utility/common';
|
import { setSelectedTab, switchCurrentDatabase } from '../utility/common';
|
||||||
@@ -367,9 +370,9 @@
|
|||||||
|
|
||||||
$: tabsWithDb = $openedTabs.filter(showTabFilterFunc).map(tab => ({
|
$: tabsWithDb = $openedTabs.filter(showTabFilterFunc).map(tab => ({
|
||||||
...tab,
|
...tab,
|
||||||
tabDbName: getTabDbName(tab, $connectionList),
|
tabDbName: getTabDbName(tab, $connectionList, $cloudConnectionsStore),
|
||||||
tabDbKey: getTabDbKey(tab),
|
tabDbKey: getTabDbKey(tab),
|
||||||
tabDbServer: getTabDbServer(tab, $connectionList),
|
tabDbServer: getTabDbServer(tab, $connectionList, $cloudConnectionsStore),
|
||||||
}));
|
}));
|
||||||
|
|
||||||
$: groupedTabs = groupTabs(tabsWithDb);
|
$: groupedTabs = groupTabs(tabsWithDb);
|
||||||
|
|||||||
Reference in New Issue
Block a user