From 6ff19a2654d4023b27fdaef8dc4ad789a7646489 Mon Sep 17 00:00:00 2001 From: Tomi Turtiainen <10324676+tomi@users.noreply.github.com> Date: Fri, 16 Aug 2024 09:44:35 +0300 Subject: [PATCH] refactor(editor): Add types to ndv event bus (no-changelog) --- .../editor-ui/src/components/NodeSettings.vue | 1 - packages/editor-ui/src/event-bus/ndv.ts | 20 ++++++++++++++++++- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/packages/editor-ui/src/components/NodeSettings.vue b/packages/editor-ui/src/components/NodeSettings.vue index f07dfd231c68b..fd2f5b4e302a5 100644 --- a/packages/editor-ui/src/components/NodeSettings.vue +++ b/packages/editor-ui/src/components/NodeSettings.vue @@ -744,7 +744,6 @@ export default defineComponent({ if (this.node) { this.historyStore.pushCommandToUndo(new RenameNodeCommand(this.node.name, name)); } - // @ts-ignore this.valueChanged({ value: name, name: 'name', diff --git a/packages/editor-ui/src/event-bus/ndv.ts b/packages/editor-ui/src/event-bus/ndv.ts index a6d705b4efea1..e8c9233c39da5 100644 --- a/packages/editor-ui/src/event-bus/ndv.ts +++ b/packages/editor-ui/src/event-bus/ndv.ts @@ -1,3 +1,21 @@ +import type { IUpdateInformation } from '@/Interface'; import { createEventBus } from 'n8n-design-system/utils'; -export const ndvEventBus = createEventBus(); +export type Position = 'minLeft' | 'maxRight' | 'initial'; + +export type CreateNewCredentialOpts = { + type: string; + showAuthOptions: boolean; +}; + +export interface NdvEventBusEvents { + /** Command to let the user create a new credential by opening the credentials modal */ + 'credential.createNew': CreateNewCredentialOpts; + + /** Command to set the NDV panels' (input, output, main) positions based on the given value */ + setPositionByName: Position; + + updateParameterValue: IUpdateInformation; +} + +export const ndvEventBus = createEventBus();