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:
Csaba Tuncsik
2023-05-12 16:43:34 +02:00
committed by GitHub
parent 13bcec1661
commit 638e3f209d
75 changed files with 863 additions and 991 deletions

View File

@@ -186,7 +186,7 @@ import {
MAIN_HEADER_TABS,
MODAL_CANCEL,
MODAL_CLOSE,
MODAL_CONFIRM,
MODAL_CONFIRMED,
NODE_OUTPUT_DEFAULT_KEY,
ONBOARDING_CALL_SIGNUP_MODAL_KEY,
ONBOARDING_PROMPT_TIMEBOX,
@@ -206,15 +206,13 @@ import { copyPaste } from '@/mixins/copyPaste';
import { externalHooks } from '@/mixins/externalHooks';
import { genericHelpers } from '@/mixins/genericHelpers';
import { moveNodeWorkflow } from '@/mixins/moveNodeWorkflow';
import {
useGlobalLinkActions,
useCanvasMouseSelect,
useMessage,
useToast,
useTitleChange,
} from '@/composables';
import useGlobalLinkActions from '@/composables/useGlobalLinkActions';
import useCanvasMouseSelect from '@/composables/useCanvasMouseSelect';
import { showMessage } from '@/mixins/showMessage';
import { useTitleChange } from '@/composables/useTitleChange';
import { useUniqueNodeName } from '@/composables/useUniqueNodeName';
import { useI18n } from '@/composables/useI18n';
import { workflowHelpers } from '@/mixins/workflowHelpers';
import { workflowRun } from '@/mixins/workflowRun';
@@ -324,6 +322,7 @@ export default mixins(
externalHooks,
genericHelpers,
moveNodeWorkflow,
showMessage,
workflowHelpers,
workflowRun,
debounceHelper,
@@ -344,8 +343,6 @@ export default mixins(
...useCanvasMouseSelect(),
...useGlobalLinkActions(),
...useTitleChange(),
...useToast(),
...useMessage(),
...useUniqueNodeName(),
...useI18n(),
};
@@ -418,21 +415,15 @@ export default mixins(
return;
}
if (this.uiStore.stateIsDirty) {
const confirmModal = await this.confirm(
const confirmModal = await this.confirmModal(
this.$locale.baseText('generic.unsavedWork.confirmMessage.message'),
{
title: this.$locale.baseText('generic.unsavedWork.confirmMessage.headline'),
type: 'warning',
confirmButtonText: this.$locale.baseText(
'generic.unsavedWork.confirmMessage.confirmButtonText',
),
cancelButtonText: this.$locale.baseText(
'generic.unsavedWork.confirmMessage.cancelButtonText',
),
showClose: true,
},
this.$locale.baseText('generic.unsavedWork.confirmMessage.headline'),
'warning',
this.$locale.baseText('generic.unsavedWork.confirmMessage.confirmButtonText'),
this.$locale.baseText('generic.unsavedWork.confirmMessage.cancelButtonText'),
true,
);
if (confirmModal === MODAL_CONFIRM) {
if (confirmModal === MODAL_CONFIRMED) {
// Make sure workflow id is empty when leaving the editor
this.workflowsStore.setWorkflowId(PLACEHOLDER_EMPTY_WORKFLOW_ID);
const saved = await this.saveCurrentWorkflow({}, false);
@@ -669,7 +660,7 @@ export default mixins(
this.registerCustomAction('showNodeCreator', () =>
this.showTriggerCreator(NODE_CREATOR_OPEN_SOURCES.NO_TRIGGER_EXECUTION_TOOLTIP),
);
const notice = this.showMessage({
const notice = this.$showMessage({
type: 'info',
title: this.$locale.baseText('nodeView.cantExecuteNoTrigger'),
message,
@@ -697,7 +688,7 @@ export default mixins(
saved = true;
}
if (saved) {
this.showMessage({
this.$showMessage({
title: this.$locale.baseText('generic.workflowSaved'),
type: 'success',
});
@@ -717,7 +708,7 @@ export default mixins(
try {
data = await this.workflowsStore.getExecution(executionId);
} catch (error) {
this.showError(error, this.$locale.baseText('nodeView.showError.openExecution.title'));
this.$showError(error, this.$locale.baseText('nodeView.showError.openExecution.title'));
return;
}
if (data === undefined) {
@@ -775,7 +766,7 @@ export default mixins(
}
}
if ((data as IExecutionsSummary).waitTill) {
this.showMessage({
this.$showMessage({
title: this.$locale.baseText('nodeView.thisExecutionHasntFinishedYet'),
message: `<a data-action="reload">${this.$locale.baseText(
'nodeView.refresh',
@@ -828,7 +819,7 @@ export default mixins(
);
}
} catch (error) {
this.showError(error, this.$locale.baseText('nodeView.couldntImportWorkflow'));
this.$showError(error, this.$locale.baseText('nodeView.couldntImportWorkflow'));
void this.$router.replace({ name: VIEWS.NEW_WORKFLOW });
return;
}
@@ -1039,7 +1030,7 @@ export default mixins(
void this.$router.push({ name: VIEWS.NEW_WORKFLOW });
}
this.showMessage({
this.$showMessage({
title: this.$locale.baseText('nodeView.showMessage.keyDown.title'),
type: 'success',
});
@@ -1314,7 +1305,7 @@ export default mixins(
this.copyToClipboard(nodeData);
if (data.nodes.length > 0) {
if (!isCut) {
this.showMessage({
this.$showMessage({
title: 'Copied!',
message: '',
type: 'success',
@@ -1336,7 +1327,7 @@ export default mixins(
try {
this.stopExecutionInProgress = true;
await this.workflowsStore.stopCurrentExecution(executionId);
this.showMessage({
this.$showMessage({
title: this.$locale.baseText('nodeView.showMessage.stopExecutionTry.title'),
type: 'success',
});
@@ -1355,7 +1346,7 @@ export default mixins(
this.uiStore.removeActiveAction('workflowRunning');
this.titleSet(this.workflowsStore.workflowName, 'IDLE');
this.showMessage({
this.$showMessage({
title: this.$locale.baseText('nodeView.showMessage.stopExecutionCatch.unsaved.title'),
message: this.$locale.baseText(
'nodeView.showMessage.stopExecutionCatch.unsaved.message',
@@ -1382,13 +1373,13 @@ export default mixins(
this.workflowsStore.executingNode = null;
this.workflowsStore.setWorkflowExecutionData(executedData as IExecutionResponse);
this.uiStore.removeActiveAction('workflowRunning');
this.showMessage({
this.$showMessage({
title: this.$locale.baseText('nodeView.showMessage.stopExecutionCatch.title'),
message: this.$locale.baseText('nodeView.showMessage.stopExecutionCatch.message'),
type: 'success',
});
} else {
this.showError(error, this.$locale.baseText('nodeView.showError.stopExecution.title'));
this.$showError(error, this.$locale.baseText('nodeView.showError.stopExecution.title'));
}
}
this.stopExecutionInProgress = false;
@@ -1410,7 +1401,7 @@ export default mixins(
try {
await this.workflowsStore.removeTestWebhook(this.workflowsStore.workflowId);
} catch (error) {
this.showError(
this.$showError(
error,
this.$locale.baseText('nodeView.showError.stopWaitingForWebhook.title'),
);
@@ -1435,23 +1426,19 @@ export default mixins(
return;
}
const importConfirm = await this.confirm(
const importConfirm = await this.confirmMessage(
this.$locale.baseText('nodeView.confirmMessage.receivedCopyPasteData.message', {
interpolate: { plainTextData },
}),
this.$locale.baseText('nodeView.confirmMessage.receivedCopyPasteData.headline'),
{
type: 'warning',
confirmButtonText: this.$locale.baseText(
'nodeView.confirmMessage.receivedCopyPasteData.confirmButtonText',
),
cancelButtonText: this.$locale.baseText(
'nodeView.confirmMessage.receivedCopyPasteData.cancelButtonText',
),
},
'warning',
this.$locale.baseText(
'nodeView.confirmMessage.receivedCopyPasteData.confirmButtonText',
),
this.$locale.baseText('nodeView.confirmMessage.receivedCopyPasteData.cancelButtonText'),
);
if (importConfirm !== MODAL_CONFIRM) {
if (!importConfirm) {
return;
}
@@ -1488,7 +1475,7 @@ export default mixins(
workflowData = await this.workflowsStore.getWorkflowFromUrl(url);
} catch (error) {
this.stopLoading();
this.showError(
this.$showError(
error,
this.$locale.baseText('nodeView.showError.getWorkflowDataFromUrl.title'),
);
@@ -1606,7 +1593,10 @@ export default mixins(
this.workflowsStore.addWorkflowTagIds(tagIds);
}
} catch (error) {
this.showError(error, this.$locale.baseText('nodeView.showError.importWorkflowData.title'));
this.$showError(
error,
this.$locale.baseText('nodeView.showError.importWorkflowData.title'),
);
}
},
onDragOver(event: DragEvent) {
@@ -1670,7 +1660,7 @@ export default mixins(
},
showMaxNodeTypeError(nodeTypeData: INodeTypeDescription) {
const maxNodes = nodeTypeData.maxNodes;
this.showMessage({
this.$showMessage({
title: this.$locale.baseText('nodeView.showMessage.showMaxNodeTypeError.title'),
message: this.$locale.baseText('nodeView.showMessage.showMaxNodeTypeError.message', {
adjustToNumber: maxNodes,
@@ -1780,7 +1770,7 @@ export default mixins(
this.nodeTypesStore.getNodeType(nodeTypeName);
if (nodeTypeData === null) {
this.showMessage({
this.$showMessage({
title: this.$locale.baseText('nodeView.showMessage.addNodeButton.title'),
message: this.$locale.baseText('nodeView.showMessage.addNodeButton.message', {
interpolate: { nodeTypeName },
@@ -2500,21 +2490,15 @@ export default mixins(
} else {
const result = this.uiStore.stateIsDirty;
if (result) {
const confirmModal = await this.confirm(
const confirmModal = await this.confirmModal(
this.$locale.baseText('generic.unsavedWork.confirmMessage.message'),
{
title: this.$locale.baseText('generic.unsavedWork.confirmMessage.headline'),
type: 'warning',
confirmButtonText: this.$locale.baseText(
'generic.unsavedWork.confirmMessage.confirmButtonText',
),
cancelButtonText: this.$locale.baseText(
'generic.unsavedWork.confirmMessage.cancelButtonText',
),
showClose: true,
},
this.$locale.baseText('generic.unsavedWork.confirmMessage.headline'),
'warning',
this.$locale.baseText('generic.unsavedWork.confirmMessage.confirmButtonText'),
this.$locale.baseText('generic.unsavedWork.confirmMessage.cancelButtonText'),
true,
);
if (confirmModal === MODAL_CONFIRM) {
if (confirmModal === MODAL_CONFIRMED) {
const saved = await this.saveCurrentWorkflow();
if (saved) await this.settingsStore.fetchPromptsData();
} else if (confirmModal === MODAL_CLOSE) {
@@ -2531,7 +2515,7 @@ export default mixins(
try {
workflow = await this.workflowsStore.fetchWorkflow(workflowId);
} catch (error) {
this.showError(error, this.$locale.baseText('openWorkflow.workflowNotFoundError'));
this.$showError(error, this.$locale.baseText('openWorkflow.workflowNotFoundError'));
void this.$router.push({
name: VIEWS.NEW_WORKFLOW,
@@ -3015,7 +2999,7 @@ export default mixins(
},
async renameNodePrompt(currentName: string) {
try {
const promptResponsePromise = this.prompt(
const promptResponsePromise = this.$prompt(
this.$locale.baseText('nodeView.prompt.newName') + ':',
this.$locale.baseText('nodeView.prompt.renameNode') + `: ${currentName}`,
{
@@ -3573,7 +3557,7 @@ export default mixins(
'*',
);
}
this.showMessage({
this.$showMessage({
title: this.$locale.baseText('openWorkflow.workflowImportError'),
message: (e as Error).message,
type: 'error',
@@ -3597,7 +3581,7 @@ export default mixins(
'*',
);
}
this.showMessage({
this.$showMessage({
title: this.$locale.baseText('nodeView.showError.openExecution.title'),
message: (e as Error).message,
type: 'error',
@@ -3796,7 +3780,7 @@ export default mixins(
try {
await Promise.all(loadPromises);
} catch (error) {
this.showError(
this.$showError(
error,
this.$locale.baseText('nodeView.showError.mounted1.title'),
this.$locale.baseText('nodeView.showError.mounted1.message') + ':',
@@ -3816,7 +3800,7 @@ export default mixins(
);
}
} catch (error) {
this.showError(
this.$showError(
error,
this.$locale.baseText('nodeView.showError.mounted2.title'),
this.$locale.baseText('nodeView.showError.mounted2.message') + ':',
@@ -3847,7 +3831,7 @@ export default mixins(
if (onboardingResponse.title && onboardingResponse.description) {
setTimeout(async () => {
this.showToast({
this.$showToast({
type: 'info',
title: onboardingResponse.title,
message: onboardingResponse.description,