Display node name if alias is missing

This fixes the issue that the name of a missing monitoring node is
not displayed in forms and in Tree/Tile view.
This commit is contained in:
Sukhwinder Dhillon 2022-10-04 10:54:32 +02:00 committed by Johannes Meyer
parent 5b4056e1b2
commit 2f730cc526
5 changed files with 15 additions and 9 deletions

View file

@ -31,15 +31,16 @@ class DeleteNodeForm extends QuickForm
public function setup()
{
$node = $this->node;
$nodeName = $node->getAlias() ?? $node->getName();
$view = $this->getView();
$this->addHtml(
'<h2>' . $view->escape(
sprintf($this->translate('Delete "%s"'), $node->getAlias())
sprintf($this->translate('Delete "%s"'), $nodeName)
) . '</h2>'
);
$biLink = $view->qlink(
$node->getAlias(),
$nodeName,
'businessprocess/node/impact',
array('name' => $node->getName()),
array('data-base-target' => '_next')
@ -61,7 +62,7 @@ class DeleteNodeForm extends QuickForm
} else {
$yesMsg = sprintf(
$this->translate('Delete root node "%s"'),
$this->node->getAlias()
$nodeName
);
}
@ -74,7 +75,7 @@ class DeleteNodeForm extends QuickForm
'multiOptions' => $this->optionalEnum(array(
'no' => $this->translate('No'),
'yes' => $yesMsg,
'all' => sprintf($this->translate('Delete all occurrences of %s'), $node->getAlias()),
'all' => sprintf($this->translate('Delete all occurrences of %s'), $nodeName),
))
));
}

View file

@ -48,9 +48,10 @@ class EditNodeForm extends QuickForm
}
$view = $this->getView();
$nodeName = $this->getNode()->getAlias() ?? $this->getNode()->getName();
$this->addHtml(
'<h2>' . $view->escape(
sprintf($this->translate('Modify "%s"'), $this->getNode()->getAlias())
sprintf($this->translate('Modify "%s"'), $nodeName)
) . '</h2>'
);

View file

@ -44,7 +44,7 @@ class SimulationForm extends QuickForm
}
$this->addHtml(
'<h2>'
. $view->escape(sprintf($title, $node->getAlias()))
. $view->escape(sprintf($title, $node->getAlias() ?? $node->getName()))
. '</h2>'
);

View file

@ -11,9 +11,9 @@ abstract class MonitoredNode extends Node
public function getLink()
{
if ($this->isMissing()) {
return Html::tag('a', ['href' => '#'], $this->getAlias());
return Html::tag('a', ['href' => '#'], $this->getAlias() ?? $this->getName());
} else {
return Html::tag('a', ['href' => $this->getUrl()], $this->getAlias());
return Html::tag('a', ['href' => $this->getUrl()], $this->getAlias() ?? $this->getName());
}
}
}

View file

@ -180,7 +180,11 @@ class NodeTile extends BaseHtmlElement
$node = $this->node;
$url = $this->getMainNodeUrl($node);
if ($node instanceof MonitoredNode) {
$link = Html::tag('a', ['href' => $url, 'data-base-target' => '_next'], $node->getAlias());
$link = Html::tag(
'a',
['href' => $url, 'data-base-target' => '_next'],
$node->getAlias() ?? $node->getName()
);
} else {
$link = Html::tag('a', ['href' => $url], $node->getAlias());
}