mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-07 14:04:27 +02:00
FilterWidget: POST instead of GET
Might have been a JS issue, but instead of messing with the URL just POSTing is easier here - and works. Filters from the search box are now added flawlessly to the filter tree.
This commit is contained in:
parent
b7521f48b9
commit
b40d0f6a1e
@ -73,7 +73,7 @@ class FilterWidget extends AbstractWidget
|
|||||||
{
|
{
|
||||||
$url = Url::fromRequest();
|
$url = Url::fromRequest();
|
||||||
$view = $this->view();
|
$view = $this->view();
|
||||||
$html = ' <form method="get" class="inline" action="'
|
$html = ' <form method="post" class="inline" action="'
|
||||||
. $url
|
. $url
|
||||||
. '"><input type="text" name="q" style="width: 8em" class="search" value="" placeholder="'
|
. '"><input type="text" name="q" style="width: 8em" class="search" value="" placeholder="'
|
||||||
. t('Add filter...')
|
. t('Add filter...')
|
||||||
|
@ -33,7 +33,11 @@ class Monitoring_ListController extends Controller
|
|||||||
protected function hasBetterUrl()
|
protected function hasBetterUrl()
|
||||||
{
|
{
|
||||||
$url = clone($this->url);
|
$url = clone($this->url);
|
||||||
$q = $url->shift('q');
|
if ($this->getRequest()->isPost()) {
|
||||||
|
$q = $this->getRequest()->getPost('q');
|
||||||
|
} else {
|
||||||
|
$q = $url->shift('q');
|
||||||
|
}
|
||||||
if ($q) {
|
if ($q) {
|
||||||
list($k, $v) = preg_split('/=/', $q);
|
list($k, $v) = preg_split('/=/', $q);
|
||||||
$url->addParams(array($k => $v));
|
$url->addParams(array($k => $v));
|
||||||
@ -57,6 +61,9 @@ class Monitoring_ListController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function hostsAction()
|
public function hostsAction()
|
||||||
{
|
{
|
||||||
|
if ($url = $this->hasBetterUrl()) {
|
||||||
|
return $this->redirectNow($url);
|
||||||
|
}
|
||||||
$this->addTitleTab('hosts');
|
$this->addTitleTab('hosts');
|
||||||
$this->setAutorefreshInterval(10);
|
$this->setAutorefreshInterval(10);
|
||||||
$this->compactView = 'hosts-compact';
|
$this->compactView = 'hosts-compact';
|
||||||
@ -103,7 +110,6 @@ class Monitoring_ListController extends Controller
|
|||||||
public function servicesAction()
|
public function servicesAction()
|
||||||
{
|
{
|
||||||
if ($url = $this->hasBetterUrl()) {
|
if ($url = $this->hasBetterUrl()) {
|
||||||
// TODO: This should NOT render
|
|
||||||
return $this->redirectNow($url);
|
return $this->redirectNow($url);
|
||||||
}
|
}
|
||||||
$this->addTitleTab('services');
|
$this->addTitleTab('services');
|
||||||
|
Loading…
x
Reference in New Issue
Block a user