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