mirror of
https://github.com/Icinga/icingaweb2-module-director.git
synced 2025-07-31 01:34:12 +02:00
CommandArgument: simple form and table
This commit is contained in:
parent
825602f509
commit
5e21301eb5
36
application/forms/IcingaCommandArgumentForm.php
Normal file
36
application/forms/IcingaCommandArgumentForm.php
Normal file
@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
namespace Icinga\Module\Director\Forms;
|
||||
|
||||
use Icinga\Module\Director\Web\Form\DirectorObjectForm;
|
||||
|
||||
class IcingaCommandArgumentForm extends DirectorObjectForm
|
||||
{
|
||||
public function setup()
|
||||
{
|
||||
|
||||
$this->addElement('select', 'command_id', array(
|
||||
'label' => $this->translate('Check command'),
|
||||
'description' => $this->translate('Check command definition')
|
||||
));
|
||||
|
||||
$this->addElement('text', 'argument_name', array(
|
||||
'label' => $this->translate('Argument name'),
|
||||
'required' => true,
|
||||
'description' => $this->translate('e.g. -H or --hostname, empty means "skip_key"')
|
||||
));
|
||||
|
||||
$this->addElement('text', 'argument_value', array(
|
||||
'label' => $this->translate('Value'),
|
||||
'description' => $this->translate('e.g. 5%, $hostname$, $lower$%:$upper$%')
|
||||
));
|
||||
/*
|
||||
$this->optionalBoolean(
|
||||
'required',
|
||||
$this->translate('Required'),
|
||||
$this->translate('Whether this is a mandatory parameter')
|
||||
);
|
||||
*/
|
||||
$this->addElement('submit', $this->translate('Store'));
|
||||
}
|
||||
}
|
49
application/tables/IcingaCommandArgumentTable.php
Normal file
49
application/tables/IcingaCommandArgumentTable.php
Normal file
@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
namespace Icinga\Module\Director\Tables;
|
||||
|
||||
use Icinga\Module\Director\Web\Table\QuickTable;
|
||||
|
||||
class IcingaCommandArgumentTable extends QuickTable
|
||||
{
|
||||
public function getColumns()
|
||||
{
|
||||
return array(
|
||||
'id' => 'ca.id',
|
||||
'command' => 'c.object_name',
|
||||
'argument_name' => 'ca.argument_name',
|
||||
'argument_value' => 'ca.argument_value',
|
||||
// 'required' => 'ca.required',
|
||||
);
|
||||
}
|
||||
|
||||
protected function getActionUrl($row)
|
||||
{
|
||||
return $this->url('director/object/commandargument', array('id' => $row->id));
|
||||
}
|
||||
|
||||
public function getTitles()
|
||||
{
|
||||
$view = $this->view();
|
||||
return array(
|
||||
$view->translate('Command'),
|
||||
$view->translate('Argument'),
|
||||
$view->translate('Value'),
|
||||
);
|
||||
}
|
||||
|
||||
public function fetchData()
|
||||
{
|
||||
$db = $this->connection()->getConnection();
|
||||
$query = $db->select()->from(
|
||||
array('ca' => 'icinga_command_argument'),
|
||||
$this->getColumns()
|
||||
)->joinLeft(
|
||||
array('c' => 'icinga_command'),
|
||||
'ca.command_id = c.id',
|
||||
array()
|
||||
);
|
||||
|
||||
return $db->fetchAll($query);
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user