mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 10:02:05 +00:00
feat(editor): Migrate debounce mixin to useDebounce composable (no-changelog) (#8244)
This commit is contained in:
@@ -315,7 +315,6 @@ import type {
|
||||
ToggleNodeCreatorOptions,
|
||||
} from '@/Interface';
|
||||
|
||||
import { debounceHelper } from '@/mixins/debounce';
|
||||
import type { Route, RawLocation } from 'vue-router';
|
||||
import { dataPinningEventBus, nodeViewEventBus } from '@/event-bus';
|
||||
import { useCanvasStore } from '@/stores/canvas.store';
|
||||
@@ -377,6 +376,7 @@ import { useExternalHooks } from '@/composables/useExternalHooks';
|
||||
import { useClipboard } from '@/composables/useClipboard';
|
||||
import { usePinnedData } from '@/composables/usePinnedData';
|
||||
import { useSourceControlStore } from '@/stores/sourceControl.store';
|
||||
import { useDebounce } from '@/composables/useDebounce';
|
||||
|
||||
interface AddNodeOptions {
|
||||
position?: XYPosition;
|
||||
@@ -404,7 +404,7 @@ export default defineComponent({
|
||||
ContextMenu,
|
||||
SetupWorkflowCredentialsButton,
|
||||
},
|
||||
mixins: [moveNodeWorkflow, workflowHelpers, workflowRun, debounceHelper],
|
||||
mixins: [moveNodeWorkflow, workflowHelpers, workflowRun],
|
||||
async beforeRouteLeave(to, from, next) {
|
||||
if (
|
||||
getNodeViewTab(to) === MAIN_HEADER_TABS.EXECUTIONS ||
|
||||
@@ -475,6 +475,7 @@ export default defineComponent({
|
||||
const clipboard = useClipboard();
|
||||
const { activeNode } = storeToRefs(ndvStore);
|
||||
const pinnedData = usePinnedData(activeNode);
|
||||
const { callDebounced } = useDebounce();
|
||||
|
||||
return {
|
||||
locale,
|
||||
@@ -484,6 +485,7 @@ export default defineComponent({
|
||||
externalHooks,
|
||||
clipboard,
|
||||
pinnedData,
|
||||
callDebounced,
|
||||
...useCanvasMouseSelect(),
|
||||
...useGlobalLinkActions(),
|
||||
...useTitleChange(),
|
||||
@@ -1422,7 +1424,7 @@ export default defineComponent({
|
||||
return;
|
||||
}
|
||||
|
||||
void this.callDebounced('onSaveKeyboardShortcut', { debounceTime: 1000 }, e);
|
||||
void this.callDebounced(this.onSaveKeyboardShortcut, { debounceTime: 1000 }, e);
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -1467,7 +1469,7 @@ export default defineComponent({
|
||||
.filter((node) => !!node) as INode[];
|
||||
|
||||
if (e.key === 'd' && noModifierKeys && !readOnly) {
|
||||
void this.callDebounced('toggleActivationNodes', { debounceTime: 350 }, selectedNodes);
|
||||
void this.callDebounced(this.toggleActivationNodes, { debounceTime: 350 }, selectedNodes);
|
||||
} else if (e.key === 'd' && ctrlModifier && !readOnly) {
|
||||
if (selectedNodes.length > 0) {
|
||||
e.preventDefault();
|
||||
@@ -1482,7 +1484,7 @@ export default defineComponent({
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
|
||||
void this.callDebounced('deleteNodes', { debounceTime: 500 }, selectedNodes);
|
||||
void this.callDebounced(this.deleteNodes, { debounceTime: 500 }, selectedNodes);
|
||||
} else if (e.key === 'Tab' && noModifierKeys && !readOnly) {
|
||||
this.onToggleNodeCreator({
|
||||
source: NODE_CREATOR_OPEN_SOURCES.TAB,
|
||||
@@ -1500,7 +1502,7 @@ export default defineComponent({
|
||||
const lastSelectedNode = this.lastSelectedNode;
|
||||
if (lastSelectedNode !== null && lastSelectedNode.type !== STICKY_NODE_TYPE) {
|
||||
void this.callDebounced(
|
||||
'renameNodePrompt',
|
||||
this.renameNodePrompt,
|
||||
{ debounceTime: 1500 },
|
||||
lastSelectedNode.name,
|
||||
);
|
||||
@@ -1510,15 +1512,15 @@ export default defineComponent({
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
|
||||
void this.callDebounced('selectAllNodes', { debounceTime: 1000 });
|
||||
void this.callDebounced(this.selectAllNodes, { debounceTime: 1000 });
|
||||
} else if (e.key === 'c' && ctrlModifier) {
|
||||
void this.callDebounced('copyNodes', { debounceTime: 1000 }, selectedNodes);
|
||||
void this.callDebounced(this.copyNodes, { debounceTime: 1000 }, selectedNodes);
|
||||
} else if (e.key === 'x' && ctrlModifier && !readOnly) {
|
||||
// Cut nodes
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
|
||||
void this.callDebounced('cutNodes', { debounceTime: 1000 }, selectedNodes);
|
||||
void this.callDebounced(this.cutNodes, { debounceTime: 1000 }, selectedNodes);
|
||||
} else if (e.key === 'n' && ctrlAltModifier) {
|
||||
// Create a new workflow
|
||||
e.stopPropagation();
|
||||
@@ -1555,7 +1557,9 @@ export default defineComponent({
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
|
||||
void this.callDebounced('selectDownstreamNodes', { debounceTime: 1000 });
|
||||
void this.callDebounced(this.selectDownstreamNodes, {
|
||||
debounceTime: 1000,
|
||||
});
|
||||
} else if (e.key === 'ArrowRight' && noModifierKeys) {
|
||||
// Set child node active
|
||||
const lastSelectedNode = this.lastSelectedNode;
|
||||
@@ -1572,7 +1576,7 @@ export default defineComponent({
|
||||
}
|
||||
|
||||
void this.callDebounced(
|
||||
'nodeSelectedByName',
|
||||
this.nodeSelectedByName,
|
||||
{ debounceTime: 100 },
|
||||
connections.main[0][0].node,
|
||||
false,
|
||||
@@ -1583,7 +1587,9 @@ export default defineComponent({
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
|
||||
void this.callDebounced('selectUpstreamNodes', { debounceTime: 1000 });
|
||||
void this.callDebounced(this.selectUpstreamNodes, {
|
||||
debounceTime: 1000,
|
||||
});
|
||||
} else if (e.key === 'ArrowLeft' && noModifierKeys) {
|
||||
// Set parent node active
|
||||
const lastSelectedNode = this.lastSelectedNode;
|
||||
@@ -1604,7 +1610,7 @@ export default defineComponent({
|
||||
}
|
||||
|
||||
void this.callDebounced(
|
||||
'nodeSelectedByName',
|
||||
this.nodeSelectedByName,
|
||||
{ debounceTime: 100 },
|
||||
connections.main[0][0].node,
|
||||
false,
|
||||
@@ -1676,7 +1682,7 @@ export default defineComponent({
|
||||
|
||||
if (nextSelectNode !== null) {
|
||||
void this.callDebounced(
|
||||
'nodeSelectedByName',
|
||||
this.nodeSelectedByName,
|
||||
{ debounceTime: 100 },
|
||||
nextSelectNode,
|
||||
false,
|
||||
@@ -3033,7 +3039,7 @@ export default defineComponent({
|
||||
},
|
||||
onDragMove() {
|
||||
const totalNodes = this.nodes.length;
|
||||
void this.callDebounced('updateConnectionsOverlays', {
|
||||
void this.callDebounced(this.updateConnectionsOverlays, {
|
||||
debounceTime: totalNodes > 20 ? 200 : 0,
|
||||
});
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user