mirror of
https://github.com/Icinga/icingaweb2-module-director.git
synced 2025-07-31 01:34:12 +02:00
HostsController: renew multiselect action, clean up
This commit is contained in:
parent
b9fd1f42d9
commit
4830a2a879
@ -5,8 +5,10 @@ namespace Icinga\Module\Director\Controllers;
|
|||||||
use Icinga\Data\Filter\Filter;
|
use Icinga\Data\Filter\Filter;
|
||||||
use Icinga\Data\Filter\FilterChain;
|
use Icinga\Data\Filter\FilterChain;
|
||||||
use Icinga\Data\Filter\FilterExpression;
|
use Icinga\Data\Filter\FilterExpression;
|
||||||
|
use Icinga\Module\Director\Forms\IcingaAddServiceToMultipleHostsForm;
|
||||||
use Icinga\Module\Director\Objects\IcingaHost;
|
use Icinga\Module\Director\Objects\IcingaHost;
|
||||||
use Icinga\Module\Director\Web\Controller\ObjectsController;
|
use Icinga\Module\Director\Web\Controller\ObjectsController;
|
||||||
|
use ipl\Html\Link;
|
||||||
|
|
||||||
class HostsController extends ObjectsController
|
class HostsController extends ObjectsController
|
||||||
{
|
{
|
||||||
@ -28,27 +30,17 @@ class HostsController extends ObjectsController
|
|||||||
|
|
||||||
parent::editAction();
|
parent::editAction();
|
||||||
|
|
||||||
$this->addActionLink($this->view->qlink(
|
$this->actions()->add(Link::create(
|
||||||
$this->translate('Add Service'),
|
$this->translate('Add Service'),
|
||||||
$url,
|
$url,
|
||||||
null,
|
null,
|
||||||
array('class' => 'icon-plus')
|
['class' => 'icon-plus']
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function addActionLink($link)
|
|
||||||
{
|
|
||||||
if (! is_array($this->view->actionLinks)) {
|
|
||||||
$this->view->actionLinks = array();
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->view->actionLinks[] = $link;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function addserviceAction()
|
public function addserviceAction()
|
||||||
{
|
{
|
||||||
$this->singleTab($this->translate('Add Service'));
|
$this->addSingleTab($this->translate('Add Service'));
|
||||||
$filter = Filter::fromQueryString($this->params->toString());
|
$filter = Filter::fromQueryString($this->params->toString());
|
||||||
|
|
||||||
$objects = array();
|
$objects = array();
|
||||||
@ -64,16 +56,15 @@ class HostsController extends ObjectsController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$this->view->title = sprintf(
|
$this->addTitle(
|
||||||
$this->translate('Add service to %d hosts'),
|
$this->translate('Add service to %d hosts'),
|
||||||
count($objects)
|
count($objects)
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->view->form = $this->loadForm('IcingaAddServiceToMultipleHosts')
|
$this->content()->add(IcingaAddServiceToMultipleHostsForm::load()
|
||||||
->setHosts($objects)
|
->setHosts($objects)
|
||||||
->setDb($this->db())
|
->setDb($this->db())
|
||||||
->handleRequest();
|
->handleRequest()
|
||||||
|
);
|
||||||
$this->setViewScript('objects/form');
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user