diff --git a/lib/galaxy/web/controllers/library_admin.py b/lib/galaxy/web/controllers/library_admin.py
index d6999b97a98..3993e0f8681 100644
--- a/lib/galaxy/web/controllers/library_admin.py
+++ b/lib/galaxy/web/controllers/library_admin.py
@@ -169,8 +169,8 @@ class LibraryAdmin( BaseController ):
# deleted / purged contents will have the same state ). When a library or folder has been deleted for
# the amount of time defined in the cleanup_datasets.py script, the library or folder and all of its
# contents will be purged. The association between this method and the cleanup_datasets.py script
- # enables clean maintenance of libraries and library dataset disk files. This is also why the following
- # 3 objects, and not any of the associations ( the cleanup_datasets.py scipot handles everything else ).
+ # enables clean maintenance of libraries and library dataset disk files. This is also why the item_types
+ # are not any of the associations ( the cleanup_datasets.py script handles everything ).
show_deleted = util.string_as_bool( kwd.get( 'show_deleted', False ) )
item_types = { 'library': trans.app.model.Library,
'folder': trans.app.model.LibraryFolder,
diff --git a/lib/galaxy/web/controllers/library_common.py b/lib/galaxy/web/controllers/library_common.py
index 632eabdb537..93ea0255c5b 100644
--- a/lib/galaxy/web/controllers/library_common.py
+++ b/lib/galaxy/web/controllers/library_common.py
@@ -1246,8 +1246,7 @@ class LibraryCommon( BaseController ):
messagetype=messagetype )
@web.expose
def act_on_multiple_datasets( self, trans, cntrller, library_id, ldda_ids='', **kwd ):
- # This method is used by the select list labeled "Perform action on selected datasets"
- # on the analysis library browser
+ # Perform an action on a list of library datasets.
params = util.Params( kwd )
msg = util.restore_text( params.get( 'msg', '' ) )
messagetype = params.get( 'messagetype', 'done' )
@@ -1262,7 +1261,7 @@ class LibraryCommon( BaseController ):
messagetype = 'error'
else:
ldda_ids = util.listify( ldda_ids )
- if action == 'add':
+ if action == 'import_to_history':
history = trans.get_history()
if history is None:
# Must be a bot sending a request without having a history.
@@ -1306,9 +1305,12 @@ class LibraryCommon( BaseController ):
elif action == 'delete':
for ldda_id in ldda_ids:
ldda = trans.sa_session.query( trans.app.model.LibraryDatasetDatasetAssociation ).get( trans.security.decode_id( ldda_id ) )
- ldda.deleted = True
- trans.sa_session.add( ldda )
- trans.sa_session.flush()
+ # Do not delete the association, just delete the library_dataset. The
+ # cleanup_datasets.py script handles everything else.
+ ld = ldda.library_dataset
+ ld.deleted = True
+ trans.sa_session.add( ld )
+ trans.sa_session.flush()
msg = "The selected datasets have been removed from this data library"
else:
error = False
diff --git a/templates/library/common/browse_library.mako b/templates/library/common/browse_library.mako
index 555ce7def7f..a7e5e7e7aa1 100644
--- a/templates/library/common/browse_library.mako
+++ b/templates/library/common/browse_library.mako
@@ -229,7 +229,7 @@
Upload a new version of this dataset
%endif
%if not branch_deleted( folder ) and not ldda.library_dataset.deleted and ldda.has_data:
- Import this dataset into your current history
+ Import this dataset into your current history
Download this dataset
%endif
%if cntrller in [ 'library_admin', 'requests_admin' ]:
diff --git a/templates/library/common/ldda_info.mako b/templates/library/common/ldda_info.mako
index c7c9d1e25f0..1701ccdf86a 100644
--- a/templates/library/common/ldda_info.mako
+++ b/templates/library/common/ldda_info.mako
@@ -57,7 +57,7 @@
Upload a new version of this dataset
%endif
%if cntrller=='library' and ldda.has_data:
- Import this dataset into your current history
+ Import this dataset into your current history
Download this dataset
%endif
diff --git a/test/base/twilltestcase.py b/test/base/twilltestcase.py
index 4c2b057a384..676397df952 100644
--- a/test/base/twilltestcase.py
+++ b/test/base/twilltestcase.py
@@ -1595,14 +1595,17 @@ class TwillTestCase( unittest.TestCase ):
self.home()
def add_library_dataset( self, cntrller, filename, library_id, folder_id, folder_name,
file_type='auto', dbkey='hg18', roles=[], message='', root=False,
- template_field_name1='', template_field_contents1='' ):
+ template_field_name1='', template_field_contents1='', show_deleted='False',
+ upload_option='upload_file' ):
"""Add a dataset to a folder"""
filename = self.get_filename( filename )
self.home()
- self.visit_url( "%s/library_common/upload_library_dataset?cntrller=%s&upload_option=upload_file&library_id=%s&folder_id=%s&message=%s" % \
- ( self.url, cntrller, library_id, folder_id, message ) )
+ self.visit_url( "%s/library_common/upload_library_dataset?cntrller=%s&library_id=%s&folder_id=%s&upload_option=%s&message=%s" % \
+ ( self.url, cntrller, library_id, folder_id, upload_option, message ) )
self.check_page_for_string( 'Upload files' )
+ tc.fv( "1", "library_id", library_id )
tc.fv( "1", "folder_id", folder_id )
+ tc.fv( "1", "show_deleted", show_deleted )
tc.formfile( "1", "files_0|file_data", filename )
tc.fv( "1", "file_type", file_type )
tc.fv( "1", "dbkey", dbkey )
diff --git a/test/functional/test_security_and_libraries.py b/test/functional/test_security_and_libraries.py
index 711ddebf9d5..7fd26cf4199 100644
--- a/test/functional/test_security_and_libraries.py
+++ b/test/functional/test_security_and_libraries.py
@@ -1181,7 +1181,7 @@ class TestSecurityAndLibraries( TwillTestCase ):
# Test importing the restricted dataset into a history, can't use the
# ~/library_admin/libraries form as twill barfs on it so we'll simulate the form submission
# by going directly to the form action
- self.visit_url( '%s/library_common/act_on_multiple_datasets?cntrller=library&do_action=add&ldda_ids=%s&library_id=%s' \
+ self.visit_url( '%s/library_common/act_on_multiple_datasets?cntrller=library&do_action=import_to_history&ldda_ids=%s&library_id=%s' \
% ( self.url, self.security.encode_id( ldda_five.id ), self.security.encode_id( library_one.id ) ) )
self.check_page_for_string( '1 dataset(s) have been imported into your history' )
self.logout()
@@ -1473,7 +1473,7 @@ class TestSecurityAndLibraries( TwillTestCase ):
for ldda in lddas:
# Import each library dataset into our history
self.home()
- self.visit_url( '%s/library_common/act_on_multiple_datasets?cntrller=library&do_action=add&ldda_ids=%s&library_id=%s' % \
+ self.visit_url( '%s/library_common/act_on_multiple_datasets?cntrller=library&do_action=import_to_history&ldda_ids=%s&library_id=%s' % \
( self.url, self.security.encode_id( ldda.id ), self.security.encode_id( library_one.id ) ) )
# Determine the new HistoryDatasetAssociation id created when the library dataset was imported into our history
last_hda_created = sa_session.query( galaxy.model.HistoryDatasetAssociation ) \
@@ -1522,7 +1522,7 @@ class TestSecurityAndLibraries( TwillTestCase ):
# be all of the above on any of the 3 datasets that are imported into a history
for ldda in lddas:
self.home()
- self.visit_url( '%s/library_common/act_on_multiple_datasets?cntrller=library&library_id=%s&do_action=add&ldda_ids=%s' % \
+ self.visit_url( '%s/library_common/act_on_multiple_datasets?cntrller=library&library_id=%s&do_action=import_to_history&ldda_ids=%s' % \
( self.url, self.security.encode_id( library_one.id ), self.security.encode_id( ldda.id ) ) )
# Determine the new HistoryDatasetAssociation id created when the library dataset was imported into our history
last_hda_created = sa_session.query( galaxy.model.HistoryDatasetAssociation ) \