Merge pull request #3801 from Icinga/feature/improve-host-service-distinction-in-lists-3615

Improve host-service distinction in lists
This commit is contained in:
Johannes Meyer 2019-07-30 08:55:03 +02:00 committed by GitHub
commit ea3a541017
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
17 changed files with 239 additions and 105 deletions

View File

@ -75,7 +75,6 @@ class EventController extends Controller
->add('event', array( ->add('event', array(
'title' => $label, 'title' => $label,
'label' => $label, 'label' => $label,
'icon' => $icon,
'url' => Url::fromRequest(), 'url' => Url::fromRequest(),
'active' => true 'active' => true
)) ))

View File

@ -281,6 +281,7 @@ class ListController extends Controller
$this->setAutorefreshInterval(15); $this->setAutorefreshInterval(15);
$notifications = $this->backend->select()->from('notification', array( $notifications = $this->backend->select()->from('notification', array(
'id',
'host_display_name', 'host_display_name',
'host_name', 'host_name',
'notification_contact_name', 'notification_contact_name',

View File

@ -30,6 +30,13 @@ class ShowController extends Controller
{ {
$contactName = $this->params->getRequired('contact_name'); $contactName = $this->params->getRequired('contact_name');
$this->getTabs()->add('contact-detail', [
'title' => $this->translate('Contact details'),
'label' => $this->translate('Contact'),
'url' => Url::fromRequest(),
'active' => true
]);
$query = $this->backend->select()->from('contact', array( $query = $this->backend->select()->from('contact', array(
'contact_name', 'contact_name',
'contact_id', 'contact_id',
@ -63,6 +70,7 @@ class ShowController extends Controller
$this->view->commands = $commands; $this->view->commands = $commands;
$notifications = $this->backend->select()->from('notification', array( $notifications = $this->backend->select()->from('notification', array(
'id',
'host_name', 'host_name',
'service_description', 'service_description',
'notification_output', 'notification_output',

View File

@ -30,7 +30,7 @@ if (! $this->compact): ?>
<td class="count-col"> <td class="count-col">
<span class="badge"><?= $contactGroup->contact_count ?></span> <span class="badge"><?= $contactGroup->contact_count ?></span>
</td> </td>
<td> <th>
<?= $this->qlink( <?= $this->qlink(
$contactGroup->contactgroup_name, $contactGroup->contactgroup_name,
'monitoring/list/contacts', 'monitoring/list/contacts',
@ -40,7 +40,7 @@ if (! $this->compact): ?>
$contactGroup->contactgroup_name $contactGroup->contactgroup_name
)) ))
) ?> ) ?>
</td> </th>
<td> <td>
<?php if ($contactGroup->contactgroup_name !== $contactGroup->contactgroup_alias): ?> <?php if ($contactGroup->contactgroup_name !== $contactGroup->contactgroup_alias): ?>
<?= $contactGroup->contactgroup_alias ?> <?= $contactGroup->contactgroup_alias ?>

View File

@ -25,7 +25,7 @@
<tbody> <tbody>
<?php foreach ($contacts->peekAhead($this->compact) as $contact): ?> <?php foreach ($contacts->peekAhead($this->compact) as $contact): ?>
<tr> <tr>
<td> <th>
<?= $this->qlink( <?= $this->qlink(
$contact->contact_name, $contact->contact_name,
'monitoring/show/contact', 'monitoring/show/contact',
@ -37,7 +37,7 @@
) )
) )
) ?> ) ?>
</td> </th>
<td> <td>
<?= $this->translate('Email') ?>: <?= $this->translate('Email') ?>:
<a href="mailto:<?= $contact->contact_email ?>" <a href="mailto:<?= $contact->contact_email ?>"

View File

@ -31,7 +31,7 @@ if (! $this->compact): ?>
$stateName = Host::getStateText($notification->notification_state); $stateName = Host::getStateText($notification->notification_state);
} }
?> ?>
<tr> <tr href="<?= $this->href('monitoring/event/show', ['id' => $notification->id, 'type' => 'notify']) ?>">
<td class="state-col state-<?= $stateName ?>"> <td class="state-col state-<?= $stateName ?>">
<div class="state-label"><?= $stateLabel ?></div> <div class="state-label"><?= $stateLabel ?></div>
<div class="state-meta"> <div class="state-meta">
@ -40,19 +40,51 @@ if (! $this->compact): ?>
</td> </td>
<td> <td>
<div class="state-header"> <div class="state-header">
<?php if ($isService): ?> <?php if ($isService) {
<?= $this->icon('service', $this->translate('Service')); ?> echo '<span class="service-on">';
<?= $this->link()->service( echo sprintf(
$notification->service_description, $this->translate('%s on %s', 'service on host'),
$notification->service_display_name, $this->qlink(
$notification->host_name, $notification->service_display_name,
'monitoring/service/show',
[
'host' => $notification->host_name,
'service' => $notification->service_description
],
[
'title' => sprintf(
$this->translate('Show detailed information for service %s on host %s'),
$notification->service_display_name,
$notification->host_display_name
)
]
),
$this->qlink(
$notification->host_display_name,
'monitoring/host/show',
['host' => $notification->host_name],
[
'title' => sprintf(
$this->translate('Show detailed information for host %s'),
$notification->host_display_name
)
]
)
);
echo '</span>';
} else {
echo $this->qlink(
$notification->host_display_name, $notification->host_display_name,
'rowaction' 'monitoring/host/show',
) ?> ['host' => $notification->host_name],
<?php else: ?> [
<?= $this->icon('host', $this->translate('Host')); ?> 'title' => sprintf(
<?= $this->link()->host($notification->host_name, $notification->host_display_name) ?> $this->translate('Show detailed information for host %s'),
<?php endif ?> $notification->host_display_name
)
]
);
} ?>
<?php if (! $this->contact): ?> <?php if (! $this->contact): ?>
<div class="notification-recipient"> <div class="notification-recipient">
<?php if ($notification->notification_contact_name): ?> <?php if ($notification->notification_contact_name): ?>

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,38 @@
<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
],
[
'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'), 'monitoring/host/show',
$comment->service_display_name, ['host' => $comment->host_name],
$comment->host_display_name [
) '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,41 @@
</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
],
[
'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'), 'monitoring/host/show',
$downtime->service_display_name, ['host' => $downtime->host_name],
$downtime->host_display_name [
) '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 +53,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

@ -188,35 +188,51 @@ $rowAction = Url::fromPath('monitoring/event/show');
<?php endif ?> <?php endif ?>
<div class="history-message-output"> <div class="history-message-output">
<?php if ($this->isOverview): ?> <?php if ($this->isOverview): ?>
<?= $this->qlink( <?php if ($isService) {
$event->host_display_name, echo '<span class="service-on">';
'monitoring/host/show', echo sprintf(
[ $this->translate('%s on %s', 'service on host'),
'host' => $event->host_name, $this->qlink(
], $event->service_display_name,
[ 'monitoring/service/show',
'title' => sprintf( [
$this->translate('Show detailed information for host %s'), 'host' => $event->host_name,
$event->host_display_name 'service' => $event->service_description
],
[
'title' => sprintf(
$this->translate('Show detailed information for service %s on host %s'),
$event->service_display_name,
$event->host_display_name
)
]
),
$this->qlink(
$event->host_display_name,
'monitoring/host/show',
['host' => $event->host_name],
[
'title' => sprintf(
$this->translate('Show detailed information for host %s'),
$event->host_display_name
)
]
) )
] );
) ?><?php if ($isService): ?>&#58; echo '</span>';
<?= $this->qlink( } else {
$event->service_display_name, echo $this->qlink(
'monitoring/service/show', $event->host_display_name,
[ 'monitoring/host/show',
'host' => $event->host_name, ['host' => $event->host_name],
'service' => $event->service_description
],
[ [
'title' => sprintf( 'title' => sprintf(
$this->translate('Show detailed information for service %s on host %s'), $this->translate('Show detailed information for host %s'),
$event->service_display_name,
$event->host_display_name $event->host_display_name
) )
] ]
) ?> );
<?php endif ?> } ?>
<?php endif ?> <?php endif ?>
<?= $this->nl2br($this->createTicketLinks($this->markdown($msg, ['class' => 'overview-plugin-output']))) ?> <?= $this->nl2br($this->createTicketLinks($this->markdown($msg, ['class' => 'overview-plugin-output']))) ?>
</div> </div>

View File

@ -25,7 +25,7 @@ $linkHostName = ! ($url->getPath() === 'monitoring/host/show' && $url->getParam(
echo '<a href="' . Url::fromPath('monitoring/host/show', array('host' => $object->host_name)) . '">'; echo '<a href="' . Url::fromPath('monitoring/host/show', array('host' => $object->host_name)) . '">';
} }
?> ?>
<span class="selectable"><?= $this->escape($object->host_display_name) ?></span> <span class="selectable"><strong><?= $this->escape($object->host_display_name) ?></strong></span>
<?php if ($object->host_display_name !== $object->host_name): ?> <?php if ($object->host_display_name !== $object->host_name): ?>
<span class="selectable host-meta">&#40;<?= $this->escape($object->host_name) ?>&#41;</span> <span class="selectable host-meta">&#40;<?= $this->escape($object->host_name) ?>&#41;</span>
<?php endif ?> <?php endif ?>

View File

@ -22,7 +22,7 @@ $linkServiceName = ! ($url->getPath() === 'monitoring/service/show' && $url->get
<td> <td>
<?= $this->iconImage()->host($object) ?> <?= $this->iconImage()->host($object) ?>
<a href="<?= Url::fromPath('monitoring/host/show', array('host' => $object->host_name)) ?>"> <a href="<?= Url::fromPath('monitoring/host/show', array('host' => $object->host_name)) ?>">
<span class="selectable"><?= $this->escape($object->host_display_name) ?></span> <span class="selectable"><strong><?= $this->escape($object->host_display_name) ?></strong></span>
<?php if ($object->host_display_name !== $object->host_name): ?> <?php if ($object->host_display_name !== $object->host_name): ?>
<span class="selectable host-meta">&#40;<?= $this->escape($object->host_name) ?>&#41;</span> <span class="selectable host-meta">&#40;<?= $this->escape($object->host_name) ?>&#41;</span>
<?php endif ?> <?php endif ?>
@ -57,7 +57,7 @@ $linkServiceName = ! ($url->getPath() === 'monitoring/service/show' && $url->get
)) . '">'; )) . '">';
} }
?> ?>
<span class="selectable"><?= $this->escape($object->service_display_name) ?></span> <span class="selectable"><strong><?= $this->escape($object->service_display_name) ?></strong></span>
<?php if ($object->service_display_name !== $object->service_description): ?> <?php if ($object->service_display_name !== $object->service_description): ?>
<span class="selectable service-meta">&#40;<?= $this->escape($object->service_description) ?>&#41;</span> <span class="selectable service-meta">&#40;<?= $this->escape($object->service_description) ?>&#41;</span>
<?php endif ?> <?php endif ?>

View File

@ -34,7 +34,6 @@ class HostnotificationQuery extends IdoQuery
'host_display_name' => 'h.display_name COLLATE latin1_general_ci' 'host_display_name' => 'h.display_name COLLATE latin1_general_ci'
), ),
'history' => array( 'history' => array(
'id' => 'hn.notification_id',
'output' => null, 'output' => null,
'state' => 'hn.state', 'state' => 'hn.state',
'timestamp' => 'UNIX_TIMESTAMP(hn.start_time)', 'timestamp' => 'UNIX_TIMESTAMP(hn.start_time)',
@ -54,6 +53,7 @@ class HostnotificationQuery extends IdoQuery
'instance_name' => 'i.instance_name' 'instance_name' => 'i.instance_name'
), ),
'notifications' => array( 'notifications' => array(
'id' => 'hn.notification_id',
'host' => 'ho.name1 COLLATE latin1_general_ci', 'host' => 'ho.name1 COLLATE latin1_general_ci',
'host_name' => 'ho.name1', 'host_name' => 'ho.name1',
'notification_output' => 'hn.output', 'notification_output' => 'hn.output',

View File

@ -22,6 +22,7 @@ class NotificationQuery extends IdoQuery
*/ */
protected $columnMap = array( protected $columnMap = array(
'notifications' => array( 'notifications' => array(
'id' => 'n.id',
'instance_name' => 'n.instance_name', 'instance_name' => 'n.instance_name',
'notification_contact_name' => 'n.notification_contact_name', 'notification_contact_name' => 'n.notification_contact_name',
'notification_output' => 'n.notification_output', 'notification_output' => 'n.notification_output',

View File

@ -26,7 +26,6 @@ class ServicenotificationQuery extends IdoQuery
'notification_contact_name' => 'co.name1' 'notification_contact_name' => 'co.name1'
), ),
'history' => array( 'history' => array(
'id' => 'sn.notification_id',
'output' => null, 'output' => null,
'state' => 'sn.state', 'state' => 'sn.state',
'timestamp' => 'UNIX_TIMESTAMP(sn.start_time)', 'timestamp' => 'UNIX_TIMESTAMP(sn.start_time)',
@ -54,6 +53,7 @@ class ServicenotificationQuery extends IdoQuery
'instance_name' => 'i.instance_name' 'instance_name' => 'i.instance_name'
), ),
'notifications' => array( 'notifications' => array(
'id' => 'sn.notification_id',
'host' => 'so.name1 COLLATE latin1_general_ci', 'host' => 'so.name1 COLLATE latin1_general_ci',
'host_name' => 'so.name1', 'host_name' => 'so.name1',
'notification_output' => 'sn.output', 'notification_output' => 'sn.output',

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

@ -17,6 +17,10 @@
// Object link and comment author in the comment overview // Object link and comment author in the comment overview
.comment-author { .comment-author {
margin-bottom: 0.25em; margin-bottom: 0.25em;
> a {
font-weight: bold;
}
} }
// Comment icons, e.g. persistent in the comment overview // Comment icons, e.g. persistent in the comment overview
@ -205,6 +209,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
@ -259,5 +267,9 @@
> .history-message-output { > .history-message-output {
flex: 1; flex: 1;
> a {
font-weight: bold;
}
} }
} }