summaryrefslogtreecommitdiffstats
path: root/library/Icingadb/Widget/ItemList/HostList.php
blob: 2be1f84a7deb3dd52f2c0653daa547c1c6399522 (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

/* Icinga DB Web | (c) 2020 Icinga GmbH | GPLv2 */

namespace Icinga\Module\Icingadb\Widget\ItemList;

use Icinga\Module\Icingadb\Common\Links;
use ipl\Web\Url;

/**
 * Host list
 */
class HostList extends StateList
{
    protected $defaultAttributes = ['class' => 'host-list'];

    protected function getItemClass(): string
    {
        switch ($this->getViewMode()) {
            case 'minimal':
                return HostListItemMinimal::class;
            case 'detailed':
                $this->removeAttribute('class', 'default-layout');

                return HostListItemDetailed::class;
            case 'objectHeader':
                return HostDetailHeader::class;
            default:
                return HostListItem::class;
        }
    }

    protected function init(): void
    {
        $this->initializeDetailActions();
        $this->setMultiselectUrl(Links::hostsDetails());
        $this->setDetailUrl(Url::fromPath('icingadb/host'));
    }
}