mirror of
https://github.com/Icinga/icingadb-web.git
synced 2026-05-28 04:36:06 -04:00
ServicegroupsController: Add show more widget in compact mode
This commit is contained in:
parent
585e65817d
commit
1f5d57165b
1 changed files with 19 additions and 1 deletions
|
|
@ -5,12 +5,15 @@ namespace Icinga\Module\Icingadb\Controllers;
|
|||
use Icinga\Module\Icingadb\Model\ServicegroupSummary;
|
||||
use Icinga\Module\Icingadb\Web\Controller;
|
||||
use Icinga\Module\Icingadb\Widget\ItemList\ServicegroupList;
|
||||
use Icinga\Module\Icingadb\Widget\ShowMore;
|
||||
use ipl\Web\Url;
|
||||
|
||||
class ServicegroupsController extends Controller
|
||||
{
|
||||
public function indexAction()
|
||||
{
|
||||
$this->setTitle($this->translate('Service Groups'));
|
||||
$compact = $this->view->compact;
|
||||
|
||||
$db = $this->getDb();
|
||||
|
||||
|
|
@ -30,6 +33,8 @@ class ServicegroupsController extends Controller
|
|||
|
||||
$this->filter($servicegroups);
|
||||
|
||||
$servicegroups->peekAhead($compact);
|
||||
|
||||
yield $this->export($servicegroups);
|
||||
|
||||
$this->addControl($paginationControl);
|
||||
|
|
@ -37,10 +42,23 @@ class ServicegroupsController extends Controller
|
|||
$this->addControl($limitControl);
|
||||
$this->addControl($filterControl);
|
||||
|
||||
$results = $servicegroups->execute();
|
||||
|
||||
$this->addContent(
|
||||
(new ServicegroupList($servicegroups))->setBaseFilter($this->getFilter())
|
||||
(new ServicegroupList($results))->setBaseFilter($this->getFilter())
|
||||
);
|
||||
|
||||
if ($compact) {
|
||||
$this->addContent(
|
||||
(new ShowMore($results, Url::fromRequest()->without(['view', 'limit'])))
|
||||
->setAttribute('data-base-target', '_next')
|
||||
->setAttribute('title', sprintf(
|
||||
$this->translate('Show all %d servicegroups'),
|
||||
$servicegroups->count()
|
||||
))
|
||||
);
|
||||
}
|
||||
|
||||
$this->setAutorefreshInterval(30);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue