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(
'title' => $label,
'label' => $label,
'icon' => $icon,
'url' => Url::fromRequest(),
'active' => true
))

View File

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

View File

@ -30,6 +30,13 @@ class ShowController extends Controller
{
$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(
'contact_name',
'contact_id',
@ -63,6 +70,7 @@ class ShowController extends Controller
$this->view->commands = $commands;
$notifications = $this->backend->select()->from('notification', array(
'id',
'host_name',
'service_description',
'notification_output',

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -22,7 +22,7 @@ $linkServiceName = ! ($url->getPath() === 'monitoring/service/show' && $url->get
<td>
<?= $this->iconImage()->host($object) ?>
<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): ?>
<span class="selectable host-meta">&#40;<?= $this->escape($object->host_name) ?>&#41;</span>
<?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): ?>
<span class="selectable service-meta">&#40;<?= $this->escape($object->service_description) ?>&#41;</span>
<?php endif ?>

View File

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

View File

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

View File

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

View File

@ -17,6 +17,10 @@
// Object link and comment author in the comment overview
.comment-author {
margin-bottom: 0.25em;
> a {
font-weight: bold;
}
}
// Comment icons, e.g. persistent in the comment overview
@ -205,6 +209,10 @@
// Wraps links, icons and meta in overviews
.state-header {
.clearfix();
> a {
font-weight: bold;
}
}
// State icons, e.g. acknowledged in overviews
@ -259,5 +267,9 @@
> .history-message-output {
flex: 1;
> a {
font-weight: bold;
}
}
}