diff --git a/web/static/graph.html b/web/static/graph.html index 37b2b7033..b0a99c8ec 100644 --- a/web/static/graph.html +++ b/web/static/graph.html @@ -43,7 +43,7 @@ - + diff --git a/web/static/js/graph.js b/web/static/js/graph.js index a3db2030b..5f5329937 100644 --- a/web/static/js/graph.js +++ b/web/static/js/graph.js @@ -76,9 +76,14 @@ Prometheus.Graph.prototype.initialize = function() { self.spinner = graphWrapper.find(".spinner"); self.evalStats = graphWrapper.find(".eval_stats"); - self.endDate = graphWrapper.find("input[name=end]"); - self.endDate.appendDtpicker(); - self.endDate.val("") + self.endDate = graphWrapper.find("input[name=end_input]"); + console.log(self.options) + if (self.options["end_input"]) { + self.endDate.appendDtpicker({"current": self.options["end_input"]}) + } else { + self.endDate.appendDtpicker(); + self.endDate.val("") + } self.endDate.change(function() { self.submitQuery() }); self.stacked.change(function() { self.updateGraph(); }); @@ -131,7 +136,7 @@ Prometheus.Graph.prototype.getOptions = function() { var optionInputs = [ "expr", "range_input", - "end", + "end_input", "step_input", "stacked" ]; @@ -189,6 +194,7 @@ Prometheus.Graph.prototype.decreaseRange = function() { }; Prometheus.Graph.prototype.getEndDate = function() { + var self = this if (!self.endDate || !self.endDate.val()) { return null; } @@ -196,6 +202,7 @@ Prometheus.Graph.prototype.getEndDate = function() { }; Prometheus.Graph.prototype.getOrSetEndDate = function() { + var self = this var date = self.getEndDate(); if (date) { return date @@ -239,7 +246,6 @@ Prometheus.Graph.prototype.submitQuery = function() { var data = self.queryForm.serialize(); var endDate = self.getEndDate() - if (endDate) { data = data + "&end=" + endDate/1000 }