Hack to get the force refresh in the explore view

This commit is contained in:
Maxime Beauchemin 2016-03-22 18:10:36 -07:00
parent d8192eca0a
commit fded04a51d
2 changed files with 10 additions and 4 deletions

View File

@ -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() {

View File

@ -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;
@ -184,6 +185,7 @@ var px = (function () {
clearInterval(timer);
token.find("img.loading").hide();
container.show();
var that = this;
var cachedSelector = null;
if (dashboard === undefined) {
@ -191,7 +193,7 @@ var px = (function () {
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()
@ -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();