diff --git a/lib/galaxy/web/controllers/dataset.py b/lib/galaxy/web/controllers/dataset.py index 95afcc3119b..a472ba8e969 100644 --- a/lib/galaxy/web/controllers/dataset.py +++ b/lib/galaxy/web/controllers/dataset.py @@ -45,6 +45,11 @@ ${traceback} """ class HistoryDatasetAssociationListGrid( grids.Grid ): + # Custom columns for grid. + class HistoryColumn( grids.GridColumn ): + def get_value( self, trans, grid, hda): + return hda.history.name + class StatusColumn( grids.GridColumn ): def get_value( self, trans, grid, hda ): if hda.deleted: @@ -52,6 +57,7 @@ class HistoryDatasetAssociationListGrid( grids.Grid ): return "" def get_link( self, trans, grid, hda ): return None + class TagsColumn( grids.GridColumn ): def __init__(self, col_name, key, filterable): grids.GridColumn.__init__(self, col_name, key=key, filterable=filterable) @@ -107,14 +113,16 @@ class HistoryDatasetAssociationListGrid( grids.Grid ): return accepted_filters # Grid definition - title = "Stored Datasets" + title = "Saved Datasets" model_class = model.HistoryDatasetAssociation template='/dataset/grid.mako' default_sort_key = "-create_time" columns = [ - grids.GridColumn( "Name", key="name", - # Link name to dataset's history. + grids.GridColumn( "Name", key="name", + # Link name to dataset's history. link=( lambda item: iff( item.history.deleted, None, dict( operation="switch", id=item.id ) ) ) ), + HistoryColumn( "History", key="history", + link=( lambda item: iff( item.history.deleted, None, dict( operation="switch_history", id=item.id ) ) ) ), TagsColumn( "Tags", key="tags", filterable=True ), StatusColumn( "Status", key="deleted", attach_popup=False ), grids.GridColumn( "Created", key="create_time", format=time_ago ), @@ -285,8 +293,9 @@ class DatasetInterface( BaseController ): log.warn( "Invalid history_dataset_association id '%r' passed to list", hda_id ) if hdas: - - if operation == "switch": + if operation == "switch" or operation == "switch_history": + # Switch to a history that the HDA resides in. + # Convert hda to histories. histories = [] for hda in hdas: @@ -295,8 +304,11 @@ class DatasetInterface( BaseController ): # Use history controller to switch the history. TODO: is this reasonable? status, message = trans.webapp.controllers['history']._list_switch( trans, histories ) - # Current history changed, refresh history frame - trans.template_context['refresh_frames'] = ['history'] + # Current history changed, refresh history frame; if switching to a dataset, set hda seek. + trans.template_context['refresh_frames'] = ['history'] + if operation == "switch": + hda_ids = [ trans.security.encode_id( hda.id ) for hda in hdas ] + trans.template_context[ 'seek_hda_ids' ] = hda_ids # Render the list view return self.stored_list_grid( trans, status=status, message=message, **kwargs ) diff --git a/templates/dataset/grid.mako b/templates/dataset/grid.mako index 268a001cfdf..0fa0e4aec14 100644 --- a/templates/dataset/grid.mako +++ b/templates/dataset/grid.mako @@ -92,8 +92,6 @@ t.autocomplete("${h.url_for( controller='tag', action='tag_autocomplete_data', item_class='HistoryDatasetAssociation' )}", autocomplete_options); - //t.addClass("tag-input"); - return t; }); ## Can this be moved into base.mako? @@ -110,7 +108,14 @@ %endif %if 'history' in refresh_frames: if ( parent.frames && parent.frames.galaxy_history ) { - parent.frames.galaxy_history.location.href="${h.url_for( controller='root', action='history', hda_id=str(ids) )}"; + ## If available, include HDA ids to seek to in history request. + <% + hda_id = None + if seek_hda_ids: + hda_id = str( seek_hda_ids[0] ) # Use only the first id. + print hda_id + %> + parent.frames.galaxy_history.location.href="${h.url_for( controller='root', action='history', hda_id=hda_id )}"; if ( parent.force_right_panel ) { parent.force_right_panel( 'show' ); } diff --git a/templates/root/history_common.mako b/templates/root/history_common.mako index 5ab511bb444..a2e3597c21e 100644 --- a/templates/root/history_common.mako +++ b/templates/root/history_common.mako @@ -1,6 +1,7 @@ <% _=n_ %> ## Render the dataset `data` as history item, using `hid` as the displayed id <%def name="render_dataset( data, hid, show_deleted_on_refresh = False, user_owns_dataset = True )"> + <% if data.state in ['no state','',None]: data_state = "queued" @@ -21,7 +22,6 @@ %endif ## Header row for history items (name, state, action buttons) -