mirror of
https://github.com/Icinga/icingaweb2-module-businessprocess.git
synced 2026-02-18 18:30:00 -05:00
NodeRemoveAction: Change display only if the removed node is a root node
Removing child nodes should not affect display of root nodes
This commit is contained in:
parent
2111103957
commit
0fba409510
1 changed files with 8 additions and 7 deletions
|
|
@ -76,14 +76,15 @@ class NodeRemoveAction extends NodeAction
|
|||
if (! $config->hasBpNode($name)) {
|
||||
$config->removeNode($name);
|
||||
} else {
|
||||
$oldDisplay = $config->getBpNode($name)->getDisplay();
|
||||
$config->removeNode($name);
|
||||
if ($config->getMetadata()->isManuallyOrdered()) {
|
||||
foreach ($config->getRootNodes() as $_ => $node) {
|
||||
$nodeDisplay = $node->getDisplay();
|
||||
if ($nodeDisplay > $oldDisplay) {
|
||||
$node->setDisplay($node->getDisplay() - 1);
|
||||
} elseif ($nodeDisplay === $oldDisplay) {
|
||||
|
||||
if ($config->hasRootNode($name) && $config->getMetadata()->isManuallyOrdered()) {
|
||||
$removedNodeDisplay = $node->getDisplay();
|
||||
foreach ($config->getRootNodes() as $rootNode) {
|
||||
$nodeDisplay = $rootNode->getDisplay();
|
||||
if ($nodeDisplay > $removedNodeDisplay) {
|
||||
$rootNode->setDisplay($nodeDisplay - 1);
|
||||
} elseif ($nodeDisplay === $removedNodeDisplay) {
|
||||
break; // Stop immediately to not make things worse ;)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue