mirror of
https://github.com/n8n-io/n8n.git
synced 2025-03-05 20:50:17 -08:00
⚡ Open new window when duplicating (#2237)
* update duplicate to open in new window * remove active action
This commit is contained in:
parent
857426a918
commit
1341958aae
|
@ -115,7 +115,7 @@ export default mixins(showMessage, workflowHelpers).extend({
|
|||
|
||||
this.$data.isSaving = true;
|
||||
|
||||
const saved = await this.saveAsNewWorkflow({name, tags: this.currentTagIds, resetWebhookUrls: true});
|
||||
const saved = await this.saveAsNewWorkflow({name, tags: this.currentTagIds, resetWebhookUrls: true, openInNewWindow: true});
|
||||
|
||||
if (saved) {
|
||||
this.closeDialog();
|
||||
|
|
|
@ -491,7 +491,7 @@ export const workflowHelpers = mixins(
|
|||
}
|
||||
},
|
||||
|
||||
async saveAsNewWorkflow ({name, tags, resetWebhookUrls}: {name?: string, tags?: string[], resetWebhookUrls?: boolean} = {}): Promise<boolean> {
|
||||
async saveAsNewWorkflow ({name, tags, resetWebhookUrls, openInNewWindow}: {name?: string, tags?: string[], resetWebhookUrls?: boolean, openInNewWindow?: boolean} = {}): Promise<boolean> {
|
||||
try {
|
||||
this.$store.commit('addActiveAction', 'workflowSaving');
|
||||
|
||||
|
@ -517,6 +517,12 @@ export const workflowHelpers = mixins(
|
|||
workflowDataRequest.tags = tags;
|
||||
}
|
||||
const workflowData = await this.restApi().createNewWorkflow(workflowDataRequest);
|
||||
if (openInNewWindow) {
|
||||
const routeData = this.$router.resolve({name: 'NodeViewExisting', params: {name: workflowData.id}});
|
||||
window.open(routeData.href, '_blank');
|
||||
this.$store.commit('removeActiveAction', 'workflowSaving');
|
||||
return true;
|
||||
}
|
||||
|
||||
this.$store.commit('setActive', workflowData.active || false);
|
||||
this.$store.commit('setWorkflowId', workflowData.id);
|
||||
|
|
Loading…
Reference in a new issue