summaryrefslogtreecommitdiffstats
path: root/library/Icingadb/Widget/ItemTable/GridCellLayout.php
blob: 95b1a0af4fe855394e20f248cf5f6d5880485717 (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) 2023 Icinga GmbH | GPLv2 */

namespace Icinga\Module\Icingadb\Widget\ItemTable;

use ipl\Html\BaseHtmlElement;
use ipl\Web\Widget\Link;

trait GridCellLayout
{
    /**
     * Creates a state badge for the Host / Service group with the highest severity that an object in the group has,
     * along with the count of the objects with this severity belonging to the corresponding group.
     *
     * @return Link
     */
    abstract public function createGroupBadge(): Link;

    protected function assembleVisual(BaseHtmlElement $visual): void
    {
        $visual->add($this->createGroupBadge());
    }

    protected function assembleTitle(BaseHtmlElement $title): void
    {
        $title->addHtml(
            $this->createSubject(),
            $this->createCaption()
        );
    }

    protected function assemble(): void
    {
        $this->add([
            $this->createTitle()
        ]);
    }
}