mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-09-24 16:30:27 +08:00
Fix importing library datasets into multiple histories - library datasets will now only be imported into those checked.
This commit is contained in:
@@ -1855,7 +1855,7 @@ class LibraryCommon( BaseUIController, UsesFormDefinitions ):
|
||||
status=status )
|
||||
|
||||
@web.expose
|
||||
def import_datasets_to_histories( self, trans, cntrller, library_id='', folder_id='', ldda_ids='', target_history_ids='', new_history_name='', **kwd ):
|
||||
def import_datasets_to_histories( self, trans, cntrller, library_id='', folder_id='', ldda_ids='', target_history_id='', target_history_ids='', new_history_name='', **kwd ):
|
||||
# This method is called from one of the following places:
|
||||
# - a menu option for a library dataset ( ldda_ids is a single ldda id )
|
||||
# - a menu option for a library folder ( folder_id has a value )
|
||||
@@ -1870,7 +1870,6 @@ class LibraryCommon( BaseUIController, UsesFormDefinitions ):
|
||||
action = params.get( 'do_action', None )
|
||||
user = trans.get_user()
|
||||
current_history = trans.get_history()
|
||||
selected_history_id = params.get( 'selected_history_id', trans.security.encode_id( current_history.id ) )
|
||||
if library_id:
|
||||
library = trans.sa_session.query( trans.model.Library ).get( trans.security.decode_id( library_id ) )
|
||||
else:
|
||||
@@ -1882,9 +1881,11 @@ class LibraryCommon( BaseUIController, UsesFormDefinitions ):
|
||||
ldda_ids = util.listify( ldda_ids )
|
||||
if ldda_ids:
|
||||
ldda_ids = map( trans.security.decode_id, ldda_ids )
|
||||
target_history_ids = util.listify( target_history_ids )
|
||||
if target_history_ids:
|
||||
target_history_ids = [ trans.security.decode_id( target_history_id ) for target_history_id in target_history_ids if target_history_id ]
|
||||
target_history_ids = util.listify( target_history_ids )
|
||||
target_history_ids = set( [ trans.security.decode_id( target_history_id ) for target_history_id in target_history_ids if target_history_id ] )
|
||||
elif target_history_id:
|
||||
target_history_ids = [ trans.security.decode_id( target_history_id ) ]
|
||||
if params.get( 'import_datasets_to_histories_button', False ):
|
||||
invalid_datasets = 0
|
||||
if not ldda_ids or not ( target_history_ids or new_history_name ):
|
||||
@@ -1965,7 +1966,7 @@ class LibraryCommon( BaseUIController, UsesFormDefinitions ):
|
||||
library=library,
|
||||
current_history=current_history,
|
||||
ldda_ids=ldda_ids,
|
||||
selected_history_id=selected_history_id,
|
||||
target_history_id=target_history_id,
|
||||
target_history_ids=target_history_ids,
|
||||
source_lddas=source_lddas,
|
||||
target_histories=target_histories,
|
||||
|
||||
@@ -236,7 +236,7 @@ class MatchedRepositoryListGrid( grids.Grid ):
|
||||
template='/webapps/community/repository/grid.mako'
|
||||
default_sort_key = "Repository.name"
|
||||
columns = [
|
||||
NameColumn( "Name",
|
||||
NameColumn( "Repository name",
|
||||
link=( lambda item: dict( operation="view_or_manage_repository",
|
||||
id=item.id,
|
||||
webapp="community" ) ),
|
||||
@@ -588,17 +588,17 @@ class RepositoryController( BaseUIController, ItemRatings ):
|
||||
match_tuples.append( ( repository_metadata.repository_id, repository_metadata.changeset_revision ) )
|
||||
else:
|
||||
ok = False
|
||||
if workflow_names:
|
||||
elif workflow_names:
|
||||
if 'workflows' in metadata:
|
||||
workflows = metadata[ 'workflows' ]
|
||||
else:
|
||||
workflows = []
|
||||
for workflow_dict in workflows:
|
||||
for workflow_name in workflow_names:
|
||||
if self.__in_workflow_dict( workflow_dict, exact_matches_checked, workflow_name=workflow_name ):
|
||||
if self.__in_workflow_dict( workflow_dict, exact_matches_checked, workflow_name ):
|
||||
match_tuples.append( ( repository_metadata.repository_id, repository_metadata.changeset_revision ) )
|
||||
return ok, match_tuples
|
||||
def __in_workflow_dict( self, workflow_dict, exact_matches_checked, workflow_name=None ):
|
||||
def __in_workflow_dict( self, workflow_dict, exact_matches_checked, workflow_name ):
|
||||
workflow_dict_workflow_name = workflow_dict[ 'name' ].lower()
|
||||
return ( workflow_name == workflow_dict_workflow_name ) or \
|
||||
( not exact_matches_checked and workflow_dict_workflow_name.find( workflow_name ) >= 0 )
|
||||
|
||||
@@ -49,12 +49,12 @@
|
||||
<div class="toolFormTitle">Destination Histories:</div>
|
||||
<div class="toolFormBody">
|
||||
<div class="form-row" id="single-destination">
|
||||
<select id="single-dest-select" name="target_history_ids">
|
||||
<select id="single-dest-select" name="target_history_id">
|
||||
%for i, target_history in enumerate( target_histories ):
|
||||
<%
|
||||
encoded_id = trans.security.encode_id( target_history.id )
|
||||
if encoded_id == selected_history_id:
|
||||
selected_text = " selected"
|
||||
if encoded_id == target_history_id:
|
||||
selected_text = " selected='selected'"
|
||||
else:
|
||||
selected_text = ""
|
||||
if target_history == current_history:
|
||||
|
||||
Reference in New Issue
Block a user