mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-09-24 16:30:27 +08:00
HDA model: allow copying the purged attribute; History model: allow copying all datasets (including purged); History imp: change query param flag 'include_deleted' to 'all_datasets', send to History model copy; history/view: incorporate 'all_datasets' flag in import button
This commit is contained in:
@@ -822,7 +822,12 @@ class History( object, Dictifiable, UsesAnnotations, HasName ):
|
||||
self.datasets.append( dataset )
|
||||
return dataset
|
||||
|
||||
def copy( self, name=None, target_user=None, activatable=False ):
|
||||
def copy( self, name=None, target_user=None, activatable=False, all_datasets=False ):
|
||||
"""
|
||||
Return a copy of this history using the given `name` and `target_user`.
|
||||
If `activatable`, copy only non-deleted datasets. If `all_datasets`, copy
|
||||
non-deleted, deleted, and purged datasets.
|
||||
"""
|
||||
# Create new history.
|
||||
if not name:
|
||||
name = self.name
|
||||
@@ -845,6 +850,8 @@ class History( object, Dictifiable, UsesAnnotations, HasName ):
|
||||
# Copy HDAs.
|
||||
if activatable:
|
||||
hdas = self.activatable_datasets
|
||||
elif all_datasets:
|
||||
hdas = self.datasets
|
||||
else:
|
||||
hdas = self.active_datasets
|
||||
for hda in hdas:
|
||||
@@ -1682,6 +1689,9 @@ class HistoryDatasetAssociation( DatasetInstance, Dictifiable, UsesAnnotations,
|
||||
deleted=self.deleted,
|
||||
parent_id=parent_id,
|
||||
copied_from_history_dataset_association=self )
|
||||
# update init non-keywords as well
|
||||
hda.purged = self.purged
|
||||
|
||||
object_session( self ).add( hda )
|
||||
object_session( self ).flush()
|
||||
hda.set_size()
|
||||
|
||||
@@ -783,8 +783,8 @@ class HistoryController( BaseUIController, SharableMixin, UsesAnnotations, UsesI
|
||||
else:
|
||||
referer_message = "<a href='%s'>go to Galaxy's start page</a>" % url_for( '/' )
|
||||
|
||||
# include activatable/deleted datasets when copying?
|
||||
include_deleted = util.string_as_bool( kwd.get( 'include_deleted', False ) )
|
||||
# include all datasets when copying?
|
||||
all_datasets = util.string_as_bool( kwd.get( 'all_datasets', False ) )
|
||||
|
||||
# Do import.
|
||||
if not id:
|
||||
@@ -799,7 +799,7 @@ class HistoryController( BaseUIController, SharableMixin, UsesAnnotations, UsesI
|
||||
#dan: I can import my own history.
|
||||
#if import_history.user_id == user.id:
|
||||
# return trans.show_error_message( "You cannot import your own history.<br>You can %s." % referer_message, use_panels=True )
|
||||
new_history = import_history.copy( target_user=user, activatable=include_deleted )
|
||||
new_history = import_history.copy( target_user=user, all_datasets=all_datasets )
|
||||
new_history.name = "imported: " + new_history.name
|
||||
new_history.user_id = user.id
|
||||
galaxy_session = trans.get_galaxy_session()
|
||||
|
||||
@@ -98,7 +98,7 @@ ${history_panel_javascripts()}
|
||||
%>
|
||||
%if not history[ 'purged' ]:
|
||||
<a id="import" class="btn btn-default" style="display: none;"
|
||||
href="${h.url_for( controller='history', action='imp', id=history['id'], include_deleted=show_deleted )}">
|
||||
href="${h.url_for( controller='history', action='imp', id=history['id'], all_datasets=show_deleted )}">
|
||||
${_('Import and start using history')}
|
||||
</a>
|
||||
%endif
|
||||
@@ -133,7 +133,7 @@ ${history_panel_javascripts()}
|
||||
// a bit hacky
|
||||
var href = $importBtn.attr( 'href' ),
|
||||
includeDeleted = $( this ).modeButton()[0].getMode().mode === 'exclude';
|
||||
href = href.replace( /include_deleted=True|False/, ( includeDeleted )?( 'True' ):( 'False' ) );
|
||||
href = href.replace( /all_datasets=True|False/, ( includeDeleted )?( 'True' ):( 'False' ) );
|
||||
$importBtn.attr( 'href', href );
|
||||
$importBtn.text( includeDeleted ? _l( 'Import with deleted datasets and start using history' )
|
||||
: _l( 'Import and start using history' ) );
|
||||
|
||||
Reference in New Issue
Block a user