From f0aae665448c003cde00951fa913aacdd76f121a Mon Sep 17 00:00:00 2001 From: Ravi Kumar Kempapura Srinivasa Date: Mon, 13 Sep 2021 16:11:51 +0200 Subject: [PATCH 1/7] Redesign state badges for acknowledged nodes Add and group state badges for acknowkedeged nodes based on state. --- configuration.php | 3 + library/Businessprocess/BpNode.php | 36 ++++++--- library/Businessprocess/Renderer/Renderer.php | 77 +++++++++++++------ .../Renderer/TileRenderer/NodeTile.php | 19 +---- library/Businessprocess/Widget/StateBadge.php | 47 +++++++++++ public/css/module.less | 66 +++++----------- public/css/state-badge.less | 60 +++++++++++++++ public/css/state-badges.less | 27 +++++++ 8 files changed, 240 insertions(+), 95 deletions(-) create mode 100644 library/Businessprocess/Widget/StateBadge.php create mode 100644 public/css/state-badge.less create mode 100644 public/css/state-badges.less diff --git a/configuration.php b/configuration.php index 4615bd4..b1b0a9f 100644 --- a/configuration.php +++ b/configuration.php @@ -59,3 +59,6 @@ $this->provideRestriction( $this->provideJsFile('vendor/Sortable.js'); $this->provideJsFile('behavior/sortable.js'); $this->provideJsFile('vendor/jquery.fn.sortable.js'); + +$this->provideCssFile('state-badge.less'); +$this->provideCssFile('state-badges.less'); diff --git a/library/Businessprocess/BpNode.php b/library/Businessprocess/BpNode.php index 6944f09..ba42cb7 100644 --- a/library/Businessprocess/BpNode.php +++ b/library/Businessprocess/BpNode.php @@ -30,15 +30,15 @@ class BpNode extends Node protected $stateOverrides = []; protected static $emptyStateSummary = array( - 'OK' => 0, - 'WARNING' => 0, - 'CRITICAL' => 0, - 'UNKNOWN' => 0, - 'PENDING' => 0, - 'UP' => 0, - 'DOWN' => 0, - 'UNREACHABLE' => 0, - 'MISSING' => 0, + 'CRITICAL' => 0, + 'CRITICAL-HANDLED' => 0, + 'WARNING' => 0, + 'WARNING-HANDLED' => 0, + 'UNKNOWN' => 0, + 'UNKNOWN-HANDLED' => 0, + 'OK' => 0, + 'PENDING' => 0, + 'MISSING' => 0, ); protected static $sortStateInversionMap = array( @@ -74,7 +74,23 @@ class BpNode extends Node $this->counters['MISSING']++; } else { $state = $child->getStateName($this->getChildState($child)); - $this->counters[$state]++; + if ($child->isHandled()) { + $state = $state . '-HANDLED'; + } + + if ($state === 'DOWN') { + $this->counters['CRITICAL']++; + } elseif ($state === 'DOWN-HANDLED') { + $this->counters['CRITICAL-HANDLED']++; + } elseif ($state === 'UNREACHABLE') { + $this->counters['UNKNOWN']++; + } elseif ($state === 'UNREACHABLE-HANDLED') { + $this->counters['UNKNOWN-HANDLED']++; + } elseif ($state === 'UP') { + $this->counters['OK']++; + } else { + $this->counters[$state]++; + } } } } diff --git a/library/Businessprocess/Renderer/Renderer.php b/library/Businessprocess/Renderer/Renderer.php index 35e3225..a659fe6 100644 --- a/library/Businessprocess/Renderer/Renderer.php +++ b/library/Businessprocess/Renderer/Renderer.php @@ -9,6 +9,7 @@ use Icinga\Module\Businessprocess\ImportedNode; use Icinga\Module\Businessprocess\MonitoredNode; use Icinga\Module\Businessprocess\Node; use Icinga\Module\Businessprocess\Web\Url; +use Icinga\Module\Businessprocess\Widget\StateBadge; use ipl\Html\BaseHtmlElement; use ipl\Html\Html; use ipl\Html\HtmlDocument; @@ -135,34 +136,39 @@ abstract class Renderer extends HtmlDocument * @param $summary * @return BaseHtmlElement */ - public function renderStateBadges($summary) + public function renderStateBadges($summary, $totalChildren) { $elements = []; - foreach ($summary as $state => $cnt) { - if ($cnt === 0 - || $state === 'OK' - || $state === 'UP' - ) { - continue; - } - - $elements[] = Html::tag( - 'span', - [ - 'class' => [ - 'badge', - 'badge-' . strtolower($state) - ], - // TODO: We should translate this in this module - 'title' => mt('monitoring', $state) + $itemCount = Html::tag( + 'span', + [ + 'class' => [ + 'item-count', ], - $cnt - ); - } + 'title' => sprintf('%u %s', $totalChildren, mtp( + 'businessprocess', + 'Child', + 'Children', + $totalChildren, + 'businessprocess.nodes' + )) + ], + $totalChildren + ); + + $elements[] = array_filter([ + $this->createBadgeGroup($summary, 'CRITICAL'), + $this->createBadgeGroup($summary, 'UNKNOWN'), + $this->createBadgeGroup($summary, 'WARNING'), + $this->createBadge($summary, 'OK'), + $this->createBadge($summary, 'MISSING'), + $this->createBadge($summary, 'PENDING') + ]); if (!empty($elements)) { - $container = Html::tag('div', ['class' => 'badges']); + $container = Html::tag('ul', ['class' => 'state-badges']); + $container->add($itemCount); foreach ($elements as $element) { $container->add($element); } @@ -172,6 +178,33 @@ abstract class Renderer extends HtmlDocument return null; } + protected function createBadge($summary, $state) + { + if ($summary[$state] !== 0) { + return Html::tag('li', new StateBadge($summary[$state], $state)); + } + + return null; + } + + protected function createBadgeGroup($summary, $state) + { + $content = []; + if ($summary[$state] !== 0) { + $content[] = Html::tag('li', new StateBadge($summary[$state], $state)); + } + + if ($summary[$state . '-HANDLED'] !== 0) { + $content[] = Html::tag('li', new StateBadge($summary[$state . '-HANDLED'], $state, true)); + } + + if (empty($content)) { + return null; + } + + return Html::tag('li', Html::tag('ul', $content)); + } + public function getNodeClasses(Node $node) { if ($node->isMissing()) { diff --git a/library/Businessprocess/Renderer/TileRenderer/NodeTile.php b/library/Businessprocess/Renderer/TileRenderer/NodeTile.php index 261b6cd..67bb4a6 100644 --- a/library/Businessprocess/Renderer/TileRenderer/NodeTile.php +++ b/library/Businessprocess/Renderer/TileRenderer/NodeTile.php @@ -129,24 +129,7 @@ class NodeTile extends BaseHtmlElement } if ($node instanceof BpNode && !$renderer->isBreadcrumb()) { - $this->add(Html::tag( - 'p', - ['class' => 'children-count'], - $node->hasChildren() - ? Html::tag( - 'span', - null, - sprintf('%u %s', $node->countChildren(), mtp( - 'businessprocess', - 'Child', - 'Children', - $node->countChildren(), - 'businessprocess.nodes' - )) - ) - : null - )); - $this->add($renderer->renderStateBadges($node->getStateSummary())); + $this->add($renderer->renderStateBadges($node->getStateSummary(), $node->countChildren())); } return parent::render(); diff --git a/library/Businessprocess/Widget/StateBadge.php b/library/Businessprocess/Widget/StateBadge.php new file mode 100644 index 0000000..783940a --- /dev/null +++ b/library/Businessprocess/Widget/StateBadge.php @@ -0,0 +1,47 @@ + 'state-badge']; + + /** @var mixed Badge content */ + protected $content; + + /** @var bool Whether the state is handled */ + protected $isHandled; + + /** @var string Textual representation of a state */ + protected $state; + + /** + * Create a new state badge + * + * @param mixed $content Content of the badge + * @param string $state Textual representation of a state + * @param bool $isHandled True if state is handled + */ + public function __construct($content, $state, $isHandled = false, $group = false) + { + $this->content = $content; + $this->isHandled = $isHandled; + $this->state = strtolower($state); + } + + protected function assemble() + { + $this->setTag('span'); + + $class = "state-{$this->state}"; + if ($this->isHandled) { + $class .= ' handled'; + } + + $this->addAttributes(['class' => $class]); + + $this->add($this->content); + } +} diff --git a/public/css/module.less b/public/css/module.less index 78617c5..0089bef 100644 --- a/public/css/module.less +++ b/public/css/module.less @@ -330,19 +330,6 @@ ul.bp { } } } - - .badge { - margin-top: 0.25em; - text-decoration: none; - - &:last-child { - margin-right: 0; - } - - &:hover { - box-shadow: 0px 0px 5px @gray-light; - } - } } .dashboard-tile, @@ -376,35 +363,31 @@ ul.bp { } /** END Dashboard **/ -/** BEGIN Badges **/ -.badges { - background-color: fade(@body-bg-color, 50%); - border-radius: 0.45em; - display: block; - padding: 0.3em 0.4em; - - .badge { - border: 1px solid @body-bg-color; - margin: 0; - } +// State summary badges +.state-badges { + .state-badges(); } -div.bp .badges { +// Node children count +.item-count { + font-size: 1em; + text-align: center; + color: @text-color-inverted; +} + +div.bp .state-badges { display: inline-block; padding-top: 0; } - - -td > a > .badges { +td > a > .state-badges { background-color: transparent; } -.badge-critical, .badge-down { background: @color-critical; } -.badge-unknown, .badge-unreachable { background: @color-unknown; } -.badge-warning { background: @color-warning } -.badge-pending { background: @color-pending } -.badge-missing { background: @gray-semilight; color: @text-color-on-icinga-blue; } +.state-badge.state-missing { + background: @gray-semilight; + color: @text-color-on-icinga-blue; +} /** END Badges **/ /** BEGIN Tiles **/ @@ -431,7 +414,11 @@ td > a > .badges { cursor: pointer; position: relative; - .badges { + .item-count { + margin-right: .5em; + } + + .state-badges { position: absolute; bottom: 0; right: 0; @@ -457,17 +444,6 @@ td > a > .badges { padding: 1em 1em 0; font-weight: bold; word-wrap: break-word; - - & + p.children-count { - margin: 0; - font-size: .5em; - text-align: center; - - span { - font-size: .8em; - font-weight: bold; - } - } } &:hover { diff --git a/public/css/state-badge.less b/public/css/state-badge.less new file mode 100644 index 0000000..9768cb8 --- /dev/null +++ b/public/css/state-badge.less @@ -0,0 +1,60 @@ +.state-badge { + .rounded-corners(); + color: @text-color-on-icinga-blue; + display: inline-block; + font-size: .8em; + min-width: 2em; + padding: .25em; + text-align: center; + border: 1px solid black; + + &.state-critical { + background-color: @color-critical + } + + &.state-critical.handled { + background-color: @color-critical-handled + } + + &.state-down { + background-color: @color-down + } + + &.state-down.handled { + background-color: @color-down-handled + } + + &.state-ok { + background-color: @color-ok + } + + &.state-pending { + background-color: @color-pending + } + + &.state-unknown { + background-color: @color-unknown + } + + &.state-unknown.handled { + background-color: @color-unknown-handled + } + + &.state-up { + background-color: @color-up + } + + &.state-warning { + background-color: @color-warning + } + + &.state-warning.handled { + background-color: @color-warning-handled + } +} + +a .state-badge { + &:hover { + filter: brightness(80%); + } +} diff --git a/public/css/state-badges.less b/public/css/state-badges.less new file mode 100644 index 0000000..570af1f --- /dev/null +++ b/public/css/state-badges.less @@ -0,0 +1,27 @@ +.state-badges() { + &.state-badges { + padding: 0; + + ul { + padding: 0; + } + + li { + display: inline-block; + } + + li > ul > li:first-child:not(:last-child) .state-badge { + border-bottom-right-radius: 0; + border-top-right-radius: 0; + } + + li > ul > li:last-child:not(:first-child) .state-badge { + border-bottom-left-radius: 0; + border-top-left-radius: 0; + } + + > li:not(:last-child) { + margin-right: .25em; + } + } +} From af4226aa436b95f5ca78a29e9eca4d1d03f1c2e9 Mon Sep 17 00:00:00 2001 From: Ravi Kumar Kempapura Srinivasa Date: Tue, 28 Sep 2021 13:58:28 +0200 Subject: [PATCH 2/7] Address Node which is UP or OK with downtime. --- library/Businessprocess/BpNode.php | 2 +- public/css/state-badge.less | 2 +- public/css/state-badges.less | 3 ++- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/library/Businessprocess/BpNode.php b/library/Businessprocess/BpNode.php index ba42cb7..2afde69 100644 --- a/library/Businessprocess/BpNode.php +++ b/library/Businessprocess/BpNode.php @@ -74,7 +74,7 @@ class BpNode extends Node $this->counters['MISSING']++; } else { $state = $child->getStateName($this->getChildState($child)); - if ($child->isHandled()) { + if ($child->isHandled() && ($state !== 'UP' && $state !== 'OK')) { $state = $state . '-HANDLED'; } diff --git a/public/css/state-badge.less b/public/css/state-badge.less index 9768cb8..f5e5577 100644 --- a/public/css/state-badge.less +++ b/public/css/state-badge.less @@ -6,7 +6,7 @@ min-width: 2em; padding: .25em; text-align: center; - border: 1px solid black; + border: 1px solid @body-bg-color; &.state-critical { background-color: @color-critical diff --git a/public/css/state-badges.less b/public/css/state-badges.less index 570af1f..89bce8f 100644 --- a/public/css/state-badges.less +++ b/public/css/state-badges.less @@ -13,6 +13,7 @@ li > ul > li:first-child:not(:last-child) .state-badge { border-bottom-right-radius: 0; border-top-right-radius: 0; + border-right: 0; } li > ul > li:last-child:not(:first-child) .state-badge { @@ -21,7 +22,7 @@ } > li:not(:last-child) { - margin-right: .25em; + margin-right: 1px; } } } From 3fcc6dd105678f7ea2151643af3c41634a4f67f0 Mon Sep 17 00:00:00 2001 From: Johannes Meyer Date: Fri, 17 Dec 2021 12:15:42 +0100 Subject: [PATCH 3/7] =?UTF-8?q?Use=20class=20`=C3=ACpl\Web\Widget\StateBad?= =?UTF-8?q?ge`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- configuration.php | 3 - library/Businessprocess/Renderer/Renderer.php | 8 +-- library/Businessprocess/Widget/StateBadge.php | 47 --------------- public/css/module.less | 24 +++++++- public/css/state-badge.less | 60 ------------------- public/css/state-badges.less | 28 --------- 6 files changed, 25 insertions(+), 145 deletions(-) delete mode 100644 library/Businessprocess/Widget/StateBadge.php delete mode 100644 public/css/state-badge.less delete mode 100644 public/css/state-badges.less diff --git a/configuration.php b/configuration.php index b1b0a9f..4615bd4 100644 --- a/configuration.php +++ b/configuration.php @@ -59,6 +59,3 @@ $this->provideRestriction( $this->provideJsFile('vendor/Sortable.js'); $this->provideJsFile('behavior/sortable.js'); $this->provideJsFile('vendor/jquery.fn.sortable.js'); - -$this->provideCssFile('state-badge.less'); -$this->provideCssFile('state-badges.less'); diff --git a/library/Businessprocess/Renderer/Renderer.php b/library/Businessprocess/Renderer/Renderer.php index a659fe6..eb385f5 100644 --- a/library/Businessprocess/Renderer/Renderer.php +++ b/library/Businessprocess/Renderer/Renderer.php @@ -9,10 +9,10 @@ use Icinga\Module\Businessprocess\ImportedNode; use Icinga\Module\Businessprocess\MonitoredNode; use Icinga\Module\Businessprocess\Node; use Icinga\Module\Businessprocess\Web\Url; -use Icinga\Module\Businessprocess\Widget\StateBadge; use ipl\Html\BaseHtmlElement; use ipl\Html\Html; use ipl\Html\HtmlDocument; +use ipl\Web\Widget\StateBadge; abstract class Renderer extends HtmlDocument { @@ -181,7 +181,7 @@ abstract class Renderer extends HtmlDocument protected function createBadge($summary, $state) { if ($summary[$state] !== 0) { - return Html::tag('li', new StateBadge($summary[$state], $state)); + return Html::tag('li', new StateBadge($summary[$state], strtolower($state))); } return null; @@ -191,11 +191,11 @@ abstract class Renderer extends HtmlDocument { $content = []; if ($summary[$state] !== 0) { - $content[] = Html::tag('li', new StateBadge($summary[$state], $state)); + $content[] = Html::tag('li', new StateBadge($summary[$state], strtolower($state))); } if ($summary[$state . '-HANDLED'] !== 0) { - $content[] = Html::tag('li', new StateBadge($summary[$state . '-HANDLED'], $state, true)); + $content[] = Html::tag('li', new StateBadge($summary[$state . '-HANDLED'], strtolower($state), true)); } if (empty($content)) { diff --git a/library/Businessprocess/Widget/StateBadge.php b/library/Businessprocess/Widget/StateBadge.php deleted file mode 100644 index 783940a..0000000 --- a/library/Businessprocess/Widget/StateBadge.php +++ /dev/null @@ -1,47 +0,0 @@ - 'state-badge']; - - /** @var mixed Badge content */ - protected $content; - - /** @var bool Whether the state is handled */ - protected $isHandled; - - /** @var string Textual representation of a state */ - protected $state; - - /** - * Create a new state badge - * - * @param mixed $content Content of the badge - * @param string $state Textual representation of a state - * @param bool $isHandled True if state is handled - */ - public function __construct($content, $state, $isHandled = false, $group = false) - { - $this->content = $content; - $this->isHandled = $isHandled; - $this->state = strtolower($state); - } - - protected function assemble() - { - $this->setTag('span'); - - $class = "state-{$this->state}"; - if ($this->isHandled) { - $class .= ' handled'; - } - - $this->addAttributes(['class' => $class]); - - $this->add($this->content); - } -} diff --git a/public/css/module.less b/public/css/module.less index 0089bef..7576834 100644 --- a/public/css/module.less +++ b/public/css/module.less @@ -366,6 +366,14 @@ ul.bp { // State summary badges .state-badges { .state-badges(); + + &.state-badges li > ul > li:last-child { + margin-left: 0; + } + + li > ul > li:first-child:not(:last-child) .state-badge { + border-right: 0; + } } // Node children count @@ -384,10 +392,20 @@ td > a > .state-badges { background-color: transparent; } -.state-badge.state-missing { - background: @gray-semilight; - color: @text-color-on-icinga-blue; +.state-badge { + font-size: .8em; + border: 1px solid @body-bg-color; + + &.state-missing { + background: @gray-semilight; + color: @text-color-on-icinga-blue; + } + + &.state-critical.handled, &.state-down.handled { background: @color-critical-handled; opacity: 1; } + &.state-unknown.handled { background-color: @color-unknown-handled; opacity: 1; } + &.state-warning.handled { background: @color-warning-handled; opacity: 1; } } + /** END Badges **/ /** BEGIN Tiles **/ diff --git a/public/css/state-badge.less b/public/css/state-badge.less deleted file mode 100644 index f5e5577..0000000 --- a/public/css/state-badge.less +++ /dev/null @@ -1,60 +0,0 @@ -.state-badge { - .rounded-corners(); - color: @text-color-on-icinga-blue; - display: inline-block; - font-size: .8em; - min-width: 2em; - padding: .25em; - text-align: center; - border: 1px solid @body-bg-color; - - &.state-critical { - background-color: @color-critical - } - - &.state-critical.handled { - background-color: @color-critical-handled - } - - &.state-down { - background-color: @color-down - } - - &.state-down.handled { - background-color: @color-down-handled - } - - &.state-ok { - background-color: @color-ok - } - - &.state-pending { - background-color: @color-pending - } - - &.state-unknown { - background-color: @color-unknown - } - - &.state-unknown.handled { - background-color: @color-unknown-handled - } - - &.state-up { - background-color: @color-up - } - - &.state-warning { - background-color: @color-warning - } - - &.state-warning.handled { - background-color: @color-warning-handled - } -} - -a .state-badge { - &:hover { - filter: brightness(80%); - } -} diff --git a/public/css/state-badges.less b/public/css/state-badges.less deleted file mode 100644 index 89bce8f..0000000 --- a/public/css/state-badges.less +++ /dev/null @@ -1,28 +0,0 @@ -.state-badges() { - &.state-badges { - padding: 0; - - ul { - padding: 0; - } - - li { - display: inline-block; - } - - li > ul > li:first-child:not(:last-child) .state-badge { - border-bottom-right-radius: 0; - border-top-right-radius: 0; - border-right: 0; - } - - li > ul > li:last-child:not(:first-child) .state-badge { - border-bottom-left-radius: 0; - border-top-left-radius: 0; - } - - > li:not(:last-child) { - margin-right: 1px; - } - } -} From 8ab2082b2887eb068ed9a27e001d899e25f86ba9 Mon Sep 17 00:00:00 2001 From: Johannes Meyer Date: Fri, 17 Dec 2021 13:40:58 +0100 Subject: [PATCH 4/7] Update requirements --- doc/02-Installation.md | 3 +++ module.info | 4 +++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/doc/02-Installation.md b/doc/02-Installation.md index 5f8c417..e5a3b4e 100644 --- a/doc/02-Installation.md +++ b/doc/02-Installation.md @@ -6,6 +6,9 @@ Requirements * Icinga Web 2 (>= 2.9) * PHP (>= 7.2) +* Icinga Web 2 libraries: + * [Icinga PHP Library (ipl)](https://github.com/Icinga/icinga-php-library) (>= 0.8) + * [Icinga PHP Thirdparty](https://github.com/Icinga/icinga-php-thirdparty) (>= 0.11) * Icinga Web 2 modules: * The `monitoring` or `icingadb` module needs to be configured and enabled. diff --git a/module.info b/module.info index 7484c03..6a41c7b 100644 --- a/module.info +++ b/module.info @@ -1,6 +1,8 @@ Name: Businessprocess Version: 2.3.1 -Depends: monitoring (>= 2.4.1), icingadb (>= 1.0.0), ipl (>= 0.5.0) +Requires: + Libraries: icinga-php-library (>=0.8.0), icinga-php-thirdparty (>=0.11.0) + Modules: monitoring (>=2.4.1), icingadb (>= 1.0.0) Description: A Business Process viewer and modeler Provides a web-based process modeler for. It integrates as a module into Icinga Web 2 and provides a plugin check command for Icinga. Tile and tree From 595c4a5cb3f94d185499321bffe885d8c0b6c85f Mon Sep 17 00:00:00 2001 From: Florian Strohmaier Date: Thu, 13 Jan 2022 15:35:29 +0100 Subject: [PATCH 5/7] Renderer: Do not display ok/up nodes --- library/Businessprocess/Renderer/Renderer.php | 1 - 1 file changed, 1 deletion(-) diff --git a/library/Businessprocess/Renderer/Renderer.php b/library/Businessprocess/Renderer/Renderer.php index eb385f5..74e4b8b 100644 --- a/library/Businessprocess/Renderer/Renderer.php +++ b/library/Businessprocess/Renderer/Renderer.php @@ -161,7 +161,6 @@ abstract class Renderer extends HtmlDocument $this->createBadgeGroup($summary, 'CRITICAL'), $this->createBadgeGroup($summary, 'UNKNOWN'), $this->createBadgeGroup($summary, 'WARNING'), - $this->createBadge($summary, 'OK'), $this->createBadge($summary, 'MISSING'), $this->createBadge($summary, 'PENDING') ]); From 2d299f73b9e73d29830c98f8a385997359316e02 Mon Sep 17 00:00:00 2001 From: Florian Strohmaier Date: Thu, 13 Jan 2022 15:36:11 +0100 Subject: [PATCH 6/7] Renderer: specify total number of nodes with "Node" --- library/Businessprocess/Renderer/Renderer.php | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/library/Businessprocess/Renderer/Renderer.php b/library/Businessprocess/Renderer/Renderer.php index 74e4b8b..58e1c4d 100644 --- a/library/Businessprocess/Renderer/Renderer.php +++ b/library/Businessprocess/Renderer/Renderer.php @@ -145,16 +145,9 @@ abstract class Renderer extends HtmlDocument [ 'class' => [ 'item-count', - ], - 'title' => sprintf('%u %s', $totalChildren, mtp( - 'businessprocess', - 'Child', - 'Children', - $totalChildren, - 'businessprocess.nodes' - )) + ] ], - $totalChildren + sprintf(mtp('businessprocess', '%u Child', '%u Children', $totalChildren), $totalChildren) ); $elements[] = array_filter([ From d325844b90cffb84706b5178e43b1e6ae126dd49 Mon Sep 17 00:00:00 2001 From: Florian Strohmaier Date: Mon, 17 Jan 2022 10:51:27 +0100 Subject: [PATCH 7/7] BPNode: Ignore node children states in state badges --- library/Businessprocess/BpNode.php | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/library/Businessprocess/BpNode.php b/library/Businessprocess/BpNode.php index 2afde69..2ea8f8e 100644 --- a/library/Businessprocess/BpNode.php +++ b/library/Businessprocess/BpNode.php @@ -65,12 +65,7 @@ class BpNode extends Node $this->counters = self::$emptyStateSummary; foreach ($this->getChildren() as $child) { - if ($child instanceof BpNode) { - $counters = $child->getStateSummary(); - foreach ($counters as $k => $v) { - $this->counters[$k] += $v; - } - } elseif ($child->isMissing()) { + if ($child->isMissing()) { $this->counters['MISSING']++; } else { $state = $child->getStateName($this->getChildState($child));