mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-18 02:21:13 +00:00
refactor(editor): Refactor workflowHelpers mixin to composable (no-changelog) (#8600)
This commit is contained in:
@@ -18,7 +18,6 @@ import {
|
||||
|
||||
import { useToast } from '@/composables/useToast';
|
||||
import { useNodeHelpers } from '@/composables/useNodeHelpers';
|
||||
import { workflowHelpers } from '@/mixins/workflowHelpers';
|
||||
|
||||
import { FORM_TRIGGER_NODE_TYPE, WAIT_NODE_TYPE } from '@/constants';
|
||||
import { useTitleChange } from '@/composables/useTitleChange';
|
||||
@@ -27,16 +26,20 @@ import { useUIStore } from '@/stores/ui.store';
|
||||
import { useWorkflowsStore } from '@/stores/workflows.store';
|
||||
import { openPopUpWindow } from '@/utils/executionUtils';
|
||||
import { useExternalHooks } from '@/composables/useExternalHooks';
|
||||
import { useWorkflowHelpers } from '@/composables/useWorkflowHelpers';
|
||||
import { useRouter } from 'vue-router';
|
||||
|
||||
export const workflowRun = defineComponent({
|
||||
mixins: [workflowHelpers],
|
||||
setup() {
|
||||
const nodeHelpers = useNodeHelpers();
|
||||
const router = useRouter();
|
||||
const workflowHelpers = useWorkflowHelpers(router);
|
||||
|
||||
return {
|
||||
...useTitleChange(),
|
||||
...useToast(),
|
||||
nodeHelpers,
|
||||
workflowHelpers,
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
@@ -81,7 +84,7 @@ export const workflowRun = defineComponent({
|
||||
| { triggerNode: string; nodeData: ITaskData; source?: string }
|
||||
| { source?: string },
|
||||
): Promise<IExecutionPushResponse | undefined> {
|
||||
const workflow = this.getCurrentWorkflow();
|
||||
const workflow = this.workflowHelpers.getCurrentWorkflow();
|
||||
|
||||
if (this.uiStore.isActionActive('workflowRunning')) {
|
||||
return;
|
||||
@@ -97,7 +100,10 @@ export const workflowRun = defineComponent({
|
||||
const issuesExist = this.workflowsStore.nodesIssuesExist;
|
||||
if (issuesExist) {
|
||||
// If issues exist get all of the issues of all nodes
|
||||
const workflowIssues = this.checkReadyForExecution(workflow, options.destinationNode);
|
||||
const workflowIssues = this.workflowHelpers.checkReadyForExecution(
|
||||
workflow,
|
||||
options.destinationNode,
|
||||
);
|
||||
if (workflowIssues !== null) {
|
||||
const errorMessages = [];
|
||||
let nodeIssues: string[];
|
||||
@@ -143,7 +149,7 @@ export const workflowRun = defineComponent({
|
||||
nodeName: options.destinationNode,
|
||||
});
|
||||
|
||||
await this.getWorkflowDataToSave().then((workflowData) => {
|
||||
await this.workflowHelpers.getWorkflowDataToSave().then((workflowData) => {
|
||||
this.$telemetry.track('Workflow execution preflight failed', {
|
||||
workflow_id: workflow.id,
|
||||
workflow_name: workflow.name,
|
||||
@@ -152,7 +158,7 @@ export const workflowRun = defineComponent({
|
||||
node_graph_string: JSON.stringify(
|
||||
TelemetryHelpers.generateNodesGraph(
|
||||
workflowData as IWorkflowBase,
|
||||
this.getNodeTypes(),
|
||||
this.workflowHelpers.getNodeTypes(),
|
||||
).nodeGraph,
|
||||
),
|
||||
error_node_types: JSON.stringify(trackErrorNodeTypes),
|
||||
@@ -231,10 +237,10 @@ export const workflowRun = defineComponent({
|
||||
}
|
||||
|
||||
if (this.workflowsStore.isNewWorkflow) {
|
||||
await this.saveCurrentWorkflow();
|
||||
await this.workflowHelpers.saveCurrentWorkflow();
|
||||
}
|
||||
|
||||
const workflowData = await this.getWorkflowDataToSave();
|
||||
const workflowData = await this.workflowHelpers.getWorkflowDataToSave();
|
||||
|
||||
const startRunData: IStartRunData = {
|
||||
workflowData,
|
||||
|
||||
Reference in New Issue
Block a user