diff options
author | Alexander Shubin <aleksandrs.subins@zabbix.com> | 2021-02-24 14:28:38 +0300 |
---|---|---|
committer | Alexander Shubin <aleksandrs.subins@zabbix.com> | 2021-02-25 15:40:47 +0300 |
commit | 365f6b0bb9e9243d6941409d146d9810bd952e3a (patch) | |
tree | 0080ae8e4cde523814fd7555df2298be908fe6fd /ui | |
parent | e47a02422b235698c34f3bf829a2ad749cddfea6 (diff) |
..F....... [ZBXNEXT-6309] fixed code style
Diffstat (limited to 'ui')
-rwxr-xr-x | ui/js/class.dashboard.loader.js | 24 | ||||
-rw-r--r-- | ui/js/class.dashboard.page.js | 25 |
2 files changed, 14 insertions, 35 deletions
diff --git a/ui/js/class.dashboard.loader.js b/ui/js/class.dashboard.loader.js index e355b8226ce..71c10de70a6 100755 --- a/ui/js/class.dashboard.loader.js +++ b/ui/js/class.dashboard.loader.js @@ -1,23 +1 @@ -/* -** Zabbix -** Copyright (C) 2001-2021 Zabbix SIA -** -** This program is free software; you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation; either version 2 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program; if not, write to the Free Software -** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -**/ - - -class CDashboardLoader { - -} +/*
** Zabbix
** Copyright (C) 2001-2021 Zabbix SIA
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 2 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
**/
class CDashboardLoader {
constructor() {
this._cache = {};
}
getContent(key) {
if (this._cache[key] !== undefined) {
}
}
}
\ No newline at end of file diff --git a/ui/js/class.dashboard.page.js b/ui/js/class.dashboard.page.js index e5e271bf039..09eb50eab09 100644 --- a/ui/js/class.dashboard.page.js +++ b/ui/js/class.dashboard.page.js @@ -217,7 +217,7 @@ class CDashboardPage { addWidgets(widgets) { for (const w of widgets) { - this.addWidget(w); + this._addWidget(w); } for (const w of this._widgets) { @@ -225,22 +225,23 @@ class CDashboardPage { } } - addWidget(widget) { - widget = { - ...JSON.parse(JSON.stringify(widget)), - defaults: this._data.widget_defaults[widget.type], + _addWidget(config) { + config = { + ...config, + defaults: this._data.widget_defaults[config.type], uniqueid: this._generateUniqueId(), index: this._widgets.length, cell_height: this._options['widget-height'], cell_width: this._options['widget-width'], is_editable: this._options['editable'] && !this._options['kioskmode'], - dynamic_hostid: this._data.dashboard.dynamic_hostid !== null ? this._data.dashboard.dynamic_hostid : null + dynamic_hostid: this._data.dashboard.dynamic_hostid }; - if (widget.defaults.iterator) { + let widget; + if (config.defaults.iterator) { widget = new CDashboardWidgetIterator({ min_rows: this._options['widget-min-rows'], - ...widget + ...config }); widget @@ -262,7 +263,7 @@ class CDashboardPage { }) } else { - widget = new CDashboardWidget(widget); + widget = new CDashboardWidget(config); } widget @@ -502,7 +503,7 @@ class CDashboardPage { this._promiseScrollIntoView(pos) .then(() => { - this.addWidget(new_widget); + this._addWidget(new_widget); new_widget = this._widgets.slice(-1)[0]; // Restrict loading content prior to sanitizing widget fields. @@ -2770,7 +2771,7 @@ class CDashboardPage { this._promiseScrollIntoView(pos) .then(() => { - this.addWidget(widget_data); + this._addWidget(widget_data); this._data.pos_action = ''; // New widget is last element in data['widgets'] array. @@ -2819,7 +2820,7 @@ class CDashboardPage { // Disable position/size checking during addWidget call. this._data.pos_action = 'updateWidgetConfig'; - this.addWidget(widget_data); + this._addWidget(widget_data); this._data.pos_action = ''; // New widget is last element in data['widgets'] array. |