parent
7b776956e3
commit
a1ed3f4be5
|
@ -11,6 +11,7 @@ use Icinga\Module\Director\Objects\IcingaService;
|
||||||
use Icinga\Module\Director\Objects\IcingaServiceSet;
|
use Icinga\Module\Director\Objects\IcingaServiceSet;
|
||||||
use Icinga\Module\Director\Util;
|
use Icinga\Module\Director\Util;
|
||||||
use Icinga\Module\Director\Web\Controller\ObjectController;
|
use Icinga\Module\Director\Web\Controller\ObjectController;
|
||||||
|
use Icinga\Web\Url;
|
||||||
|
|
||||||
class HostController extends ObjectController
|
class HostController extends ObjectController
|
||||||
{
|
{
|
||||||
|
@ -253,6 +254,28 @@ class HostController extends ObjectController
|
||||||
$this->commonForServices();
|
$this->commonForServices();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function removesetAction()
|
||||||
|
{
|
||||||
|
// TODO: clean this up, use POST
|
||||||
|
$db = $this->db()->getDbAdapter();
|
||||||
|
$query = $db->select()->from(
|
||||||
|
array('ss' => 'icinga_service_set'),
|
||||||
|
array('id' => 'ss.id')
|
||||||
|
)->join(
|
||||||
|
array('si' => 'icinga_service_set_inheritance'),
|
||||||
|
'si.service_set_id = ss.id',
|
||||||
|
array()
|
||||||
|
)->where('si.parent_service_set_id = ?', $this->params->get('setId'))
|
||||||
|
->where('ss.host_id = ?', $this->object->id);
|
||||||
|
|
||||||
|
IcingaServiceSet::loadWithAutoIncId($db->fetchOne($query), $this->db())->delete();
|
||||||
|
$this->redirectNow(
|
||||||
|
Url::fromPath('director/host/services', array(
|
||||||
|
'name' => $this->object->getObjectName()
|
||||||
|
))
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
public function servicesetserviceAction()
|
public function servicesetserviceAction()
|
||||||
{
|
{
|
||||||
$db = $this->db();
|
$db = $this->db();
|
||||||
|
|
|
@ -49,6 +49,15 @@ class IcingaServiceSetServiceTable extends QuickTable
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function renderTitles($row)
|
||||||
|
{
|
||||||
|
if ($this->host) {
|
||||||
|
return $this->renderHostTitles($row);
|
||||||
|
} else {
|
||||||
|
return parent::renderTitles($row);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
protected function getActionUrl($row)
|
protected function getActionUrl($row)
|
||||||
{
|
{
|
||||||
if ($this->host) {
|
if ($this->host) {
|
||||||
|
@ -77,6 +86,33 @@ class IcingaServiceSetServiceTable extends QuickTable
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function renderHostTitles($row)
|
||||||
|
{
|
||||||
|
$view = $this->view();
|
||||||
|
// Hint: row is an array of titles!?!?!?
|
||||||
|
$title = $view->escape(array_shift($row));
|
||||||
|
|
||||||
|
$htm = "<thead>\n <tr>\n";
|
||||||
|
|
||||||
|
$deleteLink = $view->qlink(
|
||||||
|
$view->translate('Remove'),
|
||||||
|
'director/host/removeset',
|
||||||
|
array(
|
||||||
|
'name' => $this->host->getObjectName(),
|
||||||
|
'setId' => $this->set->id
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
'class' => 'icon-cancel',
|
||||||
|
'style' => 'float: right; font-weight: normal',
|
||||||
|
'title' => $view->translate('Remove this set from this host')
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
$htm .= ' <th>' . $view->escape($title) . "$deleteLink</th>\n";
|
||||||
|
|
||||||
|
return $htm . " </tr>\n</thead>\n";
|
||||||
|
}
|
||||||
|
|
||||||
public function getUnfilteredQuery()
|
public function getUnfilteredQuery()
|
||||||
{
|
{
|
||||||
return $this->db()->select()->from(
|
return $this->db()->select()->from(
|
||||||
|
|
Loading…
Reference in New Issue