diff options
author | Alexander Shubin <aleksandrs.subins@zabbix.com> | 2021-02-26 13:07:30 +0300 |
---|---|---|
committer | Alexander Shubin <aleksandrs.subins@zabbix.com> | 2021-02-26 13:07:30 +0300 |
commit | d0ca3575ade8ddb2032889eed7daeaf1b219abbe (patch) | |
tree | 2bccbcdf7830985aa31d75a613a8d96d35f46c9e /ui | |
parent | 01e394f3e62a962c574753f6e69bdf99cc14a087 (diff) |
..F....... [ZBXNEXT-6309] fixed iterator hidden header
Diffstat (limited to 'ui')
-rw-r--r-- | ui/js/class.dashboard.page.js | 26 | ||||
-rwxr-xr-x | ui/js/class.dashboard.widget.iterator.js | 20 | ||||
-rw-r--r-- | ui/js/class.dashboard.widget.js | 4 |
3 files changed, 33 insertions, 17 deletions
diff --git a/ui/js/class.dashboard.page.js b/ui/js/class.dashboard.page.js index 4f4544fd0c5..02b61ac44dd 100644 --- a/ui/js/class.dashboard.page.js +++ b/ui/js/class.dashboard.page.js @@ -264,6 +264,7 @@ class CDashboardPage { }; let widget; + if (config.defaults.iterator) { widget = new CDashboardWidgetIterator({ min_rows: this._options['widget-min-rows'], @@ -2171,11 +2172,32 @@ class CDashboardPage { reused_widgetids.push(child.widgetid); } else { - iterator.addWidget({ + child = new CDashboardWidget({ ...child, defaults: this._data.widget_defaults[child.type], - uniqueid: this._generateUniqueId() + uniqueid: this._generateUniqueId(), + view_mode: iterator.getViewMode(), + cell_height: this._options['widget-height'], + cell_width: this._options['widget-width'], + parent: iterator, + is_editable: iterator.isEditable(), + is_new: false }); + + child + .activate() + .showPreloader() + .on(WIDGET_EVENT_EDIT_CLICK, (e) => { + this.editWidget(e.detail.target, e.target); + }) + .on(WIDGET_EVENT_ENTER, (e) => { + this._enterWidget(e.detail.target); + }) + .on(WIDGET_EVENT_LEAVE, (e) => { + this._leaveWidget(e.detail.target); + }); + + iterator.addChild(child); } }); diff --git a/ui/js/class.dashboard.widget.iterator.js b/ui/js/class.dashboard.widget.iterator.js index 11c089ecf4c..3029e6b8ba6 100755 --- a/ui/js/class.dashboard.widget.iterator.js +++ b/ui/js/class.dashboard.widget.iterator.js @@ -55,6 +55,10 @@ class CDashboardWidgetIterator extends CDashboardWidget { } } + getViewMode() { + return this.view_mode; + } + setViewMode(view_mode) { if (this.view_mode !== view_mode) { this.view_mode = view_mode; @@ -73,22 +77,8 @@ class CDashboardWidgetIterator extends CDashboardWidget { return this; } - addWidget(config) { - const child = new CDashboardWidget({ - view_mode: this.view_mode, - ...config, - cell_height: this._cell_height, - cell_width: this._cell_width, - parent: this, - is_editable: this._is_editable, - is_iterator: false, - is_new: false - }); - + addChild(child) { this.children.push(child); - - child.activate(); - child.showPreloader(); this.content_body.append(child.getView()); return this; diff --git a/ui/js/class.dashboard.widget.js b/ui/js/class.dashboard.widget.js index 7e9e80bf5f9..80c07a2560f 100644 --- a/ui/js/class.dashboard.widget.js +++ b/ui/js/class.dashboard.widget.js @@ -270,10 +270,14 @@ class CDashboardWidget extends CBaseComponent { showPreloader() { this.div.find(`.${this._css_classes.content}`).addClass('is-loading'); + + return this; } hidePreloader() { this.div.find(`.${this._css_classes.content}`).removeClass('is-loading'); + + return this; } startPreloader(timeout = this._preloader_timeout) { |