diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-14 13:21:16 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-14 13:21:16 +0000 |
commit | 2e582fe0b8b6a8e67982ddb84935db1bd3b401fe (patch) | |
tree | dd511b321f308264952cffb005a4288ea4e478e6 /application/views/scripts | |
parent | Initial commit. (diff) | |
download | icingaweb2-module-graphite-2e582fe0b8b6a8e67982ddb84935db1bd3b401fe.tar.xz icingaweb2-module-graphite-2e582fe0b8b6a8e67982ddb84935db1bd3b401fe.zip |
Adding upstream version 1.2.2.upstream/1.2.2
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'application/views/scripts')
-rw-r--r-- | application/views/scripts/config/advanced.phtml | 7 | ||||
-rw-r--r-- | application/views/scripts/config/backend.phtml | 7 | ||||
-rw-r--r-- | application/views/scripts/list/hosts.phtml | 67 | ||||
-rw-r--r-- | application/views/scripts/list/services.phtml | 77 | ||||
-rw-r--r-- | application/views/scripts/test/apache.phtml | 12 | ||||
-rw-r--r-- | application/views/scripts/test/cpu.phtml | 28 |
6 files changed, 198 insertions, 0 deletions
diff --git a/application/views/scripts/config/advanced.phtml b/application/views/scripts/config/advanced.phtml new file mode 100644 index 0000000..ab47cdb --- /dev/null +++ b/application/views/scripts/config/advanced.phtml @@ -0,0 +1,7 @@ +<div class="controls"> + <?= /** @var \Icinga\Web\Widget\Tabs $tabs */ $tabs ?> +</div> + +<div class="content"> + <?= /** @var \Icinga\Module\Graphite\Forms\Config\AdvancedForm $form */ $form ?> +</div> diff --git a/application/views/scripts/config/backend.phtml b/application/views/scripts/config/backend.phtml new file mode 100644 index 0000000..7750f3c --- /dev/null +++ b/application/views/scripts/config/backend.phtml @@ -0,0 +1,7 @@ +<div class="controls"> + <?= /** @var \Icinga\Web\Widget\Tabs $tabs */ $tabs ?> +</div> + +<div class="content"> + <?= /** @var \Icinga\Module\Graphite\Forms\Config\BackendForm $form */ $form ?> +</div> diff --git a/application/views/scripts/list/hosts.phtml b/application/views/scripts/list/hosts.phtml new file mode 100644 index 0000000..ce0e37c --- /dev/null +++ b/application/views/scripts/list/hosts.phtml @@ -0,0 +1,67 @@ +<?php + +use Icinga\Module\Graphite\Web\Widget\Graphs\Host; +use Icinga\Web\Url; + +/** @var \Icinga\Web\View $this */ +/** @var \Icinga\Web\Widget\FilterEditor $filterEditor */ +/** @var \Icinga\Module\Monitoring\Object\Host[] $hosts */ +/** @var bool $hasMoreHosts */ +/** @var \Icinga\Web\Url $baseUrl */ + +if (! $compact): ?> +<div class="controls"> + <?= $tabs ?> + <?= $paginator ?> + <div class="sort-controls-container"> + <?= $limiter ?> + <?= $sortBox ?> + </div> + <?= $filterEditor ?> + <?= $timeRangePicker ?> +</div> +<?php endif ?> +<div class="content"> +<?php +if (! empty($hosts)) { + echo '<div class="graphite-graph-color-registry"></div>'; + echo '<div class="grid">'; + foreach ($hosts as $host) { + $hostGraphs = (string) (new Host($host))->setPreloadDummy()->handleRequest(); + + if ($hostGraphs !== '') { + echo '<div class="grid-item">' + . '<h2>' + . $this->qlink( + $host->host_name === $host->host_display_name + ? $host->host_display_name + : $host->host_display_name . ' (' . $this->escape($host->host_name) . ')', + $baseUrl->with(['host' => $host->host_name]), + null, + ['data-base-target' => '_next'] + ) + . '</h2>' + . $hostGraphs + . '</div>'; + } + } + + if ($hasMoreHosts) { + echo '<div class="action-links">' + . $this->qlink( + mt('monitoring', 'Show More'), + $this->url()->without(array('view', 'limit')), + null, + [ + 'class' => 'action-link', + 'data-base-target' => '_next' + ] + ) + . '</div>'; + } + echo '</div>'; +} else { + echo '<p>' . $this->escape(mt('monitoring', 'No hosts found matching the filter.')) . '</p>'; +} +?> +</div> diff --git a/application/views/scripts/list/services.phtml b/application/views/scripts/list/services.phtml new file mode 100644 index 0000000..90ca03c --- /dev/null +++ b/application/views/scripts/list/services.phtml @@ -0,0 +1,77 @@ +<?php + +use Icinga\Module\Graphite\Web\Widget\Graphs\Service; +use Icinga\Web\Url; + +/** @var \Icinga\Web\View $this */ +/** @var \Icinga\Web\Widget\FilterEditor $filterEditor */ +/** @var \Icinga\Module\Monitoring\Object\Service[] $services */ +/** @var bool $hasMoreServices */ +/** @var \Icinga\Web\Url $hostBaseUrl */ +/** @var \Icinga\Web\Url $serviceBaseUrl */ + +if (! $compact): ?> +<div class="controls"> + <?= $tabs ?> + <?= $paginator ?> + <div class="sort-controls-container"> + <?= $limiter ?> + <?= $sortBox ?> + </div> + <?= $filterEditor ?> + <?= $timeRangePicker ?> +</div> +<?php endif ?> +<div class="content"> +<?php +if (! empty($services)) { + echo '<div class="graphite-graph-color-registry"></div>'; + echo '<div class="grid">'; + foreach ($services as $service) { + echo '<div class="grid-item">' + . '<h2>' + . $this->qlink( + $service->host_name === $service->host_display_name + ? $service->host_display_name + : $service->host_display_name . ' (' . $this->escape($service->host_name) . ')', + $hostBaseUrl->with(['host' => $service->host_name]), + null, + ['data-base-target' => '_next'] + ) + . ': ' + . $this->qlink( + $service->service_description === $service->service_display_name + ? $service->service_display_name + : $service->service_display_name . ' (' . $this->escape($service->service_description) . ')', + $serviceBaseUrl->with([ + 'host' => $service->host_name, + 'service' => $service->service_description + ]), + null, + ['data-base-target' => '_next'] + ) + . '</h2>'; + + echo (new Service($service))->setPreloadDummy()->handleRequest(); + echo '</div>'; + } + + if ($hasMoreServices) { + echo '<div class="action-links">' + . $this->qlink( + mt('monitoring', 'Show More'), + $this->url()->without(array('view', 'limit')), + null, + [ + 'class' => 'action-link', + 'data-base-target' => '_next' + ] + ) + . '</div>'; + } + echo '</div>'; +} else { + echo '<p>' . $this->escape(mt('monitoring', 'No services found matching the filter.')) . '</p>'; +} +?> +</div> diff --git a/application/views/scripts/test/apache.phtml b/application/views/scripts/test/apache.phtml new file mode 100644 index 0000000..069ccbe --- /dev/null +++ b/application/views/scripts/test/apache.phtml @@ -0,0 +1,12 @@ +<div class="controls"> +<?= $this->tabs ?> +</div> + +<div class="content"> +<?php foreach ($this->images as $base => $img): ?> +<div style="width: 260px; float: left; margin-right: 5px;"> +<h3><?= $this->escape($base) ?></h3> +<img src="<?= $img ?>" /> +</div> +<?php endforeach ?> +</div> diff --git a/application/views/scripts/test/cpu.phtml b/application/views/scripts/test/cpu.phtml new file mode 100644 index 0000000..495e315 --- /dev/null +++ b/application/views/scripts/test/cpu.phtml @@ -0,0 +1,28 @@ +<?php +$maxCnt = 0; +foreach ($this->images as $base => $cpus) { + $maxCnt = max($maxCnt, count($cpus)); +} +?> +<div class="controls"> +<?= $this->tabs ?> +<h1>CPUs</h1> +</div> +<div class="content"> +<table style="width: 100%;"> +<tr> + <th style="width: 15em;"> </th> + <th>CPUs</th> +</tr> +<?php foreach ($this->images as $base => $cpus): ?> +<tr> +<th style="vertical-align: top; text-align: right; padding-right: 2em;"><?= $this->escape($base) ?></th> +<td> +<?php foreach ($cpus as $num => $img): ?> +<div style="width: 53px; float: left;"><img src="<?= $img ?>" /><!--<br />CPU <?= $num ?>--></div> +<?php endforeach ?> +</td> +</tr> +<?php endforeach ?> +</table> +</div> |