commit/galaxy-central: jmchilton: Merged in jmchilton/galaxy-central-fork-1 (pull request #442)
1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/e8692fc5228b/ Changeset: e8692fc5228b User: jmchilton Date: 2014-07-28 19:21:29 Summary: Merged in jmchilton/galaxy-central-fork-1 (pull request #442) More generic logic for checking empty histories. Affected #: 2 files diff -r d5870d822b2492d99cc46fc31ab21c5b9b237cae -r e8692fc5228bed58379bfde50af5b6abb71026fe lib/galaxy/model/__init__.py --- a/lib/galaxy/model/__init__.py +++ b/lib/galaxy/model/__init__.py @@ -874,7 +874,7 @@ class History( object, Dictifiable, UsesAnnotations, HasName ): dict_collection_visible_keys = ( 'id', 'name', 'published', 'deleted' ) - dict_element_visible_keys = ( 'id', 'name', 'published', 'deleted', 'genome_build', 'purged', 'importable', 'slug' ) + dict_element_visible_keys = ( 'id', 'name', 'published', 'deleted', 'genome_build', 'purged', 'importable', 'slug', 'empty' ) default_name = 'Unnamed history' def __init__( self, id=None, name=None, user=None ): @@ -891,6 +891,10 @@ self.galaxy_sessions = [] self.tags = [] + @property + def empty( self ): + return self.hid_counter == 1 + def _next_hid( self ): # this is overriden in mapping.py db_next_hid() method if len( self.datasets ) == 0: diff -r d5870d822b2492d99cc46fc31ab21c5b9b237cae -r e8692fc5228bed58379bfde50af5b6abb71026fe static/scripts/mvc/history/history-model.js --- a/static/scripts/mvc/history/history-model.js +++ b/static/scripts/mvc/history/history-model.js @@ -212,17 +212,14 @@ // get the history data return jQuery.ajax( galaxy_config.root + 'api/histories/' + historyId ); } - function countHdasFromHistory( historyData ){ + function isEmpty( historyData ){ // get the number of hdas accrd. to the history - if( !historyData || !historyData.state_ids ){ return 0; } - return _.reduce( historyData.state_ids, function( memo, list, state ){ - return memo + list.length; - }, 0 ); + return historyData && historyData.empty; } function getHdas( historyData ){ // get the hda data // if no hdas accrd. to history: return empty immed. - if( !countHdasFromHistory( historyData ) ){ return []; } + if( isEmpty( historyData ) ){ return []; } // if there are hdas accrd. to history: get those as well if( _.isFunction( hdaDetailIds ) ){ hdaDetailIds = hdaDetailIds( historyData ); Repository URL: https://bitbucket.org/galaxy/galaxy-central/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email.
participants (1)
-
commits-noreply@bitbucket.org