icingaweb2/modules/monitoring/application/views/scripts/config/index.phtml

100 lines
3.6 KiB
PHTML
Raw Normal View History

<?php
use Icinga\Web\Url;
$fileNotReadable = array();
foreach (array('backends', 'instances') as $element) {
if (is_object($this->{$element}) &&
get_class($this->{$element}) === 'Icinga\Exception\NotReadableError') {
$fileNotReadable[$element] = $this->{$element}->getMessage();
} else {
$fileNotReadable[$element] = false;
}
}
?>
<div class="controls">
<?= $this->tabs->render($this); ?>
</div>
2014-03-11 17:13:42 +01:00
<div class="content" data-base-target="_next">
<?php if ($fileNotReadable['backends'] === false): ?>
<h1>Monitoring Backends</h1>
<?php if (isset($this->messageBox)): ?>
<?= $this->messageBox->render() ?>
<?php endif ?>
<p>
<a href="<?= Url::fromPath('/monitoring/config/createbackend')->getAbsoluteUrl();?>">
<?= $this->icon('create.png'); ?> Create New Monitoring Backend
</a>
</p>
<table class="action">
<thead>
2014-03-11 17:13:42 +01:00
<th>Monitoring Backend</th>
<th style="width: 5em">Remove</th>
</thead>
<tbody>
2014-03-11 17:13:42 +01:00
<?php foreach ($this->backends as $backendName => $config): ?>
<?php
$removeUrl = Url::fromPath('/monitoring/config/removebackend', array('backend' => $backendName));
$editUrl = Url::fromPath('/monitoring/config/editbackend', array('backend' => $backendName));
?>
<tr>
<td>
<a href="<?= $editUrl; ?>"><?= $this->icon('edit.png'); ?> <?= $this->escape($backendName); ?></a>
<small>(Type: <?= $this->escape($config['type'] === 'ido' ? 'IDO' : ucfirst($config['type'])); ?>)</small>
</td>
<td>
<a href="<?= $removeUrl; ?>"><?= $this->icon('remove.png'); ?></a>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<?php else: ?>
<p class="fileNotReadable">
<?= $this->escape($fileNotReadable['backends']) ?>
</p>
<?php endif ?>
<?php if ($fileNotReadable['instances'] === false): ?>
<h1>Monitoring Instances</h1>
<p>
<a href="<?= Url::fromPath('/monitoring/config/createinstance')->getAbsoluteUrl();?>">
<?= $this->icon('create.png'); ?> Create New Instance
</a>
</p>
<table class="action">
<thead>
<th>Instance</th>
<th style="width: 5em">Remove</th>
</thead>
<tbody>
<?php foreach ($this->instances as $instanceName => $config): ?>
<?php
$removeUrl = Url::fromPath('/monitoring/config/removeinstance', array('instance' => $instanceName));
$editUrl = Url::fromPath('/monitoring/config/editinstance', array('instance' => $instanceName));
?>
<tr>
<td>
<a href="<?= $editUrl; ?>"><?= $this->icon('edit.png'); ?> <?= $this->escape($instanceName); ?></a>
<small>(Type: <?= isset($config['host']) ? 'Remote' : 'Local'; ?>)</small>
</td>
<td>
<a href="<?= $removeUrl; ?>"><?= $this->icon('remove.png'); ?></a>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<?php else: ?>
<p class="fileNotReadable">
<?= $this->escape($fileNotReadable['instances']) ?>
</p>
<?php endif ?>
</div>