Fix incorrect pages offset on app ntp page (#15349)

* Update app_ntp.inc.php

Fixes ISSUE 15344
- Corrects start point in table when showing NTP APP
- Corrects blank page when showing ALL NTP entries

* Update app_ntp.inc.php

Use row count for page start not a hard coded 10
This commit is contained in:
Tim
2023-09-26 18:47:45 -07:00
committed by GitHub
parent c8041b6699
commit 2ee837eb90

View File

@@ -6,8 +6,9 @@ $options['filter']['ignore'] = ['=', 0];
$options['type'] = 'ntp';
$components = $component->getComponents(null, $options);
$first = $vars['current'] - 1; // Which record do we start on.
$last = $first + $vars['rowCount']; // Which record do we end on.
$first = ($vars['current'] - 1) * $vars['rowCount']; // Which record do we start on.
$last = $first + $vars['rowCount']; // Which record do we end on.
$showAll = $vars['rowCount'] == -1; // Show all devices y/n
$count = 0;
// Loop through each device in the component array
foreach ($components as $devid => $comp) {
@@ -48,7 +49,7 @@ foreach ($components as $devid => $comp) {
$count++;
// If this record is in the range we want.
if (($count > $first) && ($count <= $last)) {
if ($showAll || (($count > $first) && ($count <= $last))) {
$device_link = generate_device_link($device, null, ['tab' => 'apps', 'app' => 'ntp']);
$graph_array = [];