2 new commits in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/4b37f57c1d2e/ Changeset: 4b37f57c1d2e User: jmchilton Date: 2014-07-25 04:20:08 Summary: More generic logic for checking empty histories. This fixes a bug where web UI short circuits rendering of history panel if history only contains dataset collections and no datasets. The most obvious alternative to this would be to 1) add collection information to the per-content state ids dict - which may not make a lot of sense since we haven't nailed down exactly what collection states should look like and if they will be drawn from the same possible set of states as dataset states or 2) build a separate set of state summaries for dataset collections. In addition to these two approaches being more work, they also lock the API into more expensive queries by default. Affected #: 2 files diff -r 646c414e90515d78d99461e090815f1a01f18c72 -r 4b37f57c1d2ecd925697ade51a043e51452db606 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 646c414e90515d78d99461e090815f1a01f18c72 -r 4b37f57c1d2ecd925697ade51a043e51452db606 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 ); 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.