mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-09-24 16:30:27 +08:00
History: allow admin to use display_structured w/ id, add display_structured link in history/view, allow switching to a history from history/view
This commit is contained in:
@@ -456,7 +456,10 @@ class HistoryController( BaseUIController, SharableMixin, UsesAnnotations, UsesI
|
||||
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
|
||||
|
||||
@@ -72,24 +72,37 @@ ${parent.javascripts()}
|
||||
## ----------------------------------------------------------------------------
|
||||
<%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 @@ ${parent.javascripts()}
|
||||
]
|
||||
});
|
||||
|
||||
$( '#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 @@ ${parent.javascripts()}
|
||||
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.
|
||||
|
||||
Reference in New Issue
Block a user