IcingaServiceSetServiceTable: add host support
This commit is contained in:
parent
457fee77a4
commit
8dabfef378
|
@ -2,6 +2,7 @@
|
|||
|
||||
namespace Icinga\Module\Director\Tables;
|
||||
|
||||
use Icinga\Module\Director\Objects\IcingaHost;
|
||||
use Icinga\Module\Director\Objects\IcingaServiceSet;
|
||||
use Icinga\Module\Director\Web\Table\QuickTable;
|
||||
|
||||
|
@ -9,6 +10,11 @@ class IcingaServiceSetServiceTable extends QuickTable
|
|||
{
|
||||
protected $set;
|
||||
|
||||
protected $title;
|
||||
|
||||
/** @var IcingaHost */
|
||||
protected $host;
|
||||
|
||||
protected $searchColumns = array(
|
||||
'service',
|
||||
);
|
||||
|
@ -18,33 +24,58 @@ class IcingaServiceSetServiceTable extends QuickTable
|
|||
return array(
|
||||
'id' => 's.id',
|
||||
'service_set_id' => 's.service_set_id',
|
||||
'host_id' => 'ss.host_id',
|
||||
'service_set' => 'ss.object_name',
|
||||
'service' => 's.object_name',
|
||||
'object_type' => 's.object_type',
|
||||
);
|
||||
}
|
||||
|
||||
public function setTitle($title)
|
||||
{
|
||||
$this->title = $title;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setHost(IcingaHost $host)
|
||||
{
|
||||
$this->host = $host;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setServiceSet(IcingaServiceSet $set)
|
||||
{
|
||||
$this->set = $set;
|
||||
$this->setId = $set->get('id');
|
||||
return $this;
|
||||
}
|
||||
|
||||
protected function getActionUrl($row)
|
||||
{
|
||||
$params = array(
|
||||
'name' => $row->service,
|
||||
'set' => $row->service_set
|
||||
);
|
||||
|
||||
return $this->url('director/service', $params);
|
||||
if ($this->host) {
|
||||
$params = array(
|
||||
'name' => $this->host->getObjectName(),
|
||||
'service' => $row->service,
|
||||
'set' => $row->service_set
|
||||
);
|
||||
|
||||
return $this->url('director/host/servicesetservice', $params);
|
||||
|
||||
} else {
|
||||
$params = array(
|
||||
'name' => $row->service,
|
||||
'set' => $row->service_set
|
||||
);
|
||||
|
||||
return $this->url('director/service', $params);
|
||||
}
|
||||
}
|
||||
|
||||
public function getTitles()
|
||||
{
|
||||
$view = $this->view();
|
||||
return array(
|
||||
'service' => $view->translate('Servicename'),
|
||||
'service' => $this->title ?: $view->translate('Servicename'),
|
||||
);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue