From 4961bbd8d10a5a911b7faa81d1012a500fc7e47b Mon Sep 17 00:00:00 2001 From: Thomas Gelf Date: Thu, 6 Mar 2014 18:57:21 +0000 Subject: [PATCH] Object detail component cleanup, less HTML --- .../scripts/show/components/command.phtml | 42 +++------ .../scripts/show/components/contacts.phtml | 92 +++++++------------ .../scripts/show/components/customvars.phtml | 34 +++---- .../scripts/show/components/hostgroups.phtml | 34 +++---- .../show/components/servicegroups.phtml | 33 +++---- 5 files changed, 87 insertions(+), 148 deletions(-) diff --git a/modules/monitoring/application/views/scripts/show/components/command.phtml b/modules/monitoring/application/views/scripts/show/components/command.phtml index 6e76bbfc6..ec70c50a5 100644 --- a/modules/monitoring/application/views/scripts/show/components/command.phtml +++ b/modules/monitoring/application/views/scripts/show/components/command.phtml @@ -1,30 +1,16 @@ -
-
-
- Check Command -
-
+ +$parts = explode('!', $object->check_command); +$command = array_shift($parts); + +?> + translate('Command') ?> + escape($command) ?> + +\n %s\n %s\n\n"; +for ($i = 0; $i < count($parts); $i++) { + printf($row, '$ARG' . ($i + 1) . '$', $this->escape($parts[$i])); +} -
- - - - - - - - - -
Command - object->check_command, 2); - $command = array_shift($explodedCommand); - echo $command; - ?> -
Arguments - commandArguments($this->object->check_command); ?> -
-
-
diff --git a/modules/monitoring/application/views/scripts/show/components/contacts.phtml b/modules/monitoring/application/views/scripts/show/components/contacts.phtml index cbd1a8bb4..6ead26293 100644 --- a/modules/monitoring/application/views/scripts/show/components/contacts.phtml +++ b/modules/monitoring/application/views/scripts/show/components/contacts.phtml @@ -1,65 +1,39 @@ contacts as $contact) { - $contacts[] = '' - . $contact->contact_alias - . ''; + +if (! empty($object->contacts)) { + + $list = array(); + foreach ($object->contacts as $contact) { + $list[] = $this->qlink($contact->contact_alias, 'monitoring/show/contact', array( + 'contact_name' => $contact->contact_name + )); + } + + printf( + "%s%s %s\n", + $this->translate('Contacts'), + $this->img('img/icons/user_petrol.png'), + implode(', ', $list) + ); + } -?> -
-
-
- Contacts -
-
-
- -
- - No Contacts - - - -
-
- -contactgroups as $contactgroup) { - $contactgroups[] = '' - . $contactgroup->contactgroup_alias - . ''; + array('contactgroup_name' => $contactgroup->contactgroup_name) + ); + } + + printf( + "%s%s %s\n", + $this->translate('Contactgroups'), + $this->img('img/icons/user_petrol.png'), + implode(', ', $list) + ); + } -?> -
-
-
- Contactgroups -
-
-
- -
- - No Contactgroups - - - -
-
diff --git a/modules/monitoring/application/views/scripts/show/components/customvars.phtml b/modules/monitoring/application/views/scripts/show/components/customvars.phtml index e3ba9563b..9eeb4a0ac 100644 --- a/modules/monitoring/application/views/scripts/show/components/customvars.phtml +++ b/modules/monitoring/application/views/scripts/show/components/customvars.phtml @@ -1,22 +1,16 @@ -
-
-
- Custom Variables -
-
+ +if (! $object->customvars) { return; } + +foreach ($object->customvars as $name => $value) { + $name = ucwords(str_replace('_', ' ', strtolower($name))); + if (preg_match('~(?:pw|pass|community)~', strtolower($name))) { + $value = '***'; + } + printf( + "%s%s\n", + $this->escape($name), + $this->escape($value) + ); +} -
- object->customvars)): ?> - No customvars - -
- object->customvars as $varname => $varvalue): ?> -
-
- -
- -
-
\ No newline at end of file diff --git a/modules/monitoring/application/views/scripts/show/components/hostgroups.phtml b/modules/monitoring/application/views/scripts/show/components/hostgroups.phtml index 8f7709ef0..f0cb76140 100644 --- a/modules/monitoring/application/views/scripts/show/components/hostgroups.phtml +++ b/modules/monitoring/application/views/scripts/show/components/hostgroups.phtml @@ -1,25 +1,17 @@ hostgroups)) return; + +$list = array(); foreach ($object->hostgroups as $name => $alias) { - $hostgroups[] = '' - . $alias - . ''; + $list[] = $this->qlink($alias, 'monitoring/list/services', array( + 'hostgroup' => $name + )); } -?> -
-
-
- Hostgroups -
-
+printf( + "%s%s %s\n", + $this->translate('Hostgroups'), + $this->img('img/icons/hostgroup_petrol.png'), + implode(', ', $list) +); -
- -
- - No Hostgroups - - - -
-
diff --git a/modules/monitoring/application/views/scripts/show/components/servicegroups.phtml b/modules/monitoring/application/views/scripts/show/components/servicegroups.phtml index c4620e13f..1609eea13 100644 --- a/modules/monitoring/application/views/scripts/show/components/servicegroups.phtml +++ b/modules/monitoring/application/views/scripts/show/components/servicegroups.phtml @@ -1,25 +1,18 @@ servicegroups)) return; + +$list = array(); foreach ($object->servicegroups as $name => $alias) { - $servicegroups[] = '' - . $alias - . ''; + $list[] = $this->qlink($alias, 'monitoring/list/services', array( + 'servicegroup' => $name + )); } -?> -
-
-
- Servicegroups -
-
-
+printf( + "%s%s %s\n", + $this->translate('Servicegroups'), + $this->img('img/icons/servicegroup_petrol.png'), + implode(', ', $list) +); -
- - No Servicegroups - - - -
-