Skip to content
This repository has been archived by the owner on Jan 18, 2020. It is now read-only.

Commit

Permalink
Don't hide loading overlay until variant data is returned
Browse files Browse the repository at this point in the history
This fixes a bug where the loading overlay was being hidden by Cilantro
as soon as the call to /api/data/preview/ returned which was problematic
in Varify because the variant data is not retrieved by that call but
instead comes back in a successive call to /api/samples/variants/. The
loading overlay is now hidden after that second call.

Signed-off-by: Don Naegely <[email protected]>
  • Loading branch information
naegelyd committed Sep 8, 2014
1 parent bd39aaa commit 133e44d
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
7 changes: 6 additions & 1 deletion varify/static/js/src/ui/tables/body.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,16 @@ define([
},

_fetch: function() {
var _this = this;

this.collection.fetch({
data: JSON.stringify({ids: this._collection.pluck('pk')}),
type: 'POST',
contentType: 'application/json',
parse: true
parse: true,
success: function() {
_this.trigger('synced');
}
});
},

Expand Down
16 changes: 15 additions & 1 deletion varify/static/js/src/ui/workflows/results.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,19 @@ define([
},

initialize: function() {
_.bindAll(this, 'hideLoadingOverlay');

c.ui.ResultsWorkflow.prototype.initialize.call(this);

// We will manage the hiding of the loading overlay ourselves. The
// call to the preview endpoint returns the variant IDs. The actual
// variant data is retrieved by another call after the call to the
// preview endpoint comes back so we cannot let Cilantro hide the
// overlay after the preview endpoint syncs like it normally does.
// Insted, we need to hide it after the variant collection becomes
// synced.
this.stopListening(this.data.results, 'sync');

// The Cilantro workflow no longer requires the context but we
// need it to have any hope of referencing the sample name in the
// result count. The data object will already have been initialized
Expand Down Expand Up @@ -85,7 +96,10 @@ define([
view: this.data.view,
collection: this.data.results
}));

// When the body of the table reports that it is synced, then the
// variant data has arrived and we can now hide the loading
// overlay.
this.table.currentView.on('itemview:synced', this.hideLoadingOverlay);

this.ui.navbarButtons.tooltip({
animation: false,
Expand Down

0 comments on commit 133e44d

Please sign in to comment.