[icinga-checkins] icinga.org: icingaweb2-module-director/master: DirectorObjectForm: provide event command for...

git at icinga.org git at icinga.org
Wed Jul 20 17:55:07 CEST 2016


Module: icingaweb2-module-director
Branch: master
Commit: c2f3609cc6e896ad591b410e10e10538a98e716b
URL:    https://git.icinga.org/?p=icingaweb2-module-director.git;a=commit;h=c2f3609cc6e896ad591b410e10e10538a98e716b

Author: Thomas Gelf <thomas at gelf.net>
Date:   Wed Jul 20 17:53:19 2016 +0200

DirectorObjectForm: provide event command for...

...hosts and services

fixes #12117
fixes #12126

---

 library/Director/Db.php                          |    9 +++++++++
 library/Director/Web/Form/DirectorObjectForm.php |   12 ++++++++++++
 2 files changed, 21 insertions(+)

diff --git a/library/Director/Db.php b/library/Director/Db.php
index 9f5159f..7ec564a 100644
--- a/library/Director/Db.php
+++ b/library/Director/Db.php
@@ -489,6 +489,15 @@ class Db extends DbConnection
         return $this->enumIcingaObjects('command', $filters);
     }
 
+    public function enumEventcommands()
+    {
+        $filters = array(
+            'methods_execute = ?' => 'PluginEvent',
+
+        );
+        return $this->enumIcingaObjects('command', $filters);
+    }
+
     public function enumNotificationCommands()
     {
         $filters = array(
diff --git a/library/Director/Web/Form/DirectorObjectForm.php b/library/Director/Web/Form/DirectorObjectForm.php
index fa9864c..ab3d9e5 100644
--- a/library/Director/Web/Form/DirectorObjectForm.php
+++ b/library/Director/Web/Form/DirectorObjectForm.php
@@ -1177,6 +1177,18 @@ abstract class DirectorObjectForm extends QuickForm
         ));
         $this->addToCheckExecutionDisplayGroup('check_command_id');
 
+        $eventCommands = $this->db->enumEventCommands();
+
+        if (! empty($eventCommands)) {
+            $this->addElement('select', 'event_command_id', array(
+                'label' => $this->translate('Event command'),
+                'description'  => $this->translate('Event command definition'),
+                'multiOptions' => $this->optionalEnum($eventCommands),
+                'class'        => 'autosubmit',
+            ));
+            $this->addToCheckExecutionDisplayGroup('event_command_id');
+        }
+
         return $this;
     }
 



More information about the icinga-checkins mailing list