mirror of
https://github.com/Icinga/icingaweb2-module-businessprocess.git
synced 2026-01-02 03:39:35 -05:00
Display node name if alias for monitoring node is missing (#360)
When a monitoring node is missing, its alias is also missing. So in this case we should display the node name.
This commit is contained in:
commit
6abcf8a757
6 changed files with 19 additions and 9 deletions
|
|
@ -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),
|
||||
))
|
||||
));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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>'
|
||||
);
|
||||
|
||||
|
|
|
|||
|
|
@ -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>'
|
||||
);
|
||||
|
||||
|
|
|
|||
|
|
@ -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());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -65,6 +65,10 @@ class ServiceNode extends MonitoredNode
|
|||
|
||||
public function getAlias()
|
||||
{
|
||||
if ($this->getHostAlias() === null || $this->alias === null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return $this->getHostAlias() . ': ' . $this->alias;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue