[icinga-checkins] icinga.org: icingaweb2/feature/add-to-dashboard-4537: Fix the add link to the resource configuration

git at icinga.org git at icinga.org
Wed Nov 19 11:48:08 CET 2014


Module: icingaweb2
Branch: feature/add-to-dashboard-4537
Commit: 268dc7e4b14bf685a8fb12e5b6c3a0ce57a1896f
URL:    https://git.icinga.org/?p=icingaweb2.git;a=commit;h=268dc7e4b14bf685a8fb12e5b6c3a0ce57a1896f

Author: Alexander Fuhr <alexander.fuhr at netways.de>
Date:   Tue Nov 18 18:06:36 2014 +0100

Fix the add link to the resource configuration

refs #7493

---

 .../application/forms/Config/BackendConfigForm.php |   28 +++++++++++++-------
 1 file changed, 19 insertions(+), 9 deletions(-)

diff --git a/modules/monitoring/application/forms/Config/BackendConfigForm.php b/modules/monitoring/application/forms/Config/BackendConfigForm.php
index f467b8f..4b1aa65 100644
--- a/modules/monitoring/application/forms/Config/BackendConfigForm.php
+++ b/modules/monitoring/application/forms/Config/BackendConfigForm.php
@@ -237,18 +237,28 @@ class BackendConfigForm extends ConfigForm
             )
         );
 
-        $resourceName = (isset($formData['resource'])) ? $formData['resource'] : $this->getValue('resource');
-        if ($resourceElement) {
-            $resourceElement->getDecorator('Description')->setEscape(false);
-            $link = sprintf(
-                '<a href="%s" data-base-target="_main">%s</a>',
-                $this->getView()->href('/icingaweb/config/editresource', array('resource' => $resourceName)),
-                mt('monitoring', 'Show resource configuration')
-            );
-            $resourceElement->setDescription($resourceElement->getDescription() . ' (' . $link . ')');
+        if (empty($formData)) {
+            $options = $resourceElement->options;
+            $resourceName = array_shift($options);
+        } else {
+            $resourceName = (isset($formData['resource'])) ? $formData['resource'] : $this->getValue('resource');
         }
 
         $this->addElement($resourceElement);
 
+        if ($resourceElement) {
+            $this->addElement(
+                'note',
+                'resource_note',
+                array(
+                    'value' => sprintf(
+                        '<a href="%s" data-base-target="_main">%s</a>',
+                        $this->getView()->href('/icingaweb/config/editresource', array('resource' => $resourceName)),
+                        mt('monitoring', 'Show resource configuration')
+                    ),
+                    'escape' => false
+                )
+            );
+        }
     }
 }



More information about the icinga-checkins mailing list