summaryrefslogtreecommitdiffstats
path: root/modules/monitoring/application/views/scripts/partials/object/quick-actions.phtml
blob: fe05a84a0c164ec5e719c5ee8fe3d165ca59d63a (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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
<div class="quick-actions">
    <ul class="nav tab-nav">
    <?php if (isset($removeAckForm)): ?>
        <li>
            <?php
            $removeAckForm = clone $removeAckForm;
            $removeAckForm->setAttrib('id', 'quickAction_' . $removeAckForm->getName()); // Avoids id duplication
            $removeAckForm->setLabelEnabled(true);
            echo $removeAckForm;
            ?>
        </li>
    <?php elseif /** @var \Icinga\Module\Monitoring\Object\MonitoredObject $object */   ($this->hasPermission('monitoring/command/acknowledge-problem') && ! (in_array((int) $object->state, array(0, 99))) ): ?>
        <li>
        <?php if ($object->getType() === $object::TYPE_HOST) {
            echo $this->qlink(
                $this->translate('Acknowledge'),
                'monitoring/host/acknowledge-problem',
                array('host' => $object->getName()),
                array(
                    'class'             => 'action-link',
                    'data-base-target'  => '_self',
                    'icon'              => 'edit',
                    'title'             => $this->translate(
                        'Acknowledge this problem, suppress all future notifications for it and tag it as being handled'
                    )
                )
            );
        } else {
            echo $this->qlink(
                $this->translate('Acknowledge'),
                'monitoring/service/acknowledge-problem',
                array('host' => $object->getHost()->getName(), 'service' => $object->getName()),
                array(
                    'class'             => 'action-link',
                    'data-base-target'  => '_self',
                    'icon'              => 'edit',
                    'title'             => $this->translate(
                        'Acknowledge this problem, suppress all future notifications for it and tag it as being handled'
                    )
                )
            );
        } ?>
        </li>
    <?php endif ?>
    <?php if (isset($checkNowForm)): // Form is unset if the current user lacks the respective permission ?>
        <?php ($checkNowForm = clone $checkNowForm)->setAttrib('id', 'quickAction_' . $checkNowForm->getName()); // Avoids id duplication ?>
        <li><?= $checkNowForm ?></li>
    <?php endif ?>
    <?php if ($this->hasPermission('monitoring/command/comment/add')): ?>
        <li>
        <?php if ($object->getType() === $object::TYPE_HOST) {
            echo $this->qlink(
                $this->translate('Comment'),
                'monitoring/host/add-comment',
                array('host' => $object->getName()),
                array(
                    'class'             => 'action-link',
                    'data-base-target'  => '_self',
                    'icon'              => 'comment-empty',
                    'title'             => $this->translate('Add a new comment to this host')
                )
            );
        } else {
            echo $this->qlink(
                $this->translate('Comment'),
                'monitoring/service/add-comment',
                array('host' => $object->getHost()->getName(), 'service' => $object->getName()),
                array(
                    'class'             => 'action-link',
                    'data-base-target'  => '_self',
                    'icon'              => 'comment-empty',
                    'title'             => $this->translate('Add a new comment to this service')
                )
            );
        } ?>
        </li>
    <?php endif ?>
    <?php if ($this->hasPermission('monitoring/command/send-custom-notification')): ?>
        <li>
        <?php if ($object->getType() === $object::TYPE_HOST) {
            echo $this->qlink(
                $this->translate('Notification'),
                'monitoring/host/send-custom-notification',
                array('host' => $object->getName()),
                array(
                    'class'             => 'action-link',
                    'data-base-target'  => '_self',
                    'icon'              => 'bell',
                    'title'             => $this->translate(
                        'Send a custom notification to contacts responsible for this host'
                    )
                )
            );
        } else {
            echo $this->qlink(
                $this->translate('Notification'),
                'monitoring/service/send-custom-notification',
                array('host' => $object->getHost()->getName(), 'service' => $object->getName()),
                array(
                    'class'             => 'action-link',
                    'data-base-target'  => '_self',
                    'icon'              => 'bell',
                    'title'             => $this->translate(
                        'Send a custom notification to contacts responsible for this service'
                    )
                )
            );
        } ?>
        </li>
    <?php endif ?>
    <?php if ($this->hasPermission('monitoring/command/downtime/schedule')): ?>
        <li><?php if ($object->getType() === $object::TYPE_HOST) {
            echo $this->qlink(
                $this->translate('Downtime'),
                'monitoring/host/schedule-downtime',
                array('host' => $object->getName()),
                array(
                    'class'             => 'action-link',
                    'data-base-target'  => '_self',
                    'icon'              => 'plug',
                    'title'             => $this->translate(
                        'Schedule a downtime to suppress all problem notifications within a specific period of time'
                    )
                )
            );
        } else {
            echo $this->qlink(
                $this->translate('Downtime'),
                'monitoring/service/schedule-downtime',
                array('host' => $object->getHost()->getName(), 'service' => $object->getName()),
                array(
                    'class'             => 'action-link',
                    'data-base-target'  => '_self',
                    'icon'              => 'plug',
                    'title'             => $this->translate(
                        'Schedule a downtime to suppress all problem notifications within a specific period of time'
                    )
                )
            );
        } ?>
        </li>
    <?php endif ?>
    </ul>
</div>