diff options
author | Valdis Murzins <valdis.murzins@zabbix.com> | 2021-05-08 18:18:30 +0300 |
---|---|---|
committer | Valdis Murzins <valdis.murzins@zabbix.com> | 2021-05-10 16:57:57 +0300 |
commit | a292b777ae6177ca2694f5aedebe51359bfd4daa (patch) | |
tree | 7123763327acf925278ba07d1689a9e2059ad6d5 /ui | |
parent | 92af08ce00bdecde18734db4e6f59a434cbe8fc9 (diff) |
..F....... [ZBXNEXT-6411] fixed TOC name selection for templates and host prototypes
Diffstat (limited to 'ui')
-rw-r--r-- | ui/app/controllers/CControllerPopupImportCompare.php | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/ui/app/controllers/CControllerPopupImportCompare.php b/ui/app/controllers/CControllerPopupImportCompare.php index e136f09a72c..5eebb73bb6d 100644 --- a/ui/app/controllers/CControllerPopupImportCompare.php +++ b/ui/app/controllers/CControllerPopupImportCompare.php @@ -444,7 +444,7 @@ class CControllerPopupImportCompare extends CController { $id = $object['uuid']; $this->toc[$change_type][$entity_type][] = [ - 'name' => $object['name'], + 'name' => $this->nameForToc($entity_type, $object), 'id' => $id ]; @@ -460,6 +460,17 @@ class CControllerPopupImportCompare extends CController { return $rows; } + private function nameForToc(string $entity_type, array $object): string { + switch ($entity_type) { + case 'templates': + return array_key_exists('name', $object) ? $object['name'] : $object['template']; + case 'host_prototypes': + return array_key_exists('name', $object) ? $object['name'] : $object['host']; + default: + return $object['name']; + } + } + private function convertToYaml($object): string { $writer = new CYamlExportWriter(); |