Fix service compact view, remove dashboard.ini trash

refs #4192
This commit is contained in:
Jannis Moßhammer 2013-08-08 16:33:42 +02:00
parent 6e68826da6
commit 237f7f1e60
3 changed files with 156 additions and 102 deletions

View File

@ -1,4 +0,0 @@
[gdssdg]
title = "gdssdg"
[gdssdg.dsgdsg]
url = "dsdgs"

View File

@ -196,7 +196,7 @@ class Monitoring_ListController extends ModuleActionController
protected function handleFormatRequest($query)
{
if ($this->compactView !== null && $this->_getParam("view", false) === "compact") {
if ($this->compactView !== null && ($this->_getParam('view', false) === 'compact')) {
$this->_helper->viewRenderer($this->compactView);
}

View File

@ -1,102 +1,160 @@
<?php
$paginator = $services->paginate();
$count = $services->count();
if (! $count) {
echo '- no object is matching this filter -';
return;
}
$services->paginate();
?><table class="services action">
<thead>
<tr>
<th style="width: 6em;" >State</th>
<th >Service</th>
</tr>
</thead>
<tbody>
<?php foreach ($services->fetchAll() as $service):
$icons = array();
if ($service->service_acknowledged) {
$icons['ack.gif'] = 'Problem has been acknowledged';
}
if ($service->service_in_downtime) {
$icons['downtime.gif'] = 'Service is in a scheduled downtime';
}
if ($service->host_problems) {
$icons['server.png'] = 'This services host has a problem';
}
$state_classes = array($this->monitoringState($service, 'service'));
if ($service->service_handled || $service->service_acknowledged || ! empty($service->service_downtimes_with_info)) {
$state_classes[] = 'handled';
}
if ($service->service_last_state_change > (time() - 600)) {
$state_classes[] = 'new';
}
$state_title = date('Y-m-d H:i:s', $service->service_last_state_change);
$params = array(
'host' => $service->host_name,
'service' => $service->service_description
);
if (isset($this->preserve['backend'])) {
$params['backend'] = $this->preserve['backend'];
}
$viewHelper = $this->getHelper('MonitoringState');
$trimArea = $this->getHelper('Trim');
?>
<tr class="<?= implode(' ', $state_classes) ?>">
<td class="state" title="<?= $state_title ?>"><?=
$this->qlink(
$this->timeSince($service->service_last_state_change),
'monitoring/show/history',
$params,
array('quote' => false)
) ?></td>
<td><?php
foreach ($icons as $icon => $alt) {
echo $this->img('img/classic/' . $icon, array(
'class' => 'icon',
'title' => $alt
));
}
echo $this->qlink(
$service->host_name,
'monitoring/show/host',
$params
) . ': ' . $this->qlink(
$service->service_description,
'monitoring/show/service',
$params,
array('class' => 'row-action')
) ?></td>
</tr>
<?php endforeach ?>
</tbody>
<?php if (empty($services)): ?>
<div class="alert alert-info fullpage_infobox">
Sorry, no services found for this search
</div>
<?php return; endif ?>
<form method="get" action="<?= $this->qUrl(
'monitoring/list/services?' . http_build_query($this->services->getAppliedFilter()->toParams()),
array()
);
?>">
Sort by <?= $this->formSelect(
'sort',
$this->sort,
array('class' => 'autosubmit'),
array(
'service_severity' => 'Severity',
'service_last_state_change' => 'Last state change',
'service_last_time_unknown' => 'Last UNKNOWN',
'service_last_time_critical' => 'Last CRITICAL',
'service_last_time_warning' => 'Last WARNING',
'service_last_time_ok' => 'Last OK',
'service_description' => 'Service',
)
) ?>
<input type="search" name="filter" placeholder="Type to filter" />
<button class="btn btn-small"><i class="icon-refresh"></i></button>
</form>
<?= $this->paginationControl($paginator, null, null, array('preserve' => $this->preserve)) ?>
<table class="statustable action services">
<thead>
<tr>
<th colspan="3">Status</th>
<th>Service</th>
<th>Output</th>
<th></th>
</tr>
</thead>
<tbody>
<?php foreach ($services->fetchAll() as $service): ?>
<tr class="<?= implode(' ', $viewHelper->getStateFlags($service, 'service')); ?>">
<td class="icons indicator">
<div class="img-box"><?php $trimArea->start(); ?>
<?php if ($service->service_icon_image) : ?>
<img src="<?= $service->service_icon_image; ?>"/>
<?php endif; ?>
<?php $trimArea->end(); ?></div>
</td>
<td class="icons indicator">
<div class="icon-box"><?php $trimArea->start(); ?>
<?php if (!$service->service_handled && $service->service_state > 0): ?>
<a href="#" title="<?= 'Unhandled service' ?>">
<i class="icon-warning-sign"></i>
</a>
<?php endif; ?>
<?php if ($service->service_acknowledged && !$service->service_in_downtime): ?>
<a href="#" title="<?= 'Acknowledged' ?>">
<i class="icon-ok-sign"></i>
</a>
<?php endif; ?>
<?php if ($service->service_is_flapping): ?>
<a href="#" title="<?= 'Flapping' ?>">
<i class="icon-random"></i>
</a>
<?php endif; ?>
<?php if (!$service->service_notifications_enabled): ?>
<a href="#" title="<?= 'Notifications disabled' ?>">
<i class="icon-volume-off"></i>
</a>
<?php endif; ?>
<?php if ($service->service_in_downtime): ?>
<a href="#" title="<?= 'In downtime' ?>">
<i class="icon-wrench"></i>
</a>
<?php endif; ?>
<?php $trimArea->end(); ?></div>
</td>
<td class="indicator state" title="<?= $viewHelper->getStateTitle($service, 'service'); ?>">
<div class="statetext">
<?= $this->qlink(
"<b>".ucfirst($viewHelper->monitoringState($service, 'service'))."</b>".
'<div class="nowrap"> since&nbsp;'.
$this->timeSince($service->service_last_state_change),
'monitoring/show/history', array(
'host' => $service->host_name,
'service' => $service->service_description
),
array('quote' => false)
);?>
<?php if ($service->service_state_type == 0): ?>
<a href="#" title="<?= 'Soft state' ?>">
<i class="icon-gears"></i>
</a>
<?php endif; ?>
</div>
</td>
<td class="servicename">
<?php if ($service->service_last_comment !== null): ?>
<a href="#" title="<?= 'Comments' ?>">
<i class="icon-comment"> </i>
</a>
<?php endif; ?>
<?= $this->qlink(
"<b>".$service->service_display_name."</b><br/>",
'monitoring/show/service', array(
'host' => $service->host_name,
'service' => $service->service_description
), array(
'class' => 'row-action',
'quote' => false
)
); ?>
<?= $this->qlink(
$service->host_name,
'monitoring/show/host', array(
'host' => $service->host_name
), array(
'class' => 'row-action',
'quote' => false
)
); ?>
<?php if ($service->service_action_url != ""): ?>
<a href="<?= $service->service_action_url; ?>">Action</a>
<?php endif; ?>
<?php if ($service->service_notes_url != ""): ?>
<a href="<?= $service->service_notes_url; ?>">Notes</a>
<?php endif; ?>
<?php if ($service->service_state_type == 0): ?>
<a href="#" title="<?= 'Soft state' ?>">
<i class="icon-gears"></i>
</a>
<?php endif; ?>
</td>
<td class="expand-full">
<?= $this->escape(substr(strip_tags($service->service_output), 0, 10000)); ?>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<?php
$limit = $services->getLimit();
$count = $services->count();
if ($limit < $count) {
$more = sprintf(
$this->translate(
'Showing %d of %s, click here for more',
$limit,
$count
)
);
} else {
$more = $this->translate(
sprintf(
'Showing %d objects, click here for details',
$count
)
);
}
?><p><?= $this->qlink($more,$this->url()->without('page', 'limit', 'view')) ?></p>