Fix context for the showWarning function (#5833)

* Fix context for the showWarning function

If the difference between the current time on a client and time on a server is quite big, Prometheus tries to show a related warning in UI on the Graph tab. But in the code, an incorrect context is used to invoke this method. As a result, an error is showed in the web developer console and the whole page stop working at all. This commit fixes the context.

CC @juliusv

Signed-off-by: Vyacheslav Kulakov <vkulakov@swiftserve.com>

* Fix context for the showWarning function

Fixed assets

CC @juliusv

Signed-off-by: Vyacheslav Kulakov <vkulakov@swiftserve.com>
This commit is contained in:
slava 2019-08-05 21:03:12 +03:00 committed by Julius Volz
parent a3487fc74c
commit 5e974d3170
2 changed files with 2 additions and 2 deletions

File diff suppressed because one or more lines are too long

View file

@ -246,7 +246,7 @@ Prometheus.Graph.prototype.checkTimeDrift = function() {
var diff = Math.abs(browserTime - serverTime); var diff = Math.abs(browserTime - serverTime);
if (diff >= 30) { if (diff >= 30) {
this.showWarning( self.showWarning(
"<div class=\"alert alert-warning\"><strong>Warning!</strong> Detected " + "<div class=\"alert alert-warning\"><strong>Warning!</strong> Detected " +
diff.toFixed(2) + diff.toFixed(2) +
" seconds time difference between your browser and the server. Prometheus relies on accurate time and time drift might cause unexpected query results.</div>" " seconds time difference between your browser and the server. Prometheus relies on accurate time and time drift might cause unexpected query results.</div>"