From d23e393a9a4050e9697b1cd2a68b7678e4deae3e Mon Sep 17 00:00:00 2001 From: iglocska Date: Thu, 5 Oct 2023 12:47:18 +0200 Subject: [PATCH] fix: [topology] various fixes --- src/Model/Table/InstanceTable.php | 20 ++++++++++---------- templates/Instance/topology.php | 4 ++++ 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/src/Model/Table/InstanceTable.php b/src/Model/Table/InstanceTable.php index 83b29bd..6d1d5c0 100644 --- a/src/Model/Table/InstanceTable.php +++ b/src/Model/Table/InstanceTable.php @@ -275,7 +275,7 @@ class InstanceTable extends AppTable $status = ''; if ($brood['status']['code'] === 200) { $status = sprintf( - '
Ping: %sms
Version: v%s
Role: %s
', + "
Ping: %sms
Version: v%s
Role: %s
", h($brood['status']['ping']), $brood['status']['response']['version'] === $newest ? 'text-success' : 'text-danger', h($brood['status']['response']['version']) . ($brood['status']['response']['version'] !== $newest ? ' - outdated' : ''), @@ -292,7 +292,7 @@ class InstanceTable extends AppTable sprintf( " cerebrate_%s[%s
%sfas:fa-eye]" . PHP_EOL, h($brood['id']), - '' . h($brood['name']) . '', + "" . h($brood['name']) . '', sprintf( "Connected: %s%s", $brood['status']['code'] === 200 ? 'text-success' : 'text-danger', @@ -311,20 +311,20 @@ class InstanceTable extends AppTable ); } $tools = ''; - foreach ($data['tools'] as $tool) { + foreach ($data['tools'] as $k => $tool) { $tools .= sprintf( ' subgraph instance_local_tools_%s[%s %s connector]' . PHP_EOL . ' direction TB' . PHP_EOL, - h($tool['name']), - isset($tool['logo']) ? '' : 'fas:fa-wrench', + h($k), + isset($tool['logo']) ? "" : 'fas:fa-wrench', h($tool['name']) ); - foreach ($tool['connections'] as $connection) { + foreach ($tool['connections'] as $k2 => $connection) { $tools .= sprintf( - " %s[%s
%s
%s]" . PHP_EOL, - h($connection['name']), + " connection%s[%s
%s
%s]" . PHP_EOL, + h($k2), h($connection['name']), sprintf( - __('Health') . ': %s', + __('Health') . ": %s", h($connection['message']), $connection['health'] === 1 ? 'text-success' : 'text-danger', $connection['health'] === 1 ? 'fas:fa-check' : 'fas:fa-times' @@ -338,7 +338,7 @@ class InstanceTable extends AppTable $tools .= ' end' . PHP_EOL; } $this_cerebrate = sprintf( - 'C1[My Cerebrate
Version: v%s]', + "C1[My Cerebrate
Version: v%s]", $version === $newest ? 'text-success' : 'text-danger', $version ); diff --git a/templates/Instance/topology.php b/templates/Instance/topology.php index c97d2c0..1151b0e 100644 --- a/templates/Instance/topology.php +++ b/templates/Instance/topology.php @@ -1,4 +1,8 @@ Download markdown', + h($baseurl) +); echo $this->element('genericElements/mermaid', [ 'data' => $data, ]);