mirror of
https://github.com/prometheus/prometheus.git
synced 2025-03-05 20:59:13 -08:00
Neurotic cleanups to graph.js
This commit is contained in:
parent
70490fe568
commit
d770783777
File diff suppressed because one or more lines are too long
|
@ -8,7 +8,7 @@ Handlebars.registerHelper('pathPrefix', function() { return PATH_PREFIX; });
|
||||||
|
|
||||||
Prometheus.Graph = function(element, options) {
|
Prometheus.Graph = function(element, options) {
|
||||||
this.el = element;
|
this.el = element;
|
||||||
this.graphHtml = null;
|
this.graphHTML = null;
|
||||||
this.options = options;
|
this.options = options;
|
||||||
this.changeHandler = null;
|
this.changeHandler = null;
|
||||||
this.rickshawGraph = null;
|
this.rickshawGraph = null;
|
||||||
|
@ -46,8 +46,8 @@ Prometheus.Graph.prototype.initialize = function() {
|
||||||
|
|
||||||
// Draw graph controls and container from Handlebars template.
|
// Draw graph controls and container from Handlebars template.
|
||||||
|
|
||||||
self.graphHtml = $(graphTemplate(self.options));
|
self.graphHTML = $(graphTemplate(self.options));
|
||||||
self.el.append(self.graphHtml);
|
self.el.append(self.graphHTML);
|
||||||
|
|
||||||
// Get references to all the interesting elements in the graph container and
|
// Get references to all the interesting elements in the graph container and
|
||||||
// bind event handlers.
|
// bind event handlers.
|
||||||
|
@ -90,7 +90,7 @@ Prometheus.Graph.prototype.initialize = function() {
|
||||||
self.submitQuery();
|
self.submitQuery();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Return moves focus back to expr instead of submitting.
|
// Return moves focus back to expr instead of submitting.
|
||||||
self.insertMetric.bind("keydown", "return", function(e) {
|
self.insertMetric.bind("keydown", "return", function(e) {
|
||||||
self.expr.focus();
|
self.expr.focus();
|
||||||
|
@ -188,7 +188,7 @@ Prometheus.Graph.prototype.populateInsertableMetrics = function() {
|
||||||
if (json.status !== "success") {
|
if (json.status !== "success") {
|
||||||
self.showError("Error loading available metrics!");
|
self.showError("Error loading available metrics!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var metrics = json.data;
|
var metrics = json.data;
|
||||||
for (var i = 0; i < metrics.length; i++) {
|
for (var i = 0; i < metrics.length; i++) {
|
||||||
self.insertMetric[0].options.add(new Option(metrics[i], metrics[i]));
|
self.insertMetric[0].options.add(new Option(metrics[i], metrics[i]));
|
||||||
|
@ -621,7 +621,7 @@ Prometheus.Graph.prototype.handleConsoleResponse = function(data, textStatus) {
|
||||||
|
|
||||||
Prometheus.Graph.prototype.remove = function() {
|
Prometheus.Graph.prototype.remove = function() {
|
||||||
var self = this;
|
var self = this;
|
||||||
$(self.graphHtml).remove();
|
$(self.graphHTML).remove();
|
||||||
graphs = graphs.filter(function(e) {return e !== self});
|
graphs = graphs.filter(function(e) {return e !== self});
|
||||||
storeGraphOptionsInURL();
|
storeGraphOptionsInURL();
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue