commit/galaxy-central: carlfeberhard: History: allow admin to use display_structured w/ id, add display_structured link in history/view, allow switching to a history from history/view
1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/b526afe822e5/ Changeset: b526afe822e5 User: carlfeberhard Date: 2014-04-29 18:34:07 Summary: History: allow admin to use display_structured w/ id, add display_structured link in history/view, allow switching to a history from history/view Affected #: 2 files diff -r 78a2fa5ee8b82011c09a152c5be5334eb14d8ded -r b526afe822e53ce530fabe94dff683818a33b29a lib/galaxy/webapps/galaxy/controllers/history.py --- a/lib/galaxy/webapps/galaxy/controllers/history.py +++ b/lib/galaxy/webapps/galaxy/controllers/history.py @@ -456,7 +456,10 @@ eagerload_all( 'active_datasets.children' ) ).get( id ) assert history - assert history.user and ( history.user.id == trans.user.id ) or ( history.id == trans.history.id ) + #TODO: formalize to trans.show_error + assert ( history.user and ( history.user.id == trans.user.id ) + or ( history.id == trans.history.id ) + or ( trans.user_is_admin() ) ) # Resolve jobs and workflow invocations for the datasets in the history # items is filled with items (hdas, jobs, or workflows) that go at the # top level diff -r 78a2fa5ee8b82011c09a152c5be5334eb14d8ded -r b526afe822e53ce530fabe94dff683818a33b29a templates/webapps/galaxy/history/view.mako --- a/templates/webapps/galaxy/history/view.mako +++ b/templates/webapps/galaxy/history/view.mako @@ -72,24 +72,37 @@ ## ---------------------------------------------------------------------------- <%def name="center_panel()"><% + imp_with_deleted_url = h.url_for( controller='history', action='imp', id=history[ 'id' ], all_datasets=True ) + imp_without_deleted_url = h.url_for( controller='history', action='imp', id=history[ 'id' ] ) + + structure_url = h.url_for( controller='history', action='display_structured', id=history[ 'id' ] ) + + switch_to_url = h.url_for( controller='history', action='switch_to_history', hist_id=history[ 'id' ] ) + show_deleted = context.get( 'show_deleted', None ) show_hidden = context.get( 'show_hidden', None ) user_is_owner_json = 'true' if user_is_owner else 'false' show_deleted_json = h.to_json_string( show_deleted ) show_hidden_json = h.to_json_string( show_hidden ) - - imp_with_deleted_url = h.url_for( controller='history', action='imp', id=history['id'], all_datasets=True ) - imp_without_deleted_url = h.url_for( controller='history', action='imp', id=history['id'] ) %><div id="header" class="clear"> - <div id="history-view-controls" class="pull-right"> - %if not user_is_owner and not history[ 'purged' ]: - <button id="import" class="btn btn-default"></button> - %endif - <button id="toggle-deleted" class="btn btn-default"></button> - <button id="toggle-hidden" class="btn btn-default"></button> + <div id="history-view-controls"> + <div class="pull-left"> + %if not history[ 'purged' ]: + %if user_is_owner: + <button id="switch" class="btn btn-default">${ _( 'Switch to this history' ) }</button> + %else: + <button id="import" class="btn btn-default"></button> + %endif + <a id="structure" href="${ structure_url }" class="btn btn-default">${ _( 'Show structure' ) }</a> + %endif + </div> + <div class="pull-right"> + <button id="toggle-deleted" class="btn btn-default"></button> + <button id="toggle-hidden" class="btn btn-default"></button> + </div></div></div> @@ -120,6 +133,18 @@ ] }); + $( '#switch' ).click( function( ev ){ + ##HACK:ity hack hack + ##TODO: remove when out of iframe + var hpanel = Galaxy.currHistoryPanel + || ( top.Galaxy && top.Galaxy.currHistoryPanel )? top.Galaxy.currHistoryPanel : null; + if( hpanel ){ + hpanel.switchToHistory( "${ history[ 'id' ] }" ); + } else { + window.location = "${ switch_to_url }"; + } + }); + $( '#import' ).modeButton({ switchModesOnClick : false, initialMode : "${ 'with_deleted' if show_deleted else 'without_deleted' }", @@ -149,11 +174,7 @@ baseUrl : "${h.url_for( '/static/scripts' )}" })([ 'mvc/user/user-model', panelToUse.location, 'utils/localization' ], function( user, panelMod, _l ){ $(function(){ - window._l = _l; setUpBehaviors(); - if( !Galaxy.currUser ){ - Galaxy.currUser = new user.User( ${h.to_json_string( get_user_json() )} ); - } var panelClass = panelMod[ panelToUse.className ], // history module is already in the dpn chain from the panel. We can re-scope it here. 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)
-
commits-noreply@bitbucket.org