From d9c6debfa9b84aae524184ae83dbb985504d7d7f Mon Sep 17 00:00:00 2001 From: Johannes Meyer Date: Fri, 4 Aug 2023 14:01:54 +0200 Subject: [PATCH] ServiceNode: Change alias to ` on ` --- library/Businessprocess/ServiceNode.php | 9 ++++++++- test/php/library/Businessprocess/ServiceNodeTest.php | 4 ++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/library/Businessprocess/ServiceNode.php b/library/Businessprocess/ServiceNode.php index cba6acf..c80b984 100644 --- a/library/Businessprocess/ServiceNode.php +++ b/library/Businessprocess/ServiceNode.php @@ -3,9 +3,12 @@ namespace Icinga\Module\Businessprocess; use Icinga\Module\Businessprocess\Web\Url; +use ipl\I18n\Translation; class ServiceNode extends MonitoredNode { + use Translation; + protected $hostname; /** @var string Alias of the host */ @@ -69,7 +72,11 @@ class ServiceNode extends MonitoredNode return null; } - return $this->getHostAlias() . ': ' . $this->alias; + return sprintf( + $this->translate('%s on %s', ' on '), + $this->alias, + $this->getHostAlias() + ); } public function getUrl() diff --git a/test/php/library/Businessprocess/ServiceNodeTest.php b/test/php/library/Businessprocess/ServiceNodeTest.php index d56529d..62c1605 100644 --- a/test/php/library/Businessprocess/ServiceNodeTest.php +++ b/test/php/library/Businessprocess/ServiceNodeTest.php @@ -27,7 +27,7 @@ class ServiceNodeTest extends BaseTestCase public function testReturnsCorrectAlias() { $this->assertEquals( - 'localhost: ping <> pong', + 'ping <> pong on localhost', $this->pingOnLocalhost()->getAlias() ); } @@ -36,7 +36,7 @@ class ServiceNodeTest extends BaseTestCase { $this->assertEquals( '' - . 'localhost: ping <> pong', + . 'ping <> pong on localhost', $this->pingOnLocalhost()->getLink()->render() ); }