diff --git a/modules/monitoring/application/controllers/ServicesController.php b/modules/monitoring/application/controllers/ServicesController.php
index ca9788ff2..6877aca02 100644
--- a/modules/monitoring/application/controllers/ServicesController.php
+++ b/modules/monitoring/application/controllers/ServicesController.php
@@ -50,6 +50,7 @@ class Monitoring_ServicesController extends Controller
protected function handleCommandForm(ObjectsCommandForm $form)
{
$this->serviceList->setColumns(array(
+ 'host_icon_image',
'host_name',
'host_output',
'host_state',
@@ -94,6 +95,7 @@ class Monitoring_ServicesController extends Controller
->handleRequest();
$this->view->checkNowForm = $checkNowForm;
$this->serviceList->setColumns(array(
+ 'host_icon_image',
'host_name',
'host_output',
'host_state',
diff --git a/modules/monitoring/application/views/helpers/IconImage.php b/modules/monitoring/application/views/helpers/IconImage.php
new file mode 100644
index 000000000..2ed3b1d25
--- /dev/null
+++ b/modules/monitoring/application/views/helpers/IconImage.php
@@ -0,0 +1,46 @@
+host_icon_image && ! preg_match('/[\'"]/', $object->host_icon_image)) {
+ return $this->view->icon($this->view->resolveMacros($object->host_icon_image, $object));
+ }
+ return '';
+ }
+
+ /**
+ * Display the image_icon of a MonitoredObject
+ *
+ * @param MonitoredObject|stdClass $object The host or service
+ * @return string
+ */
+ public function service($object)
+ {
+ if ($object->service_icon_image && ! preg_match('/[\'"]/', $object->service_icon_image)) {
+ return $this->view->icon($this->view->resolveMacros($object->service_icon_image, $object));
+ }
+ return '';
+ }
+}
diff --git a/modules/monitoring/application/views/scripts/list/hosts.phtml b/modules/monitoring/application/views/scripts/list/hosts.phtml
index 89c2e7d26..a83f3bb8a 100644
--- a/modules/monitoring/application/views/scripts/list/hosts.phtml
+++ b/modules/monitoring/application/views/scripts/list/hosts.phtml
@@ -52,9 +52,7 @@ if (count($hosts) === 0) {
- host_icon_image && ! preg_match('/[\'"]/', $host->host_icon_image)): ?>
- = $this->icon($this->resolveMacros($host->host_icon_image, $host)) ?>
-
+ = $this->iconImage()->host($host) ?>
= implode(' ', $this->hostFlags($host)) ?>
= $this->qlink(
$host->host_display_name,
@@ -75,7 +73,7 @@ if (count($hosts) === 0) {
'host' => $host->host_name,
'service_problem' => 1,
'service_handled' => 0
- ),
+ ),
array(
'style' => 'font-weight: normal',
'title' => sprintf(
diff --git a/modules/monitoring/application/views/scripts/list/services.phtml b/modules/monitoring/application/views/scripts/list/services.phtml
index 12ba232cc..964a0e982 100644
--- a/modules/monitoring/application/views/scripts/list/services.phtml
+++ b/modules/monitoring/application/views/scripts/list/services.phtml
@@ -58,12 +58,8 @@ if (count($services) === 0) {
|
= $this->perfdata($service->service_perfdata, true, 8) ?>
-
+ = $this->iconImage()->service($service) ?>
= implode(' ', $this->serviceFlags($service)); ?>
-
- service_icon_image && ! preg_match('/[\'"]/', $service->service_icon_image)): ?>
- = $this->icon($this->resolveMacros($service->service_icon_image, $service)) ?>
-
= $this->qlink(
$service->service_display_name,
$serviceLink,
diff --git a/modules/monitoring/application/views/scripts/partials/host/object-header.phtml b/modules/monitoring/application/views/scripts/partials/host/object-header.phtml
index 127f492e6..ed7edae79 100644
--- a/modules/monitoring/application/views/scripts/partials/host/object-header.phtml
+++ b/modules/monitoring/application/views/scripts/partials/host/object-header.phtml
@@ -9,9 +9,7 @@ use Icinga\Module\Monitoring\Object\Host;
= $this->prefixedTimeSince($object->host_last_state_change, true); ?>
|
- host_icon_image && ! preg_match('/[\'"]/', $object->host_icon_image)): ?>
- = $this->icon($this->resolveMacros($object->host_icon_image, $object)) ?>
-
+ = $this->iconImage()->host($object) ?>
= $this->escape($object->host_display_name); ?>
host_display_name !== $object->host_name): ?>
(= $this->escape($object->host_name); ?>)
@@ -23,4 +21,4 @@ use Icinga\Module\Monitoring\Object\Host;
= $this->render('partials/host/statusicons.phtml'); ?>
|
-
\ No newline at end of file
+
diff --git a/modules/monitoring/application/views/scripts/partials/host/objects-header.phtml b/modules/monitoring/application/views/scripts/partials/host/objects-header.phtml
index b6856609c..bce62db6b 100644
--- a/modules/monitoring/application/views/scripts/partials/host/objects-header.phtml
+++ b/modules/monitoring/application/views/scripts/partials/host/objects-header.phtml
@@ -17,10 +17,8 @@ $i = 0;
= Host::getStateText($host->host_state, true); ?>
|
+ = $this->iconImage()->host($host) ?>
= implode(' ', $this->hostFlags($host)) ?>
- host_icon_image && ! preg_match('/[\'"]/', $host->host_icon_image)): ?>
- = $this->icon($this->resolveMacros($host->host_icon_image, $host)) ?>
-
= $this->escape($host->getName()); ?>
= $this->escape($host->host_output) ?>
|
diff --git a/modules/monitoring/application/views/scripts/partials/service/object-header.phtml b/modules/monitoring/application/views/scripts/partials/service/object-header.phtml
index b50aff9bc..c6dbb4730 100644
--- a/modules/monitoring/application/views/scripts/partials/service/object-header.phtml
+++ b/modules/monitoring/application/views/scripts/partials/service/object-header.phtml
@@ -10,9 +10,7 @@ use Icinga\Module\Monitoring\Object\Service;
= $this->prefixedTimeSince($object->host_last_state_change, true); ?>
- host_icon_image && ! preg_match('/[\'"]/', $object->host_icon_image)): ?>
- = $this->icon($this->resolveMacros($object->host_icon_image, $object)) ?>
-
+ = $this->iconImage()->service($object) ?>
= $this->escape($object->host_display_name); ?>
host_display_name !== $object->host_name): ?>
(= $this->escape($object->host_name); ?>)
@@ -30,9 +28,7 @@ use Icinga\Module\Monitoring\Object\Service;
= $this->prefixedTimeSince($object->service_last_state_change, true); ?>
|
- service_icon_image && ! preg_match('/[\'"]/', $object->service_icon_image)): ?>
- = $this->icon($this->resolveMacros($object->service_icon_image, $object)) ?>
-
+ = $this->iconImage()->host($object) ?>
= $this->translate('Service'); ?>: = $this->escape($object->service_display_name); ?>
service_display_name !== $object->service_description): ?>
(= $this->escape($object->service_description); ?>)
diff --git a/modules/monitoring/application/views/scripts/partials/service/objects-header.phtml b/modules/monitoring/application/views/scripts/partials/service/objects-header.phtml
index fe1e4b16a..176c43d92 100644
--- a/modules/monitoring/application/views/scripts/partials/service/objects-header.phtml
+++ b/modules/monitoring/application/views/scripts/partials/service/objects-header.phtml
@@ -15,10 +15,8 @@ $i = 0;
|
= Service::getStateText($service->service_state, true); ?>
|
+ = $this->iconImage()->service($service) ?>
= implode(' ', $this->serviceFlags($service)) ?>
- service_icon_image && ! preg_match('/[\'"]/', $service->service_icon_image)): ?>
- = $this->icon($this->resolveMacros($service->service_icon_image, $service)) ?>
-
= $this->escape($service->getName()); ?>
= $this->translate('on') ?>
|