Skip to content

Commit

Permalink
UI, history: get element_counts after history load
Browse files Browse the repository at this point in the history
- Waits 2s after history contents loading and fetches element_count
for all dataset collections in the history
- Removes element_count as a default summary field for HDCAs
  • Loading branch information
carlfeberhard committed May 9, 2016
1 parent 8ce93d7 commit 3aaccda
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 15 deletions.
26 changes: 18 additions & 8 deletions client/galaxy/scripts/mvc/history/history-view.js
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,9 @@ var HistoryView = _super.extend(
return this.loadHistory( historyId, attributes, historyFn, contentsFn, detailIdsFn );
},

/** @type {Number} ms to wait after history load to fetch/decorate hdcas with element_count */
FETCH_COLLECTION_COUNTS_DELAY : 2000,

/** loads a history & contents (but does not make them the current history) */
loadHistory : function( historyId, attributes, historyFn, contentsFn, detailIdsFn ){
this.info( 'loadHistory:', historyId, attributes, historyFn, contentsFn, detailIdsFn );
Expand All @@ -200,6 +203,12 @@ var HistoryView = _super.extend(
panel.trigger( 'error', panel, xhr, attributes, _l( 'An error was encountered while ' + where ),
{ historyId: historyId, history: history || {} });
})
.done( function(){
// after the initial load, decorate with more time consuming fields (like HDCA element_counts)
_.delay( function(){
panel.model.contents.fetchCollectionCounts();
}, panel.FETCH_COLLECTION_COUNTS_DELAY );
})
.always( function(){
// bc _hideLoadingIndicator relies on this firing
panel.trigger( 'loading-done', panel );
Expand All @@ -209,14 +218,15 @@ var HistoryView = _super.extend(
/** given an xhr that will provide both history and contents data, pass data to set model or handle xhr errors */
_loadHistoryFromXHR : function( xhr, attributes ){
var panel = this;
xhr.then( function( historyJSON, contentsJSON ){
panel.JSONToModel( historyJSON, contentsJSON, attributes );
panel.render();
});
xhr.fail( function( xhr, where ){
// render anyways - whether we get a model or not
panel.render();
});
xhr
.then( function( historyJSON, contentsJSON ){
panel.JSONToModel( historyJSON, contentsJSON, attributes );
panel.render();
})
.fail( function( xhr, where ){
// render anyways - whether we get a model or not
panel.render();
});
return xhr;
},

Expand Down
1 change: 0 additions & 1 deletion lib/galaxy/managers/hdcas.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,6 @@ def __init__( self, app ):
'populated',
'populated_state',
'populated_state_message',
'element_count',

'name',
'type_id',
Expand Down
2 changes: 1 addition & 1 deletion static/maps/mvc/history/history-view.js.map

Large diffs are not rendered by default.

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.

2 changes: 1 addition & 1 deletion static/scripts/mvc/history/history-view.js

Large diffs are not rendered by default.

0 comments on commit 3aaccda

Please sign in to comment.