mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-24 00:16:00 +00:00
SYNC: disable commands when modal is opened
This commit is contained in:
committed by
Diflow
parent
7457328b59
commit
89ddced342
@@ -9,6 +9,7 @@ import { safeJsonParse } from 'dbgate-tools';
|
||||
import { apiCall } from './utility/api';
|
||||
import { getOpenedTabsStorageName, isAdminPage } from './utility/pageDefs';
|
||||
import { switchCurrentDatabase } from './utility/common';
|
||||
import { tick } from 'svelte';
|
||||
|
||||
export interface TabDefinition {
|
||||
title: string;
|
||||
@@ -189,7 +190,6 @@ export const cloudConnectionsStore = writable({});
|
||||
|
||||
export const promoWidgetPreview = writable(null);
|
||||
|
||||
|
||||
export const DEFAULT_OBJECT_SEARCH_SETTINGS = {
|
||||
pureName: true,
|
||||
schemaName: false,
|
||||
@@ -310,17 +310,39 @@ openedTabs.subscribe(value => {
|
||||
});
|
||||
export const getOpenedTabs = () => openedTabsValue;
|
||||
|
||||
let openedModalsValue = [];
|
||||
openedModals.subscribe(value => {
|
||||
openedModalsValue = value;
|
||||
|
||||
tick().then(() => {
|
||||
dispatchUpdateCommands();
|
||||
});
|
||||
});
|
||||
export const getOpenedModals = () => openedModalsValue;
|
||||
|
||||
let commandsValue = null;
|
||||
commands.subscribe(value => {
|
||||
commandsValue = value;
|
||||
|
||||
const electron = getElectron();
|
||||
if (electron) {
|
||||
electron.send('update-commands', JSON.stringify(value));
|
||||
}
|
||||
tick().then(() => {
|
||||
dispatchUpdateCommands();
|
||||
});
|
||||
});
|
||||
export const getCommands = () => commandsValue;
|
||||
|
||||
function dispatchUpdateCommands() {
|
||||
const electron = getElectron();
|
||||
if (electron) {
|
||||
electron.send(
|
||||
'update-commands',
|
||||
JSON.stringify({
|
||||
isModalOpened: openedModalsValue?.length > 0,
|
||||
commands: commandsValue,
|
||||
})
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
let activeTabValue = null;
|
||||
activeTab.subscribe(value => {
|
||||
activeTabValue = value;
|
||||
@@ -418,12 +440,6 @@ selectedDatabaseObjectAppObject.subscribe(value => {
|
||||
});
|
||||
export const getSelectedDatabaseObjectAppObject = () => selectedDatabaseObjectAppObjectValue;
|
||||
|
||||
let openedModalsValue = [];
|
||||
openedModals.subscribe(value => {
|
||||
openedModalsValue = value;
|
||||
});
|
||||
export const getOpenedModals = () => openedModalsValue;
|
||||
|
||||
let focusedConnectionOrDatabaseValue = null;
|
||||
focusedConnectionOrDatabase.subscribe(value => {
|
||||
focusedConnectionOrDatabaseValue = value;
|
||||
|
||||
Reference in New Issue
Block a user