summaryrefslogtreecommitdiffstats
path: root/library/Director/Web/Table/ServiceTemplateUsageTable.php
blob: c2806f683ad8e63bc138291d31e0ccffb3707e1a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<?php

namespace Icinga\Module\Director\Web\Table;

use Icinga\Authentication\Auth;
use Icinga\Module\Director\Db;

class ServiceTemplateUsageTable extends TemplateUsageTable
{
    public function getTypes()
    {
        return [
            'templates'  => $this->translate('Templates'),
            'objects'    => $this->translate('Objects'),
            'applyrules' => $this->translate('Apply Rules'),
            'setmembers' => $this->translate('Set Members'),
        ];
    }

    protected function getSummaryTables(string $templateType, Db $connection)
    {
        $auth = Auth::getInstance();
        return [
            'templates'  => TemplatesTable::create(
                $templateType,
                $connection
            ),
            'objects'    => ObjectsTable::create($templateType, $connection, $this->auth)
                ->setBranchUuid($this->branchUuid),
            'applyrules' => ApplyRulesTable::create($templateType, $connection)
                ->setBranchUuid($this->branchUuid),
            'setmembers' => ObjectsTableSetMembers::create(
                $templateType,
                $connection,
                $auth
            )
        ];
    }
}