summaryrefslogtreecommitdiffstats
path: root/modules/monitoring/application/views/scripts/partials/object/service-header.phtml
blob: 318fe49851d3a9cc35cbaafff9250197031a1646 (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
<?php
use Icinga\Module\Monitoring\Object\Host;
use Icinga\Module\Monitoring\Object\Service;
use Icinga\Web\Url;

/** @var \Icinga\Module\Monitoring\Object\MonitoredObject $object */

$url = Url::fromRequest();
$linkServiceName = ! ($url->getPath() === 'monitoring/service/show' && $url->getParam('service') === $object->service_description);
?>
<table class="state-table service-detail-state">
    <tr>
        <td class="state-col state-<?= Host::getStateText($object->host_state) ?><?= $object->host_handled ? ' handled' : '' ?>">
            <div class="state-label"><?= Host::getStateText($object->host_state, true) ?></div>
            <div class="state-meta">
                <?= $this->timeSince($object->host_last_state_change) ?>
            <?php if ((int) $object->host_state > 0 && (int) $object->host_state_type === 0): ?>
                <div><?= $this->translate('Soft', 'Soft state') ?> <?= $object->host_attempt ?></div>
            <?php endif ?>
            </div>
        </td>
        <td>
            <?= $this->iconImage()->host($object) ?>
            <a href="<?= Url::fromPath('monitoring/host/show', array('host' => $object->host_name)) ?>">
                <span class="selectable"><strong><?= $this->escape($object->host_display_name) ?></strong></span>
            <?php if ($object->host_display_name !== $object->host_name): ?>
                <span class="selectable host-meta">&#40;<?= $this->escape($object->host_name) ?>&#41;</span>
            <?php endif ?>
            </a>
            <?= $this->hostFlags($object) ?>
        <?php if ($object->host_address6 && $object->host_address6 !== $object->host_name): ?>
            <div class="selectable host-meta" title="<?= $this->translate('IPv6 address') ?>"><?= $this->escape($object->host_address6) ?></div>
        <?php endif ?>
        <?php if ($object->host_address && $object->host_address !== $object->host_name): ?>
            <div class="selectable host-meta" title="<?= $this->translate('IPv4 address') ?>"><?= $this->escape($object->host_address) ?></div>
        <?php endif ?>
        </td>
    </tr>
    <tr>
        <td class="state-col state-<?= Service::getStateText($object->service_state) ?><?= $object->service_handled ? ' handled' : '' ?>">
            <div class="state-label"><?= Service::getStateText($object->service_state, true) ?></div>
            <div class="state-meta">
                <?= $this->timeSince($object->service_last_state_change) ?>
            <?php if ((int) $object->service_state > 0 && (int) $object->service_state_type === 0): ?>
                <div><?= $this->translate('Soft', 'Soft state') ?> <?= $object->service_attempt ?></div>
            <?php endif ?>
            </div>
        </td>
        <td>
            <?= $this->iconImage()->service($object) ?>
            <?= $this->translate('Service') ?>&#58;
            <?php
            if ($linkServiceName) {
                echo '<a href="' . Url::fromPath('monitoring/service/show', array(
                    'host'      => $object->host_name,
                    'service'   => $object->service_description
                )) . '">';
            }
            ?>
                <span class="selectable"><strong><?= $this->escape($object->service_display_name) ?></strong></span>
                <?php if ($object->service_display_name !== $object->service_description): ?>
                    <span class="selectable service-meta">&#40;<?= $this->escape($object->service_description) ?>&#41;</span>
                <?php endif ?>
            <?php
            if ($linkServiceName) {
                echo '</a>';
            }
            ?>
            <?= $this->serviceFlags($object) ?>
        </td>
    </tr>
</table>