Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/zabbix/zabbix.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/ui
diff options
context:
space:
mode:
authorValdis Murzins <valdis.murzins@zabbix.com>2021-05-08 18:18:30 +0300
committerValdis Murzins <valdis.murzins@zabbix.com>2021-05-10 16:57:57 +0300
commita292b777ae6177ca2694f5aedebe51359bfd4daa (patch)
tree7123763327acf925278ba07d1689a9e2059ad6d5 /ui
parent92af08ce00bdecde18734db4e6f59a434cbe8fc9 (diff)
..F....... [ZBXNEXT-6411] fixed TOC name selection for templates and host prototypes
Diffstat (limited to 'ui')
-rw-r--r--ui/app/controllers/CControllerPopupImportCompare.php13
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();