Skip to content
This repository was archived by the owner on Mar 15, 2018. It is now read-only.

Commit 1363bde

Browse files
committed
update the export as csv link when the graph view changes
1 parent 493834e commit 1363bde

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

media/js/impala/stats/dateutils.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
return this.forward(-by, unit);
4444
},
4545
pretty : function(del) {
46-
del = del || '-';
46+
del = del || '';
4747
return [this.getFullYear(), pad2(this.getMonth()+1), pad2(this.getDate())].join(del);
4848
},
4949
iso : function() {

media/js/impala/stats/stats.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,19 @@
2727
group: 'day'
2828
};
2929

30+
// Update the "Export as CSV" link when the view changes.
31+
(function() {
32+
var view = {},
33+
baseURL = $(".primary").attr("data-base_url");
34+
$(window).bind('changeview', function(e, newView) {
35+
_.extend(view, newView);
36+
var metric = view.metric,
37+
range = normalizeRange(view.range),
38+
url = baseURL + ([metric,'day',range.start.pretty(''),range.end.pretty('')]).join('-') + '.csv';
39+
$('#export_data').attr('href', url);
40+
});
41+
})();
42+
3043
$(window).trigger('changeview', initView);
3144
});
3245

0 commit comments

Comments
 (0)