Improve host-service distinction for hosts, services, comments and

downtimes
This commit is contained in:
Jennifer Mourek 2019-05-27 11:44:02 +02:00 committed by Eric Lippmann
parent a94e8fb211
commit 9c3da17f2e
5 changed files with 136 additions and 59 deletions

View File

@ -61,20 +61,13 @@ if (! $this->compact): ?>
<td> <td>
<div class="state-header"> <div class="state-header">
<span class="service-on">
<?= $this->iconImage()->service($service) ?> <?= $this->iconImage()->service($service) ?>
<?php if ($this->showHost): ?><?= $this->qlink( <?php
$service->host_display_name if ($this->showHost) {
. ($service->host_state != 0 ? ' (' . Host::getStateText($service->host_state, true) . ')' : ''), echo sprintf(
$hostLink, $this->translate('%s on %s', 'service on host'),
null, $this->qlink(
array(
'title' => sprintf(
$this->translate('Show detailed information for host %s'),
$service->host_display_name
)
)
) ?>&#58;
<?php endif ?><?= $this->qlink(
$service->service_display_name, $service->service_display_name,
$serviceLink, $serviceLink,
null, null,
@ -86,7 +79,37 @@ if (! $this->compact): ?>
), ),
'class' => 'rowaction' 'class' => 'rowaction'
) )
) ?> ),
$this->qlink(
$service->host_display_name
. ($service->host_state != 0 ? ' (' . Host::getStateText($service->host_state, true) . ')' : ''),
$hostLink,
null,
[
'title' => sprintf(
$this->translate('Show detailed information for host %s'),
$service->host_display_name
)
]
)
);
} else {
echo $this->qlink(
$service->service_display_name,
$serviceLink,
null,
array(
'title' => sprintf(
$this->translate('Show detailed information for service %s on host %s'),
$service->service_display_name,
$service->host_display_name
),
'class' => 'rowaction'
)
);
}
?>
</span>
<span class="state-icons"><?= $this->serviceFlags($service) ?></span> <span class="state-icons"><?= $this->serviceFlags($service) ?></span>
</div> </div>
<div class="overview-plugin-output-container"> <div class="overview-plugin-output-container">

View File

@ -1,23 +1,42 @@
<div class="comment-author"> <div class="comment-author">
<?php if ($comment->objecttype === 'service') { <?php if ($comment->objecttype === 'service') {
echo $this->icon('service', $this->translate('Service')); echo '<span class="service-on">';
echo $this->qlink( echo sprintf(
$comment->host_display_name . ': ' . $comment->service_display_name, $this->translate('%s on %s', 'service on host'),
$this->qlink(
$comment->service_display_name,
'monitoring/service/show', 'monitoring/service/show',
array( [
'host' => $comment->host_name, 'host' => $comment->host_name,
'service' => $comment->service_description 'service' => $comment->service_description
), ],
array( null,
[
'title' => sprintf( 'title' => sprintf(
$this->translate('Show detailed information for this comment about service %s on host %s'), $this->translate('Show detailed information for service %s on host %s'),
$comment->service_display_name, $comment->service_display_name,
$comment->host_display_name $comment->host_display_name
),
'class' => 'rowaction'
]
),
$this->qlink(
$comment->host_display_name,
$this->href(
'monitoring/host/show',
['host' => $comment->host_name]
),
null,
[
'title' => sprintf(
$this->translate('Show detailed information for host %s'),
$comment->host_display_name
) )
]
) )
); );
echo '</span>';
} else { } else {
echo $this->icon('host', $this->translate('Host'));
echo $this->qlink( echo $this->qlink(
$comment->host_display_name, $comment->host_display_name,
'monitoring/host/show', 'monitoring/host/show',

View File

@ -9,24 +9,45 @@
</td> </td>
<td> <td>
<div class="comment-author"> <div class="comment-author">
<?php if ($isService): ?> <?php if ($isService) {
<?= $this->icon('service', $this->translate('Service')); ?> <?= $this->qlink( echo '<span class="service-on">';
$downtime->host_display_name . ': ' . $downtime->service_display_name, echo sprintf(
$this->translate('%s on %s', 'service on host'),
$this->qlink(
$downtime->service_display_name,
'monitoring/service/show', 'monitoring/service/show',
array( [
'host' => $downtime->host_name, 'host' => $downtime->host_name,
'service' => $downtime->service_description 'service' => $downtime->service_description
), ],
array( null,
[
'title' => sprintf( 'title' => sprintf(
$this->translate('Show detailed information for this downtime scheduled for service %s on host %s'), $this->translate('Show detailed information for service %s on host %s'),
$downtime->service_display_name, $downtime->service_display_name,
$downtime->host_display_name $downtime->host_display_name
),
'class' => 'rowaction'
]
),
$this->qlink(
$downtime->host_display_name,
$this->href(
'monitoring/host/show',
['host' => $downtime->host_name]
),
null,
[
'title' => sprintf(
$this->translate('Show detailed information for host %s'),
$downtime->host_display_name
) )
]
) )
); ?> );
<?php else: ?> echo '</span>';
<?= $this->icon('host', $this->translate('host')); ?> <?= $this->qlink( } else {
echo $this->qlink(
$downtime->host_display_name, $downtime->host_display_name,
'monitoring/host/show', 'monitoring/host/show',
array('host' => $downtime->host_name, 'downtime_id' => $downtime->id), array('host' => $downtime->host_name, 'downtime_id' => $downtime->id),
@ -36,8 +57,8 @@
$downtime->host_display_name $downtime->host_display_name
) )
) )
); ?> );
<?php endif ?> } ?>
<span class="comment-time"> <span class="comment-time">
<?= $this->escape(sprintf( <?= $this->escape(sprintf(
$downtime->is_flexible $downtime->is_flexible

View File

@ -175,6 +175,16 @@
} }
} }
.service-on {
color: @text-color-light;
> a {
color: @text-color;
letter-spacing: normal;
font-weight: bold;
}
}
// 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 {

View File

@ -205,6 +205,10 @@
// Wraps links, icons and meta in overviews // Wraps links, icons and meta in overviews
.state-header { .state-header {
.clearfix(); .clearfix();
> a {
font-weight: bold;
}
} }
// State icons, e.g. acknowledged in overviews // State icons, e.g. acknowledged in overviews