mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-30 19:43:58 +00:00
last used actions changed in switch button
This commit is contained in:
@@ -21,7 +21,7 @@
|
|||||||
import createActivator, { getActiveComponent } from '../utility/createActivator';
|
import createActivator, { getActiveComponent } from '../utility/createActivator';
|
||||||
import ToolStripContainer from '../buttons/ToolStripContainer.svelte';
|
import ToolStripContainer from '../buttons/ToolStripContainer.svelte';
|
||||||
import { useConnectionInfo, useDatabaseInfo } from '../utility/metadataLoaders';
|
import { useConnectionInfo, useDatabaseInfo } from '../utility/metadataLoaders';
|
||||||
import { extensions } from '../stores';
|
import { extensions, lastUsedDefaultActions } from '../stores';
|
||||||
import { findEngineDriver } from 'dbgate-tools';
|
import { findEngineDriver } from 'dbgate-tools';
|
||||||
import registerCommand from '../commands/registerCommand';
|
import registerCommand from '../commands/registerCommand';
|
||||||
import applyScriptTemplate, { getSupportedScriptTemplates } from '../utility/applyScriptTemplate';
|
import applyScriptTemplate, { getSupportedScriptTemplates } from '../utility/applyScriptTemplate';
|
||||||
@@ -30,6 +30,7 @@
|
|||||||
import { changeTab } from '../utility/common';
|
import { changeTab } from '../utility/common';
|
||||||
import ToolStripButton from '../buttons/ToolStripButton.svelte';
|
import ToolStripButton from '../buttons/ToolStripButton.svelte';
|
||||||
import openNewTab from '../utility/openNewTab';
|
import openNewTab from '../utility/openNewTab';
|
||||||
|
import { getBoolSettingsValue } from '../settings/settingsTools';
|
||||||
|
|
||||||
export let tabid;
|
export let tabid;
|
||||||
export let appObjectData;
|
export let appObjectData;
|
||||||
@@ -40,6 +41,7 @@
|
|||||||
export let conid;
|
export let conid;
|
||||||
export let database;
|
export let database;
|
||||||
export let objectTypeField;
|
export let objectTypeField;
|
||||||
|
export let tabPreviewMode;
|
||||||
|
|
||||||
$: appObjectData = {
|
$: appObjectData = {
|
||||||
schemaName,
|
schemaName,
|
||||||
@@ -99,6 +101,13 @@
|
|||||||
icon="icon structure"
|
icon="icon structure"
|
||||||
iconAfter="icon arrow-link"
|
iconAfter="icon arrow-link"
|
||||||
on:click={() => {
|
on:click={() => {
|
||||||
|
if (tabPreviewMode && getBoolSettingsValue('defaultAction.useLastUsedAction', true)) {
|
||||||
|
lastUsedDefaultActions.update(actions => ({
|
||||||
|
...actions,
|
||||||
|
[objectTypeField]: 'openStructure',
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
openNewTab({
|
openNewTab({
|
||||||
title: pureName,
|
title: pureName,
|
||||||
icon: 'img table-structure',
|
icon: 'img table-structure',
|
||||||
@@ -119,6 +128,13 @@
|
|||||||
icon="icon table"
|
icon="icon table"
|
||||||
iconAfter="icon arrow-link"
|
iconAfter="icon arrow-link"
|
||||||
on:click={() => {
|
on:click={() => {
|
||||||
|
if (tabPreviewMode && getBoolSettingsValue('defaultAction.useLastUsedAction', true)) {
|
||||||
|
lastUsedDefaultActions.update(actions => ({
|
||||||
|
...actions,
|
||||||
|
[objectTypeField]: 'openTable',
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
openNewTab({
|
openNewTab({
|
||||||
title: pureName,
|
title: pureName,
|
||||||
icon: objectTypeField == 'tables' ? 'img table' : 'img view',
|
icon: objectTypeField == 'tables' ? 'img table' : 'img view',
|
||||||
|
|||||||
@@ -82,13 +82,12 @@
|
|||||||
import ErrorMessageModal from '../modals/ErrorMessageModal.svelte';
|
import ErrorMessageModal from '../modals/ErrorMessageModal.svelte';
|
||||||
import { useConnectionInfo, useDatabaseInfo } from '../utility/metadataLoaders';
|
import { useConnectionInfo, useDatabaseInfo } from '../utility/metadataLoaders';
|
||||||
import { scriptToSql } from 'dbgate-sqltree';
|
import { scriptToSql } from 'dbgate-sqltree';
|
||||||
import { extensions } from '../stores';
|
import { extensions, lastUsedDefaultActions } from '../stores';
|
||||||
import ConfirmSqlModal from '../modals/ConfirmSqlModal.svelte';
|
import ConfirmSqlModal from '../modals/ConfirmSqlModal.svelte';
|
||||||
import createActivator, { getActiveComponent } from '../utility/createActivator';
|
import createActivator, { getActiveComponent } from '../utility/createActivator';
|
||||||
import registerCommand from '../commands/registerCommand';
|
import registerCommand from '../commands/registerCommand';
|
||||||
import { registerMenu } from '../utility/contextMenu';
|
import { registerMenu } from '../utility/contextMenu';
|
||||||
import { showSnackbarSuccess } from '../utility/snackbar';
|
import { showSnackbarSuccess } from '../utility/snackbar';
|
||||||
import StatusBarTabItem from '../widgets/StatusBarTabItem.svelte';
|
|
||||||
import openNewTab from '../utility/openNewTab';
|
import openNewTab from '../utility/openNewTab';
|
||||||
import { onDestroy, setContext } from 'svelte';
|
import { onDestroy, setContext } from 'svelte';
|
||||||
import { apiCall } from '../utility/api';
|
import { apiCall } from '../utility/api';
|
||||||
@@ -109,6 +108,7 @@
|
|||||||
export let schemaName;
|
export let schemaName;
|
||||||
export let pureName;
|
export let pureName;
|
||||||
export let isRawMode = false;
|
export let isRawMode = false;
|
||||||
|
export let tabPreviewMode;
|
||||||
|
|
||||||
export const activator = createActivator('TableDataTab', true);
|
export const activator = createActivator('TableDataTab', true);
|
||||||
|
|
||||||
@@ -266,6 +266,13 @@
|
|||||||
icon="icon structure"
|
icon="icon structure"
|
||||||
iconAfter="icon arrow-link"
|
iconAfter="icon arrow-link"
|
||||||
on:click={() => {
|
on:click={() => {
|
||||||
|
if (tabPreviewMode && getBoolSettingsValue('defaultAction.useLastUsedAction', true)) {
|
||||||
|
lastUsedDefaultActions.update(actions => ({
|
||||||
|
...actions,
|
||||||
|
tables: 'openStructure',
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
openNewTab({
|
openNewTab({
|
||||||
title: pureName,
|
title: pureName,
|
||||||
icon: 'img table-structure',
|
icon: 'img table-structure',
|
||||||
@@ -287,6 +294,13 @@
|
|||||||
icon="img sql-file"
|
icon="img sql-file"
|
||||||
iconAfter="icon arrow-link"
|
iconAfter="icon arrow-link"
|
||||||
on:click={() => {
|
on:click={() => {
|
||||||
|
if (tabPreviewMode && getBoolSettingsValue('defaultAction.useLastUsedAction', true)) {
|
||||||
|
lastUsedDefaultActions.update(actions => ({
|
||||||
|
...actions,
|
||||||
|
tables: 'showSql',
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
openNewTab({
|
openNewTab({
|
||||||
title: pureName,
|
title: pureName,
|
||||||
icon: 'img sql-file',
|
icon: 'img sql-file',
|
||||||
|
|||||||
@@ -39,7 +39,7 @@
|
|||||||
import _ from 'lodash';
|
import _ from 'lodash';
|
||||||
import registerCommand from '../commands/registerCommand';
|
import registerCommand from '../commands/registerCommand';
|
||||||
|
|
||||||
import { extensions } from '../stores';
|
import { extensions, lastUsedDefaultActions } from '../stores';
|
||||||
import useEditorData from '../query/useEditorData';
|
import useEditorData from '../query/useEditorData';
|
||||||
import TableEditor from '../tableeditor/TableEditor.svelte';
|
import TableEditor from '../tableeditor/TableEditor.svelte';
|
||||||
import createActivator, { getActiveComponent } from '../utility/createActivator';
|
import createActivator, { getActiveComponent } from '../utility/createActivator';
|
||||||
@@ -56,6 +56,7 @@
|
|||||||
import ToolStripButton from '../buttons/ToolStripButton.svelte';
|
import ToolStripButton from '../buttons/ToolStripButton.svelte';
|
||||||
import hasPermission from '../utility/hasPermission';
|
import hasPermission from '../utility/hasPermission';
|
||||||
import { changeTab, markTabSaved, markTabUnsaved } from '../utility/common';
|
import { changeTab, markTabSaved, markTabUnsaved } from '../utility/common';
|
||||||
|
import { getBoolSettingsValue } from '../settings/settingsTools';
|
||||||
|
|
||||||
export let tabid;
|
export let tabid;
|
||||||
export let conid;
|
export let conid;
|
||||||
@@ -63,6 +64,7 @@
|
|||||||
export let schemaName;
|
export let schemaName;
|
||||||
export let pureName;
|
export let pureName;
|
||||||
export let objectTypeField = 'tables';
|
export let objectTypeField = 'tables';
|
||||||
|
export let tabPreviewMode;
|
||||||
let domEditor;
|
let domEditor;
|
||||||
|
|
||||||
let savedName;
|
let savedName;
|
||||||
@@ -174,6 +176,13 @@
|
|||||||
icon={'icon table'}
|
icon={'icon table'}
|
||||||
iconAfter="icon arrow-link"
|
iconAfter="icon arrow-link"
|
||||||
on:click={() => {
|
on:click={() => {
|
||||||
|
if (tabPreviewMode && getBoolSettingsValue('defaultAction.useLastUsedAction', true)) {
|
||||||
|
lastUsedDefaultActions.update(actions => ({
|
||||||
|
...actions,
|
||||||
|
[objectTypeField]: 'openTable',
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
openNewTab({
|
openNewTab({
|
||||||
title: pureName,
|
title: pureName,
|
||||||
icon: objectTypeField == 'tables' ? 'img table' : 'img view',
|
icon: objectTypeField == 'tables' ? 'img table' : 'img view',
|
||||||
@@ -195,6 +204,13 @@
|
|||||||
icon="img sql-file"
|
icon="img sql-file"
|
||||||
iconAfter="icon arrow-link"
|
iconAfter="icon arrow-link"
|
||||||
on:click={() => {
|
on:click={() => {
|
||||||
|
if (tabPreviewMode && getBoolSettingsValue('defaultAction.useLastUsedAction', true)) {
|
||||||
|
lastUsedDefaultActions.update(actions => ({
|
||||||
|
...actions,
|
||||||
|
[objectTypeField]: 'showSql',
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
openNewTab({
|
openNewTab({
|
||||||
title: pureName,
|
title: pureName,
|
||||||
icon: 'img sql-file',
|
icon: 'img sql-file',
|
||||||
|
|||||||
Reference in New Issue
Block a user