Skip to content

Commit

Permalink
[24.1] Fix input_step_parameters missing vals without label
Browse files Browse the repository at this point in the history
`input_step_parameters` that did not have labels (label=None) were being excluded in the `WorkflowInvocation.to_dict()` result.

This therefore changes the `key` of the `input_step_parameters` from the `workflow_step.label` to the `workflow_step_id`, and allows for `null` labels.

Fixes galaxyproject#18366
  • Loading branch information
ahmedhamidawan committed Jun 14, 2024
1 parent f2de606 commit 854e3d8
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 12 deletions.
2 changes: 1 addition & 1 deletion client/src/api/schema/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7998,7 +7998,7 @@ export interface components {
* Label
* @description Label of the workflow step associated with the input parameter.
*/
label: string;
label?: string | null;
/**
* Parameter value
* @description Value of the input parameter.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<b-table small caption-top :fields="['label', 'parameter_value']" :items="parameters" />
<b-table small caption-top :fields="fields" :items="parameters" />
</template>
<script>
import BootstrapVue from "bootstrap-vue";
Expand All @@ -11,5 +11,10 @@ export default {
props: {
parameters: { type: Array, required: true },
},
computed: {
fields() {
return this.parameters.length > 1 ? ["label", "parameter_value"] : ["parameter_value"];
},
},
};
</script>
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
</details>
<ParameterStep
v-else-if="workflowStepType == 'parameter_input'"
:parameters="[invocation.input_step_parameters[stepDetails.workflow_step_label]]" />
:parameters="[invocation.input_step_parameters[stepDetails.workflow_step_id]]" />
<GenericHistoryItem
v-else-if="
isDataStep &&
Expand Down
13 changes: 7 additions & 6 deletions lib/galaxy/model/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8870,7 +8870,7 @@ def _serialize(self, id_encoder, serialization_options):
serialization_options.attach_identifier(id_encoder, self, invocation_attrs)
return invocation_attrs

def to_dict(self, view="collection", value_mapper=None, step_details=False, legacy_job_state=False):
def to_dict(self, view="collection", value_mapper=None, step_details=False, legacy_job_state=False, security=None):
rval = super().to_dict(view=view, value_mapper=value_mapper)
if rval["state"] is None:
# bugs could result in no state being set
Expand Down Expand Up @@ -8921,12 +8921,13 @@ def to_dict(self, view="collection", value_mapper=None, step_details=False, lega

input_parameters = {}
for input_step_parameter in self.input_step_parameters:
label = input_step_parameter.workflow_step.label
if not label:
continue
input_parameters[label] = {
if security:
step_id = security.encode_id(input_step_parameter.workflow_step_id)
else:
step_id = input_step_parameter.workflow_step_id
input_parameters[step_id] = {
"parameter_value": input_step_parameter.parameter_value,
"label": label,
"label": input_step_parameter.workflow_step.label,
"workflow_step_id": input_step_parameter.workflow_step_id,
}
rval["input_step_parameters"] = input_parameters
Expand Down
4 changes: 2 additions & 2 deletions lib/galaxy/schema/invocation.py
Original file line number Diff line number Diff line change
Expand Up @@ -490,8 +490,8 @@ class InvocationInput(InvocationIOBase):
class InvocationInputParameter(Model):
# TODO - Change the type of parameter_value, when all valid types are known
parameter_value: Any = Field(default=..., title="Parameter value", description="Value of the input parameter.")
label: str = Field(
default=..., title="Label", description="Label of the workflow step associated with the input parameter."
label: Optional[str] = Field(
default=None, title="Label", description="Label of the workflow step associated with the input parameter."
)
workflow_step_id: EncodedDatabaseIdField = Field(
default=...,
Expand Down
4 changes: 3 additions & 1 deletion lib/galaxy/webapps/galaxy/services/invocations.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,9 @@ def serialize_workflow_invocation(
view = params.view or default_view
step_details = params.step_details
legacy_job_state = params.legacy_job_state
as_dict = invocation.to_dict(view.value, step_details=step_details, legacy_job_state=legacy_job_state)
as_dict = invocation.to_dict(
view.value, step_details=step_details, legacy_job_state=legacy_job_state, security=self.security
)
as_dict["messages"] = invocation.messages
return WorkflowInvocationResponse(**as_dict)

Expand Down

0 comments on commit 854e3d8

Please sign in to comment.