summaryrefslogtreecommitdiffstats
path: root/application/views/scripts/list/services.phtml
blob: 90ca03c75465f251538f9e55a7c6294b9e42719e (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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
<?php

use Icinga\Module\Graphite\Web\Widget\Graphs\Service;
use Icinga\Web\Url;

/** @var \Icinga\Web\View $this */
/** @var \Icinga\Web\Widget\FilterEditor $filterEditor */
/** @var \Icinga\Module\Monitoring\Object\Service[] $services */
/** @var bool $hasMoreServices */
/** @var \Icinga\Web\Url $hostBaseUrl */
/** @var \Icinga\Web\Url $serviceBaseUrl */

if (! $compact): ?>
<div class="controls">
    <?= $tabs ?>
    <?= $paginator ?>
    <div class="sort-controls-container">
        <?= $limiter ?>
        <?= $sortBox ?>
    </div>
    <?= $filterEditor ?>
    <?= $timeRangePicker ?>
</div>
<?php endif ?>
<div class="content">
<?php
if (! empty($services)) {
    echo '<div class="graphite-graph-color-registry"></div>';
    echo '<div class="grid">';
        foreach ($services as $service) {
            echo '<div class="grid-item">'
                . '<h2>'
                . $this->qlink(
                    $service->host_name === $service->host_display_name
                        ? $service->host_display_name
                        : $service->host_display_name . ' (' . $this->escape($service->host_name) . ')',
                    $hostBaseUrl->with(['host' => $service->host_name]),
                    null,
                    ['data-base-target' => '_next']
                )
                . '&#58; '
                . $this->qlink(
                    $service->service_description === $service->service_display_name
                        ? $service->service_display_name
                        : $service->service_display_name . ' (' . $this->escape($service->service_description) . ')',
                    $serviceBaseUrl->with([
                        'host'      => $service->host_name,
                        'service'   => $service->service_description
                    ]),
                    null,
                    ['data-base-target' => '_next']
                )
                . '</h2>';

            echo (new Service($service))->setPreloadDummy()->handleRequest();
            echo '</div>';
        }

        if ($hasMoreServices) {
            echo '<div class="action-links">'
                . $this->qlink(
                    mt('monitoring', 'Show More'),
                    $this->url()->without(array('view', 'limit')),
                    null,
                    [
                        'class'             => 'action-link',
                        'data-base-target'  => '_next'
                    ]
                )
                . '</div>';
        }
    echo '</div>';
} else {
    echo '<p>' . $this->escape(mt('monitoring', 'No services found matching the filter.')) . '</p>';
}
?>
</div>