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

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'),
'monitoring/service/show', $this->qlink(
array( $comment->service_display_name,
'host' => $comment->host_name, 'monitoring/service/show',
'service' => $comment->service_description [
'host' => $comment->host_name,
'service' => $comment->service_description
],
null,
[
'title' => sprintf(
$this->translate('Show detailed information for service %s on host %s'),
$comment->service_display_name,
$comment->host_display_name
),
'class' => 'rowaction'
]
), ),
array( $this->qlink(
'title' => sprintf( $comment->host_display_name,
$this->translate('Show detailed information for this comment about service %s on host %s'), $this->href(
$comment->service_display_name, 'monitoring/host/show',
$comment->host_display_name ['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(
'monitoring/service/show', $this->translate('%s on %s', 'service on host'),
array( $this->qlink(
'host' => $downtime->host_name, $downtime->service_display_name,
'service' => $downtime->service_description 'monitoring/service/show',
[
'host' => $downtime->host_name,
'service' => $downtime->service_description
],
null,
[
'title' => sprintf(
$this->translate('Show detailed information for service %s on host %s'),
$downtime->service_display_name,
$downtime->host_display_name
),
'class' => 'rowaction'
]
), ),
array( $this->qlink(
'title' => sprintf( $downtime->host_display_name,
$this->translate('Show detailed information for this downtime scheduled for service %s on host %s'), $this->href(
$downtime->service_display_name, 'monitoring/host/show',
$downtime->host_display_name ['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