commit/galaxy-central: natefoo: Make purged histories visible in the history list grid, make any history viewable from the grid.
1 new changeset in galaxy-central: http://bitbucket.org/galaxy/galaxy-central/changeset/3c1f3268512d/ changeset: 3c1f3268512d user: natefoo date: 2011-10-10 21:45:31 summary: Make purged histories visible in the history list grid, make any history viewable from the grid. affected #: 3 files (-1 bytes) --- a/lib/galaxy/web/controllers/history.py Mon Oct 10 09:39:20 2011 -0400 +++ b/lib/galaxy/web/controllers/history.py Mon Oct 10 15:45:31 2011 -0400 @@ -59,6 +59,21 @@ if not history.deleted: link = dict( operation="Switch", id=history.id, use_panels=grid.use_panels ) return link + class DeletedColumn( grids.DeletedColumn ): + def get_value( self, trans, grid, history ): + if history == trans.history: + return "<strong>current history</strong>" + if history.purged: + return "deleted permanently" + elif history.deleted: + return "deleted" + return "" + def sort( self, trans, query, ascending, column_name=None ): + if ascending: + query = query.order_by( self.model_class.table.c.purged.asc(), self.model_class.table.c.update_time.desc() ) + else: + query = query.order_by( self.model_class.table.c.purged.desc(), self.model_class.table.c.update_time.desc() ) + return query # Grid definition title = "Saved Histories" @@ -74,8 +89,7 @@ grids.GridColumn( "Size on Disk", key="get_disk_size_bytes", format=nice_size, sortable=False ), grids.GridColumn( "Created", key="create_time", format=time_ago ), grids.GridColumn( "Last Updated", key="update_time", format=time_ago ), - # Columns that are valid for filtering but are not visible. - grids.DeletedColumn( "Status", key="deleted", visible=False, filterable="advanced" ) + DeletedColumn( "Status", key="deleted", filterable="advanced" ) ] columns.append( grids.MulticolFilterColumn( @@ -85,11 +99,12 @@ ) operations = [ grids.GridOperation( "Switch", allow_multiple=False, condition=( lambda item: not item.deleted ), async_compatible=False ), + grids.GridOperation( "View", allow_multiple=False ), grids.GridOperation( "Share or Publish", allow_multiple=False, condition=( lambda item: not item.deleted ), async_compatible=False ), grids.GridOperation( "Rename", condition=( lambda item: not item.deleted ), async_compatible=False ), grids.GridOperation( "Delete", condition=( lambda item: not item.deleted ), async_compatible=True ), - grids.GridOperation( "Delete Permanently", confirm="History contents will be removed from disk, this cannot be undone. Continue?", async_compatible=True ), - grids.GridOperation( "Undelete", condition=( lambda item: item.deleted ), async_compatible=True ), + grids.GridOperation( "Delete Permanently", condition=( lambda item: not item.purged ), confirm="History contents will be removed from disk, this cannot be undone. Continue?", async_compatible=True ), + grids.GridOperation( "Undelete", condition=( lambda item: item.deleted and not item.purged ), async_compatible=True ), ] standard_filters = [ grids.GridColumnFilter( "Active", args=dict( deleted=False ) ), @@ -104,7 +119,7 @@ def get_current_item( self, trans, **kwargs ): return trans.get_history() def apply_query_filter( self, trans, query, **kwargs ): - return query.filter_by( user=trans.user, purged=False, importing=False ) + return query.filter_by( user=trans.user, importing=False ) class SharedHistoryListGrid( grids.Grid ): # Custom column types @@ -212,6 +227,15 @@ if 'name' in kwargs: del kwargs['name'] # Remove ajax name param that rename method uses return self.rename( trans, **kwargs ) + if operation == "view": + history = self.get_history( trans, kwargs.get( 'id', None ) ) + if history: + return trans.response.send_redirect( url_for( controller='history', + action='view', + id=kwargs['id'], + show_deleted=history.deleted, + use_panels=False ) ) + #return self.view( trans, id=kwargs['id'], show_deleted=history.deleted, use_panels=False ) history_ids = util.listify( kwargs.get( 'id', [] ) ) # Display no message by default status, message = None, None @@ -793,7 +817,7 @@ """ % ( web.url_for( id=id, confirm=True, referer=trans.request.referer ), referer_message ), use_panels=True ) @web.expose - def view( self, trans, id=None, show_deleted=False ): + def view( self, trans, id=None, show_deleted=False, use_panels=True ): """View a history. If a history is importable, then it is viewable by any user.""" # Get history to view. if not id: @@ -808,10 +832,15 @@ # View history. show_deleted = util.string_as_bool( show_deleted ) datasets = self.get_history_datasets( trans, history_to_view, show_deleted=show_deleted ) + try: + use_panels = util.string_as_bool( use_panels ) + except: + pass # already a bool return trans.stream_template_mako( "history/view.mako", history = history_to_view, datasets = datasets, - show_deleted = show_deleted ) + show_deleted = show_deleted, + use_panels = use_panels ) @web.expose def display_by_username_and_slug( self, trans, username, slug ): --- a/templates/display_common.mako Mon Oct 10 09:39:20 2011 -0400 +++ b/templates/display_common.mako Mon Oct 10 15:45:31 2011 -0400 @@ -138,7 +138,7 @@ %if history.slug and history.user.username: <% return h.url_for( controller='/history', action='display_by_username_and_slug', username=history.user.username, slug=history.slug, qualified=qualify ) %> %else: - <% return h.url_for( controller='/history', action='view', id=trans.security.encode_id( history.id ), qualified=qualify ) %> + <% return h.url_for( controller='/history', action='view', id=trans.security.encode_id( history.id ), qualified=qualify, use_panels=context.get('use_panels', True) ) %> %endif </%def> --- a/templates/history/view.mako Mon Oct 10 09:39:20 2011 -0400 +++ b/templates/history/view.mako Mon Oct 10 15:45:31 2011 -0400 @@ -1,8 +1,16 @@ -<%inherit file="/webapps/galaxy/base_panels.mako"/><%namespace file="/display_common.mako" import="get_history_link, get_controller_name" /><%namespace file="/root/history_common.mako" import="render_dataset" /><%namespace file="/tagging_common.mako" import="render_individual_tagging_element, render_community_tagging_element" /> +<%! + def inherit(context): + if context.get('use_panels'): + return '/webapps/galaxy/base_panels.mako' + else: + return '/base.mako' +%> +<%inherit file="${inherit(context)}"/> + <%def name="javascripts()"> ${parent.javascripts()} ${h.js( "galaxy.base", "jquery", "json2", "jstorage" )} @@ -63,6 +71,10 @@ %></%def> +<%def name="body()"> + ${center_panel()} +</%def> + <%def name="center_panel()"> ## Get URL to other histories owned by user that owns this history. <% @@ -81,14 +93,16 @@ <div style="overflow: auto; height: 100%;"> ## Render view of history. <div id="top-links" class="historyLinks" style="padding: 0px 0px 5px 0px"> + %if not history.purged: <a href="${h.url_for( action='imp', id=trans.security.encode_id(history.id) )}">import and start using history</a> | - <a href="${get_history_link( history )}">${_('refresh')}</a> + <a href="${get_history_link( history )}">${_('refresh')}</a> | + %endif %if show_deleted: - | <a href="${h.url_for( id=trans.security.encode_id(history.id), show_deleted=False )}">${_('hide deleted')}</a> + <a href="${h.url_for( id=trans.security.encode_id(history.id), show_deleted=False, use_panels=use_panels )}">${_('hide deleted')}</a> | %else: - | <a href="${h.url_for( id=trans.security.encode_id(history.id), show_deleted=True )}">${_('show deleted')}</a> + <a href="${h.url_for( id=trans.security.encode_id(history.id), show_deleted=True, use_panels=use_panels )}">${_('show deleted')}</a> | %endif - | <a href="#" class="toggle">collapse all</a> + <a href="#" class="toggle">collapse all</a></div><div id="history-name-area" class="historyLinks" style="color: gray; font-weight: bold; padding: 0px 0px 5px 0px"> Repository URL: https://bitbucket.org/galaxy/galaxy-central/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email.
participants (1)
-
Bitbucket