Skip to content

Commit

Permalink
monitoring: Fix notification overview markup
Browse files Browse the repository at this point in the history
refs #5543
  • Loading branch information
lippserd committed Nov 2, 2015
1 parent ecfeb4f commit fee77af
Show file tree
Hide file tree
Showing 2 changed files with 85 additions and 53 deletions.
Expand Up @@ -2,8 +2,6 @@
use Icinga\Module\Monitoring\Object\Host;
use Icinga\Module\Monitoring\Object\Service;

$notifications->peekAhead($this->compact);

if (! $this->compact): ?>
<div class="controls separated dont-print">
<?= $tabs ?>
Expand All @@ -16,22 +14,32 @@ if (! $this->compact): ?>
</div>
<?php endif ?>
<div class="content">
<table data-base-target="_next" class="action action-table">
<?php if (! $notifications->hasResult()): ?>
<p><?= $this->translate('No notifications found matching the filter.') ?></p>
</div>
<?php return; endif ?>
<table data-base-target="_next" class="action-table">
<tbody>
<?php foreach ($notifications as $notification):
<?php foreach ($notifications->peekAhead($this->compact) as $notification):
if (isset($notification->service_description)) {
$isService = true;
$stateLabel = Service::getStateText($notification->notification_state, true);
$stateName = Service::getStateText($notification->notification_state);
} else {
$isService = false;
$stateLabel = Host::getStateText($notification->notification_state, true);
$stateName = Host::getStateText($notification->notification_state);
}
?>
<tr>
<td class="state-col state-<?= $stateName ?>">
<?= $this->timeAgo($notification->notification_start_time, $this->compact) ?>
<div class="state-label"><?= $stateLabel ?></div>
<div class="state-meta">
<?= $this->timeAgo($notification->notification_start_time, $this->compact) ?>
</div>
</td>
<td>
<div class="state-header">
<?php if ($isService): ?>
<?= $this->icon('service', $this->translate('Service')); ?>
<?= $this->link()->service(
Expand All @@ -45,42 +53,42 @@ if (! $this->compact): ?>
<?= $this->icon('host', $this->translate('Host')); ?>
<?= $this->link()->host($notification->host_name, $notification->host_display_name) ?>
<?php endif ?>

<?php if (! $this->contact): ?>
<span class="pull-right text-small">
<?php if ($notification->notification_contact_name): ?>
<?= sprintf(
$this->translate('Sent to %s'),
$this->qlink(
$notification->notification_contact_name,
'monitoring/show/contact',
array('contact_name' => $notification->notification_contact_name)
)
) ?>
<?php else: ?>
<?= $this->translate('This notification was not sent out to any contact.'); ?>
<?php endif ?>
</span>
<div class="notification-recipient">
<?php if ($notification->notification_contact_name): ?>
<?= sprintf(
$this->translate('Sent to %s'),
$this->qlink(
$notification->notification_contact_name,
'monitoring/show/contact',
array('contact_name' => $notification->notification_contact_name)
)
) ?>
<?php else: ?>
<?= $this->translate('Sent out to any contact') ?>
<?php endif ?>
</div>
<?php endif ?>
<p class="plugin-output">
</div>
<p class="overview-plugin-output">
<?= $this->pluginOutput($this->ellipsis($notification->notification_output, 10000), true) ?>
</p>
</td>
</tr>
<?php endforeach ?>
</tbody>
</table>
<?php if (! $notifications->hasResult()): ?>
<?= $this->translate('No notifications found matching the filter'); ?>
<?php elseif ($notifications->hasMore()): ?>
<?= $this->qlink(
$this->translate('Show More'),
$this->url(isset($notificationsUrl) ? $notificationsUrl : null)->without(array('view', 'limit')),
null,
array(
'data-base-target' => '_next',
'class' => 'pull-right action-link'
)
); ?>
<?php if ($notifications->hasMore()): ?>
<div class="text-right">
<?= $this->qlink(
$this->translate('Show More'),
$this->url(isset($notificationsUrl) ? $notificationsUrl : null)->without(array('view', 'limit')),
null,
array(
'class' => 'action-link',
'data-base-target' => '_next'
)
); ?>
</div>
<?php endif ?>
</div>
64 changes: 44 additions & 20 deletions modules/monitoring/public/css/tables.less
Expand Up @@ -2,10 +2,50 @@

@border-left-width: 6px;

// Check source reachable information in the host and service detail views
.check-source-meta {
font-size: @font-size-small;
}

// Column for counts, e.g. host group members
.count-col {
width: 4em;
}

// Host name and IP addresses in the host and service detail view
.host-meta {
color: @text-color-light;
font-size: @font-size-small;
}

// Link to unhandled services in the hosts overview
.host-services-incidents {
color: @color-critical;
font-family: @font-family-wide;
font-size: @font-size-small;
}

// Notification recipient in the notifications overview
.notification-recipient {
color: @text-color-light;
float: right;
font-size: @font-size-small;
}

// Plugin output in overviews
.overview-plugin-output {
color: @text-color-light;
font-family: @font-family-fixed;
font-size: @font-size-small;
}

// Service description if in the service detail view
.service-meta {
color: @text-color-light;
font-size: @font-size-small;
}

// State column for label and duration in overviews
.state-col {
&.state-ok,
&.state-up {
Expand Down Expand Up @@ -69,40 +109,24 @@
width: 8em;
}

.host-meta, .service-meta {
color: @text-color-light;
font-size: @font-size-small;
}

// Link to unhandled services in the hosts overview
.host-services-incidents {
color: @color-critical;
font-family: @font-family-wide;
font-size: @font-size-small;
}

// Plugin output in overviews
.overview-plugin-output {
color: @text-color-light;
font-family: @font-family-fixed;
font-size: @font-size-small;
}

// Wraps links, icons and meta in overviews
.state-header {
.clearfix();
}

// State icons, e.g. acknowledged in overviews
.state-icons {
float: right;
}

// State label in overviews
.state-label {
font-family: @font-family-wide;
font-size: @font-size-small;
letter-spacing: 1px;
}

.check-source-meta,
// State duration and state type information in overviews
.state-meta {
font-size: @font-size-small;
}

0 comments on commit fee77af

Please sign in to comment.