mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-18 02:21:13 +00:00
Revert "refactor(editor): Turn showMessage mixin to composable" (#6243)
Revert "refactor(editor): Turn showMessage mixin to composable (#6081)"
This reverts commit b95fcd7323.
This commit is contained in:
@@ -7,7 +7,8 @@ import type {
|
||||
|
||||
import { externalHooks } from '@/mixins/externalHooks';
|
||||
import { nodeHelpers } from '@/mixins/nodeHelpers';
|
||||
import { useTitleChange, useToast } from '@/composables';
|
||||
import { showMessage } from '@/mixins/showMessage';
|
||||
import { useTitleChange } from '@/composables/useTitleChange';
|
||||
import { workflowHelpers } from '@/mixins/workflowHelpers';
|
||||
|
||||
import type {
|
||||
@@ -18,7 +19,6 @@ import type {
|
||||
IRunExecutionData,
|
||||
IWorkflowBase,
|
||||
SubworkflowOperationError,
|
||||
IExecuteContextData,
|
||||
} from 'n8n-workflow';
|
||||
import { TelemetryHelpers } from 'n8n-workflow';
|
||||
|
||||
@@ -35,11 +35,15 @@ import { useSettingsStore } from '@/stores/settings.store';
|
||||
import { parse } from 'flatted';
|
||||
import { useSegment } from '@/stores/segment.store';
|
||||
|
||||
export const pushConnection = mixins(externalHooks, nodeHelpers, workflowHelpers).extend({
|
||||
export const pushConnection = mixins(
|
||||
externalHooks,
|
||||
nodeHelpers,
|
||||
showMessage,
|
||||
workflowHelpers,
|
||||
).extend({
|
||||
setup() {
|
||||
return {
|
||||
...useTitleChange(),
|
||||
...useToast(),
|
||||
};
|
||||
},
|
||||
data() {
|
||||
@@ -320,7 +324,7 @@ export const pushConnection = mixins(externalHooks, nodeHelpers, workflowHelpers
|
||||
|
||||
const runDataExecuted = pushData.data;
|
||||
|
||||
let runDataExecutedErrorMessage = this.getExecutionError(runDataExecuted.data);
|
||||
let runDataExecutedErrorMessage = this.$getExecutionError(runDataExecuted.data);
|
||||
|
||||
if (pushData.data.status === 'crashed') {
|
||||
runDataExecutedErrorMessage = this.$locale.baseText(
|
||||
@@ -363,7 +367,7 @@ export const pushConnection = mixins(externalHooks, nodeHelpers, workflowHelpers
|
||||
|
||||
// Workflow did start but had been put to wait
|
||||
this.titleSet(workflow.name as string, 'IDLE');
|
||||
this.showToast({
|
||||
this.$showToast({
|
||||
title: 'Workflow started waiting',
|
||||
message: `${action} <a href="https://docs.n8n.io/integrations/builtin/core-nodes/n8n-nodes-base.wait/" target="_blank">More info</a>`,
|
||||
type: 'success',
|
||||
@@ -418,7 +422,7 @@ export const pushConnection = mixins(externalHooks, nodeHelpers, workflowHelpers
|
||||
|
||||
this.workflowsStore.subWorkflowExecutionError = error;
|
||||
|
||||
this.showMessage({
|
||||
this.$showMessage({
|
||||
title: error.message,
|
||||
message: error.description,
|
||||
type: 'error',
|
||||
@@ -432,7 +436,7 @@ export const pushConnection = mixins(externalHooks, nodeHelpers, workflowHelpers
|
||||
title = 'Problem executing workflow';
|
||||
}
|
||||
|
||||
this.showMessage({
|
||||
this.$showMessage({
|
||||
title,
|
||||
message: runDataExecutedErrorMessage,
|
||||
type: 'error',
|
||||
@@ -455,7 +459,7 @@ export const pushConnection = mixins(externalHooks, nodeHelpers, workflowHelpers
|
||||
execution.data.resultData.runData &&
|
||||
execution.data.resultData.runData[execution.executedNode];
|
||||
if (nodeType && nodeType.polling && !nodeOutput) {
|
||||
this.showMessage({
|
||||
this.$showMessage({
|
||||
title: this.$locale.baseText('pushConnection.pollingNode.dataNotFound', {
|
||||
interpolate: {
|
||||
service: getTriggerNodeServiceName(nodeType),
|
||||
@@ -469,13 +473,13 @@ export const pushConnection = mixins(externalHooks, nodeHelpers, workflowHelpers
|
||||
type: 'success',
|
||||
});
|
||||
} else {
|
||||
this.showMessage({
|
||||
this.$showMessage({
|
||||
title: this.$locale.baseText('pushConnection.nodeExecutedSuccessfully'),
|
||||
type: 'success',
|
||||
});
|
||||
}
|
||||
} else {
|
||||
this.showMessage({
|
||||
this.$showMessage({
|
||||
title: this.$locale.baseText('pushConnection.workflowExecutedSuccessfully'),
|
||||
type: 'success',
|
||||
});
|
||||
@@ -578,38 +582,5 @@ export const pushConnection = mixins(externalHooks, nodeHelpers, workflowHelpers
|
||||
}
|
||||
return true;
|
||||
},
|
||||
getExecutionError(data: IRunExecutionData | IExecuteContextData) {
|
||||
const error = data.resultData.error;
|
||||
|
||||
let errorMessage: string;
|
||||
|
||||
if (data.resultData.lastNodeExecuted && error) {
|
||||
errorMessage = error.message || error.description;
|
||||
} else {
|
||||
errorMessage = this.$locale.baseText('pushConnection.executionError', {
|
||||
interpolate: { error: '!' },
|
||||
});
|
||||
|
||||
if (error && error.message) {
|
||||
let nodeName: string | undefined;
|
||||
if ('node' in error) {
|
||||
nodeName = typeof error.node === 'string' ? error.node : error.node!.name;
|
||||
}
|
||||
|
||||
const receivedError = nodeName ? `${nodeName}: ${error.message}` : error.message;
|
||||
errorMessage = this.$locale.baseText('pushConnection.executionError', {
|
||||
interpolate: {
|
||||
error: `.${this.$locale.baseText('pushConnection.executionError.details', {
|
||||
interpolate: {
|
||||
details: receivedError,
|
||||
},
|
||||
})}`,
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
return errorMessage;
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user