mirror of
https://github.com/dbgate/dbgate
synced 2024-11-07 20:26:23 +00:00
getConnectionLabel refactor
This commit is contained in:
parent
cf39fd59f9
commit
7fcebedcdd
@ -39,6 +39,10 @@ class AuthProviderBase {
|
|||||||
getAdditionalConfigProps() {
|
getAdditionalConfigProps() {
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getLoginPageConnections() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class OAuthProvider extends AuthProviderBase {
|
class OAuthProvider extends AuthProviderBase {
|
||||||
|
@ -4,11 +4,17 @@ module.exports = {
|
|||||||
return null;
|
return null;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
getConnection_meta: true,
|
||||||
async getConnection({ conid }) {
|
async getConnection({ conid }) {
|
||||||
return null;
|
return null;
|
||||||
},
|
},
|
||||||
|
|
||||||
async loadSuperadminPermissions() {
|
async loadSuperadminPermissions() {
|
||||||
return [];
|
return [];
|
||||||
}
|
},
|
||||||
|
|
||||||
|
getConnectionsForLoginPage_meta: true,
|
||||||
|
async getConnectionsForLoginPage() {
|
||||||
|
return null;
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
@ -31,7 +31,7 @@ function getConnectionLabelCore(connection, { allowExplicitDatabase = true } = {
|
|||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function getConnectionLabel(connection, { allowExplicitDatabase = true, showUnsaved = false } = {}) {
|
export function getConnectionLabel(connection, { allowExplicitDatabase = true, showUnsaved = false } = {}) {
|
||||||
const res = getConnectionLabelCore(connection, { allowExplicitDatabase });
|
const res = getConnectionLabelCore(connection, { allowExplicitDatabase });
|
||||||
|
|
||||||
if (res && showUnsaved && connection?.unsaved) {
|
if (res && showUnsaved && connection?.unsaved) {
|
@ -20,3 +20,4 @@ export * from './computeDiffRows';
|
|||||||
export * from './preloadedRowsTools';
|
export * from './preloadedRowsTools';
|
||||||
export * from './ScriptWriter';
|
export * from './ScriptWriter';
|
||||||
export * from './getLogger';
|
export * from './getLogger';
|
||||||
|
export * from './getConnectionLabel';
|
||||||
|
@ -98,7 +98,6 @@
|
|||||||
import openNewTab from '../utility/openNewTab';
|
import openNewTab from '../utility/openNewTab';
|
||||||
import { getDatabaseMenuItems } from './DatabaseAppObject.svelte';
|
import { getDatabaseMenuItems } from './DatabaseAppObject.svelte';
|
||||||
import getElectron from '../utility/getElectron';
|
import getElectron from '../utility/getElectron';
|
||||||
import getConnectionLabel from '../utility/getConnectionLabel';
|
|
||||||
import { getDatabaseList, useUsedApps } from '../utility/metadataLoaders';
|
import { getDatabaseList, useUsedApps } from '../utility/metadataLoaders';
|
||||||
import { getLocalStorage } from '../utility/storageCache';
|
import { getLocalStorage } from '../utility/storageCache';
|
||||||
import { apiCall, removeVolatileMapping } from '../utility/api';
|
import { apiCall, removeVolatileMapping } from '../utility/api';
|
||||||
@ -106,6 +105,7 @@
|
|||||||
import { closeMultipleTabs } from '../tabpanel/TabsPanel.svelte';
|
import { closeMultipleTabs } from '../tabpanel/TabsPanel.svelte';
|
||||||
import AboutModal from '../modals/AboutModal.svelte';
|
import AboutModal from '../modals/AboutModal.svelte';
|
||||||
import { tick } from 'svelte';
|
import { tick } from 'svelte';
|
||||||
|
import { getConnectionLabel } from 'dbgate-tools';
|
||||||
|
|
||||||
export let data;
|
export let data;
|
||||||
export let passProps;
|
export let passProps;
|
||||||
|
@ -340,7 +340,6 @@
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import getConnectionLabel from '../utility/getConnectionLabel';
|
|
||||||
import uuidv1 from 'uuid/v1';
|
import uuidv1 from 'uuid/v1';
|
||||||
|
|
||||||
import _, { find } from 'lodash';
|
import _, { find } from 'lodash';
|
||||||
@ -365,7 +364,7 @@
|
|||||||
import openNewTab from '../utility/openNewTab';
|
import openNewTab from '../utility/openNewTab';
|
||||||
import AppObjectCore from './AppObjectCore.svelte';
|
import AppObjectCore from './AppObjectCore.svelte';
|
||||||
import { showSnackbarError, showSnackbarSuccess } from '../utility/snackbar';
|
import { showSnackbarError, showSnackbarSuccess } from '../utility/snackbar';
|
||||||
import { findEngineDriver } from 'dbgate-tools';
|
import { findEngineDriver, getConnectionLabel } from 'dbgate-tools';
|
||||||
import InputTextModal from '../modals/InputTextModal.svelte';
|
import InputTextModal from '../modals/InputTextModal.svelte';
|
||||||
import { getDatabaseInfo, useUsedApps } from '../utility/metadataLoaders';
|
import { getDatabaseInfo, useUsedApps } from '../utility/metadataLoaders';
|
||||||
import { openJsonDocument } from '../tabs/JsonTab.svelte';
|
import { openJsonDocument } from '../tabs/JsonTab.svelte';
|
||||||
|
@ -776,7 +776,7 @@
|
|||||||
pinnedTables,
|
pinnedTables,
|
||||||
} from '../stores';
|
} from '../stores';
|
||||||
import openNewTab from '../utility/openNewTab';
|
import openNewTab from '../utility/openNewTab';
|
||||||
import { filterName, generateDbPairingId, getAlterDatabaseScript } from 'dbgate-tools';
|
import { filterName, generateDbPairingId, getAlterDatabaseScript, getConnectionLabel } from 'dbgate-tools';
|
||||||
import { getConnectionInfo, getDatabaseInfo } from '../utility/metadataLoaders';
|
import { getConnectionInfo, getDatabaseInfo } from '../utility/metadataLoaders';
|
||||||
import fullDisplayName from '../utility/fullDisplayName';
|
import fullDisplayName from '../utility/fullDisplayName';
|
||||||
import ImportExportModal from '../modals/ImportExportModal.svelte';
|
import ImportExportModal from '../modals/ImportExportModal.svelte';
|
||||||
@ -784,7 +784,6 @@
|
|||||||
import { findEngineDriver } from 'dbgate-tools';
|
import { findEngineDriver } from 'dbgate-tools';
|
||||||
import uuidv1 from 'uuid/v1';
|
import uuidv1 from 'uuid/v1';
|
||||||
import SqlGeneratorModal from '../modals/SqlGeneratorModal.svelte';
|
import SqlGeneratorModal from '../modals/SqlGeneratorModal.svelte';
|
||||||
import getConnectionLabel from '../utility/getConnectionLabel';
|
|
||||||
import { exportQuickExportFile } from '../utility/exportFileTools';
|
import { exportQuickExportFile } from '../utility/exportFileTools';
|
||||||
import createQuickExportMenu from '../utility/createQuickExportMenu';
|
import createQuickExportMenu from '../utility/createQuickExportMenu';
|
||||||
import ConfirmSqlModal, { saveScriptToDatabase } from '../modals/ConfirmSqlModal.svelte';
|
import ConfirmSqlModal, { saveScriptToDatabase } from '../modals/ConfirmSqlModal.svelte';
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<script lang="ts" context="module">
|
<script lang="ts" context="module">
|
||||||
import { filterName } from 'dbgate-tools';
|
import { filterName, getConnectionLabel } from 'dbgate-tools';
|
||||||
|
|
||||||
interface FileTypeHandler {
|
interface FileTypeHandler {
|
||||||
icon: string;
|
icon: string;
|
||||||
@ -100,7 +100,6 @@
|
|||||||
import { currentDatabase } from '../stores';
|
import { currentDatabase } from '../stores';
|
||||||
import { apiCall } from '../utility/api';
|
import { apiCall } from '../utility/api';
|
||||||
|
|
||||||
import getConnectionLabel from '../utility/getConnectionLabel';
|
|
||||||
import hasPermission from '../utility/hasPermission';
|
import hasPermission from '../utility/hasPermission';
|
||||||
import openNewTab from '../utility/openNewTab';
|
import openNewTab from '../utility/openNewTab';
|
||||||
|
|
||||||
|
@ -60,7 +60,7 @@
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { filterName } from 'dbgate-tools';
|
import { filterName, getConnectionLabel } from 'dbgate-tools';
|
||||||
|
|
||||||
import _ from 'lodash';
|
import _ from 'lodash';
|
||||||
import { onMount } from 'svelte';
|
import { onMount } from 'svelte';
|
||||||
@ -75,7 +75,6 @@
|
|||||||
visibleCommandPalette,
|
visibleCommandPalette,
|
||||||
} from '../stores';
|
} from '../stores';
|
||||||
import clickOutside from '../utility/clickOutside';
|
import clickOutside from '../utility/clickOutside';
|
||||||
import getConnectionLabel from '../utility/getConnectionLabel';
|
|
||||||
import { isElectronAvailable } from '../utility/getElectron';
|
import { isElectronAvailable } from '../utility/getElectron';
|
||||||
import keycodes from '../utility/keycodes';
|
import keycodes from '../utility/keycodes';
|
||||||
import { useConnectionList, useDatabaseInfo } from '../utility/metadataLoaders';
|
import { useConnectionList, useDatabaseInfo } from '../utility/metadataLoaders';
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import _ from 'lodash';
|
import _ from 'lodash';
|
||||||
import { recentDatabases, currentDatabase, getRecentDatabases } from '../stores';
|
import { recentDatabases, currentDatabase, getRecentDatabases } from '../stores';
|
||||||
import getConnectionLabel from '../utility/getConnectionLabel';
|
|
||||||
import registerCommand from './registerCommand';
|
import registerCommand from './registerCommand';
|
||||||
|
import { getConnectionLabel } from 'dbgate-tools';
|
||||||
|
|
||||||
currentDatabase.subscribe(value => {
|
currentDatabase.subscribe(value => {
|
||||||
if (!value) return;
|
if (!value) return;
|
||||||
|
@ -121,7 +121,7 @@ registerCommand({
|
|||||||
toolbarName: 'Add connection folder',
|
toolbarName: 'Add connection folder',
|
||||||
category: 'New',
|
category: 'New',
|
||||||
toolbarOrder: 1,
|
toolbarOrder: 1,
|
||||||
name: 'Connection',
|
name: 'Connection folder',
|
||||||
testEnabled: () => !getCurrentConfig()?.runAsPortal,
|
testEnabled: () => !getCurrentConfig()?.runAsPortal,
|
||||||
onClick: () => {
|
onClick: () => {
|
||||||
showModal(InputTextModal, {
|
showModal(InputTextModal, {
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import _ from 'lodash';
|
import _ from 'lodash';
|
||||||
import FormSelectField from '../forms/FormSelectField.svelte';
|
import FormSelectField from '../forms/FormSelectField.svelte';
|
||||||
import getConnectionLabel from '../utility/getConnectionLabel';
|
|
||||||
import { useConnectionList } from '../utility/metadataLoaders';
|
import { useConnectionList } from '../utility/metadataLoaders';
|
||||||
|
import { getConnectionLabel } from 'dbgate-tools';
|
||||||
|
|
||||||
export let allowChooseModel = false;
|
export let allowChooseModel = false;
|
||||||
export let direction;
|
export let direction;
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
import { closeCurrentModal, showModal } from './modalTools';
|
import { closeCurrentModal, showModal } from './modalTools';
|
||||||
import InputTextModal from './InputTextModal.svelte';
|
import InputTextModal from './InputTextModal.svelte';
|
||||||
import { apiCall } from '../utility/api';
|
import { apiCall } from '../utility/api';
|
||||||
import getConnectionLabel from '../utility/getConnectionLabel';
|
import { getConnectionLabel } from 'dbgate-tools';
|
||||||
|
|
||||||
export let connection;
|
export let connection;
|
||||||
|
|
||||||
|
@ -9,12 +9,12 @@
|
|||||||
import { currentDropDownMenu } from '../stores';
|
import { currentDropDownMenu } from '../stores';
|
||||||
import { apiCall } from '../utility/api';
|
import { apiCall } from '../utility/api';
|
||||||
import { importSqlDump } from '../utility/exportFileTools';
|
import { importSqlDump } from '../utility/exportFileTools';
|
||||||
import getConnectionLabel from '../utility/getConnectionLabel';
|
|
||||||
import getElectron from '../utility/getElectron';
|
import getElectron from '../utility/getElectron';
|
||||||
import { setUploadListener } from '../utility/uploadFiles';
|
import { setUploadListener } from '../utility/uploadFiles';
|
||||||
import ChangeDownloadUrlModal from './ChangeDownloadUrlModal.svelte';
|
import ChangeDownloadUrlModal from './ChangeDownloadUrlModal.svelte';
|
||||||
import ModalBase from './ModalBase.svelte';
|
import ModalBase from './ModalBase.svelte';
|
||||||
import { closeCurrentModal, showModal } from './modalTools';
|
import { closeCurrentModal, showModal } from './modalTools';
|
||||||
|
import { getConnectionLabel } from 'dbgate-tools';
|
||||||
|
|
||||||
export let connection;
|
export let connection;
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
import FormSubmit from '../forms/FormSubmit.svelte';
|
import FormSubmit from '../forms/FormSubmit.svelte';
|
||||||
import ModalBase from '../modals/ModalBase.svelte';
|
import ModalBase from '../modals/ModalBase.svelte';
|
||||||
import { closeCurrentModal } from '../modals/modalTools';
|
import { closeCurrentModal } from '../modals/modalTools';
|
||||||
import { fullNameFromString, fullNameToLabel, fullNameToString } from 'dbgate-tools';
|
import { fullNameFromString, fullNameToLabel, fullNameToString, getConnectionLabel } from 'dbgate-tools';
|
||||||
import SelectField from '../forms/SelectField.svelte';
|
import SelectField from '../forms/SelectField.svelte';
|
||||||
import _ from 'lodash';
|
import _ from 'lodash';
|
||||||
import {
|
import {
|
||||||
@ -18,7 +18,6 @@
|
|||||||
import { onMount, tick } from 'svelte';
|
import { onMount, tick } from 'svelte';
|
||||||
import { createPerspectiveNodeConfig, PerspectiveTreeNode } from 'dbgate-datalib';
|
import { createPerspectiveNodeConfig, PerspectiveTreeNode } from 'dbgate-datalib';
|
||||||
import type { ChangePerspectiveConfigFunc, PerspectiveConfig, PerspectiveCustomJoinConfig } from 'dbgate-datalib';
|
import type { ChangePerspectiveConfigFunc, PerspectiveConfig, PerspectiveCustomJoinConfig } from 'dbgate-datalib';
|
||||||
import getConnectionLabel from '../utility/getConnectionLabel';
|
|
||||||
import uuidv1 from 'uuid/v1';
|
import uuidv1 from 'uuid/v1';
|
||||||
import TextField from '../forms/TextField.svelte';
|
import TextField from '../forms/TextField.svelte';
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import _ from 'lodash';
|
import _ from 'lodash';
|
||||||
import { getCurrentDatabase } from '../stores';
|
import { getCurrentDatabase } from '../stores';
|
||||||
import getConnectionLabel from '../utility/getConnectionLabel';
|
import { getConnectionLabel } from 'dbgate-tools';
|
||||||
import openNewTab from '../utility/openNewTab';
|
import openNewTab from '../utility/openNewTab';
|
||||||
|
|
||||||
export default function newQuery({
|
export default function newQuery({
|
||||||
|
@ -287,7 +287,6 @@
|
|||||||
import tabs from '../tabs';
|
import tabs from '../tabs';
|
||||||
import { setSelectedTab } from '../utility/common';
|
import { setSelectedTab } from '../utility/common';
|
||||||
import contextMenu from '../utility/contextMenu';
|
import contextMenu from '../utility/contextMenu';
|
||||||
import getConnectionLabel from '../utility/getConnectionLabel';
|
|
||||||
import { isElectronAvailable } from '../utility/getElectron';
|
import { isElectronAvailable } from '../utility/getElectron';
|
||||||
import { getConnectionInfo, useConnectionList } from '../utility/metadataLoaders';
|
import { getConnectionInfo, useConnectionList } from '../utility/metadataLoaders';
|
||||||
import { duplicateTab, getTabDbKey, sortTabs, groupTabs } from '../utility/openNewTab';
|
import { duplicateTab, getTabDbKey, sortTabs, groupTabs } from '../utility/openNewTab';
|
||||||
@ -295,6 +294,7 @@
|
|||||||
import TabCloseButton from '../elements/TabCloseButton.svelte';
|
import TabCloseButton from '../elements/TabCloseButton.svelte';
|
||||||
import CloseTabModal from '../modals/CloseTabModal.svelte';
|
import CloseTabModal from '../modals/CloseTabModal.svelte';
|
||||||
import SwitchDatabaseModal from '../modals/SwitchDatabaseModal.svelte';
|
import SwitchDatabaseModal from '../modals/SwitchDatabaseModal.svelte';
|
||||||
|
import { getConnectionLabel } from 'dbgate-tools';
|
||||||
|
|
||||||
export let multiTabIndex;
|
export let multiTabIndex;
|
||||||
export let shownTab;
|
export let shownTab;
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
import { apiCall } from '../utility/api';
|
import { apiCall } from '../utility/api';
|
||||||
import { showSnackbarError, showSnackbarSuccess } from '../utility/snackbar';
|
import { showSnackbarError, showSnackbarSuccess } from '../utility/snackbar';
|
||||||
import { changeTab } from '../utility/common';
|
import { changeTab } from '../utility/common';
|
||||||
import getConnectionLabel from '../utility/getConnectionLabel';
|
import { getConnectionLabel } from 'dbgate-tools';
|
||||||
import { onMount } from 'svelte';
|
import { onMount } from 'svelte';
|
||||||
import { disconnectServerConnection, openConnection } from '../appobj/ConnectionAppObject.svelte';
|
import { disconnectServerConnection, openConnection } from '../appobj/ConnectionAppObject.svelte';
|
||||||
import { disconnectDatabaseConnection } from '../appobj/DatabaseAppObject.svelte';
|
import { disconnectDatabaseConnection } from '../appobj/DatabaseAppObject.svelte';
|
||||||
|
@ -5,7 +5,7 @@ import ImportExportModal from '../modals/ImportExportModal.svelte';
|
|||||||
import getElectron from './getElectron';
|
import getElectron from './getElectron';
|
||||||
import { currentDatabase, extensions, getCurrentDatabase } from '../stores';
|
import { currentDatabase, extensions, getCurrentDatabase } from '../stores';
|
||||||
import { getUploadListener } from './uploadFiles';
|
import { getUploadListener } from './uploadFiles';
|
||||||
import getConnectionLabel, { getDatabaseFileLabel } from './getConnectionLabel';
|
import {getConnectionLabel, getDatabaseFileLabel } from 'dbgate-tools';
|
||||||
import { apiCall } from './api';
|
import { apiCall } from './api';
|
||||||
import openNewTab from './openNewTab';
|
import openNewTab from './openNewTab';
|
||||||
import { openJsonDocument } from '../tabs/JsonTab.svelte';
|
import { openJsonDocument } from '../tabs/JsonTab.svelte';
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
collapsedConnectionGroupNames,
|
collapsedConnectionGroupNames,
|
||||||
} from '../stores';
|
} from '../stores';
|
||||||
import runCommand from '../commands/runCommand';
|
import runCommand from '../commands/runCommand';
|
||||||
import getConnectionLabel from '../utility/getConnectionLabel';
|
import { getConnectionLabel } from 'dbgate-tools';
|
||||||
import { useConnectionColorFactory } from '../utility/useConnectionColor';
|
import { useConnectionColorFactory } from '../utility/useConnectionColor';
|
||||||
import FontIcon from '../icons/FontIcon.svelte';
|
import FontIcon from '../icons/FontIcon.svelte';
|
||||||
import CloseSearchButton from '../buttons/CloseSearchButton.svelte';
|
import CloseSearchButton from '../buttons/CloseSearchButton.svelte';
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
selectedWidget,
|
selectedWidget,
|
||||||
visibleCommandPalette,
|
visibleCommandPalette,
|
||||||
} from '../stores';
|
} from '../stores';
|
||||||
import getConnectionLabel from '../utility/getConnectionLabel';
|
import { getConnectionLabel } from 'dbgate-tools';
|
||||||
import { useConnectionList, useDatabaseServerVersion, useDatabaseStatus } from '../utility/metadataLoaders';
|
import { useConnectionList, useDatabaseServerVersion, useDatabaseStatus } from '../utility/metadataLoaders';
|
||||||
import { findCommand } from '../commands/runCommand';
|
import { findCommand } from '../commands/runCommand';
|
||||||
import { useConnectionColor } from '../utility/useConnectionColor';
|
import { useConnectionColor } from '../utility/useConnectionColor';
|
||||||
|
Loading…
Reference in New Issue
Block a user