From 4fac7daae31c70050276d06876188fcbb62150dc Mon Sep 17 00:00:00 2001 From: Laila Los <44241786+ElectronicBlueberry@users.noreply.github.com> Date: Thu, 19 Dec 2024 13:40:27 +0100 Subject: [PATCH 1/4] fix stepIdOffset handling --- client/src/components/Workflow/Editor/modules/model.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/client/src/components/Workflow/Editor/modules/model.ts b/client/src/components/Workflow/Editor/modules/model.ts index f4ad5da41dba..20500f71fa39 100644 --- a/client/src/components/Workflow/Editor/modules/model.ts +++ b/client/src/components/Workflow/Editor/modules/model.ts @@ -48,9 +48,15 @@ export async function fromSimple( // If workflow being copied into another, wipe UUID and let // Galaxy assign new ones. if (options?.reassignIds ?? appendData) { - const stepIdOffset = stepStore.getStepIndex + 1; + const highestStepId = stepStore.getStepIndex; - Object.values(data.steps).forEach((step) => { + const stepArray = Object.values(data.steps); + const stepIds = Object.keys(data.steps).map((id) => parseInt(id)); + const lowestStepId = Math.min(...stepIds); + + const stepIdOffset = highestStepId - lowestStepId + 1; + + stepArray.forEach((step) => { delete step.uuid; if (!step.position) { // Should only happen for manually authored editor content, From 09fb715a664f0eb1f8c146fabada3f5f3de4e73f Mon Sep 17 00:00:00 2001 From: Laila Los <44241786+ElectronicBlueberry@users.noreply.github.com> Date: Thu, 19 Dec 2024 14:22:08 +0100 Subject: [PATCH 2/4] fix link assignment --- .../Workflow/Editor/modules/model.ts | 47 +++++++++++++++---- 1 file changed, 37 insertions(+), 10 deletions(-) diff --git a/client/src/components/Workflow/Editor/modules/model.ts b/client/src/components/Workflow/Editor/modules/model.ts index 20500f71fa39..0ea90f078a03 100644 --- a/client/src/components/Workflow/Editor/modules/model.ts +++ b/client/src/components/Workflow/Editor/modules/model.ts @@ -2,7 +2,12 @@ import reportDefault from "@/components/Workflow/Editor/reportDefault"; import { useWorkflowCommentStore, type WorkflowComment } from "@/stores/workflowEditorCommentStore"; import { useWorkflowStateStore } from "@/stores/workflowEditorStateStore"; import { useWorkflowEditorToolbarStore } from "@/stores/workflowEditorToolbarStore"; -import { type ConnectionOutputLink, type Steps, useWorkflowStepStore } from "@/stores/workflowStepStore"; +import { + type ConnectionOutputLink, + type StepInputConnection, + type Steps, + useWorkflowStepStore, +} from "@/stores/workflowStepStore"; export interface Workflow { name: string; @@ -48,13 +53,19 @@ export async function fromSimple( // If workflow being copied into another, wipe UUID and let // Galaxy assign new ones. if (options?.reassignIds ?? appendData) { - const highestStepId = stepStore.getStepIndex; - + const stepIdOffset = stepStore.getStepIndex + 1; const stepArray = Object.values(data.steps); - const stepIds = Object.keys(data.steps).map((id) => parseInt(id)); - const lowestStepId = Math.min(...stepIds); - const stepIdOffset = highestStepId - lowestStepId + 1; + // Since we are resigning IDs based on index, ensure correct ordering + stepArray.sort((a, b) => a.id - b.id); + + const stepIdMapOldToNew = new Map(); + + stepArray.forEach((step, index) => { + const oldId = step.id; + step.id = index + stepIdOffset; + stepIdMapOldToNew.set(oldId, step.id); + }); stepArray.forEach((step) => { delete step.uuid; @@ -63,10 +74,12 @@ export async function fromSimple( // good enough for a first pass IMO. step.position = { top: step.id * 100, left: step.id * 100 }; } - step.id += stepIdOffset; step.position.left += defaultPosition.left; step.position.top += defaultPosition.top; - Object.values(step.input_connections).forEach((link) => { + + const newInputConnections: StepInputConnection = {}; + + Object.entries(step.input_connections).forEach(([key, link]) => { if (link === undefined) { console.error("input connections invalid", step.input_connections); } else { @@ -76,11 +89,25 @@ export async function fromSimple( } else { linkArray = link; } - linkArray.forEach((link) => { - link.id += stepIdOffset; + + const remappedLinkArray = linkArray.map((link) => { + const newId = stepIdMapOldToNew.get(link.id); + + return { + ...link, + id: newId, + }; }); + + // id may be undefined, if the partial Workflow does not contain the step + // in that case, remove the link + const newLinkArray = remappedLinkArray.filter((link) => link.id) as ConnectionOutputLink[]; + + newInputConnections[key] = newLinkArray; } }); + + step.input_connections = newInputConnections; }); data.comments.forEach((comment, index) => { From 618e49077dbcb8a91b31a12e8d41e28a58ab0980 Mon Sep 17 00:00:00 2001 From: SantaMcCloud Date: Sat, 21 Dec 2024 00:07:00 +0100 Subject: [PATCH 3/4] add bcsp datatype --- lib/galaxy/config/sample/datatypes_conf.xml.sample | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/galaxy/config/sample/datatypes_conf.xml.sample b/lib/galaxy/config/sample/datatypes_conf.xml.sample index 0e026b5a7b0a..b017cae64134 100644 --- a/lib/galaxy/config/sample/datatypes_conf.xml.sample +++ b/lib/galaxy/config/sample/datatypes_conf.xml.sample @@ -1007,6 +1007,7 @@ +