2015-04-24 08:26:44 -04:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace Icinga\Module\Director\Forms;
|
|
|
|
|
|
|
|
|
|
use Icinga\Module\Director\Web\Form\DirectorObjectForm;
|
|
|
|
|
|
|
|
|
|
class IcingaCommandForm extends DirectorObjectForm
|
|
|
|
|
{
|
|
|
|
|
public function setup()
|
|
|
|
|
{
|
2016-02-17 15:58:28 -05:00
|
|
|
$this->addObjectTypeElement();
|
2016-03-07 08:20:58 -05:00
|
|
|
if (! $this->hasObjectType()) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
2016-02-17 15:58:28 -05:00
|
|
|
|
|
|
|
|
$this->addElement('select', 'methods_execute', array(
|
|
|
|
|
'label' => $this->translate('Command type'),
|
|
|
|
|
'multiOptions' => array(
|
|
|
|
|
null => '- please choose -',
|
|
|
|
|
'PluginCheck' => 'Plugin Check Command',
|
|
|
|
|
'PluginNotification' => 'Notification Plugin Command',
|
|
|
|
|
'PluginEvent' => 'Event Plugin Command',
|
|
|
|
|
'IcingaCheck' => 'Icinga Check Command',
|
|
|
|
|
'ClusterCheck' => 'Icinga Cluster Command',
|
|
|
|
|
'RandomCheck' => 'Random Check Command',
|
|
|
|
|
'ClusterZoneCheck' => 'Icinga Cluster Zone Check Command',
|
|
|
|
|
'CrlCheck' => 'Crl Check Command',
|
|
|
|
|
),
|
|
|
|
|
'required' => ! $this->isTemplate(),
|
|
|
|
|
'class' => 'autosubmit'
|
|
|
|
|
));
|
2015-04-24 08:26:44 -04:00
|
|
|
|
|
|
|
|
$this->addElement('text', 'object_name', array(
|
|
|
|
|
'label' => $this->translate('Command name'),
|
|
|
|
|
'required' => true,
|
|
|
|
|
'description' => $this->translate('Identifier for the Icinga command you are going to create')
|
|
|
|
|
));
|
|
|
|
|
|
2015-11-06 03:12:19 -05:00
|
|
|
$this->addImportsElement();
|
|
|
|
|
|
2015-08-28 17:37:06 -04:00
|
|
|
$this->addElement('text', 'command', array(
|
|
|
|
|
'label' => $this->translate('Command'),
|
2015-12-01 20:45:16 -05:00
|
|
|
'required' => ! $this->isTemplate(),
|
2016-02-26 06:42:21 -05:00
|
|
|
'description' => $this->translate(
|
|
|
|
|
'The command Icinga should run. Absolute paths are accepted as provided,'
|
|
|
|
|
. ' relative paths are prefixed with "PluginDir + ", similar Constant prefixes are allowed.'
|
|
|
|
|
. ' Spaces will lead to separation of command path and standalone arguments. Please note that'
|
|
|
|
|
. ' this means that we do not support spaces in plugin names and paths right now.'
|
|
|
|
|
)
|
2015-08-28 17:37:06 -04:00
|
|
|
));
|
|
|
|
|
|
2015-04-24 08:26:44 -04:00
|
|
|
$this->addElement('text', 'timeout', array(
|
|
|
|
|
'label' => $this->translate('Timeout'),
|
|
|
|
|
'description' => $this->translate('Optional command timeout')
|
|
|
|
|
));
|
2016-02-17 14:10:22 -05:00
|
|
|
$this->addDisabledElement();
|
2015-04-24 08:26:44 -04:00
|
|
|
|
2015-11-06 03:12:19 -05:00
|
|
|
$this->setButtons();
|
2015-04-24 08:26:44 -04:00
|
|
|
}
|
|
|
|
|
}
|