Skip to content

Commit

Permalink
Hack to get the force refresh in the explore view
Browse files Browse the repository at this point in the history
  • Loading branch information
mistercrunch committed Mar 23, 2016
1 parent d8192ec commit fded04a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
7 changes: 5 additions & 2 deletions dashed/assets/javascripts/explore.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,17 @@ function prepForm() {
});
}

function druidify() {
function druidify(force) {
if (force === undefined) {
force = false;
}
$('.query-and-save button').attr('disabled', 'disabled');
$('.btn-group.results span,a').attr('disabled', 'disabled');
$('div.alert').remove();
$('#is_cached').hide();
history.pushState({}, document.title, slice.querystring());
prepForm();
slice.render();
slice.render(force, druidify);
}

function initExploreView() {
Expand Down
7 changes: 5 additions & 2 deletions dashed/assets/javascripts/modules/dashed.js
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ var px = (function () {
container: container,
container_id: container_id,
selector: selector,
druidify: null,
querystring: function () {
var parser = document.createElement('a');
parser.href = data.json_endpoint;
Expand Down Expand Up @@ -184,14 +185,15 @@ var px = (function () {
clearInterval(timer);
token.find("img.loading").hide();
container.show();
var that = this;

var cachedSelector = null;
if (dashboard === undefined) {
cachedSelector = $('#is_cached');
if (data !== undefined && data.is_cached) {
cachedSelector
.click(function () {
slice.render(true);
that.druidify(true);
})
.attr('title', 'Served from data cached at ' + data.cached_dttm + '. Click to force-refresh')
.show()
Expand Down Expand Up @@ -269,10 +271,11 @@ var px = (function () {
}, 500);
});
},
render: function (force) {
render: function (force, druidify) {
if (force === undefined) {
force = false;
}
this.druidify = druidify;
this.force = force;
token.find("img.loading").show();
container.hide();
Expand Down

0 comments on commit fded04a

Please sign in to comment.