diff options
author | Alexander Shubin <aleksandrs.subins@zabbix.com> | 2021-03-01 15:54:57 +0300 |
---|---|---|
committer | Alexander Shubin <aleksandrs.subins@zabbix.com> | 2021-03-01 15:54:57 +0300 |
commit | 62b86e73f4b67549e019ad099bb773eb2848414f (patch) | |
tree | 1ba47ae242a2e917c01c90c9038b7cc256b9315a | |
parent | 8f76669227d862db6f1ab821c7f47bf0d7dfca3e (diff) |
..F....... [ZBXNEXT-6309] fixed map widget navigation
-rw-r--r-- | ui/include/classes/helpers/CDashboardHelper.php | 2 | ||||
-rw-r--r-- | ui/include/classes/html/CDashboardWidgetMap.php | 2 | ||||
-rw-r--r-- | ui/js/class.cnavtree.js | 8 | ||||
-rw-r--r-- | ui/js/class.dashboard.js | 4 | ||||
-rw-r--r-- | ui/js/class.dashboard.page.js | 16 |
5 files changed, 14 insertions, 18 deletions
diff --git a/ui/include/classes/helpers/CDashboardHelper.php b/ui/include/classes/helpers/CDashboardHelper.php index 2767c2dbfad..c7e2a9aedff 100644 --- a/ui/include/classes/helpers/CDashboardHelper.php +++ b/ui/include/classes/helpers/CDashboardHelper.php @@ -407,7 +407,7 @@ class CDashboardHelper { if ($widget_errors = $widget['form']->validate()) { if ($widget['name'] === '') { - $context = $this->hasInput('templateid') + $context = $templateid !== null ? CWidgetConfig::CONTEXT_TEMPLATE_DASHBOARD : CWidgetConfig::CONTEXT_DASHBOARD; diff --git a/ui/include/classes/html/CDashboardWidgetMap.php b/ui/include/classes/html/CDashboardWidgetMap.php index 5715c9b28c7..83b29f8f971 100644 --- a/ui/include/classes/html/CDashboardWidgetMap.php +++ b/ui/include/classes/html/CDashboardWidgetMap.php @@ -154,7 +154,7 @@ class CDashboardWidgetMap extends CDiv { 'data_name: "selected_mapid",'. 'callback: function(widget, data) {'. 'ZABBIX.Dashboard.setWidgetStorageValue('. - 'widget.uniqueid, \'current_sysmapid\', data[0].mapid'. + 'widget.uniqueid, \'current_sysmapid\', data.mapid'. ');'. 'ZABBIX.Dashboard.setWidgetStorageValue(widget.uniqueid, \'previous_maps\', "");'. 'ZABBIX.Dashboard.refreshWidget(widget.widgetid);'. diff --git a/ui/js/class.cnavtree.js b/ui/js/class.cnavtree.js index 627be12455c..3b8d632fd6c 100644 --- a/ui/js/class.cnavtree.js +++ b/ui/js/class.cnavtree.js @@ -1345,10 +1345,10 @@ jQuery(function($) { mapid_selector = '', prev_map_selector = ''; - mapid_selector = '.tree-item[data-sysmapid=' + data[0]['submapid'] + ']'; + mapid_selector = '.tree-item[data-sysmapid=' + data['submapid'] + ']'; - if (data[0]['previous_maps'].length) { - var prev_maps = data[0]['previous_maps'].split(','), + if (data['previous_maps'].length) { + var prev_maps = data['previous_maps'].split(','), prev_maps = prev_maps.length ? prev_maps[prev_maps.length-1] : null; @@ -1378,7 +1378,7 @@ jQuery(function($) { if (prev_map_selector.length && mapid_selector.length) { selector = prev_map_selector + ' > .tree-list > ' + mapid_selector; - if (!data[0]['moving_upward']) { + if (!data['moving_upward']) { selector = selector + ':first'; } item = $(selector.trim(selector), $this); diff --git a/ui/js/class.dashboard.js b/ui/js/class.dashboard.js index b624cc8787d..17eb57594c3 100644 --- a/ui/js/class.dashboard.js +++ b/ui/js/class.dashboard.js @@ -269,8 +269,8 @@ class CDashboard extends CBaseComponent { return this._selected_page.registerDataExchange(obj); } - widgetDataShare(widget, data_name) { - return this._selected_page.widgetDataShare(widget, data_name); + widgetDataShare(widget, data_name, data) { + return this._selected_page.widgetDataShare(widget, data_name, data); } callWidgetDataShare() { diff --git a/ui/js/class.dashboard.page.js b/ui/js/class.dashboard.page.js index eeb7c2f5f41..416eefde85a 100644 --- a/ui/js/class.dashboard.page.js +++ b/ui/js/class.dashboard.page.js @@ -709,20 +709,16 @@ class CDashboardPage { * * @param {object} widget Data origin widget * @param {string} data_name String to identify data shared + * @param {object} data Shared data * * @returns {boolean} Indicates either there was linked widget that was related to data origin widget */ - widgetDataShare(widget, data_name) { - const args = Array.prototype.slice.call(arguments, 2); + widgetDataShare(widget, data_name, data) { const uniqueid = widget.uniqueid; let ret = true; let index = -1; - if (!args.length) { - return false; - } - if (typeof this._data.widget_relations.relations[widget.uniqueid] === 'undefined' || this._data.widget_relations.relations[widget.uniqueid].length === 0) { ret = false; @@ -742,13 +738,13 @@ class CDashboardPage { if (index === -1) { this._data.data_buffer[uniqueid].push({ data_name: data_name, - args: args, + data: data, old: [] }); } else { - if (this._data.data_buffer[uniqueid][index].args !== args) { - this._data.data_buffer[uniqueid][index].args = args; + if (this._data.data_buffer[uniqueid][index].data !== data) { + this._data.data_buffer[uniqueid][index].data = data; this._data.data_buffer[uniqueid][index].old = []; } } @@ -783,7 +779,7 @@ class CDashboardPage { if (widget.length) { for (const task of this._data.widget_relations.tasks[dest_uid]) { if (task.data_name === buffer_data.data_name) { - task.callback.apply(this, [widget[0], buffer_data.args]); + task.callback.apply(this, [widget[0], buffer_data.data]); } } |