From cb09c8acdc2eaaaa988c7d35835f6332a57def68 Mon Sep 17 00:00:00 2001 From: Marius Hein Date: Fri, 7 Nov 2014 14:20:47 +0100 Subject: [PATCH] Backend/Config: Add shortlink to resource fixes #7493 --- .../forms/Config/BackendConfigForm.php | 20 +++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/modules/monitoring/application/forms/Config/BackendConfigForm.php b/modules/monitoring/application/forms/Config/BackendConfigForm.php index 4720466360..e18e882cad 100644 --- a/modules/monitoring/application/forms/Config/BackendConfigForm.php +++ b/modules/monitoring/application/forms/Config/BackendConfigForm.php @@ -225,15 +225,31 @@ public function createElements(array $formData) 'value' => $resourceType ) ); - $this->addElement( + + $resourceElement = $this->createElement( 'select', 'resource', array( 'required' => true, 'label' => mt('monitoring', 'Resource'), 'description' => mt('monitoring', 'The resource to use'), - 'multiOptions' => $this->resources[$resourceType] + 'multiOptions' => $this->resources[$resourceType], + 'autosubmit' => true ) ); + + $resourceName = (isset($formData['resource'])) ? $formData['resource'] : $this->getValue('resource'); + if ($resourceElement) { + $resourceElement->getDecorator('Description')->setEscape(false); + $link = sprintf( + '%s', + $this->getView()->href('/icingaweb/config/editresource', array('resource' => $resourceName)), + mt('monitoring', 'Show resource configuration') + ); + $resourceElement->setDescription($resourceElement->getDescription() . ' (' . $link . ')'); + } + + $this->addElement($resourceElement); + } }