From ab9faf109ca66e08e9346296bd989e8c687d6187 Mon Sep 17 00:00:00 2001 From: Tomi Turtiainen <10324676+tomi@users.noreply.github.com> Date: Mon, 19 Aug 2024 09:03:48 +0300 Subject: [PATCH] refactor(editor): Add types to ndv event bus (no-changelog) (#10451) --- .../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 f07dfd231c..fd2f5b4e30 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 a6d705b4ef..e8c9233c39 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<NdvEventBusEvents>();