Skip to content

Commit

Permalink
Merge pull request #18754 from mvdbeek/fix_job_summary_optional_input
Browse files Browse the repository at this point in the history
[24.1] Fix job summary for optional unset job data inputs
  • Loading branch information
jmchilton authored Aug 31, 2024
2 parents f39f5ab + f1dddfb commit 63a8957
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 8 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 @@ -9132,7 +9132,7 @@ export interface components {
* @description The values of the job parameter
*/
value?:
| components["schemas"]["EncodedJobParameterHistoryItem"][]
| (components["schemas"]["EncodedJobParameterHistoryItem"] | null)[]
| number
| number
| boolean
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
<template>
<div>
<div v-for="(elVal, pvIndex) in parameter_value" :key="pvIndex">
<span v-if="elVal === null">No input provided</span>
<GenericHistoryItem
v-if="['hda', 'hdca', 'dce'].includes(elVal.src)"
v-else-if="['hda', 'hdca', 'dce'].includes(elVal.src)"
:item-id="elVal.id"
:item-src="elVal.src" />
<span v-else> {{ elVal.hid }}: {{ elVal.name }} </span>
Expand Down
13 changes: 8 additions & 5 deletions lib/galaxy/managers/jobs.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@
datetime,
)
from typing import (
Any,
cast,
Dict,
List,
Optional,
Union,
)

import sqlalchemy
Expand Down Expand Up @@ -989,16 +991,17 @@ def inputs_recursive(input_params, param_values, depth=1, upgrade_messages=None)
or input.type == "data_collection"
or isinstance(input_value, model.HistoryDatasetAssociation)
):
value = []
value: List[Union[Dict[str, Any], None]] = []
for element in listify(input_value):
element_id = element.id
if isinstance(element, model.HistoryDatasetAssociation):
hda = element
value.append({"src": "hda", "id": element_id, "hid": hda.hid, "name": hda.name})
value.append({"src": "hda", "id": element.id, "hid": hda.hid, "name": hda.name})
elif isinstance(element, model.DatasetCollectionElement):
value.append({"src": "dce", "id": element_id, "name": element.element_identifier})
value.append({"src": "dce", "id": element.id, "name": element.element_identifier})
elif isinstance(element, model.HistoryDatasetCollectionAssociation):
value.append({"src": "hdca", "id": element_id, "hid": element.hid, "name": element.name})
value.append({"src": "hdca", "id": element.id, "hid": element.hid, "name": element.name})
elif element is None:
value.append(None)
else:
raise Exception(
f"Unhandled data input parameter type encountered {element.__class__.__name__}"
Expand Down
2 changes: 1 addition & 1 deletion lib/galaxy/schema/jobs.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ class JobParameter(Model):
title="Depth",
description="The depth of the job parameter.",
)
value: Optional[Union[List[EncodedJobParameterHistoryItem], float, int, bool, str]] = Field(
value: Optional[Union[List[Optional[EncodedJobParameterHistoryItem]], float, int, bool, str]] = Field(
default=None, title="Value", description="The values of the job parameter", union_mode="left_to_right"
)
notes: Optional[str] = Field(default=None, title="Notes", description="Notes associated with the job parameter.")
Expand Down

0 comments on commit 63a8957

Please sign in to comment.