mirror of
https://github.com/n8n-io/n8n.git
synced 2025-02-21 02:56:40 -08:00
feat: Add duplicate workflow error handler (#4616)
* feat: Add duplicate workflow error handler * refactor: Change translation string for existing duplicate workflow error
This commit is contained in:
parent
b35172e442
commit
f7a9ef9116
|
@ -110,8 +110,8 @@ export default mixins(showMessage, workflowHelpers, restApi).extend({
|
||||||
const name = this.name.trim();
|
const name = this.name.trim();
|
||||||
if (!name) {
|
if (!name) {
|
||||||
this.$showMessage({
|
this.$showMessage({
|
||||||
title: this.$locale.baseText('duplicateWorkflowDialog.showMessage.title'),
|
title: this.$locale.baseText('duplicateWorkflowDialog.errors.missingName.title'),
|
||||||
message: this.$locale.baseText('duplicateWorkflowDialog.showMessage.message'),
|
message: this.$locale.baseText('duplicateWorkflowDialog.errors.missingName.message'),
|
||||||
type: "error",
|
type: "error",
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -122,6 +122,7 @@ export default mixins(showMessage, workflowHelpers, restApi).extend({
|
||||||
|
|
||||||
this.isSaving = true;
|
this.isSaving = true;
|
||||||
|
|
||||||
|
try {
|
||||||
let workflowToUpdate: IWorkflowDataUpdate | undefined;
|
let workflowToUpdate: IWorkflowDataUpdate | undefined;
|
||||||
if (currentWorkflowId !== PLACEHOLDER_EMPTY_WORKFLOW_ID) {
|
if (currentWorkflowId !== PLACEHOLDER_EMPTY_WORKFLOW_ID) {
|
||||||
const { createdAt, updatedAt, ...workflow } = await this.restApi().getWorkflow(this.data.id);
|
const { createdAt, updatedAt, ...workflow } = await this.restApi().getWorkflow(this.data.id);
|
||||||
|
@ -144,8 +145,23 @@ export default mixins(showMessage, workflowHelpers, restApi).extend({
|
||||||
workflow_id: this.data.id,
|
workflow_id: this.data.id,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
} catch (error) {
|
||||||
|
if (error.httpStatusCode === 403) {
|
||||||
|
error.message = this.$locale.baseText('duplicateWorkflowDialog.errors.forbidden.message');
|
||||||
|
|
||||||
|
this.$showError(
|
||||||
|
error,
|
||||||
|
this.$locale.baseText('duplicateWorkflowDialog.errors.forbidden.title'),
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
this.$showError(
|
||||||
|
error,
|
||||||
|
this.$locale.baseText('duplicateWorkflowDialog.errors.generic.title'),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
} finally {
|
||||||
this.isSaving = false;
|
this.isSaving = false;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
closeDialog(): void {
|
closeDialog(): void {
|
||||||
this.modalBus.$emit("close");
|
this.modalBus.$emit("close");
|
||||||
|
|
|
@ -375,8 +375,11 @@
|
||||||
"duplicateWorkflowDialog.duplicateWorkflow": "Duplicate Workflow",
|
"duplicateWorkflowDialog.duplicateWorkflow": "Duplicate Workflow",
|
||||||
"duplicateWorkflowDialog.enterWorkflowName": "Enter workflow name",
|
"duplicateWorkflowDialog.enterWorkflowName": "Enter workflow name",
|
||||||
"duplicateWorkflowDialog.save": "@:_reusableBaseText.save",
|
"duplicateWorkflowDialog.save": "@:_reusableBaseText.save",
|
||||||
"duplicateWorkflowDialog.showMessage.message": "Please enter a name.",
|
"duplicateWorkflowDialog.errors.missingName.title": "Name missing",
|
||||||
"duplicateWorkflowDialog.showMessage.title": "Name missing",
|
"duplicateWorkflowDialog.errors.missingName.message": "Please enter a name.",
|
||||||
|
"duplicateWorkflowDialog.errors.forbidden.title": "Duplicate workflow failed",
|
||||||
|
"duplicateWorkflowDialog.errors.forbidden.message": "This action is forbidden. Do you have the correct permissions?",
|
||||||
|
"duplicateWorkflowDialog.errors.generic.title": "Duplicate workflow failed",
|
||||||
"error": "Error",
|
"error": "Error",
|
||||||
"error.goBack": "Go back",
|
"error.goBack": "Go back",
|
||||||
"error.pageNotFound": "Oops, couldn’t find that",
|
"error.pageNotFound": "Oops, couldn’t find that",
|
||||||
|
|
Loading…
Reference in a new issue