Merge pull request #17330 from ElectronicBlueberry/fix-workflow-id-reactivity-23-2

[23.2] Fix Subworkflow Edit Button
This commit is contained in:
Martin Cech
2024-01-20 01:57:50 +01:00
committed by GitHub
2 changed files with 32 additions and 12 deletions
@@ -688,11 +688,15 @@ export default {
const runUrl = `/workflows/run?id=${this.id}`;
this.onNavigate(runUrl);
},
onNavigate(url) {
this.onSave(true).then(() => {
this.hasChanges = false;
this.$router.push(url);
});
async onNavigate(url) {
if (this.isNewTempWorkflow) {
await this.onCreate();
} else {
await this.onSave(true);
}
this.hasChanges = false;
this.$router.push(url);
},
onSave(hideProgress = false) {
if (!this.nameValidate()) {
@@ -1,6 +1,7 @@
<template>
<Editor
v-if="editorConfig"
:key="editorReloadKey"
:workflow-id="editorConfig.id"
:data-managers="editorConfig.dataManagers"
:initial-version="editorConfig.initialVersion"
@@ -23,6 +24,7 @@ export default {
storedWorkflowId: null,
workflowId: null,
editorConfig: null,
editorReloadKey: 0,
};
},
watch: {
@@ -35,15 +37,29 @@ export default {
},
methods: {
async getEditorConfig() {
const storedWorkflowId = Query.get("id");
const workflowId = Query.get("workflow_id");
const params = {};
if (workflowId) {
params.workflow_id = workflowId;
} else if (storedWorkflowId) {
params.id = storedWorkflowId;
let reloadEditor = true;
// this will only be the case the first time the route updates from a new workflow
if (!this.storedWorkflowId && !this.workflowId) {
reloadEditor = false;
}
this.storedWorkflowId = Query.get("id");
this.workflowId = Query.get("workflow_id");
const params = {};
if (this.workflowId) {
params.workflow_id = this.workflowId;
} else if (this.storedWorkflowId) {
params.id = this.storedWorkflowId;
}
this.editorConfig = await urlData({ url: "/workflow/editor", params });
if (reloadEditor) {
this.editorReloadKey += 1;
}
},
},
};