diff options
author | Andrejs Griščenko <andrejs.griscenko@zabbix.com> | 2022-07-11 16:22:14 +0300 |
---|---|---|
committer | Andrejs Griščenko <andrejs.griscenko@zabbix.com> | 2022-07-11 16:22:14 +0300 |
commit | b3b292fb126dd85d451db9d1555b524c767b25d8 (patch) | |
tree | d79ab6eb3f825cc92a2861c3b166eab89f086ee3 | |
parent | 30853b7049554996a2f6668101c7b3c8a272a5fb (diff) | |
parent | d1159cfee4c3a35f2a8ded376beaf605f6d59f7c (diff) |
..F....... [ZBX-21157] fixed warning message overlaying error message when cloning a host
* commit 'd1159cfee4c3a35f2a8ded376beaf605f6d59f7c':
..F....... [ZBX-21157] fixed warning message overlaying error message when cloning a host
..F....... [ZBX-21157] reverted 8d0195297ca
.D........ [ZBX-21157] added changelog file
..F....... [ZBX-21157] fixed warning message overlaying error message when cloning a host
-rw-r--r-- | ChangeLog.d/bugfix/ZBX-21157 | 1 | ||||
-rw-r--r-- | ui/app/controllers/CControllerHostEdit.php | 5 | ||||
-rw-r--r-- | ui/app/partials/configuration.host.edit.html.php | 1 | ||||
-rw-r--r-- | ui/app/views/js/popup.host.edit.js.php | 8 | ||||
-rw-r--r-- | ui/app/views/popup.host.edit.php | 7 |
5 files changed, 13 insertions, 9 deletions
diff --git a/ChangeLog.d/bugfix/ZBX-21157 b/ChangeLog.d/bugfix/ZBX-21157 new file mode 100644 index 00000000000..004cefafe9f --- /dev/null +++ b/ChangeLog.d/bugfix/ZBX-21157 @@ -0,0 +1 @@ +..F....... [ZBX-21157] fixed warning message overlaying error message when cloning a host (agriscenko) diff --git a/ui/app/controllers/CControllerHostEdit.php b/ui/app/controllers/CControllerHostEdit.php index 51b2c6e58c0..886545c4a22 100644 --- a/ui/app/controllers/CControllerHostEdit.php +++ b/ui/app/controllers/CControllerHostEdit.php @@ -133,7 +133,8 @@ class CControllerHostEdit extends CController { if ($this->hasInput('full_clone') || $this->hasInput('clone')) { $clone_hostid = $this->getInput('hostid'); $this->host = ['hostid' => null]; - } else { + } + else { $hosts = API::Host()->get([ 'output' => ['hostid', 'host', 'name', 'status', 'description', 'proxy_hostid', 'ipmi_authtype', 'ipmi_privilege', 'ipmi_username', 'ipmi_password', 'tls_connect', 'tls_accept', 'tls_issuer', @@ -352,7 +353,7 @@ class CControllerHostEdit extends CController { */ protected function extendDiscoveryRule(?array &$editable_discovery_rule): void { $editable_discovery_rule = $this->host['discoveryRule'] - ? API::DiscoveryRule([ + ? API::DiscoveryRule()->get([ 'output' => [], 'itemids' => array_column($this->host['discoveryRule'], 'itemid'), 'editable' => true, diff --git a/ui/app/partials/configuration.host.edit.html.php b/ui/app/partials/configuration.host.edit.html.php index a1a2f97df3d..43622b486c2 100644 --- a/ui/app/partials/configuration.host.edit.html.php +++ b/ui/app/partials/configuration.host.edit.html.php @@ -550,6 +550,5 @@ if (array_key_exists('buttons', $data)) { } $host_form - ->addItem($data['warning']) ->addItem($tabs) ->show(); diff --git a/ui/app/views/js/popup.host.edit.js.php b/ui/app/views/js/popup.host.edit.js.php index 8557d0bf86c..c22ff8ab198 100644 --- a/ui/app/views/js/popup.host.edit.js.php +++ b/ui/app/views/js/popup.host.edit.js.php @@ -29,7 +29,7 @@ window.host_edit_popup = { dialogue: null, form: null, - init({popup_url, form_name, host_interfaces, host_is_discovered}) { + init({popup_url, form_name, host_interfaces, host_is_discovered, warning}) { this.overlay = overlays_stack.getById('host_edit'); this.dialogue = this.overlay.$dialogue[0]; this.form = this.overlay.$dialogue.$body[0].querySelector('form'); @@ -39,6 +39,12 @@ window.host_edit_popup = { history.replaceState({}, '', popup_url); host_edit.init({form_name, host_interfaces, host_is_discovered}); + + if (warning !== null) { + const message_box = makeMessageBox('warning', warning, null, true, false)[0]; + + this.form.parentNode.insertBefore(message_box, this.form); + } }, addEventListeners() { diff --git a/ui/app/views/popup.host.edit.php b/ui/app/views/popup.host.edit.php index 7923458b968..64ec911da05 100644 --- a/ui/app/views/popup.host.edit.php +++ b/ui/app/views/popup.host.edit.php @@ -89,10 +89,6 @@ else { ]; } -if ($data['warning']) { - $data['warning'] = makeMessageBox(ZBX_STYLE_MSG_WARNING, [['message' => $data['warning']]]); -} - $output = [ 'header' => ($data['hostid'] == 0) ? _('New host') : _('Host'), 'body' => (new CPartial('configuration.host.edit.html', $data))->getOutput(), @@ -102,7 +98,8 @@ $output = [ 'popup_url' => $popup_url->getUrl(), 'form_name' => $data['form_name'], 'host_interfaces' => $data['host']['interfaces'], - 'host_is_discovered' => ($data['host']['flags'] == ZBX_FLAG_DISCOVERY_CREATED) + 'host_is_discovered' => ($data['host']['flags'] == ZBX_FLAG_DISCOVERY_CREATED), + 'warning' => $data['warning'] ]).');', 'buttons' => $buttons ]; |