mirror of
https://github.com/Icinga/icingadb-web.git
synced 2026-05-28 04:36:06 -04:00
Handle search bar validity in all controllers
This commit is contained in:
parent
9795efe71a
commit
b469a88428
11 changed files with 156 additions and 23 deletions
|
|
@ -15,6 +15,7 @@ use Icinga\Module\Icingadb\Widget\ShowMore;
|
|||
use Icinga\Module\Monitoring\Forms\Command\Object\DeleteCommentsCommandForm;
|
||||
use ipl\Html\HtmlDocument;
|
||||
use ipl\Html\HtmlString;
|
||||
use ipl\Web\Filter\QueryString;
|
||||
use ipl\Web\Url;
|
||||
use ipl\Web\Widget\ActionLink;
|
||||
use ipl\Web\Widget\Icon;
|
||||
|
|
@ -58,7 +59,19 @@ class CommentsController extends Controller
|
|||
$viewModeSwitcher->getViewModeParam()
|
||||
]);
|
||||
|
||||
$this->filter($comments, $searchBar->getFilter());
|
||||
if ($searchBar->hasBeenSent() && ! $searchBar->isValid()) {
|
||||
if ($searchBar->hasBeenSubmitted()) {
|
||||
$filter = QueryString::parse($this->getFilter()->toQueryString());
|
||||
} else {
|
||||
$this->addControl($searchBar);
|
||||
$this->sendMultipartUpdate();
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
$filter = $searchBar->getFilter();
|
||||
}
|
||||
|
||||
$this->filter($comments, $filter);
|
||||
|
||||
$comments->peekAhead($compact);
|
||||
|
||||
|
|
@ -86,7 +99,7 @@ class CommentsController extends Controller
|
|||
);
|
||||
}
|
||||
|
||||
if ($searchBar->hasBeenSent()) {
|
||||
if (! $searchBar->hasBeenSubmitted() && $searchBar->hasBeenSent()) {
|
||||
$viewModeSwitcher->setUrl($searchBar->getRedirectUrl());
|
||||
$this->sendMultipartUpdate($viewModeSwitcher);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ use Icinga\Module\Icingadb\Widget\ShowMore;
|
|||
use Icinga\Module\Monitoring\Forms\Command\Object\DeleteDowntimesCommandForm;
|
||||
use ipl\Html\HtmlDocument;
|
||||
use ipl\Html\HtmlString;
|
||||
use ipl\Web\Filter\QueryString;
|
||||
use ipl\Web\Url;
|
||||
use ipl\Web\Widget\ActionLink;
|
||||
use ipl\Web\Widget\Icon;
|
||||
|
|
@ -63,7 +64,19 @@ class DowntimesController extends Controller
|
|||
$viewModeSwitcher->getViewModeParam()
|
||||
]);
|
||||
|
||||
$this->filter($downtimes, $searchBar->getFilter());
|
||||
if ($searchBar->hasBeenSent() && ! $searchBar->isValid()) {
|
||||
if ($searchBar->hasBeenSubmitted()) {
|
||||
$filter = QueryString::parse($this->getFilter()->toQueryString());
|
||||
} else {
|
||||
$this->addControl($searchBar);
|
||||
$this->sendMultipartUpdate();
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
$filter = $searchBar->getFilter();
|
||||
}
|
||||
|
||||
$this->filter($downtimes, $filter);
|
||||
|
||||
$downtimes->peekAhead($compact);
|
||||
|
||||
|
|
@ -91,7 +104,7 @@ class DowntimesController extends Controller
|
|||
);
|
||||
}
|
||||
|
||||
if ($searchBar->hasBeenSent()) {
|
||||
if (! $searchBar->hasBeenSubmitted() && $searchBar->hasBeenSent()) {
|
||||
$viewModeSwitcher->setUrl($searchBar->getRedirectUrl());
|
||||
$this->sendMultipartUpdate($viewModeSwitcher);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ use Icinga\Module\Icingadb\Web\Controller;
|
|||
use Icinga\Module\Icingadb\Widget\ItemList\HistoryList;
|
||||
use Icinga\Module\Icingadb\Widget\ShowMore;
|
||||
use ipl\Sql\Sql;
|
||||
use ipl\Web\Filter\QueryString;
|
||||
use ipl\Web\Url;
|
||||
|
||||
class HistoryController extends Controller
|
||||
|
|
@ -52,6 +53,18 @@ class HistoryController extends Controller
|
|||
$sortControl->getSortParam()
|
||||
]);
|
||||
|
||||
if ($searchBar->hasBeenSent() && ! $searchBar->isValid()) {
|
||||
if ($searchBar->hasBeenSubmitted()) {
|
||||
$filter = QueryString::parse($this->getFilter()->toQueryString());
|
||||
} else {
|
||||
$this->addControl($searchBar);
|
||||
$this->sendMultipartUpdate();
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
$filter = $searchBar->getFilter();
|
||||
}
|
||||
|
||||
$history->peekAhead();
|
||||
$history->limit($limitControl->getLimit());
|
||||
if ($page > 1) {
|
||||
|
|
@ -62,7 +75,7 @@ class HistoryController extends Controller
|
|||
}
|
||||
}
|
||||
|
||||
$this->filter($history, $searchBar->getFilter());
|
||||
$this->filter($history, $filter);
|
||||
$history->getSelectBase()
|
||||
// Make sure we'll fetch service history entries only for services which still exist
|
||||
->where(['history.service_id IS NULL', 'history_service.id IS NOT NULL'], Sql::ANY);
|
||||
|
|
@ -97,7 +110,7 @@ class HistoryController extends Controller
|
|||
$this->addContent($historyList);
|
||||
}
|
||||
|
||||
if ($searchBar->hasBeenSent()) {
|
||||
if (! $searchBar->hasBeenSubmitted() && $searchBar->hasBeenSent()) {
|
||||
$this->sendMultipartUpdate();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ use Icinga\Module\Icingadb\Web\Control\SearchBar\ObjectSuggestions;
|
|||
use Icinga\Module\Icingadb\Web\Controller;
|
||||
use Icinga\Module\Icingadb\Widget\ItemList\HostgroupList;
|
||||
use Icinga\Module\Icingadb\Widget\ShowMore;
|
||||
use ipl\Web\Filter\QueryString;
|
||||
use ipl\Web\Url;
|
||||
|
||||
class HostgroupsController extends Controller
|
||||
|
|
@ -42,7 +43,19 @@ class HostgroupsController extends Controller
|
|||
$sortControl->getSortParam()
|
||||
]);
|
||||
|
||||
$this->filter($hostgroups, $searchBar->getFilter());
|
||||
if ($searchBar->hasBeenSent() && ! $searchBar->isValid()) {
|
||||
if ($searchBar->hasBeenSubmitted()) {
|
||||
$filter = QueryString::parse($this->getFilter()->toQueryString());
|
||||
} else {
|
||||
$this->addControl($searchBar);
|
||||
$this->sendMultipartUpdate();
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
$filter = $searchBar->getFilter();
|
||||
}
|
||||
|
||||
$this->filter($hostgroups, $filter);
|
||||
|
||||
$hostgroups->peekAhead($compact);
|
||||
|
||||
|
|
@ -70,7 +83,7 @@ class HostgroupsController extends Controller
|
|||
);
|
||||
}
|
||||
|
||||
if ($searchBar->hasBeenSent()) {
|
||||
if (! $searchBar->hasBeenSubmitted() && $searchBar->hasBeenSent()) {
|
||||
$this->sendMultipartUpdate();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -62,7 +62,17 @@ class HostsController extends Controller
|
|||
$viewModeSwitcher->getViewModeParam()
|
||||
]);
|
||||
|
||||
$filter = $searchBar->getFilter();
|
||||
if ($searchBar->hasBeenSent() && ! $searchBar->isValid()) {
|
||||
if ($searchBar->hasBeenSubmitted()) {
|
||||
$filter = QueryString::parse($this->getFilter()->toQueryString());
|
||||
} else {
|
||||
$this->addControl($searchBar);
|
||||
$this->sendMultipartUpdate();
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
$filter = $searchBar->getFilter();
|
||||
}
|
||||
|
||||
$hosts->peekAhead($compact);
|
||||
|
||||
|
|
@ -104,7 +114,7 @@ class HostsController extends Controller
|
|||
);
|
||||
}
|
||||
|
||||
if ($searchBar->hasBeenSent()) {
|
||||
if (! $searchBar->hasBeenSubmitted() && $searchBar->hasBeenSent()) {
|
||||
$viewModeSwitcher->setUrl($searchBar->getRedirectUrl());
|
||||
$this->sendMultipartUpdate($viewModeSwitcher);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ use Icinga\Module\Icingadb\Web\Controller;
|
|||
use Icinga\Module\Icingadb\Widget\ItemList\NotificationList;
|
||||
use Icinga\Module\Icingadb\Widget\ShowMore;
|
||||
use ipl\Sql\Sql;
|
||||
use ipl\Web\Filter\QueryString;
|
||||
use ipl\Web\Url;
|
||||
|
||||
class NotificationsController extends Controller
|
||||
|
|
@ -44,7 +45,19 @@ class NotificationsController extends Controller
|
|||
$sortControl->getSortParam()
|
||||
]);
|
||||
|
||||
$this->filter($notifications, $searchBar->getFilter());
|
||||
if ($searchBar->hasBeenSent() && ! $searchBar->isValid()) {
|
||||
if ($searchBar->hasBeenSubmitted()) {
|
||||
$filter = QueryString::parse($this->getFilter()->toQueryString());
|
||||
} else {
|
||||
$this->addControl($searchBar);
|
||||
$this->sendMultipartUpdate();
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
$filter = $searchBar->getFilter();
|
||||
}
|
||||
|
||||
$this->filter($notifications, $filter);
|
||||
$notifications->getSelectBase()
|
||||
// Make sure we'll fetch service history entries only for services which still exist
|
||||
->where([
|
||||
|
|
@ -76,7 +89,7 @@ class NotificationsController extends Controller
|
|||
);
|
||||
}
|
||||
|
||||
if ($searchBar->hasBeenSent()) {
|
||||
if (! $searchBar->hasBeenSubmitted() && $searchBar->hasBeenSent()) {
|
||||
$this->sendMultipartUpdate();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ use Icinga\Module\Icingadb\Web\Control\SearchBar\ObjectSuggestions;
|
|||
use Icinga\Module\Icingadb\Web\Controller;
|
||||
use Icinga\Module\Icingadb\Widget\ItemList\ServicegroupList;
|
||||
use Icinga\Module\Icingadb\Widget\ShowMore;
|
||||
use ipl\Web\Filter\QueryString;
|
||||
use ipl\Web\Url;
|
||||
|
||||
class ServicegroupsController extends Controller
|
||||
|
|
@ -41,7 +42,19 @@ class ServicegroupsController extends Controller
|
|||
$sortControl->getSortParam()
|
||||
]);
|
||||
|
||||
$this->filter($servicegroups, $searchBar->getFilter());
|
||||
if ($searchBar->hasBeenSent() && ! $searchBar->isValid()) {
|
||||
if ($searchBar->hasBeenSubmitted()) {
|
||||
$filter = QueryString::parse($this->getFilter()->toQueryString());
|
||||
} else {
|
||||
$this->addControl($searchBar);
|
||||
$this->sendMultipartUpdate();
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
$filter = $searchBar->getFilter();
|
||||
}
|
||||
|
||||
$this->filter($servicegroups, $filter);
|
||||
|
||||
$servicegroups->peekAhead($compact);
|
||||
|
||||
|
|
@ -69,7 +82,7 @@ class ServicegroupsController extends Controller
|
|||
);
|
||||
}
|
||||
|
||||
if ($searchBar->hasBeenSent()) {
|
||||
if (! $searchBar->hasBeenSubmitted() && $searchBar->hasBeenSent()) {
|
||||
$this->sendMultipartUpdate();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -67,7 +67,17 @@ class ServicesController extends Controller
|
|||
$viewModeSwitcher->getViewModeParam()
|
||||
]);
|
||||
|
||||
$filter = $searchBar->getFilter();
|
||||
if ($searchBar->hasBeenSent() && ! $searchBar->isValid()) {
|
||||
if ($searchBar->hasBeenSubmitted()) {
|
||||
$filter = QueryString::parse($this->getFilter()->toQueryString());
|
||||
} else {
|
||||
$this->addControl($searchBar);
|
||||
$this->sendMultipartUpdate();
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
$filter = $searchBar->getFilter();
|
||||
}
|
||||
|
||||
$services->peekAhead($compact);
|
||||
|
||||
|
|
@ -109,7 +119,7 @@ class ServicesController extends Controller
|
|||
);
|
||||
}
|
||||
|
||||
if ($searchBar->hasBeenSent()) {
|
||||
if (! $searchBar->hasBeenSubmitted() && $searchBar->hasBeenSent()) {
|
||||
$viewModeSwitcher->setUrl($searchBar->getRedirectUrl());
|
||||
$this->sendMultipartUpdate($viewModeSwitcher);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,8 +29,17 @@ class TacticalController extends Controller
|
|||
$this->handleSearchRequest($servicestateSummary);
|
||||
|
||||
$searchBar = $this->createSearchBar($servicestateSummary);
|
||||
|
||||
$filter = $searchBar->getFilter();
|
||||
if ($searchBar->hasBeenSent() && ! $searchBar->isValid()) {
|
||||
if ($searchBar->hasBeenSubmitted()) {
|
||||
$filter = QueryString::parse($this->getFilter()->toQueryString());
|
||||
} else {
|
||||
$this->addControl($searchBar);
|
||||
$this->sendMultipartUpdate();
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
$filter = $searchBar->getFilter();
|
||||
}
|
||||
|
||||
$this->filter($hoststateSummary, $filter);
|
||||
$this->filter($servicestateSummary, $filter);
|
||||
|
|
@ -49,7 +58,7 @@ class TacticalController extends Controller
|
|||
->setBaseFilter(Filter::fromQueryString(QueryString::render($filter)))
|
||||
);
|
||||
|
||||
if ($searchBar->hasBeenSent()) {
|
||||
if (! $searchBar->hasBeenSubmitted() && $searchBar->hasBeenSent()) {
|
||||
$this->sendMultipartUpdate();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ use Icinga\Module\Icingadb\Web\Control\SearchBar\ObjectSuggestions;
|
|||
use Icinga\Module\Icingadb\Web\Controller;
|
||||
use Icinga\Module\Icingadb\Widget\ItemList\UsergroupList;
|
||||
use Icinga\Security\SecurityException;
|
||||
use ipl\Web\Filter\QueryString;
|
||||
|
||||
class UsergroupsController extends Controller
|
||||
{
|
||||
|
|
@ -45,7 +46,19 @@ class UsergroupsController extends Controller
|
|||
$sortControl->getSortParam()
|
||||
]);
|
||||
|
||||
$this->filter($usergroups, $searchBar->getFilter());
|
||||
if ($searchBar->hasBeenSent() && ! $searchBar->isValid()) {
|
||||
if ($searchBar->hasBeenSubmitted()) {
|
||||
$filter = QueryString::parse($this->getFilter()->toQueryString());
|
||||
} else {
|
||||
$this->addControl($searchBar);
|
||||
$this->sendMultipartUpdate();
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
$filter = $searchBar->getFilter();
|
||||
}
|
||||
|
||||
$this->filter($usergroups, $filter);
|
||||
|
||||
yield $this->export($usergroups);
|
||||
|
||||
|
|
@ -56,7 +69,7 @@ class UsergroupsController extends Controller
|
|||
|
||||
$this->addContent(new UsergroupList($usergroups));
|
||||
|
||||
if ($searchBar->hasBeenSent()) {
|
||||
if (! $searchBar->hasBeenSubmitted() && $searchBar->hasBeenSent()) {
|
||||
$this->sendMultipartUpdate();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ use Icinga\Module\Icingadb\Web\Control\SearchBar\ObjectSuggestions;
|
|||
use Icinga\Module\Icingadb\Web\Controller;
|
||||
use Icinga\Module\Icingadb\Widget\ItemList\UserList;
|
||||
use Icinga\Security\SecurityException;
|
||||
use ipl\Web\Filter\QueryString;
|
||||
|
||||
class UsersController extends Controller
|
||||
{
|
||||
|
|
@ -47,7 +48,19 @@ class UsersController extends Controller
|
|||
$sortControl->getSortParam()
|
||||
]);
|
||||
|
||||
$this->filter($users, $searchBar->getFilter());
|
||||
if ($searchBar->hasBeenSent() && ! $searchBar->isValid()) {
|
||||
if ($searchBar->hasBeenSubmitted()) {
|
||||
$filter = QueryString::parse($this->getFilter()->toQueryString());
|
||||
} else {
|
||||
$this->addControl($searchBar);
|
||||
$this->sendMultipartUpdate();
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
$filter = $searchBar->getFilter();
|
||||
}
|
||||
|
||||
$this->filter($users, $filter);
|
||||
|
||||
yield $this->export($users);
|
||||
|
||||
|
|
@ -58,7 +71,7 @@ class UsersController extends Controller
|
|||
|
||||
$this->addContent(new UserList($users));
|
||||
|
||||
if ($searchBar->hasBeenSent()) {
|
||||
if (! $searchBar->hasBeenSubmitted() && $searchBar->hasBeenSent()) {
|
||||
$this->sendMultipartUpdate();
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue