Skip to content

Commit

Permalink
Merge branch 'release_23.2' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
mvdbeek committed Dec 23, 2023
2 parents a735ec2 + 4fa0403 commit e132895
Show file tree
Hide file tree
Showing 8 changed files with 43 additions and 16 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 @@ -6809,7 +6809,7 @@ export interface components {
* Value
* @description The values of the job parameter
*/
value: Record<string, never>;
value?: Record<string, never>;
};
/**
* JobSourceType
Expand Down
5 changes: 4 additions & 1 deletion client/src/components/History/Index.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
<template>
<div v-if="currentUser && currentHistory" id="current-history-panel" class="d-flex flex-column history-index">
<div
v-if="currentUser && currentHistory"
id="current-history-panel"
class="d-flex flex-column history-index overflow-auto">
<HistoryPanel
v-if="!breadcrumbs.length"
:list-offset="listOffset"
Expand Down
13 changes: 13 additions & 0 deletions client/src/components/Panels/Menus/PanelViewMenu.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
<template>
<b-button
v-if="showAdvanced"
variant="link"
class="w-100"
size="sm"
@click="$emit('update:show-advanced', !showAdvanced)">
<slot name="panel-view-selector"></slot><span class="sr-only">Close advanced tool search menu</span>
</b-button>
<b-dropdown
v-else
v-b-tooltip.hover.top.noninteractive
right
block
Expand Down Expand Up @@ -59,6 +68,10 @@ export default {
currentPanelView: {
type: String,
},
showAdvanced: {
type: Boolean,
default: false,
},
storeLoading: {
type: Boolean,
default: false,
Expand Down
1 change: 1 addition & 0 deletions client/src/components/Panels/ToolPanel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ function onInsertWorkflowSteps(workflowId: string, workflowStepCount: number | u
v-if="panelViews && Object.keys(panelViews).length > 1"
:panel-views="panelViews"
:current-panel-view="currentPanelView"
:show-advanced.sync="showAdvanced"
:store-loading="loading"
@updatePanelView="updatePanelView">
<template v-slot:panel-view-selector>
Expand Down
2 changes: 1 addition & 1 deletion client/src/components/SingleItemSelector.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<Multiselect
v-if="items"
v-model="selectedItem"
deselect-label="Can't remove this value"
:deselect-label="null"
track-by="id"
label="text"
:options="items"
Expand Down
32 changes: 21 additions & 11 deletions lib/galaxy/datatypes/display_applications/parameters.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
# Contains parameters that are used in Display Applications
import mimetypes
from dataclasses import dataclass
from typing import Optional
from urllib.parse import quote_plus

from galaxy.model.base import transaction
from galaxy.schema.schema import DatasetState
from galaxy.util import string_as_bool
from galaxy.util.bunch import Bunch
from galaxy.util.template import fill_template

DEFAULT_DATASET_NAME = "dataset"
Expand Down Expand Up @@ -57,6 +58,13 @@ def build_url(self, other_values):
return fill_template(self.url, context=other_values)


@dataclass
class DatasetLikeObject:
file_name: str
state: DatasetState
extension: str


class DisplayApplicationDataParameter(DisplayApplicationParameter):
"""Parameter that returns a file_name containing the requested content"""

Expand Down Expand Up @@ -95,27 +103,29 @@ def formats(self):
)
return None

def _get_dataset_like_object(self, other_values):
def _get_dataset_like_object(self, other_values) -> Optional[DatasetLikeObject]:
# this returned object has file_name, state, and states attributes equivalent to a DatasetAssociation
data = other_values.get(self.dataset, None)
assert data, "Base dataset could not be found in values provided to DisplayApplicationDataParameter"
if isinstance(data, DisplayDataValueWrapper):
data = data.value
if data.state != data.states.OK:
if data.state != DatasetState.OK:
return None
if self.metadata:
rval = getattr(data.metadata, self.metadata, None)
assert rval, f'Unknown metadata name "{self.metadata}" provided for dataset type "{data.ext}".'
return Bunch(file_name=rval.get_file_name(), state=data.state, states=data.states, extension="data")
elif self.extensions and (self.force_conversion or not isinstance(data.datatype, self.formats)):
return DatasetLikeObject(file_name=rval.get_file_name(), state=data.state, extension="data")
elif (
self.formats and self.extensions and (self.force_conversion or not isinstance(data.datatype, self.formats))
):
for ext in self.extensions:
rval = data.get_converted_files_by_type(ext)
if rval:
return rval
return DatasetLikeObject(file_name=rval.get_file_name(), state=rval.state, extension=rval.extension)
direct_match, target_ext, _ = data.find_conversion_destination(self.formats)
assert direct_match or target_ext is not None, f"No conversion path found for data param: {self.name}"
return None
return data
return DatasetLikeObject(file_name=data.get_file_name(), state=data.state, extension=data.extension)

def get_value(self, other_values, dataset_hash, user_hash, trans):
if data := self._get_dataset_like_object(other_values):
Expand Down Expand Up @@ -153,21 +163,21 @@ def prepare(self, other_values, dataset_hash, user_hash, trans):
trans.sa_session.add(assoc)
with transaction(trans.sa_session):
trans.sa_session.commit()
elif converted_dataset and converted_dataset.state == converted_dataset.states.ERROR:
elif converted_dataset and converted_dataset.state == DatasetState.ERROR:
raise Exception(f"Dataset conversion failed for data parameter: {self.name}")
return self.get_value(other_values, dataset_hash, user_hash, trans)

def is_preparing(self, other_values):
value = self._get_dataset_like_object(other_values)
if value and value.state in (value.states.NEW, value.states.UPLOAD, value.states.QUEUED, value.states.RUNNING):
if value and value.state in (DatasetState.NEW, DatasetState.UPLOAD, DatasetState.QUEUED, DatasetState.RUNNING):
return True
return False

def ready(self, other_values):
if value := self._get_dataset_like_object(other_values):
if value.state == value.states.OK:
if value.state == DatasetState.OK:
return True
elif value.state == value.states.ERROR:
elif value.state == DatasetState.ERROR:
raise Exception(f"A data display parameter is in the error state: {self.name}")
return False

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 @@ -225,7 +225,7 @@ class JobParameter(Model):
title="Depth",
description="The depth of the job parameter.",
)
value: Any = Field(default=Required, title="Value", description="The values of the job parameter")
value: Optional[Any] = Field(default=None, title="Value", description="The values of the job parameter")
notes: Optional[str] = Field(default=None, title="Notes", description="Notes associated with the job parameter.")


Expand Down
2 changes: 1 addition & 1 deletion lib/galaxy/webapps/galaxy/controllers/dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -673,7 +673,7 @@ def display_application(
), f"Extra file content requested ({action_param_extra}), but allow_extra_files_access is False."
file_name = os.path.join(value.extra_files_path, action_param_extra)
else:
file_name = value.get_file_name()
file_name = value.file_name
content_length = os.path.getsize(file_name)
rval = open(file_name, "rb")
except OSError as e:
Expand Down

0 comments on commit e132895

Please sign in to comment.