Skip to content

Commit 4cf80af

Browse files
committed
Fix invocation step view with custom tools
1 parent 612d9fd commit 4cf80af

File tree

10 files changed

+57
-13
lines changed

10 files changed

+57
-13
lines changed

client/src/api/schema/schema.ts

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14066,6 +14066,11 @@ export interface components {
1406614066
* @description TODO
1406714067
*/
1406814068
tool_inputs?: unknown;
14069+
/**
14070+
* Tool UUID
14071+
* @description The universal unique identifier of the tool associated with this step. Takes precedence over tool_id if set.
14072+
*/
14073+
tool_uuid?: string | null;
1406914074
/**
1407014075
* Tool Version
1407114076
* @description The version of the tool associated with this step.
@@ -14108,6 +14113,11 @@ export interface components {
1410814113
* @description TODO
1410914114
*/
1411014115
tool_inputs?: unknown;
14116+
/**
14117+
* Tool UUID
14118+
* @description The universal unique identifier of the tool associated with this step. Takes precedence over tool_id if set.
14119+
*/
14120+
tool_uuid?: string | null;
1411114121
/**
1411214122
* Tool Version
1411314123
* @description The version of the tool associated with this step.
@@ -14150,6 +14160,11 @@ export interface components {
1415014160
* @description TODO
1415114161
*/
1415214162
tool_inputs?: unknown;
14163+
/**
14164+
* Tool UUID
14165+
* @description The universal unique identifier of the tool associated with this step. Takes precedence over tool_id if set.
14166+
*/
14167+
tool_uuid?: string | null;
1415314168
/**
1415414169
* Tool Version
1415514170
* @description The version of the tool associated with this step.
@@ -18106,6 +18121,11 @@ export interface components {
1810618121
* @description TODO
1810718122
*/
1810818123
tool_inputs?: unknown;
18124+
/**
18125+
* Tool UUID
18126+
* @description The universal unique identifier of the tool associated with this step. Takes precedence over tool_id if set.
18127+
*/
18128+
tool_uuid?: string | null;
1810918129
/**
1811018130
* Tool Version
1811118131
* @description The version of the tool associated with this step.
@@ -20203,6 +20223,11 @@ export interface components {
2020320223
* @description TODO
2020420224
*/
2020520225
tool_inputs?: unknown;
20226+
/**
20227+
* Tool UUID
20228+
* @description The universal unique identifier of the tool associated with this step. Takes precedence over tool_id if set.
20229+
*/
20230+
tool_uuid?: string | null;
2020620231
/**
2020720232
* Tool Version
2020820233
* @description The version of the tool associated with this step.
@@ -20732,6 +20757,11 @@ export interface components {
2073220757
* @description TODO
2073320758
*/
2073420759
tool_inputs?: unknown;
20760+
/**
20761+
* Tool UUID
20762+
* @description The universal unique identifier of the tool associated with this step. Takes precedence over tool_id if set.
20763+
*/
20764+
tool_uuid?: string | null;
2073520765
/**
2073620766
* Tool Version
2073720767
* @description The version of the tool associated with this step.

client/src/components/Markdown/Sections/Elements/Workflow/WorkflowDisplay.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@ watch(
125125
:tool-version="step.tool_version" />
126126
<WorkflowStepTitle
127127
:step-tool-id="step.tool_id"
128+
:step-tool-uuid="step.tool_uuid"
128129
:step-subworkflow-id="step.subworkflow_id"
129130
:step-label="step.label"
130131
:step-type="step.type"

client/src/components/WorkflowInvocationState/WorkflowInvocationError.vue

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ function openJobInNewTab(jobId: string) {
114114
"
115115
:step-type="dependentWorkflowStep.type"
116116
:step-tool-id="dependentWorkflowStep.tool_id"
117+
:step-tool-uuid="dependentWorkflowStep.tool_uuid"
117118
:step-subworkflow-id="
118119
'workflow_id' in dependentWorkflowStep ? dependentWorkflowStep.workflow_id : null
119120
" />
@@ -132,6 +133,7 @@ function openJobInNewTab(jobId: string) {
132133
:step-label="invocationStep?.workflow_step_label || `Step ${workflowStep.id + 1}`"
133134
:step-type="workflowStep.type"
134135
:step-tool-id="workflowStep.tool_id"
136+
:step-tool-uuid="workflowStep.tool_uuid"
135137
:step-subworkflow-id="'workflow_id' in workflowStep ? workflowStep.workflow_id : null" />
136138
</strong>
137139
</GCard>

client/src/components/WorkflowInvocationState/WorkflowInvocationStep.vue

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,8 +173,9 @@ export default {
173173
...mapActions(useWorkflowStore, ["fetchWorkflowForInstanceId"]),
174174
...mapActions(useToolStore, ["fetchToolForId"]),
175175
fetchTool() {
176-
if (this.workflowStep.tool_id && !this.getToolForId(this.workflowStep.tool_id)) {
177-
this.fetchToolForId(this.workflowStep.tool_id);
176+
const toolId = this.workflowStep.tool_uuid || this.workflowStep.tool_id;
177+
if (toolId && !this.getToolForId(toolId)) {
178+
this.fetchToolForId(toolId);
178179
}
179180
},
180181
fetchSubworkflow() {
@@ -206,6 +207,7 @@ export default {
206207
stepLabel: invocationStep && invocationStep.workflow_step_label,
207208
stepType: this.workflowStep.type,
208209
stepToolId: this.workflowStep.tool_id,
210+
stepToolUuid: this.workflowStep.tool_uuid,
209211
stepSubworkflowId: this.workflowStep.workflow_id,
210212
};
211213
return rval;

client/src/components/WorkflowInvocationState/WorkflowInvocationStepHeader.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ const stepLabel = computed(() => {
5151
:step-label="stepLabel"
5252
:step-type="props.workflowStep.type"
5353
:step-tool-id="props.workflowStep.tool_id"
54+
:step-tool-uuid="props.workflowStep.tool_uuid"
5455
:step-subworkflow-id="props.workflowStep.workflow_id" />
5556
</u>
5657
</span>

client/src/components/WorkflowInvocationState/WorkflowStepTitle.vue

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ interface WorkflowInvocationStepTitleProps {
1212
stepLabel?: string;
1313
stepType: string;
1414
stepToolId?: string | null;
15+
stepToolUuid?: string | null;
1516
stepSubworkflowId?: string | null;
1617
}
1718
@@ -27,8 +28,9 @@ const subWorkflow = computed(() => {
2728
return null;
2829
});
2930
const toolName = computed(() => {
30-
if (props.stepToolId) {
31-
return toolStore.getToolNameById(props.stepToolId);
31+
const toolId = props.stepToolUuid || props.stepToolId;
32+
if (toolId) {
33+
return toolStore.getToolNameById(toolId);
3234
}
3335
return "";
3436
});
@@ -60,8 +62,9 @@ const title = computed(() => {
6062
const hoverError = ref("");
6163
6264
async function initStores() {
63-
if (props.stepToolId && !toolStore.getToolForId(props.stepToolId)) {
64-
toolStore.fetchToolForId(props.stepToolId);
65+
const toolId = props.stepToolUuid || props.stepToolId;
66+
if (toolId && !toolStore.getToolForId(toolId)) {
67+
toolStore.fetchToolForId(toolId);
6568
}
6669
6770
if (props.stepSubworkflowId) {

lib/galaxy/managers/workflows.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1559,6 +1559,7 @@ def _workflow_to_dict_export(self, trans, stored=None, workflow=None, internal=F
15591559
}
15601560
if step.type == "tool":
15611561
step_dict["tool_id"] = content_id if allow_upgrade else step.tool_id
1562+
step_dict["tool_uuid"] = step.tool_uuid
15621563
# Add tool shed repository information and post-job actions to step dict.
15631564
if isinstance(module, ToolModule):
15641565
if module.tool and module.tool.tool_shed:
@@ -1743,6 +1744,7 @@ def _workflow_to_dict_instance(self, trans, stored, workflow, legacy=True):
17431744
"id": step_id,
17441745
"type": step_type,
17451746
"tool_id": step.tool_id,
1747+
"tool_uuid": step.tool_uuid,
17461748
"tool_version": step.tool_version,
17471749
"annotation": self.get_item_annotation_str(sa_session, stored.user, step),
17481750
"tool_inputs": step.tool_inputs,

lib/galaxy/schema/schema.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2500,6 +2500,11 @@ class WorkflowStepBase(Model):
25002500
tool_id: Optional[str] = Field(
25012501
None, title="Tool ID", description="The unique name of the tool associated with this step."
25022502
)
2503+
tool_uuid: Optional[UUID4] = Field(
2504+
None,
2505+
title="Tool UUID",
2506+
description="The universal unique identifier of the tool associated with this step. Takes precedence over tool_id if set.",
2507+
)
25032508
tool_version: Optional[str] = Field(
25042509
None, title="Tool Version", description="The version of the tool associated with this step."
25052510
)

lib/galaxy/tool_util/toolbox/base.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -734,11 +734,9 @@ def get_tool(
734734
user: Optional["User"] = None,
735735
) -> Union[Optional["Tool"], List["Tool"]]:
736736
"""Attempt to locate a tool in the tool box. Note that `exact` only refers to the `tool_id`, not the `tool_version`."""
737-
if tool_id is None:
738-
if tool_uuid is None:
739-
raise RequestParameterInvalidException(
740-
"get_tool cannot be called with both tool_id and tool_uuid as None"
741-
)
737+
if tool_id is None and tool_uuid is None:
738+
raise RequestParameterInvalidException("get_tool cannot be called with both tool_id and tool_uuid as None")
739+
elif tool_uuid:
742740
if user:
743741
unprivileged_tool = self.get_unprivileged_tool_or_none(user, tool_uuid=tool_uuid)
744742
if unprivileged_tool:
@@ -748,7 +746,7 @@ def get_tool(
748746
if tool_from_uuid is None:
749747
raise ObjectNotFound(f"Failed to find a tool with uuid [{tool_uuid}]")
750748
tool_id = tool_from_uuid.id
751-
assert tool_id
749+
assert tool_id
752750

753751
if tool_version:
754752
tool_version = str(tool_version)

lib/galaxy/webapps/galaxy/api/tools.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,7 @@ def show(self, trans: GalaxyWebTransaction, id, **kwd):
415415
io_details = util.string_as_bool(kwd.get("io_details", False))
416416
link_details = util.string_as_bool(kwd.get("link_details", False))
417417
tool_version = kwd.get("tool_version")
418-
tool = self.service._get_tool(trans, id, user=trans.user, tool_version=tool_version)
418+
tool = self.service._get_tool(trans, id, user=trans.user, tool_version=tool_version, tool_uuid=id)
419419
return tool.to_dict(trans, io_details=io_details, link_details=link_details)
420420

421421
@expose_api_anonymous

0 commit comments

Comments
 (0)