diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-14 13:17:31 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-14 13:17:31 +0000 |
commit | f66ab8dae2f3d0418759f81a3a64dc9517a62449 (patch) | |
tree | fbff2135e7013f196b891bbde54618eb050e4aaf /library/Director/Web/Table/IcingaServiceSetHostTable.php | |
parent | Initial commit. (diff) | |
download | icingaweb2-module-director-f66ab8dae2f3d0418759f81a3a64dc9517a62449.tar.xz icingaweb2-module-director-f66ab8dae2f3d0418759f81a3a64dc9517a62449.zip |
Adding upstream version 1.10.2.upstream/1.10.2
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'library/Director/Web/Table/IcingaServiceSetHostTable.php')
-rw-r--r-- | library/Director/Web/Table/IcingaServiceSetHostTable.php | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/library/Director/Web/Table/IcingaServiceSetHostTable.php b/library/Director/Web/Table/IcingaServiceSetHostTable.php new file mode 100644 index 0000000..9fc3c61 --- /dev/null +++ b/library/Director/Web/Table/IcingaServiceSetHostTable.php @@ -0,0 +1,64 @@ +<?php + +namespace Icinga\Module\Director\Web\Table; + +use Icinga\Module\Director\Objects\IcingaServiceSet; +use gipfl\IcingaWeb2\Link; +use gipfl\IcingaWeb2\Table\ZfQueryBasedTable; + +class IcingaServiceSetHostTable extends ZfQueryBasedTable +{ + protected $set; + + protected $searchColumns = array( + 'host', + ); + + public static function load(IcingaServiceSet $set) + { + $table = new static($set->getConnection()); + $table->set = $set; + return $table; + } + + public function renderRow($row) + { + return $this::row([ + Link::create( + $row->host, + 'director/host', + ['name' => $row->host] + ) + ]); + } + + public function getColumnsToBeRendered() + { + return [ + $this->translate('Hostname'), + ]; + } + + public function prepareQuery() + { + return $this->db()->select()->from( + ['h' => 'icinga_host'], + [ + 'id' => 'h.id', + 'host' => 'h.object_name', + 'object_type' => 'h.object_type', + ] + )->joinLeft( + ['ssh' => 'icinga_service_set'], + 'ssh.host_id = h.id', + [] + )->joinLeft( + ['ssih' => 'icinga_service_set_inheritance'], + 'ssih.service_set_id = ssh.id', + [] + )->where( + 'ssih.parent_service_set_id = ?', + $this->set->id + )->order('h.object_name'); + } +} |