mirror of
https://github.com/Icinga/icingaweb2-module-director.git
synced 2025-09-26 03:09:11 +02:00
ObjectController: use new DeploymentForm, tables
This commit is contained in:
parent
1df9ef13d9
commit
5d01c1d843
@ -6,12 +6,16 @@ use Exception;
|
|||||||
use Icinga\Exception\IcingaException;
|
use Icinga\Exception\IcingaException;
|
||||||
use Icinga\Exception\InvalidPropertyException;
|
use Icinga\Exception\InvalidPropertyException;
|
||||||
use Icinga\Exception\NotFoundError;
|
use Icinga\Exception\NotFoundError;
|
||||||
|
use Icinga\Module\Director\Deployment\DeploymentInfo;
|
||||||
use Icinga\Module\Director\Exception\DuplicateKeyException;
|
use Icinga\Module\Director\Exception\DuplicateKeyException;
|
||||||
use Icinga\Module\Director\Exception\NestingError;
|
use Icinga\Module\Director\Exception\NestingError;
|
||||||
|
use Icinga\Module\Director\Forms\DeploymentLinkForm;
|
||||||
use Icinga\Module\Director\Forms\IcingaObjectFieldForm;
|
use Icinga\Module\Director\Forms\IcingaObjectFieldForm;
|
||||||
use Icinga\Module\Director\Objects\IcingaObject;
|
use Icinga\Module\Director\Objects\IcingaObject;
|
||||||
|
use Icinga\Module\Director\Objects\IcingaObjectGroup;
|
||||||
use Icinga\Module\Director\Web\Controller\Extension\ObjectRestrictions;
|
use Icinga\Module\Director\Web\Controller\Extension\ObjectRestrictions;
|
||||||
use Icinga\Module\Director\Web\Form\DirectorObjectForm;
|
use Icinga\Module\Director\Web\Form\DirectorObjectForm;
|
||||||
|
use Icinga\Module\Director\Web\Table\ActivityLogTable;
|
||||||
use Icinga\Module\Director\Web\Table\GroupMemberTable;
|
use Icinga\Module\Director\Web\Table\GroupMemberTable;
|
||||||
use Icinga\Module\Director\Web\Tabs\ObjectTabs;
|
use Icinga\Module\Director\Web\Tabs\ObjectTabs;
|
||||||
use ipl\Html\Html;
|
use ipl\Html\Html;
|
||||||
@ -289,20 +293,16 @@ abstract class ObjectController extends ActionController
|
|||||||
$this->object->object_name
|
$this->object->object_name
|
||||||
);
|
);
|
||||||
$lastDeployedId = $db->getLastDeploymentActivityLogId();
|
$lastDeployedId = $db->getLastDeploymentActivityLogId();
|
||||||
$this->content()->add(
|
(new ActivityLogTable($db))
|
||||||
$this->applyPaginationLimits(
|
->setLastDeployedId($lastDeployedId)
|
||||||
$this->loadTable('activityLog')
|
->filterObject('icinga_' . $type, $this->object->object_name)
|
||||||
->setConnection($db)
|
->renderTo($this);
|
||||||
->setLastDeployedId($lastDeployedId)
|
|
||||||
->filterObject('icinga_' . $type, $this->object->object_name)
|
|
||||||
)
|
|
||||||
)->addAttributes(['data-base-target' => '_next']);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function membershipAction()
|
public function membershipAction()
|
||||||
{
|
{
|
||||||
$this->requireObject();
|
$this->requireObject();
|
||||||
if (! $this->object->isGroup()) {
|
if (! $this->object instanceof IcingaObjectGroup) {
|
||||||
throw new NotFoundError('Not Found');
|
throw new NotFoundError('Not Found');
|
||||||
}
|
}
|
||||||
$type = substr($this->getType(), 0, -5);
|
$type = substr($this->getType(), 0, -5);
|
||||||
@ -329,6 +329,7 @@ abstract class ObjectController extends ActionController
|
|||||||
|
|
||||||
protected function loadObject()
|
protected function loadObject()
|
||||||
{
|
{
|
||||||
|
$info = new DeploymentInfo($this->db());
|
||||||
if ($this->object === null) {
|
if ($this->object === null) {
|
||||||
if ($name = $this->params->get('name')) {
|
if ($name = $this->params->get('name')) {
|
||||||
$this->object = IcingaObject::loadByType(
|
$this->object = IcingaObject::loadByType(
|
||||||
@ -357,9 +358,13 @@ abstract class ObjectController extends ActionController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->view->undeployedChanges = $this->countUndeployedChanges();
|
$info->setObject($this->object);
|
||||||
$this->view->totalUndeployedChanges = $this->db()
|
}
|
||||||
->countActivitiesSinceLastDeployedConfig();
|
|
||||||
|
if (! $this->getRequest()->isApiRequest()) {
|
||||||
|
$this->actions()->add(
|
||||||
|
DeploymentLinkForm::create($info, $this->Auth())->handleRequest()
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->object;
|
return $this->object;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user