mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-28 23:26:00 +00:00
feat: prevent closing tab if any modal is open
This commit is contained in:
@@ -323,3 +323,9 @@ appliedCurrentSchema.subscribe(value => {
|
|||||||
appliedCurrentSchemaValue = value;
|
appliedCurrentSchemaValue = value;
|
||||||
});
|
});
|
||||||
export const getAppliedCurrentSchema = () => appliedCurrentSchemaValue;
|
export const getAppliedCurrentSchema = () => appliedCurrentSchemaValue;
|
||||||
|
|
||||||
|
let openedModalsValue = [];
|
||||||
|
openedModals.subscribe(value => {
|
||||||
|
openedModalsValue = value;
|
||||||
|
});
|
||||||
|
export const getOpenedModals = () => openedModalsValue;
|
||||||
|
|||||||
@@ -224,7 +224,12 @@
|
|||||||
category: 'Tabs',
|
category: 'Tabs',
|
||||||
name: 'Close tab',
|
name: 'Close tab',
|
||||||
keyText: isElectronAvailable() ? 'CtrlOrCommand+W' : null,
|
keyText: isElectronAvailable() ? 'CtrlOrCommand+W' : null,
|
||||||
testEnabled: () => getOpenedTabs().filter(x => !x.closedTime).length >= 1,
|
testEnabled: () => {
|
||||||
|
const hasAnyOtherTab = getOpenedTabs().filter(x => !x.closedTime).length >= 1;
|
||||||
|
const hasAnyModalOpen = getOpenedModals().length > 0;
|
||||||
|
|
||||||
|
return hasAnyOtherTab && !hasConfirmModalOpen;
|
||||||
|
},
|
||||||
onClick: closeCurrentTab,
|
onClick: closeCurrentTab,
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -283,6 +288,7 @@
|
|||||||
draggingDbGroupTarget,
|
draggingDbGroupTarget,
|
||||||
draggingTab,
|
draggingTab,
|
||||||
draggingTabTarget,
|
draggingTabTarget,
|
||||||
|
getOpenedModals,
|
||||||
} from '../stores';
|
} from '../stores';
|
||||||
import tabs from '../tabs';
|
import tabs from '../tabs';
|
||||||
import { setSelectedTab, switchCurrentDatabase } from '../utility/common';
|
import { setSelectedTab, switchCurrentDatabase } from '../utility/common';
|
||||||
|
|||||||
Reference in New Issue
Block a user