diff --git a/lib/galaxy/model/__init__.py b/lib/galaxy/model/__init__.py index 66cbd175f7b..b3913fc12cb 100644 --- a/lib/galaxy/model/__init__.py +++ b/lib/galaxy/model/__init__.py @@ -1406,20 +1406,19 @@ class History( object, Dictifiable, UsesAnnotations, HasName ): return galaxy.util.nice_size( self.disk_size ) @property - def active_datasets_children_and_roles( self ): - if not hasattr(self, '_active_datasets_children_and_roles'): + def active_datasets_and_roles( self ): + if not hasattr(self, '_active_datasets_and_roles'): db_session = object_session( self ) query = ( db_session.query( HistoryDatasetAssociation ) .filter( HistoryDatasetAssociation.table.c.history_id == self.id ) .filter( not_( HistoryDatasetAssociation.deleted ) ) .order_by( HistoryDatasetAssociation.table.c.hid.asc() ) - .options( joinedload("children"), - joinedload("dataset"), + .options( joinedload("dataset"), joinedload("dataset.actions"), joinedload("dataset.actions.role"), )) - self._active_datasets_children_and_roles = query.all() - return self._active_datasets_children_and_roles + self._active_datasets_and_roles = query.all() + return self._active_datasets_and_roles @property def active_contents( self ): diff --git a/lib/galaxy/tools/parameters/basic.py b/lib/galaxy/tools/parameters/basic.py index 502af61f986..f7b4bb14589 100644 --- a/lib/galaxy/tools/parameters/basic.py +++ b/lib/galaxy/tools/parameters/basic.py @@ -1461,7 +1461,7 @@ class BaseDataToolParameter( ToolParameter ): if history is not None: dataset_matcher = DatasetMatcher( trans, self, None, other_values ) if isinstance( self, DataToolParameter ): - for hda in reversed( history.active_datasets_children_and_roles ): + for hda in reversed( history.active_datasets_and_roles ): match = dataset_matcher.hda_match( hda, check_security=False ) if match: return match.hda @@ -1582,25 +1582,6 @@ class DataToolParameter( BaseDataToolParameter ): if dataset_collection_matcher.hdca_match( history_dataset_collection, reduction=reduction ): yield history_dataset_collection - def match_datasets( self, history, dataset_matcher ): - - def dataset_collector( hdas, parent_hid ): - for i, hda in enumerate( hdas ): - if parent_hid is not None: - hid = "%s.%d" % ( parent_hid, i + 1 ) - else: - hid = str( hda.hid ) - hda_match = dataset_matcher.hda_match( hda ) - if not hda_match: - continue - yield (hda_match, hid) - # Also collect children via association object - for item in dataset_collector( hda.children, hid ): - yield item - - for item in dataset_collector( history.active_datasets_children_and_roles, None ): - yield item - def from_json( self, value, trans, other_values={} ): if trans.workflow_building_mode is workflow_building_modes.ENABLED: return None @@ -1799,7 +1780,7 @@ class DataToolParameter( BaseDataToolParameter ): # add datasets visible_hda = other_values.get( self.name ) has_matched = False - for hda in history.active_datasets_children_and_roles: + for hda in history.active_datasets_and_roles: match = dataset_matcher.hda_match( hda, check_security=False ) if match: m = match.hda