Skip to content

Commit

Permalink
UI & API, history: return element_count by default
Browse files Browse the repository at this point in the history
- Adds element_count to summary serialization for hdcas through
history/{:id}/contents
- Implements a HistoryContents fetch method to decorate the hdcas
after loading if necessary
  • Loading branch information
carlfeberhard committed May 9, 2016
1 parent a16ba6c commit f9afb7b
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 21 deletions.
24 changes: 13 additions & 11 deletions client/galaxy/scripts/mvc/history/history-contents.js
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,19 @@ var HistoryContents = Backbone.Collection
return this.fetch( options );
},

/** */
fetchCollectionCounts : function( options ){
options = options || {};
options.data = _.defaults({
keys : [ 'type_id', 'element_count' ].join( ',' ),
q : 'history_content_type',
qv : 'dataset_collection',
}, options.data || {} );
options.merge = true;
options.remove = false;
return this.fetch( options );
},

/** using a queue, perform ajaxFn on each of the models in this collection */
ajaxQueue : function( ajaxFn, options ){
var deferred = jQuery.Deferred(),
Expand Down Expand Up @@ -292,17 +305,6 @@ var HistoryContents = Backbone.Collection
},

// ........................................................................ misc
/** override to ensure type id is set */
set : function( models, options ){
models = _.isArray( models )? models : [ models ];
_.each( models, function( model ){
if( !model.type_id || !model.get || !model.get( 'type_id' ) ){
model.type_id = HISTORY_CONTENT.typeIdStr( model.history_content_type, model.id );
}
});
Backbone.Collection.prototype.set.call( this, models, options );
},

/** */
createHDCA : function( elementIdentifiers, collectionType, name, options ){
//precondition: elementIdentifiers is an array of plain js objects
Expand Down
13 changes: 9 additions & 4 deletions lib/galaxy/managers/hdcas.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,14 +192,18 @@ def __init__( self, app ):

self.default_view = 'summary'
self.add_view( 'summary', [
'id', 'name',
'type_id',
'history_id', 'hid',
'history_content_type',
'id',
'collection_type',
'populated',
'populated_state',
'populated_state_message',
'element_count',

'name',
'type_id',
'history_id',
'hid',
'history_content_type',
'deleted',
# 'purged',
'visible',
Expand All @@ -217,6 +221,7 @@ def add_serializers( self ):

self.serializers.update({
'model_class' : lambda *a, **c: self.hdca_manager.model_class.__class__.__name__,
# TODO: remove
'type' : lambda *a, **c: 'collection',
# part of a history and container
'history_id' : self.serialize_id,
Expand Down
2 changes: 1 addition & 1 deletion static/maps/mvc/history/history-contents.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions static/scripts/bundled/analysis.bundled.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion static/scripts/bundled/analysis.bundled.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion static/scripts/bundled/libs.bundled.js.map

Large diffs are not rendered by default.

0 comments on commit f9afb7b

Please sign in to comment.