Skip to content

Commit

Permalink
Explore mode should only expose cache on first load
Browse files Browse the repository at this point in the history
  • Loading branch information
mistercrunch committed Mar 23, 2016
1 parent fded04a commit 417749f
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 11 deletions.
8 changes: 5 additions & 3 deletions dashed/assets/javascripts/explore.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ function druidify(force) {
$('#is_cached').hide();
history.pushState({}, document.title, slice.querystring());
prepForm();
slice.render(force, druidify);
slice.render(force);
}

function initExploreView() {
Expand Down Expand Up @@ -256,7 +256,9 @@ function initExploreView() {
}
});

$(".druidify").click(druidify);
$(".druidify").click(function () {
druidify(true);
});

function create_choices(term, data) {
var filtered = $(data).filter(function () {
Expand Down Expand Up @@ -319,7 +321,7 @@ $(document).ready(function () {
$('.slice').data('slice', slice);

// call vis render method, which issues ajax
druidify();
druidify(false);

// make checkbox inputs display as toggles
$(':checkbox')
Expand Down
8 changes: 1 addition & 7 deletions dashed/assets/javascripts/modules/dashed.js
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,6 @@ 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 @@ -185,16 +184,12 @@ 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 () {
that.druidify(true);
})
.attr('title', 'Served from data cached at ' + data.cached_dttm + '. Click to force-refresh')
.show()
.tooltip('fixTitle');
Expand Down Expand Up @@ -271,11 +266,10 @@ var px = (function () {
}, 500);
});
},
render: function (force, druidify) {
render: function (force) {
if (force === undefined) {
force = false;
}
this.druidify = druidify;
this.force = force;
token.find("img.loading").show();
container.hide();
Expand Down
1 change: 0 additions & 1 deletion dashed/assets/stylesheets/dashed.css
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,6 @@ li.widget .chart-header a {

#is_cached {
display: none;
cursor: pointer;
}

li.widget .chart-controls {
Expand Down

0 comments on commit 417749f

Please sign in to comment.