mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-31 01:34:09 +02:00
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');
|
$editor = Widget::create('filterEditor');
|
||||||
|
/** @var \Icinga\Web\Widget\FilterEditor $editor */
|
||||||
call_user_func_array(
|
call_user_func_array(
|
||||||
array($editor, 'preserveParams'),
|
array($editor, 'preserveParams'),
|
||||||
array_merge($defaultPreservedParams, $preserveParams ?: array())
|
array_merge($defaultPreservedParams, $preserveParams ?: array())
|
||||||
@ -221,10 +222,12 @@ class Controller extends ModuleActionController
|
|||||||
->setSearchColumns($searchColumns)
|
->setSearchColumns($searchColumns)
|
||||||
->handleRequest($this->getRequest());
|
->handleRequest($this->getRequest());
|
||||||
|
|
||||||
if (! $this->view->compact) {
|
if ($this->view->compact) {
|
||||||
$this->view->filterEditor = $editor;
|
$editor->setVisible(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$this->view->filterEditor = $editor;
|
||||||
|
|
||||||
return $this;
|
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)
|
public function addFilter($and)
|
||||||
{
|
{
|
||||||
$this->setQueryString(
|
$this->setQueryString(
|
||||||
Filter::matchAll(
|
Filter::fromQueryString($this->getQueryString())
|
||||||
$and,
|
->andFilter($and)
|
||||||
Filter::fromQueryString($this->getQueryString())
|
->toQueryString()
|
||||||
)->toQueryString()
|
|
||||||
);
|
);
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
@ -55,6 +55,13 @@ class FilterEditor extends AbstractWidget
|
|||||||
*/
|
*/
|
||||||
private $selectedIdx;
|
private $selectedIdx;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether the filter control is visible
|
||||||
|
*
|
||||||
|
* @var bool
|
||||||
|
*/
|
||||||
|
protected $visible = true;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new FilterWidget
|
* Create a new FilterWidget
|
||||||
*
|
*
|
||||||
@ -144,6 +151,30 @@ class FilterEditor extends AbstractWidget
|
|||||||
return $this;
|
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)
|
protected function redirectNow($url)
|
||||||
{
|
{
|
||||||
$response = Icinga::app()->getFrontController()->getResponse();
|
$response = Icinga::app()->getFrontController()->getResponse();
|
||||||
@ -731,6 +762,9 @@ class FilterEditor extends AbstractWidget
|
|||||||
|
|
||||||
public function render()
|
public function render()
|
||||||
{
|
{
|
||||||
|
if (! $this->visible) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
if (! $this->preservedUrl()->getParam('modifyFilter')) {
|
if (! $this->preservedUrl()->getParam('modifyFilter')) {
|
||||||
return '<div class="filter">' . $this->renderSearch() . $this->view()->escape($this->shorten($this->filter, 50)) . '</div>';
|
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 = new StateBadges();
|
||||||
$stateBadges
|
$stateBadges
|
||||||
->setUrl('monitoring/list/hosts')
|
->setUrl('monitoring/list/hosts')
|
||||||
|
->setBaseFilter($this->filterEditor->getFilter())
|
||||||
->add(
|
->add(
|
||||||
StateBadges::STATE_UP,
|
StateBadges::STATE_UP,
|
||||||
$hostgroup->hosts_up,
|
$hostgroup->hosts_up,
|
||||||
|
@ -43,6 +43,7 @@ if (! $this->compact): ?>
|
|||||||
$stateBadges = new StateBadges();
|
$stateBadges = new StateBadges();
|
||||||
$stateBadges
|
$stateBadges
|
||||||
->setUrl('monitoring/list/services')
|
->setUrl('monitoring/list/services')
|
||||||
|
->setBaseFilter($this->filterEditor->getFilter())
|
||||||
->add(
|
->add(
|
||||||
StateBadges::STATE_OK,
|
StateBadges::STATE_OK,
|
||||||
$serviceGroup->services_ok,
|
$serviceGroup->services_ok,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user