mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-26 23:34:08 +02:00
parent
f4032988bf
commit
bf4e492fa1
@ -124,7 +124,6 @@ class NavigationItem implements IteratorAggregate
|
|||||||
public function __construct($name, array $properties = null)
|
public function __construct($name, array $properties = null)
|
||||||
{
|
{
|
||||||
$this->setName($name);
|
$this->setName($name);
|
||||||
$this->render = true;
|
|
||||||
$this->priority = 100;
|
$this->priority = 100;
|
||||||
$this->children = new Navigation();
|
$this->children = new Navigation();
|
||||||
|
|
||||||
@ -717,6 +716,10 @@ class NavigationItem implements IteratorAggregate
|
|||||||
*/
|
*/
|
||||||
public function getRender()
|
public function getRender()
|
||||||
{
|
{
|
||||||
|
if ($this->render === null) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
return $this->render;
|
return $this->render;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
namespace Icinga\Module\Monitoring\Web\Navigation;
|
namespace Icinga\Module\Monitoring\Web\Navigation;
|
||||||
|
|
||||||
|
use Icinga\Data\Filter\Filter;
|
||||||
use Icinga\Web\Navigation\NavigationItem;
|
use Icinga\Web\Navigation\NavigationItem;
|
||||||
use Icinga\Module\Monitoring\Object\Macro;
|
use Icinga\Module\Monitoring\Object\Macro;
|
||||||
use Icinga\Module\Monitoring\Object\MonitoredObject;
|
use Icinga\Module\Monitoring\Object\MonitoredObject;
|
||||||
@ -26,6 +27,13 @@ class Action extends NavigationItem
|
|||||||
*/
|
*/
|
||||||
protected $object;
|
protected $object;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The filter to use when being asked whether to render this action
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $filter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set this action's object
|
* Set this action's object
|
||||||
*
|
*
|
||||||
@ -49,6 +57,29 @@ class Action extends NavigationItem
|
|||||||
return $this->object;
|
return $this->object;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the filter to use when being asked whether to render this action
|
||||||
|
*
|
||||||
|
* @param string $filter
|
||||||
|
*
|
||||||
|
* @return $this
|
||||||
|
*/
|
||||||
|
public function setFilter($filter)
|
||||||
|
{
|
||||||
|
$this->filter = $filter;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the filter to use when being asked whether to render this action
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getFilter()
|
||||||
|
{
|
||||||
|
return $this->filter;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
*/
|
*/
|
||||||
@ -62,4 +93,17 @@ class Action extends NavigationItem
|
|||||||
|
|
||||||
return $url;
|
return $url;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
public function getRender()
|
||||||
|
{
|
||||||
|
if ($this->render === null) {
|
||||||
|
$filter = $this->getFilter();
|
||||||
|
$this->render = $filter ? $this->getObject()->matches(Filter::fromQueryString($filter)) : true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->render;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user