[icinga-checkins] icinga.org: icingaweb2-module-director/feature/propose-more-vars-12972: IcingaObjectFieldForm: also propose existing...

git at icinga.org git at icinga.org
Tue Oct 25 00:04:10 CEST 2016


Module: icingaweb2-module-director
Branch: feature/propose-more-vars-12972
Commit: ddfa6e0aa6e923f780470235ab5b77b87eefa5e6
URL:    https://git.icinga.org/?p=icingaweb2-module-director.git;a=commit;h=ddfa6e0aa6e923f780470235ab5b77b87eefa5e6

Author: Thomas Gelf <thomas at gelf.net>
Date:   Mon Oct 24 21:32:22 2016 +0000

IcingaObjectFieldForm: also propose existing...

...command vars

---

 application/forms/IcingaObjectFieldForm.php |   12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/application/forms/IcingaObjectFieldForm.php b/application/forms/IcingaObjectFieldForm.php
index 18c798c..e6503fb 100644
--- a/application/forms/IcingaObjectFieldForm.php
+++ b/application/forms/IcingaObjectFieldForm.php
@@ -73,6 +73,11 @@ class IcingaObjectFieldForm extends DirectorObjectForm
             }
         }
 
+        $objectVars = null;
+        if ($this->icingaObject->supportsCustomVars()) {
+            $objectVars = (array) $this->icingaObject->vars;
+        }
+
         // Prepare combined fields array
         $fields = array();
         if (! empty($suggestedFields)) {
@@ -80,6 +85,13 @@ class IcingaObjectFieldForm extends DirectorObjectForm
             $fields[$this->translate('Suggested fields')] = $suggestedFields;
         }
 
+        if ($objectVars) {
+            $vars = array_keys($objectVars);
+            $vars = array_combine($vars, $vars);
+            ksort($objectVars);
+            $fields[$this->translate('Defined vars')] = $vars;
+        }
+
         if (! empty($argumentVars)) {
             ksort($argumentVars);
             $fields[$this->translate('Argument macros')] = $argumentVars;



More information about the icinga-checkins mailing list