Skip to content

Commit

Permalink
Web Dashboard: follow up migration of the REST API
Browse files Browse the repository at this point in the history
  • Loading branch information
iagaponenko committed Dec 15, 2023
1 parent a10694d commit 9e48011
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 19 deletions.
26 changes: 10 additions & 16 deletions src/www/qserv/js/QservCzarConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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();
Expand Down Expand Up @@ -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) {
Expand Down
5 changes: 4 additions & 1 deletion src/www/qserv/js/QservCzarQueryProgress.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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()
},
Expand Down
7 changes: 5 additions & 2 deletions src/www/qserv/js/QservCzarStatistics.js
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 9e48011

Please sign in to comment.