Use gray tiles and state-balls for the entire branch of empty BpNode

The node state is recursively calculated in case the node contains only BpNodes as its children and are empty. The gray tiles and state-balls are used for the entire branch if the children are empty.
This commit is contained in:
Ravi Kumar Kempapura Srinivasa 2020-03-03 16:51:03 +01:00 committed by Eric Lippmann
parent 6cc5eb8e74
commit 1bc6bf6236
2 changed files with 10 additions and 5 deletions

View file

@ -6,6 +6,7 @@ use Icinga\Exception\ProgrammingError;
use Icinga\Module\Businessprocess\BpNode;
use Icinga\Module\Businessprocess\BpConfig;
use Icinga\Module\Businessprocess\ImportedNode;
use Icinga\Module\Businessprocess\MonitoredNode;
use Icinga\Module\Businessprocess\Node;
use Icinga\Module\Businessprocess\Web\Url;
use ipl\Html\BaseHtmlElement;
@ -176,9 +177,13 @@ abstract class Renderer extends HtmlDocument
if ($node->isMissing()) {
$classes = array('missing');
} else {
$classes = array(
strtolower($node->getStateName())
);
if ($node->isEmpty() && ! $node instanceof MonitoredNode) {
$classes = array('empty');
} else {
$classes = array(
strtolower($node->getStateName())
);
}
if ($node->hasMissingChildren()) {
$classes[] = 'missing-children';
}

View file

@ -85,7 +85,7 @@ class NodeTile extends BaseHtmlElement
$this->addActionLinks();
}
}
if (! $node instanceof ImportedNode || ! $node->isMissing()) {
if (! $node instanceof ImportedNode || $node->getBpConfig()->hasNode($node->getName())) {
$link = $this->getMainNodeLink();
if ($renderer->isBreadcrumb()) {
$link->prepend((new StateBall(strtolower($node->getStateName())))->addAttributes([
@ -202,7 +202,7 @@ class NodeTile extends BaseHtmlElement
Html::tag('i', ['class' => 'icon icon-sitemap'])
));
if ($node instanceof ImportedNode) {
if (! $node->isMissing()) {
if ($node->getBpConfig()->hasNode($node->getName())) {
$this->actions()->add(Html::tag(
'a',
[