From b18bc644404e02b57635bfcc8258e85abb141146 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sat, 13 Apr 2024 13:44:46 +0200 Subject: Adding upstream version 1.1.1. Signed-off-by: Daniel Baumann --- .../scripts/joystickPagination-icingadb.phtml | 162 +++++++++++++++++++++ .../views/scripts/services/grid-flipped.phtml | 149 +++++++++++++++++++ application/views/scripts/services/grid.phtml | 150 +++++++++++++++++++ 3 files changed, 461 insertions(+) create mode 100644 application/views/scripts/joystickPagination-icingadb.phtml create mode 100644 application/views/scripts/services/grid-flipped.phtml create mode 100644 application/views/scripts/services/grid.phtml (limited to 'application/views') diff --git a/application/views/scripts/joystickPagination-icingadb.phtml b/application/views/scripts/joystickPagination-icingadb.phtml new file mode 100644 index 0000000..122d72a --- /dev/null +++ b/application/views/scripts/joystickPagination-icingadb.phtml @@ -0,0 +1,162 @@ +translate('%s: Show %s %u to %u out of %u', 'pagination.joystick'); +$flipUrl = clone $baseUrl; +if ($flipUrl->getParam('flipped')) { + $flipUrl->remove('flipped'); +} else { + $flipUrl->setParam('flipped'); +} +if ($flipUrl->hasParam('page')) { + $flipUrl->setParam('page', implode(',', array_reverse(explode(',', $flipUrl->getParam('page'))))); +} +if ($flipUrl->hasParam('limit')) { + $flipUrl->setParam('limit', implode(',', array_reverse(explode(',', $flipUrl->getParam('limit'))))); +} + +$yAxisTotalItem = $yAxisPaginator->count(); +$yAxisItemCountPerPage = $yAxisPaginator->getLimit() ?? $yAxisTotalItem; +$totalYAxisPages = ceil($yAxisTotalItem / $yAxisItemCountPerPage); +$currentYAxisPage = round($yAxisPaginator->getOffset() / $yAxisItemCountPerPage) + 1; +$prevYAxisPage = $currentYAxisPage > 1 ? $currentYAxisPage - 1 : null; +$nextYAxisPage = $currentYAxisPage < $totalYAxisPages ? $currentYAxisPage + 1 : null; + +$xAxisTotalItem = $xAxisPaginator->count(); +$xAxisItemCountPerPage = $xAxisPaginator->getLimit() ?? $xAxisTotalItem; +$totalXAxisPages = ceil($xAxisTotalItem / $xAxisItemCountPerPage); +$currentXAxisPage = round($xAxisPaginator->getOffset() / $xAxisItemCountPerPage) + 1; +$prevXAxisPage = $currentXAxisPage > 1 ? $currentXAxisPage - 1 : null; +$nextXAxisPage = $currentXAxisPage < $totalXAxisPages ? $currentXAxisPage + 1 : null; +?> + + + + + + + + + + + flippable): ?> + + + + + + + + + + + + +
  + + qlink( + '', + $baseUrl, + array( + 'page' => $currentXAxisPage . ',' . $prevYAxisPage + ), + array( + 'icon' => 'up-open', + 'data-base-target' => '_self', + 'title' => sprintf( + $showText, + $this->translate('Y-Axis', 'pagination.joystick'), + $this->translate('hosts', 'pagination.joystick'), + ($prevYAxisPage - 1) * $xAxisItemCountPerPage + 1, + $prevYAxisPage * $xAxisItemCountPerPage, + $yAxisTotalItem + ) + ) + ); ?> + + icon('up-open'); ?> + +  
+ + qlink( + '', + $baseUrl, + array( + 'page' => $prevXAxisPage . ',' . $currentYAxisPage + ), + array( + 'icon' => 'left-open', + 'data-base-target' => '_self', + 'title' => sprintf( + $showText, + $this->translate('X-Axis', 'pagination.joystick'), + $this->translate('services', 'pagination.joystick'), + ($prevXAxisPage - 1) * $xAxisItemCountPerPage + 1, + $prevXAxisPage * $xAxisItemCountPerPage, + $xAxisTotalItem + ) + ) + ); ?> + + icon('left-open'); ?> + + qlink( + '', + $flipUrl, + null, + array( + 'icon' => 'arrows-cw', + 'data-base-target' => '_self', + 'title' => $this->translate('Flip grid axes') + ) + ) ?>  + + qlink( + '', + $baseUrl, + array( + 'page' => $nextXAxisPage . ',' . $currentYAxisPage + ), + array( + 'icon' => 'right-open', + 'data-base-target' => '_self', + 'title' => sprintf( + $showText, + $this->translate('X-Axis', 'pagination.joystick'), + $this->translate('services', 'pagination.joystick'), + $currentXAxisPage * $xAxisItemCountPerPage + 1, + $nextXAxisPage === $totalXAxisPages ? $xAxisItemCountPerPage : $nextXAxisPage * $xAxisItemCountPerPage, + $xAxisTotalItem + ) + ), + false + ); ?> + + icon('right-open'); ?> + +
  + + qlink( + '', + $baseUrl, + array( + 'page' => $currentXAxisPage . ',' . $nextYAxisPage + ), + array( + 'icon' => 'down-open', + 'data-base-target' => '_self', + 'title' => sprintf( + $showText, + $this->translate('Y-Axis', 'pagination.joystick'), + $this->translate('hosts', 'pagination.joystick'), + $currentYAxisPage * $yAxisItemCountPerPage + 1, + $nextYAxisPage === $totalYAxisPages ? $yAxisItemCountPerPage : $nextYAxisPage * $yAxisItemCountPerPage, + $yAxisTotalItem + ) + ) + ); ?> + + icon('down-open'); ?> + +  
diff --git a/application/views/scripts/services/grid-flipped.phtml b/application/views/scripts/services/grid-flipped.phtml new file mode 100644 index 0000000..0642eb2 --- /dev/null +++ b/application/views/scripts/services/grid-flipped.phtml @@ -0,0 +1,149 @@ +compact): ?> + controls ?> + +
+ +
+
translate('No services found matching the filter.') ?>
+
+
+ $_) { + $serviceFilter->orFilter(Filter::where('service.name', $serviceDescription)); +} +?> + + + + + $hostAlias): ?> + + + + + + + + $serviceDisplayName): ?> + + + + + + horizontalPaginator->count(); + $horizontalItemsPerPage = $this->horizontalPaginator->getLimit() ?? $horizontalTotalItems; + $horizontalTotalPages = ceil($horizontalTotalItems / $horizontalItemsPerPage); + + $verticalTotalItems = $this->verticalPaginator->count(); + $verticalItemsPerPage = $this->verticalPaginator->getLimit() ?? $verticalTotalItems; + $verticalTotalPages = ceil($verticalTotalItems / $verticalItemsPerPage); + + if (! $this->compact && $horizontalTotalPages > 1): ?> + + + + + compact && $verticalTotalPages > 1): ?> + + + + + +
partial( + 'joystickPagination-icingadb.phtml', + 'default', + array( + 'flippable' => true, + 'baseUrl' => $baseUrl, + 'xAxisPaginator' => $horizontalPaginator, + 'yAxisPaginator' => $verticalPaginator + ) + ) ?>
qlink( + $this->ellipsis($hostAlias, 24), + Url::fromPath('icingadb/services')->addFilter( + Filter::matchAll($serviceFilter, Filter::where('host.name', $hostName)) + ), + null, + array('title' => sprintf($this->translate('List all reported services on host %s'), $hostAlias)), + false + ) ?>
$_) { + $hostFilter->orFilter(Filter::where('host.name', $hostName)); + } + echo $this->qlink( + $serviceDisplayName, + Url::fromPath('icingadb/services')->addFilter( + Filter::matchAll($hostFilter, Filter::where('service.name', $serviceDescription)) + ), + null, + array('title' => sprintf( + $this->translate('List all services with the name "%s" on all reported hosts'), + $serviceDisplayName + )) + ); + ?> + + + protectId($service->host_name . '_' . $service->name . '_desc') ?> + + escape($service->state->output) ?> + + qlink( + '', + 'icingadb/services', + array( + 'host.name' => $hostName, + 'name' => $serviceDescription + ), + array( + 'aria-describedby' => $ariaDescribedById, + 'aria-label' => sprintf( + $this->translate('Show detailed information for service %s on host %s'), + $service->display_name, + $service->host_display_name + ), + 'class' => 'service-grid-link state-' . $service->state->getStateText() . ($service->state->is_handled ? ' handled' : ''), + 'title' => $service->state->output + ) + ) ?> + + qlink( + $this->translate('Load more'), + $baseUrl, + array( + 'limit' => ($horizontalItemsPerPage + 20) + . ',' + . $verticalItemsPerPage + ), + array( + 'class' => 'action-link', + 'data-base-target' => '_self' + ) + ) ?> + +
+ qlink( + $this->translate('Load more'), + $baseUrl, + array( + 'limit' => $horizontalItemsPerPage + . ',' + . ($verticalItemsPerPage + 20) + ), + array( + 'class' => 'action-link', + 'data-base-target' => '_self' + ) + ) ?> +
+ diff --git a/application/views/scripts/services/grid.phtml b/application/views/scripts/services/grid.phtml new file mode 100644 index 0000000..f00ce8e --- /dev/null +++ b/application/views/scripts/services/grid.phtml @@ -0,0 +1,150 @@ +compact): ?> + controls ?> + +
+ +
+
translate('No services found matching the filter.') ?>
+
+
+ $_) { + $hostFilter->orFilter(Filter::where('host.name', $hostName)); +} +?> + + + + + $serviceDisplayName):?> + + + + + + + + $hostDisplayName): ?> + + + + + + horizontalPaginator->count(); + $horizontalItemsPerPage = $this->horizontalPaginator->getLimit() ?? $horizontalTotalItems; + $horizontalTotalPages = ceil($horizontalTotalItems / $horizontalItemsPerPage); + + $verticalTotalItems = $this->verticalPaginator->count(); + $verticalItemsPerPage = $this->verticalPaginator->getLimit() ?? $verticalTotalItems; + $verticalTotalPages = ceil($verticalTotalItems / $verticalItemsPerPage); + + if (! $this->compact && $horizontalTotalPages > 1): ?> + + + + + compact && $verticalTotalPages > 1): ?> + + + + + +
partial( + 'joystickPagination-icingadb.phtml', + 'default', + array( + 'flippable' => true, + 'baseUrl' => $baseUrl, + 'xAxisPaginator' => $horizontalPaginator, + 'yAxisPaginator' => $verticalPaginator + ) + ); ?>
qlink( + $this->ellipsis($serviceDisplayName, 24), + Url::fromPath('icingadb/services')->addFilter( + Filter::matchAll($hostFilter, Filter::where('service.name', $serviceDescription)) + ), + null, + array('title' => sprintf( + $this->translate('List all services with the name "%s" on all reported hosts'), + $serviceDisplayName + )), + false + ) ?>
$_) { + $serviceFilter->orFilter(Filter::where('service.name', $serviceName)); + } + echo $this->qlink( + $hostDisplayName, + Url::fromPath('icingadb/services')->addFilter( + Filter::matchAll($serviceFilter, Filter::where('host.name', $hostName)) + ), + null, + array('title' => sprintf($this->translate('List all reported services on host %s'), $hostDisplayName)) + ); + ?> + + + + protectId($service->host_name . '_' . $service->name . '_desc') ?> + + escape($service->state->output) ?> + + qlink( + '', + 'icingadb/service', + array( + 'host.name' => $hostName, + 'name' => $serviceDescription + ), + array( + 'aria-describedby' => $ariaDescribedById, + 'aria-label' => sprintf( + $this->translate('Show detailed information for service %s on host %s'), + $service->display_name, + $service->host_display_name + ), + 'class' => 'service-grid-link state-' . $service->state->getStateText() . ($service->state->is_handled ? ' handled' : ''), + 'title' => $service->state->output + ) + ) ?> + + qlink( + $this->translate('Load more'), + $baseUrl, + array( + 'limit' => ( + $horizontalItemsPerPage + 20) . ',' + . $verticalItemsPerPage + ), + array( + 'class' => 'action-link', + 'data-base-target' => '_self' + ) + ) ?> + +
+ qlink( + $this->translate('Load more'), + $baseUrl, + array( + 'limit' => $horizontalItemsPerPage . ',' . + ($verticalItemsPerPage + 20) + ), + array( + 'class' => 'action-link', + 'data-base-target' => '_self' + ) + ) ?> +
+ -- cgit v1.2.3