From 9e480119984be264845395ac4632dcb4abbb1af6 Mon Sep 17 00:00:00 2001 From: Igor Gaponenko Date: Fri, 15 Dec 2023 00:11:33 +0000 Subject: [PATCH] Web Dashboard: follow up migration of the REST API --- src/www/qserv/js/QservCzarConfig.js | 26 +++++++++------------- src/www/qserv/js/QservCzarQueryProgress.js | 5 ++++- src/www/qserv/js/QservCzarStatistics.js | 7 ++++-- 3 files changed, 19 insertions(+), 19 deletions(-) diff --git a/src/www/qserv/js/QservCzarConfig.js b/src/www/qserv/js/QservCzarConfig.js index 98e4b4671..2e412e564 100644 --- a/src/www/qserv/js/QservCzarConfig.js +++ b/src/www/qserv/js/QservCzarConfig.js @@ -15,10 +15,8 @@ function(CSSLoader, class QservCzarConfig extends FwkApplication { - /** - * @returns the default update interval for the page - */ - static update_ival_sec() { return 10; } + static update_ival_sec = 10; /// The default update interval for the page. + static czar_name = "default"; /// The name of Czar. constructor(name) { super(name); @@ -33,7 +31,7 @@ function(CSSLoader, this._prev_update_sec = 0; } let now_sec = Fwk.now().sec; - if (now_sec - this._prev_update_sec > QservCzarConfig.update_ival_sec()) { + if (now_sec - this._prev_update_sec > QservCzarConfig.update_ival_sec) { this._prev_update_sec = now_sec; this._init(); this._load(); @@ -67,28 +65,24 @@ function(CSSLoader, this.fwk_app_container.html(html); } _table() { - if (_.isUndefined(this._table_obj)) { - this._table_obj = this.fwk_app_container.find('table#fwk-qserv-czar-config'); - } + if (_.isUndefined(this._table_obj)) this._table_obj = this.fwk_app_container.find('table#fwk-qserv-czar-config'); return this._table_obj; } _status() { - if (_.isUndefined(this._status_obj)) { - this._status_obj = this._table().children('caption'); - } + if (_.isUndefined(this._status_obj)) this._status_obj = this._table().children('caption'); return this._status_obj; } _load() { - if (this._loading === undefined) { - this._loading = false; - } + if (this._loading === undefined) this._loading = false; if (this._loading) return; this._loading = true; this._status().addClass('updating'); Fwk.web_service_GET( - "/replication/qserv/master/config", - {version: Common.RestAPIVersion}, + "/replication/qserv/master/config/" + QservCzarConfig.czar_name, + { timeout_sec: 2, + version: Common.RestAPIVersion + }, (data) => { this._display(data); if (data.success) { diff --git a/src/www/qserv/js/QservCzarQueryProgress.js b/src/www/qserv/js/QservCzarQueryProgress.js index 16d1dbecd..7d86533c1 100644 --- a/src/www/qserv/js/QservCzarQueryProgress.js +++ b/src/www/qserv/js/QservCzarQueryProgress.js @@ -19,6 +19,8 @@ function(CSSLoader, class QservCzarQueryProgress extends FwkApplication { + static czar_name = "default"; /// The name of Czar. + constructor(name) { super(name); this._data = undefined; @@ -194,8 +196,9 @@ function(CSSLoader, this._loading = true; this._status().addClass('updating'); Fwk.web_service_GET( - "replication/qserv/master/queries/active/progress", + "replication/qserv/master/queries/active/progress/" + QservCzarQueryProgress.czar_name, { version: Common.RestAPIVersion, + timeout_sec: 2, query_id: this._query_id(), last_seconds: this._last_seconds() }, diff --git a/src/www/qserv/js/QservCzarStatistics.js b/src/www/qserv/js/QservCzarStatistics.js index 3455f26c6..640742559 100644 --- a/src/www/qserv/js/QservCzarStatistics.js +++ b/src/www/qserv/js/QservCzarStatistics.js @@ -15,6 +15,8 @@ function(CSSLoader, class QservCzarStatistics extends FwkApplication { + static czar_name = "default"; /// The name of Czar. + constructor(name) { super(name); // The previous snapshot of the stats. It's used for reporting "deltas" @@ -234,8 +236,9 @@ function(CSSLoader, this._loading = true; this._status().addClass('updating'); Fwk.web_service_GET( - "/replication/qserv/master/status", - {version: Common.RestAPIVersion}, + "/replication/qserv/master/status/" + QservCzarStatistics.czar_name, + { timeout_sec: 2, + version: Common.RestAPIVersion}, (data) => { if (data.success) { this._display(data.status);