mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-10-13 00:44:55 +08:00
change router.push -> window.location to scope wf stores to new id
This commit is contained in:
@@ -12,7 +12,7 @@
|
||||
:state="!nameCurrent ? false : null"
|
||||
@keyup="$emit('update:nameCurrent', nameCurrent)" />
|
||||
</div>
|
||||
<div id="workflow-version-area" class="mt-2">
|
||||
<div v-if="versionCurrent !== null" id="workflow-version-area" class="mt-2">
|
||||
<b>Version</b>
|
||||
<b-form-select v-model="versionCurrent" @change="onVersion">
|
||||
<b-form-select-option v-for="v in versionOptions" :key="v.version" :value="v.version">
|
||||
|
||||
@@ -176,7 +176,6 @@ import { provideScopedWorkflowStores } from "@/composables/workflowStores";
|
||||
import { hide_modal } from "@/layout/modal";
|
||||
import { getAppRoot } from "@/onload/loadConfig";
|
||||
import { LastQueue } from "@/utils/promise-queue";
|
||||
import { withPrefix } from "@/utils/redirect";
|
||||
|
||||
import { defaultPosition } from "./composables/useDefaultStepPosition";
|
||||
import { fromSimple, toSimple } from "./modules/model";
|
||||
@@ -219,7 +218,7 @@ export default {
|
||||
},
|
||||
initialVersion: {
|
||||
type: Number,
|
||||
default: 0,
|
||||
default: undefined,
|
||||
},
|
||||
workflowTags: {
|
||||
type: Array,
|
||||
@@ -350,7 +349,7 @@ export default {
|
||||
},
|
||||
watch: {
|
||||
id(newId, oldId) {
|
||||
if (oldId && !this.isNewTempWorkflow) {
|
||||
if (oldId) {
|
||||
this._loadCurrent(newId);
|
||||
}
|
||||
},
|
||||
@@ -370,9 +369,7 @@ export default {
|
||||
},
|
||||
created() {
|
||||
this.lastQueue = new LastQueue();
|
||||
if (!this.isNewTempWorkflow) {
|
||||
this._loadCurrent(this.id, this.version);
|
||||
}
|
||||
this._loadCurrent(this.id, this.version);
|
||||
hide_modal();
|
||||
},
|
||||
methods: {
|
||||
@@ -521,9 +518,9 @@ export default {
|
||||
onDownload() {
|
||||
window.location = `${getAppRoot()}api/workflows/${this.id}/download?format=json-download`;
|
||||
},
|
||||
doSaveAs() {
|
||||
const rename_name = this.saveAsName ?? `SavedAs_${this.name}`;
|
||||
const rename_annotation = this.saveAsAnnotation ?? "";
|
||||
doSaveAs(create = false) {
|
||||
const rename_name = this.saveAsName ?? create ? this.name : `SavedAs_${this.name}`;
|
||||
const rename_annotation = this.saveAsAnnotation ?? create ? this.annotation : "";
|
||||
|
||||
// This is an old web controller endpoint that wants form data posted...
|
||||
const formData = new FormData();
|
||||
@@ -537,7 +534,11 @@ export default {
|
||||
.then((response) => {
|
||||
this.onWorkflowMessage("Workflow saved as", "success");
|
||||
this.hideModal();
|
||||
this.onNavigate(`${getAppRoot()}workflows/edit?id=${response.data}`, true);
|
||||
if (create) {
|
||||
window.location = `${getAppRoot()}workflows/edit?id=${response.data}`;
|
||||
} else {
|
||||
this.onNavigate(`${getAppRoot()}workflows/edit?id=${response.data}`);
|
||||
}
|
||||
})
|
||||
.catch((response) => {
|
||||
this.onWorkflowError("Saving workflow failed, please contact an administrator.");
|
||||
@@ -566,7 +567,7 @@ export default {
|
||||
const step = { ...this.steps[nodeId], annotation: newAnnotation };
|
||||
this.onUpdateStep(step);
|
||||
},
|
||||
async onCreate() {
|
||||
onCreate() {
|
||||
if (!this.name) {
|
||||
const response = "Please provide a name for your workflow.";
|
||||
this.onWorkflowError("Creating workflow failed", response, {
|
||||
@@ -577,27 +578,8 @@ export default {
|
||||
this.onAttributes();
|
||||
return;
|
||||
}
|
||||
const payload = {
|
||||
workflow_name: this.name,
|
||||
workflow_annotation: this.annotation || "",
|
||||
};
|
||||
|
||||
try {
|
||||
const { data } = await axios.put(withPrefix("/workflow/create"), payload);
|
||||
const { id, message } = data;
|
||||
this.id = id;
|
||||
this.onWorkflowMessage("Success", message);
|
||||
const editUrl = `/workflows/edit?id=${id}`;
|
||||
this.onNavigate(editUrl);
|
||||
} catch (e) {
|
||||
this.onWorkflowError("Creating workflow failed"),
|
||||
e,
|
||||
{
|
||||
Ok: () => {
|
||||
this.hideModal();
|
||||
},
|
||||
};
|
||||
}
|
||||
this.hasChanges = false;
|
||||
this.doSaveAs(true);
|
||||
},
|
||||
onSetData(stepId, newData) {
|
||||
this.lastQueue
|
||||
@@ -745,17 +727,19 @@ export default {
|
||||
this.hasChanges = has_changes;
|
||||
},
|
||||
_loadCurrent(id, version) {
|
||||
this.resetStores();
|
||||
this.onWorkflowMessage("Loading workflow...", "progress");
|
||||
this.lastQueue
|
||||
.enqueue(loadWorkflow, { id, version })
|
||||
.then((data) => {
|
||||
fromSimple(id, data);
|
||||
this._loadEditorData(data);
|
||||
})
|
||||
.catch((response) => {
|
||||
this.onWorkflowError("Loading workflow failed...", response);
|
||||
});
|
||||
if (!this.isNewTempWorkflow) {
|
||||
this.resetStores();
|
||||
this.onWorkflowMessage("Loading workflow...", "progress");
|
||||
this.lastQueue
|
||||
.enqueue(loadWorkflow, { id, version })
|
||||
.then((data) => {
|
||||
fromSimple(id, data);
|
||||
this._loadEditorData(data);
|
||||
})
|
||||
.catch((response) => {
|
||||
this.onWorkflowError("Loading workflow failed...", response);
|
||||
});
|
||||
}
|
||||
},
|
||||
onTags(tags) {
|
||||
if (this.tags != tags) {
|
||||
|
||||
@@ -10,6 +10,7 @@ interface Workflow {
|
||||
report: any;
|
||||
steps: Steps;
|
||||
comments: WorkflowComment[];
|
||||
tags: string[];
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -80,6 +81,7 @@ export function toSimple(id: string, workflow: Workflow): Omit<Workflow, "versio
|
||||
const creator = workflow.creator;
|
||||
const annotation = workflow.annotation;
|
||||
const name = workflow.name;
|
||||
const tags = workflow.tags;
|
||||
|
||||
const commentStore = useWorkflowCommentStore(id);
|
||||
commentStore.resolveCommentsInFrames();
|
||||
@@ -87,5 +89,5 @@ export function toSimple(id: string, workflow: Workflow): Omit<Workflow, "versio
|
||||
|
||||
const comments = workflow.comments.filter((comment) => !(comment.type === "text" && comment.data.text === ""));
|
||||
|
||||
return { steps, report, license, creator, annotation, name, comments };
|
||||
return { steps, report, license, creator, annotation, name, comments, tags };
|
||||
}
|
||||
|
||||
@@ -54,11 +54,7 @@ export async function loadWorkflow({ id, version = null }) {
|
||||
export async function saveWorkflow(workflow) {
|
||||
if (workflow.hasChanges) {
|
||||
try {
|
||||
const requestData = {
|
||||
workflow: toSimple(workflow.id, workflow),
|
||||
from_tool_form: true,
|
||||
tags: workflow.tags,
|
||||
};
|
||||
const requestData = { workflow: toSimple(workflow.id, workflow), from_tool_form: true };
|
||||
const { data } = await axios.put(`${getAppRoot()}api/workflows/${workflow.id}`, requestData);
|
||||
workflow.name = data.name;
|
||||
workflow.hasChanges = false;
|
||||
|
||||
@@ -687,6 +687,16 @@ class WorkflowContentsManager(UsesAnnotations):
|
||||
stored_workflow.latest_workflow = workflow
|
||||
workflow.stored_workflow = stored_workflow
|
||||
|
||||
data = raw_workflow_description.as_dict
|
||||
if isinstance(data, str):
|
||||
data = json.loads(data)
|
||||
if "tags" in data:
|
||||
trans.tag_handler.set_tags_from_list(
|
||||
trans.user,
|
||||
stored_workflow,
|
||||
data.get("tags", []),
|
||||
)
|
||||
|
||||
if workflow_update_options.update_stored_workflow_attributes:
|
||||
update_dict = raw_workflow_description.as_dict
|
||||
if "name" in update_dict:
|
||||
|
||||
Reference in New Issue
Block a user