ServiceController: support the host parameter
This commit is contained in:
parent
59028ebeb4
commit
0f9f172ebb
|
@ -3,6 +3,8 @@
|
||||||
namespace Icinga\Module\Director\Controllers;
|
namespace Icinga\Module\Director\Controllers;
|
||||||
|
|
||||||
use Icinga\Module\Director\Web\Controller\ObjectController;
|
use Icinga\Module\Director\Web\Controller\ObjectController;
|
||||||
|
use Icinga\Module\Director\Objects\IcingaService;
|
||||||
|
use Icinga\Module\Director\Objects\IcingaHost;
|
||||||
|
|
||||||
class ServiceController extends ObjectController
|
class ServiceController extends ObjectController
|
||||||
{
|
{
|
||||||
|
@ -15,6 +17,12 @@ class ServiceController extends ObjectController
|
||||||
'urlParams' => array('name' => $this->object->object_name),
|
'urlParams' => array('name' => $this->object->object_name),
|
||||||
'label' => 'Assign'
|
'label' => 'Assign'
|
||||||
));
|
));
|
||||||
|
|
||||||
|
if ($host = $this->params->get('host')) {
|
||||||
|
foreach ($this->getTabs()->getTabs() as $tab) {
|
||||||
|
$tab->getUrl()->setParam('host', $host);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -32,4 +40,21 @@ class ServiceController extends ObjectController
|
||||||
$this->view->title = 'Assign service to host';
|
$this->view->title = 'Assign service to host';
|
||||||
$this->render('object/fields', null, true); // TODO: render table
|
$this->render('object/fields', null, true); // TODO: render table
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function loadObject()
|
||||||
|
{
|
||||||
|
if ($this->object === null && $name = $this->params->get('name')) {
|
||||||
|
$params = array('object_name' => $name);
|
||||||
|
$db = $this->db();
|
||||||
|
|
||||||
|
if ($hostname = $this->params->get('host')) {
|
||||||
|
$this->view->host = IcingaHost::load($hostname, $db);
|
||||||
|
$params['host_id'] = $this->view->host->id;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->object = IcingaService::load($params, $db);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->object;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue