mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-05-01 03:53:57 +00:00
feat: invalidate commands on modal show/close
This commit is contained in:
@@ -2,18 +2,22 @@ import { openedModals } from '../stores';
|
|||||||
import { get } from 'svelte/store';
|
import { get } from 'svelte/store';
|
||||||
import uuidv1 from 'uuid/v1';
|
import uuidv1 from 'uuid/v1';
|
||||||
import _ from 'lodash';
|
import _ from 'lodash';
|
||||||
|
import invalidateCommands from '../commands/invalidateCommands';
|
||||||
|
|
||||||
export function showModal(component, props = {}) {
|
export function showModal(component, props = {}) {
|
||||||
const modalId = uuidv1();
|
const modalId = uuidv1();
|
||||||
openedModals.update(x => [...x, { component, modalId, props }]);
|
openedModals.update(x => [...x, { component, modalId, props }]);
|
||||||
|
invalidateCommands();
|
||||||
}
|
}
|
||||||
|
|
||||||
export function closeModal(modalId) {
|
export function closeModal(modalId) {
|
||||||
openedModals.update(x => x.filter(y => y.modalId != modalId));
|
openedModals.update(x => x.filter(y => y.modalId != modalId));
|
||||||
|
invalidateCommands();
|
||||||
}
|
}
|
||||||
|
|
||||||
export function closeCurrentModal() {
|
export function closeCurrentModal() {
|
||||||
openedModals.update(modals => modals.slice(0, modals.length - 1));
|
openedModals.update(modals => modals.slice(0, modals.length - 1));
|
||||||
|
invalidateCommands();
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getActiveModalId() {
|
export function getActiveModalId() {
|
||||||
|
|||||||
Reference in New Issue
Block a user