diff options
author | Gregory Chalenko <gregory.chalenko@zabbix.com> | 2021-04-30 21:15:51 +0300 |
---|---|---|
committer | Gregory Chalenko <gregory.chalenko@zabbix.com> | 2021-04-30 21:15:51 +0300 |
commit | 90438eb423eb4a36832beb6c5dd7c80accdee41e (patch) | |
tree | 04bc6038d9e8ca037cb07212c7e6a6ead14e21e7 /ui/app/controllers | |
parent | 0e07949a74c9e6fb253faf72cf946b9afcea28b6 (diff) |
..F....... [ZBXNEXT-114,ZBXNEXT-6572] minor fixes
Diffstat (limited to 'ui/app/controllers')
-rw-r--r-- | ui/app/controllers/CControllerPopupGeneric.php | 2 | ||||
-rw-r--r-- | ui/app/controllers/CControllerPopupValueMapEdit.php | 20 |
2 files changed, 20 insertions, 2 deletions
diff --git a/ui/app/controllers/CControllerPopupGeneric.php b/ui/app/controllers/CControllerPopupGeneric.php index 4761a29972e..fddb2bff5b9 100644 --- a/ui/app/controllers/CControllerPopupGeneric.php +++ b/ui/app/controllers/CControllerPopupGeneric.php @@ -1360,7 +1360,7 @@ class CControllerPopupGeneric extends CController { 'id' => $db_valuemap['valuemapid'], 'hostname' => $hosts[$db_valuemap['hostid']]['name'], 'name' => $db_valuemap['name'], - 'mappings' => $db_valuemap['mappings'], + 'mappings' => array_values($db_valuemap['mappings']), '_disabled' => in_array($db_valuemap['name'], $disable_names) ]; diff --git a/ui/app/controllers/CControllerPopupValueMapEdit.php b/ui/app/controllers/CControllerPopupValueMapEdit.php index 75759a78325..13b89533a0c 100644 --- a/ui/app/controllers/CControllerPopupValueMapEdit.php +++ b/ui/app/controllers/CControllerPopupValueMapEdit.php @@ -67,9 +67,27 @@ class CControllerPopupValueMapEdit extends CController { $this->getInputs($data, array_keys($data)); if (!$data['mappings']) { - $data['mappings'][] = ['type' => VALUEMAP_MAPPING_TYPE_EQUAL, 'value' => '', 'newvalue' => '']; + $mappings = ['type' => VALUEMAP_MAPPING_TYPE_EQUAL, 'value' => '', 'newvalue' => '']; } + else { + $mappings = []; + $default = []; + foreach ($data['mappings'] as $mapping) { + if ($mapping['type'] == VALUEMAP_MAPPING_TYPE_DEFAULT) { + $default = $mapping; + } + else { + $mappings[] = $mapping; + } + } + + if ($default) { + $mappings[] = $default; + } + } + + $data['mappings'] = $mappings; $data += [ 'title' => _('Value mapping'), 'user' => [ |