refactor(editor): Turn titleChange mixin to composable (#6059)

This commit is contained in:
Csaba Tuncsik
2023-04-21 15:48:07 +02:00
committed by GitHub
parent 649389edad
commit 19f540ecf9
7 changed files with 54 additions and 59 deletions

View File

@@ -14,19 +14,18 @@ import { workflowHelpers } from '@/mixins/workflowHelpers';
import { showMessage } from '@/mixins/showMessage';
import mixins from 'vue-typed-mixins';
import { titleChange } from './titleChange';
import { useTitleChange } from '@/composables/useTitleChange';
import { mapStores } from 'pinia';
import { useUIStore } from '@/stores/ui';
import { useWorkflowsStore } from '@/stores/workflows';
import { useRootStore } from '@/stores/n8nRootStore';
export const workflowRun = mixins(
externalHooks,
restApi,
workflowHelpers,
showMessage,
titleChange,
).extend({
export const workflowRun = mixins(externalHooks, restApi, workflowHelpers, showMessage).extend({
setup() {
return {
...useTitleChange(),
};
},
computed: {
...mapStores(useRootStore, useUIStore, useWorkflowsStore),
},
@@ -72,7 +71,7 @@ export const workflowRun = mixins(
return;
}
this.$titleSet(workflow.name as string, 'EXECUTING');
this.titleSet(workflow.name as string, 'EXECUTING');
this.clearAllStickyNotifications();
@@ -119,7 +118,7 @@ export const workflowRun = mixins(
type: 'error',
duration: 0,
});
this.$titleSet(workflow.name as string, 'ERROR');
this.titleSet(workflow.name as string, 'ERROR');
this.$externalHooks().run('workflowRun.runError', { errorMessages, nodeName });
this.getWorkflowDataToSave().then((workflowData) => {
@@ -245,7 +244,7 @@ export const workflowRun = mixins(
return runWorkflowApiResponse;
} catch (error) {
this.$titleSet(workflow.name as string, 'ERROR');
this.titleSet(workflow.name as string, 'ERROR');
this.$showError(error, this.$locale.baseText('workflowRun.showError.title'));
return undefined;
}