Matthias Jentsch ca33e71f2d Deduplicate and clean up service summary component
Remove redundant component view script and streamline subFilter handling in all views that render it. Remove
heading from component to allow embedding in different types of views.

refs #10033
2015-09-04 13:02:57 +02:00

237 lines
7.9 KiB
PHTML

<div class="controls">
<?php if (! $this->compact): ?>
<?= $tabs; ?>
<?php endif ?>
<h2 class="tinystatesummary" <?= $this->compact ? ' data-base-target="col1"' : ''; ?>
<?= $this->render('list/components/hostssummary.phtml') ?>
</h2>
<?= $this->render('partials/host/objects-header.phtml'); ?>
</div>
<div class="content multi-commands">
<h3>
<?= $this->icon('reschedule') ?>
<?= $this->translate('Commands') ?>
</h3>
<p>
<?= sprintf($this->translatePlural(
'Issue commands to %s selected host:',
'Issue commands to all %s selected hosts:',
count($objects)
), '<b>' . count($objects) . '</b>') ?>
</p>
<?php if (($hostCount = count($objects)) === 0): ?>
<?= $this->translate('No hosts found matching the filter'); ?>
<?php else: ?>
<?= $checkNowForm; ?>
<br>
<?= $this->qlink(
$this->translate('Reschedule next checks'),
$rescheduleAllLink,
null,
array('icon' => 'reschedule')
); ?>
<br>
<?= $this->qlink(
$this->translate('Schedule downtimes'),
$downtimeAllLink,
null,
array('icon' => 'plug')
); ?>
<br>
<?= $this->qlink(
$this->translate('Submit passive check results'),
$processCheckResultAllLink,
null,
array('icon' => 'reply')
); ?>
<br>
<?= $this->qlink(
$this->translate('Add comments'),
$addCommentLink,
null,
array('icon' => 'comment')
); ?>
<?php if ($this->hasPermission('monitoring/command/send-custom-notification')): ?>
<br>
<?= $this->qlink(
sprintf($this->translate('Send a custom notification for all %u hosts'), $hostCount),
$sendCustomNotificationLink,
null,
array('icon' => 'comment')
); ?>
<?php endif; ?>
<?php
$unhandledCount = count($unhandledObjects);
$problemCount = count($problemObjects);
$unackCount = count($unacknowledgedObjects);
?>
<?php if ($problemCount || $unhandledCount || $unackCount): ?>
<h3>
<?= $this->icon('attention-alt') ?>
<?= $this->translatePlural(
'Problem',
'Problems',
$unhandledCount + $problemCount
) ?>
</h3>
<?php if ($problemCount): ?>
<p>
<?= sprintf(
$this->translatePlural(
'There is %s problem.',
'There are %s problems.',
$problemCount
),
'<b>' . $problemCount . '</b>'
); ?>
</p>
<?= $this->qlink(
sprintf(
$this->translatePlural(
'Schedule a downtime for %u problem host',
'Schedule a downtime for %u problem hosts',
$problemCount
),
$problemCount
),
$downtimeLink,
null,
array('icon' => 'plug')
); ?>
<?php endif; ?>
<?php
if ($unackCount > 0): ?>
<br>
<?= $this->qlink(
sprintf(
$this->translatePlural(
'Acknowledge %u unacknowledged problem hosts',
'Acknowledge %u unacknowledged problem hosts',
$unackCount
),
$unackCount
),
$acknowledgeLink,
null,
array('icon' => 'ok')
); ?>
<?php endif; ?>
<?php if ($unhandledCount): ?>
<p>
<?= sprintf(
$this->translatePlural(
'There is %s unhandled problem host, issue commands to the problematic host:',
'There are %s unhandled problem hosts, issue commands to the problematic hosts:',
$unhandledCount
),
'<span class="badge badge-critical">' . $unhandledCount . '</span>'
); ?>
</p>
<?= $this->qlink(
sprintf(
$this->translatePlural(
'Schedule a downtime for %u unhandled problem host',
'Schedule a downtime for %u unhandled problem hosts',
$unhandledCount
),
$unhandledCount
),
$downtimeUnhandledLink,
null,
array('icon' => 'plug')
); ?>
<?php endif; ?>
<?php endif;?>
<?php if (($acknowledgedCount = count($acknowledgedObjects)) > 0): ?>
<div>
<h3><?= $this->icon('ok', $this->translate('Acknowledgements')) ?> <?= $this->translate('Acknowledgements') ?></h3>
<?= sprintf(
$this->translatePlural(
'%s Acknowledged Host Problem',
'%s Acknowledged Host Problems',
$acknowledgedCount
),
'<b>' . $acknowledgedCount . '</b>'
); ?>
<?= $removeAckForm ?>
</div>
<?php endif ?>
<?php $scheduledDowntimeCount = count($objects->getScheduledDowntimes()) ?>
<?php if ($scheduledDowntimeCount): ?>
<h3><?= $this->icon('plug', $this->translate('Downtimes'))?> <?=$this->translate('Downtimes')?></h3>
<?= $this->qlink(
sprintf(
$this->translatePlural(
'%s scheduled downtime',
'%s scheduled downtimes',
$scheduledDowntimeCount
),
$scheduledDowntimeCount
),
$showDowntimesLink,
null,
array('data-base-target' => '_next')
);?>
<?= sprintf($this->translate('on all selected hosts.')) ?>
<?php if (($inDowntimeCount = count($objectsInDowntime)) > 0): ?>
<br>
<?= $this->qlink(
sprintf(
$this->translatePlural(
'%s host',
'%s hosts',
$inDowntimeCount
),
$inDowntimeCount
),
$inDowntimeLink,
null,
array('data-base-target' => '_next')
); ?>
<?= $this->translate('are currently in downtime.') ?>
<?php endif; ?>
<?php endif ?>
<?php if (($commentCount = count($objects->getComments())) > 0): ?>
<h3> <?= $this->icon('comment', $this->translate('Comments'))?> <?=$this->translate('Comments') ?></h3>
<?= $this->qlink(
sprintf(
$this->translatePlural(
'%s comment',
'%s comments',
$commentCount
),
$commentCount
),
$commentsLink,
null,
array('data-base-target' => '_next')
); ?>
<?= $this->translate('on all selected hosts.') ?>
<?php endif ?>
<?php endif ?>
</div>