Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(editor): Type node view event bus (no-changelog) #10396

Merged
merged 3 commits into from
Aug 15, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 28 additions & 1 deletion packages/editor-ui/src/event-bus/node-view.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,30 @@
import type { EventBus } from 'n8n-design-system/utils';
import { createEventBus } from 'n8n-design-system/utils';
import type { IDataObject } from 'n8n-workflow';

export const nodeViewEventBus = createEventBus();
export type CallbackFn = () => void;

export interface NodeViewEventBusEvents {
/** Command to create a new workflow */
newWorkflow: never;

/** Command to open the chat */
openChat: never;

/** Command to save the current workflow */
saveWorkflow: CallbackFn;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

using this particula alias feels confusing. We should either call the type OnSaveWorkflowFn or replace the line with saveWorkflow: () => void;

Copy link
Contributor Author

@tomi tomi Aug 15, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed. I tried to clarify it. LMK if it's clearer now


/** Command to import a workflow from given data */
importWorkflowData: IDataObject;

/** Command to import a workflow from given URL */
importWorkflowUrl: IDataObject;

'runWorkflowButton:mouseenter': never;

'runWorkflowButton:mouseleave': never;
}

export type NodeViewEventBus = EventBus<NodeViewEventBusEvents>;

export const nodeViewEventBus = createEventBus<NodeViewEventBusEvents>();
Loading