[icinga-checkins] icinga.org: icingaweb2/master: QuickActions: create quick actions template

git at icinga.org git at icinga.org
Thu Nov 24 13:22:20 CET 2016


Module: icingaweb2
Branch: master
Commit: 1b4428e8a2dcf8871678d0c1259ab051b327f478
URL:    https://git.icinga.org/?p=icingaweb2.git;a=commit;h=1b4428e8a2dcf8871678d0c1259ab051b327f478

Author: Florian Strohmaier <florian.strohmaier at netways.de>
Date:   Wed Nov  9 17:36:15 2016 +0100

QuickActions: create quick actions template

refs #13187

Signed-off-by: Eric Lippmann <eric.lippmann at icinga.com>

---

 .../scripts/partials/object/quick-actions.phtml    |  142 ++++++++++++++++++++
 1 file changed, 142 insertions(+)

diff --git a/modules/monitoring/application/views/scripts/partials/object/quick-actions.phtml b/modules/monitoring/application/views/scripts/partials/object/quick-actions.phtml
new file mode 100644
index 0000000..d79c836
--- /dev/null
+++ b/modules/monitoring/application/views/scripts/partials/object/quick-actions.phtml
@@ -0,0 +1,142 @@
+<div class="quick-actions">
+    <ul class="nav tab-nav">
+    <?php if (isset($removeAckForm)): ?>
+        <li>
+            <?php
+            $removeAckForm = clone $removeAckForm;
+            $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'              => 'ok',
+                    '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'              => 'ok',
+                    '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 ?>
+        <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',
+                    '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',
+                    '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-alt',
+                    '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-alt',
+                    '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>



More information about the icinga-checkins mailing list