mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-09-24 16:30:27 +08:00
Add functionality for deleting all hidden datasets in a history. This is card https://trello.com/c/0SoREcMn
This commit is contained in:
@@ -497,6 +497,21 @@ class HistoryController( BaseUIController, SharableMixin, UsesAnnotations, UsesI
|
||||
#
|
||||
return trans.fill_template( "history/display_structured.mako", items=items )
|
||||
|
||||
@web.expose
|
||||
def delete_hidden_datasets( self, trans ):
|
||||
"""
|
||||
This method deletes all hidden datasets in the current history.
|
||||
"""
|
||||
count = 0
|
||||
for hda in trans.history.datasets:
|
||||
if not hda.visible and not hda.deleted and not hda.purged:
|
||||
hda.mark_deleted()
|
||||
count += 1
|
||||
trans.sa_session.add( hda )
|
||||
trans.log_event( "HDA id %s has been deleted" % hda.id )
|
||||
trans.sa_session.flush()
|
||||
return trans.show_ok_message( "%d hidden datasets have been deleted" % count, refresh_frames=['history'] )
|
||||
|
||||
@web.expose
|
||||
def purge_deleted_datasets( self, trans ):
|
||||
count = 0
|
||||
|
||||
@@ -45,6 +45,11 @@
|
||||
galaxy_main.location = "${h.url_for( controller='history', action='unhide_datasets', current=True )}";
|
||||
}
|
||||
},
|
||||
"${_("Delete Hidden Datasets")}": function() {
|
||||
if ( confirm( "Really delete all hidden datasets?" ) ) {
|
||||
galaxy_main.location = "${h.url_for( controller='history', action='delete_hidden_datasets')}";
|
||||
}
|
||||
},
|
||||
"${_("Purge Deleted Datasets")}": function() {
|
||||
if ( confirm( "Really delete all deleted datasets permanently? This cannot be undone." ) ) {
|
||||
galaxy_main.location = "${h.url_for( controller='history', action='purge_deleted_datasets' )}";
|
||||
|
||||
Reference in New Issue
Block a user