[hotfix] periodic refresh dashboard feature had broken caching

This commit is contained in:
Maxime Beauchemin 2016-04-25 15:28:14 -07:00
parent 37be01bc12
commit 7b1075990c
2 changed files with 13 additions and 7 deletions

View File

@ -18,6 +18,7 @@ var Dashboard = function (dashboardData) {
filters: {},
init: function () {
this.initDashboardView();
this.firstLoad = true;
px.initFavStars();
var sliceObjects = [],
dash = this;
@ -67,15 +68,17 @@ var Dashboard = function (dashboardData) {
startPeriodicRender: function (interval) {
this.stopPeriodicRender();
var dash = this;
var maxRandomDelay = Math.min(interval * 0.1, 5000);
var maxRandomDelay = Math.min(interval * 0.2, 5000);
var refreshAll = function () {
dash.slices.forEach(function (slice) {
var force = !dash.firstLoad;
setTimeout(function () {
slice.render(true);
},
//Randomize to prevent all widgets refreshing at the same time
maxRandomDelay * Math.random());
slice.render(force);
},
//Randomize to prevent all widgets refreshing at the same time
maxRandomDelay * Math.random());
});
dash.firstLoad = false;
};
var fetchAndRender = function () {

View File

@ -120,13 +120,16 @@ class BaseViz(object):
del d['action']
d.update(kwargs)
# Remove unchecked checkboxes because HTML is weird like that
for key in d.keys():
od = OrderedDict()
for key in sorted(d.keys()):
if d[key] is False:
del d[key]
else:
od[key] = d[key]
href = Href(
'/caravel/explore/{self.datasource.type}/'
'{self.datasource.id}/'.format(**locals()))
return href(d)
return href(od)
def get_df(self, query_obj=None):
"""Returns a pandas dataframe based on the query object"""