mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 18:12:04 +00:00
feat(editor): Do not automatically add manual trigger on node plus (#5644)
* feat(editor): Do not add manual trigger node if node creator trigger via canvas actions * Add e2e tests * Install cypress-plugin-tab, do not use cy.realPress as it hangs the tests * Exclude tab tests
This commit is contained in:
@@ -33,7 +33,7 @@
|
||||
>
|
||||
<canvas-add-button
|
||||
:style="canvasAddButtonStyle"
|
||||
@click="showTriggerCreator('trigger_placeholder_button')"
|
||||
@click="showTriggerCreator(NODE_CREATOR_OPEN_SOURCES.TRIGGER_PLACEHOLDER_BUTTON)"
|
||||
v-show="showCanvasAddButton"
|
||||
:showTooltip="!containsTrigger && showTriggerMissingTooltip"
|
||||
:position="canvasStore.canvasAddButtonPosition"
|
||||
@@ -198,6 +198,7 @@ import {
|
||||
ASSUMPTION_EXPERIMENT,
|
||||
REGULAR_NODE_FILTER,
|
||||
MANUAL_TRIGGER_NODE_TYPE,
|
||||
NODE_CREATOR_OPEN_SOURCES,
|
||||
} from '@/constants';
|
||||
import { copyPaste } from '@/mixins/copyPaste';
|
||||
import { externalHooks } from '@/mixins/externalHooks';
|
||||
@@ -256,6 +257,7 @@ import {
|
||||
IWorkflowToShare,
|
||||
IUser,
|
||||
INodeUpdatePropertiesInformation,
|
||||
NodeCreatorOpenSource,
|
||||
} from '@/Interface';
|
||||
|
||||
import { debounceHelper } from '@/mixins/debounce';
|
||||
@@ -613,6 +615,7 @@ export default mixins(
|
||||
// in undo history as a user action.
|
||||
// This should prevent automatically removed connections from populating undo stack
|
||||
suspendRecordingDetachedConnections: false,
|
||||
NODE_CREATOR_OPEN_SOURCES,
|
||||
};
|
||||
},
|
||||
beforeDestroy() {
|
||||
@@ -662,7 +665,7 @@ export default mixins(
|
||||
: this.$locale.baseText('nodeView.addATriggerNodeFirst');
|
||||
|
||||
this.registerCustomAction('showNodeCreator', () =>
|
||||
this.showTriggerCreator('no_trigger_execution_tooltip'),
|
||||
this.showTriggerCreator(NODE_CREATOR_OPEN_SOURCES.NO_TRIGGER_EXECUTION_TOOLTIP),
|
||||
);
|
||||
const notice = this.$showMessage({
|
||||
type: 'info',
|
||||
@@ -756,7 +759,7 @@ export default mixins(
|
||||
const saved = await this.saveCurrentWorkflow();
|
||||
if (saved) await this.settingsStore.fetchPromptsData();
|
||||
},
|
||||
showTriggerCreator(source: string) {
|
||||
showTriggerCreator(source: NodeCreatorOpenSource) {
|
||||
if (this.createNodeActive) return;
|
||||
this.nodeCreatorStore.setSelectedView(TRIGGER_NODE_FILTER);
|
||||
this.nodeCreatorStore.setShowScrim(true);
|
||||
@@ -1029,7 +1032,7 @@ export default mixins(
|
||||
this.callDebounced('deleteSelectedNodes', { debounceTime: 500 });
|
||||
} else if (e.key === 'Tab') {
|
||||
this.onToggleNodeCreator({
|
||||
source: 'tab',
|
||||
source: NODE_CREATOR_OPEN_SOURCES.TAB,
|
||||
createNodeActive: !this.createNodeActive && !this.isReadOnly,
|
||||
});
|
||||
} else if (e.key === this.controlKeyCode) {
|
||||
@@ -2059,7 +2062,7 @@ export default mixins(
|
||||
insertNodeAfterSelected(info: {
|
||||
sourceId: string;
|
||||
index: number;
|
||||
eventSource: string;
|
||||
eventSource: NodeCreatorOpenSource;
|
||||
connection?: Connection;
|
||||
}) {
|
||||
// Get the node and set it as active that new nodes
|
||||
@@ -2078,7 +2081,10 @@ export default mixins(
|
||||
this.lastSelectedConnection = info.connection;
|
||||
}
|
||||
|
||||
this.onToggleNodeCreator({ source: info.eventSource, createNodeActive: true });
|
||||
this.onToggleNodeCreator({
|
||||
source: info.eventSource,
|
||||
createNodeActive: true,
|
||||
});
|
||||
},
|
||||
onEventConnectionAbort(connection: Connection) {
|
||||
try {
|
||||
@@ -2103,7 +2109,7 @@ export default mixins(
|
||||
this.insertNodeAfterSelected({
|
||||
sourceId: connection.parameters.nodeId,
|
||||
index: connection.parameters.index,
|
||||
eventSource: 'node_connection_drop',
|
||||
eventSource: NODE_CREATOR_OPEN_SOURCES.NODE_CONNECTION_DROP,
|
||||
});
|
||||
} catch (e) {
|
||||
console.error(e); // eslint-disable-line no-console
|
||||
@@ -2183,7 +2189,7 @@ export default mixins(
|
||||
sourceId: info.sourceEndpoint.parameters.nodeId,
|
||||
index: sourceInfo.index,
|
||||
connection: info.connection,
|
||||
eventSource: 'node_connection_action',
|
||||
eventSource: NODE_CREATOR_OPEN_SOURCES.NODE_CONNECTION_ACTION,
|
||||
});
|
||||
},
|
||||
);
|
||||
@@ -2421,7 +2427,7 @@ export default mixins(
|
||||
this.insertNodeAfterSelected({
|
||||
sourceId: endpoint.__meta.nodeId,
|
||||
index: endpoint.__meta.index,
|
||||
eventSource: 'plus_endpoint',
|
||||
eventSource: NODE_CREATOR_OPEN_SOURCES.PLUS_ENDPOINT,
|
||||
});
|
||||
}
|
||||
},
|
||||
@@ -3718,7 +3724,7 @@ export default mixins(
|
||||
source,
|
||||
createNodeActive,
|
||||
}: {
|
||||
source?: string;
|
||||
source?: NodeCreatorOpenSource;
|
||||
createNodeActive: boolean;
|
||||
}) {
|
||||
if (createNodeActive === this.createNodeActive) return;
|
||||
@@ -3732,6 +3738,8 @@ export default mixins(
|
||||
|
||||
const mode =
|
||||
this.nodeCreatorStore.selectedView === TRIGGER_NODE_FILTER ? 'trigger' : 'regular';
|
||||
|
||||
this.nodeCreatorStore.openSource = source || '';
|
||||
this.$externalHooks().run('nodeView.createNodeActiveChanged', {
|
||||
source,
|
||||
mode,
|
||||
@@ -3927,7 +3935,7 @@ export default mixins(
|
||||
activated() {
|
||||
const openSideMenu = this.uiStore.addFirstStepOnLoad;
|
||||
if (openSideMenu) {
|
||||
this.showTriggerCreator('trigger_placeholder_button');
|
||||
this.showTriggerCreator(NODE_CREATOR_OPEN_SOURCES.TRIGGER_PLACEHOLDER_BUTTON);
|
||||
}
|
||||
this.uiStore.addFirstStepOnLoad = false;
|
||||
this.bindCanvasEvents();
|
||||
|
||||
Reference in New Issue
Block a user