Fixes status page design

main
Yasen Pramatarov 2025-01-24 11:48:37 +02:00
parent e59920cfd0
commit fc71cdd7f8
8 changed files with 119 additions and 110 deletions

View File

@ -286,7 +286,7 @@ class Agent {
$base64Url_payload = $this->base64UrlEncode($payload);
// signature
$signature = hash_hmac('sha256', $base64Url_header . "." . $base64Url_payload, $secret_key, true);
$signature = hash_hmac('sha256', $base64Url_header . "." . $base64Url_payload, $secret_key ?? '', true);
$base64Url_signature = $this->base64UrlEncode($signature);
// build the JWT

View File

@ -13,7 +13,9 @@ include '../app/includes/messages.php';
include '../app/includes/messages-show.php';
require '../app/classes/agent.php';
require '../app/classes/host.php';
$agentObject = new Agent($dbWeb);
$hostObject = new Host($dbWeb);
include '../app/templates/status-server.php';
@ -25,17 +27,22 @@ foreach ($platformsAll as $platform) {
if ($response['error'] !== null) {
$jilo_database_status = $response['error'];
} else {
$jilo_database_status = 'OK';
$jilo_database_status = 'Connected';
}
include '../app/templates/status-platform.php';
// fetch agent details for the current platform
$agentDetails = $agentObject->getAgentDetails($platform['id']);
// fetch hosts for the current platform
$hostDetails = $hostObject->getHostDetails($platform['id']);
foreach ($hostDetails as $host) {
// fetch agent details for the current host
$agentDetails = $agentObject->getAgentDetails($host['id']);
foreach ($agentDetails as $agent) {
// we try to parse the URL to scheme:/host:port
$agent_url = parse_url($agent['url']);
$agent_protocol = isset($agent_url['scheme']) ? $agent_url['scheme']: '';
$agent_host = isset($agent_url['host']) ? $agent_url['host']: '';
// on failure we keep the full value for displaying purpose
$agent_host = isset($agent_url['host']) ? $agent_url['host']: $agent['url'];
$agent_port = isset($agent_url['port']) ? $agent_url['port']: '';
// we get agent data to check availability
@ -67,7 +74,11 @@ foreach ($platformsAll as $platform) {
include '../app/templates/status-agent.php';
}
echo '</div>';
echo '</div>';
}
echo "\n\t\t\t\t\t\t\t</div>\n";
}
echo "\n\t\t\t\t\t\t</div>";
echo "\n\t\t\t\t\t</div>";
echo "\n\t\t\t\t</div>";
?>

View File

@ -19,7 +19,6 @@ $(document).ready(function(){
});
</script>
<script>
// dismissible messages
document.addEventListener('DOMContentLoaded', function() {
@ -39,7 +38,6 @@ document.addEventListener('DOMContentLoaded', function() {
});
</script>
</body>
</html>

View File

@ -46,5 +46,6 @@
<?= Messages::render($msg['category'], $msg['key'], $msg['custom_message'] ?? null) ?>
<?php endforeach; ?>
<?php endif; ?>
</div>
</div>

View File

@ -3,7 +3,7 @@
<div class="d-flex align-items-center flex-wrap border-top p-3">
<div class="d-flex align-items-center me-4">
<span class="me-2">Jilo agent
<a href="<?= htmlspecialchars($app_root) ?>?page=config#platform<?= htmlspecialchars($platform['id']) ?>agent<?= htmlspecialchars($agent['id']) ?>" class="text-decoration-none">
<a href="<?= htmlspecialchars($app_root) ?>?page=settings#platform-<?= htmlspecialchars($platform['id']) ?>agent-<?= htmlspecialchars($agent['id']) ?>" class="text-decoration-none">
<?= htmlspecialchars($agent['agent_description']) ?>
</a>:
</span>
@ -13,7 +13,7 @@
</div>
<div class="d-flex align-items-center me-4">
<span class="me-4">Host: <strong><?= htmlspecialchars($agent_host) ?></strong></span>
<span class="me-4">Port: <strong><?= htmlspecialchars($agent_port) ?></strong></span>
<span class="me-4">Port: <?= isset($agent_port) && $agent_port !== '' ? '<strong>' . htmlspecialchars($agent_port) . '</strong>' : '<em class="small text-muted">not set</em>' ?></span>
<span>Endpoint: <strong><?= htmlspecialchars($agent['agent_endpoint']) ?></strong></span>
</div>
</div>

View File

@ -3,19 +3,18 @@
<div class="card mt-3 mb-3">
<div class="card-header">
<h4>
<a href="<?= htmlspecialchars($app_root) ?>?page=config#platform<?= htmlspecialchars($platform['id']) ?>" class="text-decoration-none">
<a href="<?= htmlspecialchars($app_root) ?>?page=settings#platform-<?= htmlspecialchars($platform['id']) ?>" class="text-decoration-none">
Jitsi platform "<?= htmlspecialchars($platform['name']) ?>"
</a>
</h4>
<small class="text-muted">Remote Jitsi Meet installation with its database and agents here.</small>
</div>
<div class="card-body p-0">
<div class="card-body">
<div class="d-flex align-items-center flex-wrap">
<span class="me-4">Jilo database: <strong><?= htmlspecialchars($platform['jilo_database']) ?></strong></span>
<div class="d-flex align-items-center">
<span class="me-2">Status:</span>
<span class="badge <?= $jilo_database_status === 'OK' ? 'bg-success' : 'bg-danger' ?>"><?= htmlspecialchars($jilo_database_status) ?></span>
<span class="badge <?= $jilo_database_status === 'Connected' ? 'bg-success' : 'bg-danger' ?>"><?= htmlspecialchars($jilo_database_status) ?></span>
</div>
</div>
</div>

View File

@ -7,7 +7,7 @@
</div>
<div class="row mb-4">
<!-- jilo status -->
<!-- jilo server status -->
<div class="card mt-3">
<div class="card-header">
<h4>Jilo server</h4>