mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-18 02:21:13 +00:00
feat(editor): Unify regular and trigger node creator panels (#5315)
* WIP: Merge TriggerHelperPanel with MainPanel * WIP: Implement switching between views * Remove logging * WIP: Rework search * Fix category toggling and search results display * Fix node item description * Sort actions based on the root view * Adjust personalisation modal, make trigger canvas node round * Linting fixes * Fix filtering of API options * Fix types and no result state * Cleanup * Linting fixes * Adjust mode prop for node creator tracking * Fix merging of core nodes and filtering of single placeholder actions * Lint fixes * Implement actions override, fix node creator view item spacing and increase click radius of trigger node icon * Fix keyboard view navigation * WIP: E2E Tests * Address product review * Minor fixes & cleanup * Fix tests * Some more test fixes * Add specs to check actions and panels * Update personalisation survey snapshot
This commit is contained in:
@@ -196,6 +196,8 @@ import {
|
||||
TRIGGER_NODE_FILTER,
|
||||
EnterpriseEditionFeature,
|
||||
POSTHOG_ASSUMPTION_TEST,
|
||||
REGULAR_NODE_FILTER,
|
||||
MANUAL_TRIGGER_NODE_TYPE,
|
||||
} from '@/constants';
|
||||
import { copyPaste } from '@/mixins/copyPaste';
|
||||
import { externalHooks } from '@/mixins/externalHooks';
|
||||
@@ -752,10 +754,9 @@ export default mixins(
|
||||
},
|
||||
showTriggerCreator(source: string) {
|
||||
if (this.createNodeActive) return;
|
||||
this.nodeCreatorStore.setSelectedType(TRIGGER_NODE_FILTER);
|
||||
this.nodeCreatorStore.setSelectedView(TRIGGER_NODE_FILTER);
|
||||
this.nodeCreatorStore.setShowScrim(true);
|
||||
this.onToggleNodeCreator({ source, createNodeActive: true });
|
||||
this.$nextTick(() => this.nodeCreatorStore.setShowTabs(false));
|
||||
},
|
||||
async openExecution(executionId: string) {
|
||||
this.startLoading();
|
||||
@@ -1799,6 +1800,7 @@ export default mixins(
|
||||
options: AddNodeOptions = {},
|
||||
showDetail = true,
|
||||
trackHistory = false,
|
||||
isAutoAdd = false,
|
||||
) {
|
||||
const nodeTypeData: INodeTypeDescription | null =
|
||||
this.nodeTypesStore.getNodeType(nodeTypeName);
|
||||
@@ -1920,6 +1922,7 @@ export default mixins(
|
||||
this.$externalHooks().run('nodeView.addNodeButton', { nodeTypeName });
|
||||
const trackProperties: ITelemetryTrackProperties = {
|
||||
node_type: nodeTypeName,
|
||||
is_auto_add: isAutoAdd,
|
||||
workflow_id: this.workflowsStore.workflowId,
|
||||
drag_and_drop: options.dragAndDrop,
|
||||
};
|
||||
@@ -2005,6 +2008,7 @@ export default mixins(
|
||||
options: AddNodeOptions = {},
|
||||
showDetail = true,
|
||||
trackHistory = false,
|
||||
isAutoAdd = false,
|
||||
) {
|
||||
if (!this.editAllowedCheck()) {
|
||||
return;
|
||||
@@ -2016,7 +2020,13 @@ export default mixins(
|
||||
|
||||
this.historyStore.startRecordingUndo();
|
||||
|
||||
const newNodeData = await this.injectNode(nodeTypeName, options, showDetail, trackHistory);
|
||||
const newNodeData = await this.injectNode(
|
||||
nodeTypeName,
|
||||
options,
|
||||
showDetail,
|
||||
trackHistory,
|
||||
isAutoAdd,
|
||||
);
|
||||
if (!newNodeData) {
|
||||
return;
|
||||
}
|
||||
@@ -3674,12 +3684,14 @@ export default mixins(
|
||||
if (createNodeActive === this.createNodeActive) return;
|
||||
|
||||
// Default to the trigger tab in node creator if there's no trigger node yet
|
||||
if (!this.containsTrigger) this.nodeCreatorStore.setSelectedType(TRIGGER_NODE_FILTER);
|
||||
this.nodeCreatorStore.setSelectedView(
|
||||
this.containsTrigger ? REGULAR_NODE_FILTER : TRIGGER_NODE_FILTER,
|
||||
);
|
||||
|
||||
this.createNodeActive = createNodeActive;
|
||||
|
||||
const mode =
|
||||
this.nodeCreatorStore.selectedType === TRIGGER_NODE_FILTER ? 'trigger' : 'default';
|
||||
this.nodeCreatorStore.selectedView === TRIGGER_NODE_FILTER ? 'trigger' : 'regular';
|
||||
this.$externalHooks().run('nodeView.createNodeActiveChanged', {
|
||||
source,
|
||||
mode,
|
||||
@@ -3697,11 +3709,14 @@ export default mixins(
|
||||
dragAndDrop: boolean,
|
||||
) {
|
||||
nodeTypes.forEach(({ nodeTypeName, position }, index) => {
|
||||
const isManualTrigger = nodeTypeName === MANUAL_TRIGGER_NODE_TYPE;
|
||||
const openNDV = !isManualTrigger && (nodeTypes.length === 1 || index > 0);
|
||||
this.addNode(
|
||||
nodeTypeName,
|
||||
{ position, dragAndDrop },
|
||||
nodeTypes.length === 1 || index > 0,
|
||||
openNDV,
|
||||
true,
|
||||
nodeTypes.length > 1 && index < 1,
|
||||
);
|
||||
if (index === 0) return;
|
||||
// If there's more than one node, we want to connect them
|
||||
@@ -3717,7 +3732,7 @@ export default mixins(
|
||||
this.connectTwoNodes(previouslyAddedNode.name, 0, lastAddedNode.name, 0),
|
||||
);
|
||||
|
||||
// Position the added node to the right side of the previsouly added one
|
||||
// Position the added node to the right side of the previously added one
|
||||
lastAddedNode.position = [
|
||||
previouslyAddedNode.position[0] + NodeViewUtils.NODE_SIZE * 2,
|
||||
previouslyAddedNode.position[1],
|
||||
|
||||
Reference in New Issue
Block a user