Merge branch 'bugfix/respect-filter-in-state-links-in-group-overviews-10778'
fixes #10778
This commit is contained in:
commit
16cc5e333a
|
@ -209,6 +209,7 @@ class Controller extends ModuleActionController
|
|||
);
|
||||
|
||||
$editor = Widget::create('filterEditor');
|
||||
/** @var \Icinga\Web\Widget\FilterEditor $editor */
|
||||
call_user_func_array(
|
||||
array($editor, 'preserveParams'),
|
||||
array_merge($defaultPreservedParams, $preserveParams ?: array())
|
||||
|
@ -221,10 +222,12 @@ class Controller extends ModuleActionController
|
|||
->setSearchColumns($searchColumns)
|
||||
->handleRequest($this->getRequest());
|
||||
|
||||
if (! $this->view->compact) {
|
||||
$this->view->filterEditor = $editor;
|
||||
if ($this->view->compact) {
|
||||
$editor->setVisible(false);
|
||||
}
|
||||
|
||||
$this->view->filterEditor = $editor;
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -212,17 +212,18 @@ class Url
|
|||
}
|
||||
|
||||
/**
|
||||
* Set the new Filter of the url to be the current filter and the given filter
|
||||
* Add the given filter to the current filter of the URL
|
||||
*
|
||||
* @param Filter $and
|
||||
* @param Filter $and
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function addFilter($and)
|
||||
{
|
||||
$this->setQueryString(
|
||||
Filter::matchAll(
|
||||
$and,
|
||||
Filter::fromQueryString($this->getQueryString())
|
||||
)->toQueryString()
|
||||
Filter::fromQueryString($this->getQueryString())
|
||||
->andFilter($and)
|
||||
->toQueryString()
|
||||
);
|
||||
return $this;
|
||||
}
|
||||
|
|
|
@ -55,6 +55,13 @@ class FilterEditor extends AbstractWidget
|
|||
*/
|
||||
private $selectedIdx;
|
||||
|
||||
/**
|
||||
* Whether the filter control is visible
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
protected $visible = true;
|
||||
|
||||
/**
|
||||
* Create a new FilterWidget
|
||||
*
|
||||
|
@ -144,6 +151,30 @@ class FilterEditor extends AbstractWidget
|
|||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get whether the filter control is visible
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isVisible()
|
||||
{
|
||||
return $this->visible;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set whether the filter control is visible
|
||||
*
|
||||
* @param bool $visible
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setVisible($visible)
|
||||
{
|
||||
$this->visible = (bool) $visible;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
protected function redirectNow($url)
|
||||
{
|
||||
$response = Icinga::app()->getFrontController()->getResponse();
|
||||
|
@ -731,6 +762,9 @@ class FilterEditor extends AbstractWidget
|
|||
|
||||
public function render()
|
||||
{
|
||||
if (! $this->visible) {
|
||||
return '';
|
||||
}
|
||||
if (! $this->preservedUrl()->getParam('modifyFilter')) {
|
||||
return '<div class="filter">' . $this->renderSearch() . $this->view()->escape($this->shorten($this->filter, 50)) . '</div>';
|
||||
}
|
||||
|
|
|
@ -50,6 +50,7 @@ if (! $this->compact): ?>
|
|||
$stateBadges = new StateBadges();
|
||||
$stateBadges
|
||||
->setUrl('monitoring/list/hosts')
|
||||
->setBaseFilter($this->filterEditor->getFilter())
|
||||
->add(
|
||||
StateBadges::STATE_UP,
|
||||
$hostgroup->hosts_up,
|
||||
|
|
|
@ -43,6 +43,7 @@ if (! $this->compact): ?>
|
|||
$stateBadges = new StateBadges();
|
||||
$stateBadges
|
||||
->setUrl('monitoring/list/services')
|
||||
->setBaseFilter($this->filterEditor->getFilter())
|
||||
->add(
|
||||
StateBadges::STATE_OK,
|
||||
$serviceGroup->services_ok,
|
||||
|
|
Loading…
Reference in New Issue