Skip to content

Commit

Permalink
monitoring: Re-indent the list/services view script
Browse files Browse the repository at this point in the history
refs #5543
  • Loading branch information
lippserd committed Sep 23, 2015
1 parent cf2fe84 commit 5959991
Showing 1 changed file with 98 additions and 90 deletions.
188 changes: 98 additions & 90 deletions modules/monitoring/application/views/scripts/list/services.phtml
Expand Up @@ -5,101 +5,109 @@ use Icinga\Module\Monitoring\Object\Service;
$services->peekAhead($this->compact);

if (! $this->compact): ?>
<div class="controls separated">
<?= $this->tabs ?>
<div class="dontprint">
<?= $this->render('list/components/selectioninfo.phtml') ?>
<h1 class="tinystatesummary" <?= $this->compact ? ' data-base-target="col1"' : ''; ?>>
<?= $this->render('list/components/servicesummary.phtml') ?>
</h1>
</div>
<?= $this->sortBox ?>
<?= $this->limiter ?>
<?= $this->paginator ?>
<?= $this->filterEditor ?>
</div>
<div class="controls separated">
<?= $this->tabs ?>
<div class="dontprint">
<?= $this->render('list/components/selectioninfo.phtml') ?>
<h1 class="tinystatesummary" <?= $this->compact ? ' data-base-target="col1"' : ''; ?>>
<?= $this->render('list/components/servicesummary.phtml') ?>
</h1>
</div>
<?= $this->sortBox ?>
<?= $this->limiter ?>
<?= $this->paginator ?>
<?= $this->filterEditor ?>
</div>
<?php endif ?>
<div class="content">
<table data-base-target="_next"
class="action multiselect <?php if ($this->compact): ?> compact<?php endif ?>" style="table-layout: auto;"
data-icinga-multiselect-url="<?= $this->href("monitoring/services/show") ?>"
data-icinga-multiselect-controllers="<?= $this->href("monitoring/services") ?>"
data-icinga-multiselect-data="service,host">
<tbody>
<?php foreach ($services as $service):
$serviceLink = $this->href(
'monitoring/service/show',
array(
'host' => $service->host_name,
'service' => $service->service_description
)
);
$hostLink = $this->href(
'monitoring/host/show',
array(
'host' => $service->host_name,
)
);
$serviceStateName = Service::getStateText($service->service_state);
?>
<tr class="state <?= $serviceStateName ?><?= $service->service_handled ? ' handled' : '' ?>">
<td class="state">
<p>
<span class="state-label"><?= Service::getStateText($service->service_state, true) ?></span>
<table data-base-target="_next"
class="action multiselect<?php if ($this->compact): ?> compact<?php endif ?>" style="table-layout: auto;"
data-icinga-multiselect-url="<?= $this->href('monitoring/services/show') ?>"
data-icinga-multiselect-controllers="<?= $this->href('monitoring/services') ?>"
data-icinga-multiselect-data="service,host">
<tbody>
<?php foreach ($services as $service):
$serviceLink = $this->href(
'monitoring/service/show',
array(
'host' => $service->host_name,
'service' => $service->service_description
)
);
$hostLink = $this->href(
'monitoring/host/show',
array(
'host' => $service->host_name,
)
);
$serviceStateName = Service::getStateText($service->service_state);
?>
<tr class="state <?= $serviceStateName ?><?= $service->service_handled ? ' handled' : '' ?>">
<td class="state">
<p>
<span class="state-label"><?= Service::getStateText($service->service_state, true) ?></span>
<?php if ((int) $service->service_state !== 99): ?>
<br>
<?= $this->timeSince($service->service_last_state_change, $this->compact) ?>
<br>
<?= $this->timeSince($service->service_last_state_change, $this->compact) ?>
<?php if ((int) $service->service_state > 0 && (int) $service->service_state_type === 0): ?>
<br>
<span class="text-small">Soft <?= $service->service_attempt ?></span>
<br>
<span class="text-small">Soft <?= $service->service_attempt ?></span>
<?php endif ?>
<?php endif ?>
</p>
</td>
</p>
</td>

<td>
<?= $this->iconImage()->service($service) ?>
<span class="objectflags"><?= implode(' ', $this->serviceFlags($service)) ?></span>
<?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))
) ?>:
<?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'
)
) ?><br />
<div class="sparkline-box"><?= $this->perfdata($service->service_perfdata, true, 5) ?> </div>
<p class="plugin-output"><?= $this->pluginOutput($this->ellipsis($service->service_output, 10000), true) ?></p>
</td>
<?php foreach($this->addColumns as $col): ?>
<td><?= $this->escape($service->$col) ?></td>
<?php endforeach ?>
</tr>
<?php endforeach ?>
</tbody>
</table>
<?php if (! $services->hasResult()): ?>
<?= $this->translate('No services found matching the filter'); ?>
<?php elseif ($services->hasMore()): ?>
<?= $this->qlink(
$this->translate('Show More'),
$this->url()->without(array('view', 'limit')),
null,
array(
'data-base-target' => '_next',
'class' => 'pull-right show-more'
)
); ?>
<?php endif ?>
<td>
<?= $this->iconImage()->service($service) ?>
<span class="objectflags"><?= implode(' ', $this->serviceFlags($service)) ?></span>
<?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
)
)
) ?>:
<?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'
)
) ?><br />
<div class="sparkline-box"><?= $this->perfdata($service->service_perfdata, true, 5) ?> </div>
<p class="plugin-output">
<?= $this->pluginOutput($this->ellipsis($service->service_output, 10000), true) ?>
</p>
</td>
<?php foreach($this->addColumns as $col): ?>
<td><?= $this->escape($service->$col) ?></td>
<?php endforeach ?>
</tr>
<?php endforeach ?>
</tbody>
</table>
<?php if (! $services->hasResult()): ?>
<?= $this->translate('No services found matching the filter'); ?>
<?php elseif ($services->hasMore()): ?>
<?= $this->qlink(
$this->translate('Show More'),
$this->url()->without(array('view', 'limit')),
null,
array(
'data-base-target' => '_next',
'class' => 'pull-right show-more'
)
) ?>
<?php endif ?>
</div>

0 comments on commit 5959991

Please sign in to comment.