summaryrefslogtreecommitdiffstats
path: root/library/Icingadb/Widget/ItemList/ServiceList.php
blob: 8d41a701be6d9ecb442e7556bc1b94b0c7c37ac9 (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
<?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;

class ServiceList extends StateList
{
    protected $defaultAttributes = ['class' => 'service-list'];

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

                return ServiceListItemDetailed::class;
            case 'objectHeader':
                return ServiceDetailHeader::class;
            default:
                return ServiceListItem::class;
        }
    }

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