From 170da9460d60313639c4727dfd4cce019828e369 Mon Sep 17 00:00:00 2001 From: Julius Volz Date: Mon, 19 Jan 2015 13:33:56 +0100 Subject: [PATCH] Focus/typeahead fix. --- web/static/js/graph.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/web/static/js/graph.js b/web/static/js/graph.js index 4bf060543..3bcfce6ef 100644 --- a/web/static/js/graph.js +++ b/web/static/js/graph.js @@ -142,8 +142,6 @@ Prometheus.Graph.prototype.initialize = function() { self.expr.focus(); // refocusing }); - self.expr.focus(); // TODO: move to external Graph method. - self.populateInsertableMetrics(); if (self.expr.val()) { @@ -164,6 +162,9 @@ Prometheus.Graph.prototype.populateInsertableMetrics = function() { availableMetrics.push(json[i]); } self.expr.typeahead({source: availableMetrics}); + // This needs to happen after attaching the typeahead plugin, as it + // otherwise breaks the typeahead functionality. + self.expr.focus(); }, error: function() { self.showError("Error loading available metrics!");