Merge branch 'feature/quick-actions-13187'

resolves #13187
This commit is contained in:
Eric Lippmann 2016-11-24 13:22:00 +01:00
commit d39a41ebc6
5 changed files with 180 additions and 18 deletions

View File

@ -70,8 +70,8 @@ class RemoveAcknowledgementCommandForm extends ObjectsCommandForm
'ignore' => true, 'ignore' => true,
'label' => $this->getSubmitLabel(), 'label' => $this->getSubmitLabel(),
'title' => $this->translatePlural( 'title' => $this->translatePlural(
'Remove problem acknowledgement', 'Remove acknowledgement',
'Remove problem acknowledgements', 'Remove acknowledgements',
count($this->objects) count($this->objects)
), ),
'type' => 'submit' 'type' => 'submit'
@ -89,8 +89,8 @@ class RemoveAcknowledgementCommandForm extends ObjectsCommandForm
$label = $this->getView()->icon('cancel'); $label = $this->getView()->icon('cancel');
if ($this->isLabelEnabled()) { if ($this->isLabelEnabled()) {
$label .= $this->translatePlural( $label .= $this->translatePlural(
'Remove problem acknowledgement', 'Remove acknowledgement',
'Remove problem acknowledgements', 'Remove acknowledgements',
count($this->objects) count($this->objects)
); );
} }
@ -111,8 +111,8 @@ class RemoveAcknowledgementCommandForm extends ObjectsCommandForm
} }
Notification::success(mtp( Notification::success(mtp(
'monitoring', 'monitoring',
'Removing problem acknowledgement..', 'Removing acknowledgement..',
'Removing problem acknowledgements..', 'Removing acknowledgements..',
count($this->objects) count($this->objects)
)); ));

View File

@ -1,15 +1,14 @@
<?php use Icinga\Data\Filter\Filter; ?> <?php use Icinga\Data\Filter\Filter; ?>
<div class="controls">
<div class="controls separated">
<?php if (! $this->compact): ?> <?php if (! $this->compact): ?>
<?= $this->tabs ?> <?= $this->tabs ?>
<?php endif ?> <?php endif ?>
<?= $this->render('partials/object/host-header.phtml') ?> <?= $this->render('partials/object/host-header.phtml') ?>
<?php <?php
$this->stats = $object->stats; $this->stats = $object->stats;
$this->baseFilter = Filter::where('host', $object->host_name); $this->baseFilter = Filter::where('host', $object->host_name);
echo $this->render('list/components/servicesummary.phtml'); echo $this->render('list/components/servicesummary.phtml');
?> ?>
<?= $this->render('partials/object/quick-actions.phtml') ?>
</div> </div>
<?= $this->render('partials/object/detail-content.phtml') ?> <?= $this->render('partials/object/detail-content.phtml') ?>

View File

@ -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>

View File

@ -1,8 +1,8 @@
<div class="controls separated"> <div class="controls">
<?php if (! $this->compact): ?> <?php if (! $this->compact): ?>
<?= $this->tabs ?> <?= $this->tabs ?>
<?php endif ?> <?php endif ?>
<?= $this->render('partials/object/service-header.phtml') ?> <?= $this->render('partials/object/service-header.phtml') ?>
<?= $this->render('partials/object/quick-actions.phtml') ?>
</div> </div>
<?= $this->render('partials/object/detail-content.phtml') ?> <?= $this->render('partials/object/detail-content.phtml') ?>

View File

@ -104,6 +104,7 @@
// Host and service summaries in detail and list views // Host and service summaries in detail and list views
.hosts-summary, .hosts-summary,
.services-summary { .services-summary {
display: inline-block;
margin-bottom: 0.5em; margin-bottom: 0.5em;
> .hosts-link, > .hosts-link,
@ -113,11 +114,6 @@
} }
} }
.controls > .hosts-summary,
.controls > .services-summary {
float: left;
}
// State table in the host and service multi-selection and detail views // State table in the host and service multi-selection and detail views
.host-detail-state, .host-detail-state,
.service-detail-state { .service-detail-state {
@ -131,6 +127,31 @@
} }
} }
// Quick actions
.quick-actions {
ul {
// Center horizontally
display: table;
margin: 0 auto;
}
li {
border-right: 1px solid fade(@icinga-blue, 50%);
color: @icinga-blue;
padding: 0 0.6em;
}
li:last-child {
border-right: none;
padding-right: 0;
}
li i {
font-size: 1.2em;
vertical-align: middle;
}
}
/* Generic box element */ /* Generic box element */
.boxview > div.box { .boxview > div.box {