mirror of
https://github.com/n8n-io/n8n.git
synced 2025-01-23 18:41:48 -08:00
feat(editor): Open NDV when a node is added to canvas v2 (no-changelog) (#10114)
This commit is contained in:
parent
4559e3ae18
commit
062633ec9b
|
@ -167,6 +167,20 @@ describe('useCanvasOperations', () => {
|
|||
});
|
||||
expect(result.credentials).toBeUndefined();
|
||||
});
|
||||
|
||||
it('should open NDV when specified', async () => {
|
||||
nodeTypesStore.setNodeTypes([mockNodeTypeDescription({ name: 'type' })]);
|
||||
|
||||
await canvasOperations.addNode(
|
||||
{
|
||||
type: 'type',
|
||||
name: 'Test Name',
|
||||
},
|
||||
{ openNDV: true },
|
||||
);
|
||||
|
||||
expect(ndvStore.activeNodeName).toBe('Test Name');
|
||||
});
|
||||
});
|
||||
|
||||
describe('updateNodePosition', () => {
|
||||
|
|
|
@ -76,7 +76,7 @@ import type {
|
|||
import { NodeConnectionType, NodeHelpers, TelemetryHelpers } from 'n8n-workflow';
|
||||
import { v4 as uuid } from 'uuid';
|
||||
import type { Ref } from 'vue';
|
||||
import { computed } from 'vue';
|
||||
import { computed, nextTick } from 'vue';
|
||||
import type { useRouter } from 'vue-router';
|
||||
|
||||
type AddNodeData = Partial<INodeUi> & {
|
||||
|
@ -429,6 +429,12 @@ export function useCanvasOperations({
|
|||
workflowsStore.setNodePristine(nodeData.name, true);
|
||||
uiStore.stateIsDirty = true;
|
||||
|
||||
if (options.openNDV) {
|
||||
void nextTick(() => {
|
||||
ndvStore.setActiveNodeName(nodeData.name);
|
||||
});
|
||||
}
|
||||
|
||||
return nodeData;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue