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();
|
||||
$view = $this->view();
|
||||
$html = ' <form method="get" class="inline" action="'
|
||||
$html = ' <form method="post" class="inline" action="'
|
||||
. $url
|
||||
. '"><input type="text" name="q" style="width: 8em" class="search" value="" placeholder="'
|
||||
. t('Add filter...')
|
||||
|
|
|
@ -33,7 +33,11 @@ class Monitoring_ListController extends Controller
|
|||
protected function hasBetterUrl()
|
||||
{
|
||||
$url = clone($this->url);
|
||||
$q = $url->shift('q');
|
||||
if ($this->getRequest()->isPost()) {
|
||||
$q = $this->getRequest()->getPost('q');
|
||||
} else {
|
||||
$q = $url->shift('q');
|
||||
}
|
||||
if ($q) {
|
||||
list($k, $v) = preg_split('/=/', $q);
|
||||
$url->addParams(array($k => $v));
|
||||
|
@ -57,6 +61,9 @@ class Monitoring_ListController extends Controller
|
|||
*/
|
||||
public function hostsAction()
|
||||
{
|
||||
if ($url = $this->hasBetterUrl()) {
|
||||
return $this->redirectNow($url);
|
||||
}
|
||||
$this->addTitleTab('hosts');
|
||||
$this->setAutorefreshInterval(10);
|
||||
$this->compactView = 'hosts-compact';
|
||||
|
@ -103,7 +110,6 @@ class Monitoring_ListController extends Controller
|
|||
public function servicesAction()
|
||||
{
|
||||
if ($url = $this->hasBetterUrl()) {
|
||||
// TODO: This should NOT render
|
||||
return $this->redirectNow($url);
|
||||
}
|
||||
$this->addTitleTab('services');
|
||||
|
|
Loading…
Reference in New Issue