Reset Limit count and offset for `$table` in HostController::servicesAction

The limit in ObjectsTable::prepareQuery() limits the number of services shown in HostController::servicesAction.
But this limit is required for pagination in ServicesController. Hence, reset the limit when this query is used
in HostController::servicesAction().
This commit is contained in:
raviks789 2022-10-04 14:30:04 +02:00 committed by Thomas Gelf
parent 560e0e6520
commit 26e76c611e
3 changed files with 24 additions and 2 deletions

View File

@ -211,7 +211,8 @@ class HostController extends ObjectController
->setAuth($this->Auth())
->setHost($host)
->setBranch($branch)
->setTitle($this->translate('Individual Service objects'));
->setTitle($this->translate('Individual Service objects'))
->removeQueryLimit();
if (count($table)) {
$content->add($table);
@ -225,7 +226,9 @@ class HostController extends ObjectController
->setAuth($this->Auth())
->setBranch($branch)
->setHost($parent)
->setInheritedBy($host);
->setInheritedBy($host)
->removeQueryLimit();
if (count($table)) {
$content->add(
$table->setTitle(sprintf(
@ -253,6 +256,7 @@ class HostController extends ObjectController
->setBranch($branch)
->setAffectedHost($host)
->setTitle($title)
->removeQueryLimit()
);
}

View File

@ -247,4 +247,13 @@ class IcingaServiceSetServiceTable extends ZfQueryBasedTable
$deleteLink->handleRequest();
return $deleteLink;
}
public function removeQueryLimit()
{
$query = $this->getQuery();
$query->reset($query::LIMIT_OFFSET);
$query->reset($query::LIMIT_COUNT);
return $this;
}
}

View File

@ -303,4 +303,13 @@ class ObjectsTable extends ZfQueryBasedTable
return $query;
}
public function removeQueryLimit()
{
$query = $this->getQuery();
$query->reset($query::LIMIT_OFFSET);
$query->reset($query::LIMIT_COUNT);
return $this;
}
}