mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-09-24 16:30:27 +08:00
scopePointerStore always checks for existing scope
This commit is contained in:
@@ -546,6 +546,12 @@ export default {
|
||||
const response = await axios.post(`${getAppRoot()}workflow/save_workflow_as`, formData);
|
||||
const newId = response.data;
|
||||
|
||||
if (!create) {
|
||||
this.name = rename_name;
|
||||
this.annotation = rename_annotation;
|
||||
}
|
||||
|
||||
this.hasChanges = false;
|
||||
await this.routeToWorkflow(newId);
|
||||
} catch (e) {
|
||||
this.onWorkflowError("Saving workflow failed, please contact an administrator.");
|
||||
@@ -575,18 +581,9 @@ export default {
|
||||
this.onUpdateStep(step);
|
||||
},
|
||||
async routeToWorkflow(id) {
|
||||
const { addScopePointer, scope } = useScopePointerStore();
|
||||
|
||||
let pointedTo;
|
||||
// the current workflow id might be pointing to existing stores
|
||||
const originalPointed = scope(this.id);
|
||||
if (originalPointed !== this.id) {
|
||||
pointedTo = originalPointed;
|
||||
} else {
|
||||
pointedTo = this.id;
|
||||
}
|
||||
// map scoped stores to existing stores, before updating the id
|
||||
addScopePointer(id, pointedTo);
|
||||
const { addScopePointer } = useScopePointerStore();
|
||||
addScopePointer(id, this.id);
|
||||
|
||||
this.id = id;
|
||||
await this.onSave();
|
||||
@@ -618,7 +615,6 @@ export default {
|
||||
await this.routeToWorkflow(id);
|
||||
} else {
|
||||
// otherwise, use `save_as` endpoint to include steps, etc.
|
||||
this.hasChanges = false;
|
||||
await this.doSaveAs(true);
|
||||
}
|
||||
} catch (e) {
|
||||
|
||||
@@ -11,7 +11,7 @@ export const useScopePointerStore = defineStore("scopePointerStore", () => {
|
||||
const scopePointers = ref<Record<FromScopeId, ToScopeId | undefined>>({});
|
||||
|
||||
function addScopePointer(from: FromScopeId, to: ToScopeId) {
|
||||
scopePointers.value[from] = to;
|
||||
scopePointers.value[from] = scope.value(to);
|
||||
}
|
||||
|
||||
const scope = computed(() => (scopeId: string) => scopePointers.value[scopeId] ?? scopeId);
|
||||
|
||||
Reference in New Issue
Block a user