Commands: show external commands separately

This commit is contained in:
Thomas Gelf 2017-07-20 17:19:51 +02:00
parent 6db1f01b6e
commit d16bc24b1c
5 changed files with 42 additions and 6 deletions

View File

@ -6,4 +6,15 @@ use Icinga\Module\Director\Web\Controller\ObjectsController;
class CommandsController extends ObjectsController class CommandsController extends ObjectsController
{ {
public function indexAction()
{
parent::indexAction();
$validTypes = ['object', 'external_object'];
$type = $this->params->get('type', 'object');
if (! in_array($type, $validTypes)) {
$type = 'object';
}
$this->table->setType($type);
}
} }

View File

@ -6,10 +6,10 @@ class CommandsDashboard extends Dashboard
{ {
protected $dashletNames = array( protected $dashletNames = array(
'CheckCommands', 'CheckCommands',
// 'ExternalCheckCommands', 'ExternalCheckCommands',
// 'NotificationCommands', // 'NotificationCommands',
// 'ExternalNotificationCommands', // 'ExternalNotificationCommands',
// 'CommandTemplates', 'CommandTemplates',
); );
public function getTitle() public function getTitle()

View File

@ -16,6 +16,11 @@ class CommandTemplatesDashlet extends CheckCommandsDashlet
public function getTitle() public function getTitle()
{ {
return $this->translate('External Notification Commands'); return $this->translate('Command Templates');
}
public function getUrl()
{
return 'director/commands/templates';
} }
} }

View File

@ -9,13 +9,18 @@ class ExternalCheckCommandsDashlet extends CheckCommandsDashlet
public function getSummary() public function getSummary()
{ {
return $this->translate( return $this->translate(
'External Check Commands have been defined in your local Icinga 2' 'External Commands have been defined in your local Icinga 2'
. ' Configuration. ' . ' Configuration.'
); );
} }
public function getTitle() public function getTitle()
{ {
return $this->translate('External Check Commands'); return $this->translate('External Commands');
}
public function getUrl()
{
return 'director/commands?type=external_object';
} }
} }

View File

@ -2,6 +2,8 @@
namespace Icinga\Module\Director\Web\Table; namespace Icinga\Module\Director\Web\Table;
use Zend_Db_Select as ZfSelect;
class ObjectsTableCommand extends ObjectsTable class ObjectsTableCommand extends ObjectsTable
{ {
// TODO: external commands? Notifications separately? // TODO: external commands? Notifications separately?
@ -21,4 +23,17 @@ class ObjectsTableCommand extends ObjectsTable
'object_name' => 'Command', 'object_name' => 'Command',
'command' => 'Command line' 'command' => 'Command line'
]; ];
private $objectType;
public function setType($type)
{
$this->getQuery()->where('object_type = ?', $type);
return $this;
}
protected function applyObjectTypeFilter(ZfSelect $query)
{
return $query;
}
} }