Fix some logical inconsistencies

This commit is contained in:
Yonas Habteab 2022-04-04 09:46:44 +02:00
parent e688d48167
commit 5d5f6cbcd2
2 changed files with 7 additions and 3 deletions

View File

@ -6,7 +6,7 @@ use Icinga\Web\Widget\SearchDashboard;
$searchDashboard = new SearchDashboard(); $searchDashboard = new SearchDashboard();
$searchDashboard->setUser($this->Auth()->getUser()); $searchDashboard->setUser($this->Auth()->getUser());
if (! $searchDashboard->search('dummy')->getActiveHome()->getEntry('search')->hasEntries()): ?> if ($searchDashboard->search('dummy')->getActiveHome()->getEntry('search')->hasEntries()): ?>
<form action="<?= $this->href('search') ?>" method="get" role="search" class="search-control"> <form action="<?= $this->href('search') ?>" method="get" role="search" class="search-control">
<input type="text" name="q" id="search" class="search search-input" required <input type="text" name="q" id="search" class="search search-input" required
placeholder="<?= $this->translate('Search') ?> &hellip;" placeholder="<?= $this->translate('Search') ?> &hellip;"

View File

@ -6,6 +6,7 @@ namespace Icinga\Web\Widget;
use Icinga\Exception\Http\HttpNotFoundException; use Icinga\Exception\Http\HttpNotFoundException;
use Icinga\Application\Icinga; use Icinga\Application\Icinga;
use Icinga\Web\Dashboard\DashboardHome; use Icinga\Web\Dashboard\DashboardHome;
use Icinga\Web\Dashboard\Dashlet;
use Icinga\Web\Url; use Icinga\Web\Url;
/** /**
@ -104,11 +105,14 @@ class SearchDashboard extends \Icinga\Web\Dashboard\Dashboard
protected function assemble() protected function assemble()
{ {
if ($this->searchHome->getEntry(self::SEARCH_PANE)->hasEntries()) { if (! $this->searchHome->getEntry(self::SEARCH_PANE)->hasEntries()) {
throw new HttpNotFoundException(t('Page not found')); throw new HttpNotFoundException(t('Page not found'));
} }
$this->add($this->searchHome->getEntry(self::SEARCH_PANE)->getEntries()); /** @var Dashlet $dashlet */
foreach ($this->searchHome->getEntry(self::SEARCH_PANE)->getEntries() as $dashlet) {
$this->addHtml($dashlet->getHtml());
}
} }
/** /**