From c9d827c1d019c70adb2e0c6747d1695254ae175d Mon Sep 17 00:00:00 2001 From: TAY TS Date: Wed, 30 Sep 2020 17:06:42 +0800 Subject: [PATCH] Fix callback function bind with object as parameter (#7984) Signed-off-by: TAY TS --- web/ui/static/js/graph/index.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/web/ui/static/js/graph/index.js b/web/ui/static/js/graph/index.js index 3532015975..32a2ad5042 100644 --- a/web/ui/static/js/graph/index.js +++ b/web/ui/static/js/graph/index.js @@ -937,9 +937,11 @@ Prometheus.Page.prototype.init = function() { if (graphOptions.length === 0) { graphOptions.push({}); } - + var pageInstance = this; graphOptions.forEach(this.addGraph, this); - $("#add_graph").click(this.addGraph.bind(this, {})); + $("#add_graph").click(function() { + pageInstance.addGraph({}); + }); }; Prometheus.Page.prototype.parseURL = function() {