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); $base64Url_payload = $this->base64UrlEncode($payload);
// signature // 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); $base64Url_signature = $this->base64UrlEncode($signature);
// build the JWT // build the JWT

View File

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

@ -12,14 +12,13 @@
</div> </div>
<script src="static/sidebar.js"></script> <script src="static/sidebar.js"></script>
<script> <script>
$(document).ready(function(){ $(document).ready(function(){
$('[data-toggle="tooltip"]').tooltip(); $('[data-toggle="tooltip"]').tooltip();
}); });
</script> </script>
<script> <script>
// dismissible messages // dismissible messages
document.addEventListener('DOMContentLoaded', function() { document.addEventListener('DOMContentLoaded', function() {
@ -39,7 +38,6 @@ document.addEventListener('DOMContentLoaded', function() {
}); });
</script> </script>
</body> </body>
</html> </html>

View File

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

View File

@ -10,7 +10,7 @@
</div> </div>
</div> </div>
<li class="font-weight-light text-uppercase" style="font-size: 0.5em; color: whitesmoke; margin-right: 70px; align-content: center;">version&nbsp;<?= htmlspecialchars($config['version']) ?></li> <li class="font-weight-light text-uppercase" style="font-size: 0.5em; color: whitesmoke; margin-right: 70px; align-content: center;">version&nbsp;<?= htmlspecialchars($config['version']) ?></li>
<?php if ( isset($_SESSION['username']) ) { ?> <?php if ( isset($_SESSION['username']) ) { ?>

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 flex-wrap border-top p-3">
<div class="d-flex align-items-center me-4"> <div class="d-flex align-items-center me-4">
<span class="me-2">Jilo agent <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']) ?> <?= htmlspecialchars($agent['agent_description']) ?>
</a>: </a>:
</span> </span>
@ -13,7 +13,7 @@
</div> </div>
<div class="d-flex align-items-center me-4"> <div class="d-flex align-items-center me-4">
<span class="me-4">Host: <strong><?= htmlspecialchars($agent_host) ?></strong></span> <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> <span>Endpoint: <strong><?= htmlspecialchars($agent['agent_endpoint']) ?></strong></span>
</div> </div>
</div> </div>

View File

@ -3,19 +3,18 @@
<div class="card mt-3 mb-3"> <div class="card mt-3 mb-3">
<div class="card-header"> <div class="card-header">
<h4> <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']) ?>" Jitsi platform "<?= htmlspecialchars($platform['name']) ?>"
</a> </a>
</h4> </h4>
<small class="text-muted">Remote Jitsi Meet installation with its database and agents here.</small> <small class="text-muted">Remote Jitsi Meet installation with its database and agents here.</small>
</div> </div>
<div class="card-body p-0">
<div class="card-body"> <div class="card-body">
<div class="d-flex align-items-center flex-wrap"> <div class="d-flex align-items-center flex-wrap">
<span class="me-4">Jilo database: <strong><?= htmlspecialchars($platform['jilo_database']) ?></strong></span> <span class="me-4">Jilo database: <strong><?= htmlspecialchars($platform['jilo_database']) ?></strong></span>
<div class="d-flex align-items-center"> <div class="d-flex align-items-center">
<span class="me-2">Status:</span> <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> </div>
</div> </div>

View File

@ -1,13 +1,13 @@
<!-- jilo status --> <!-- jilo status -->
<div class="container-fluid mt-2"> <div class="container-fluid mt-2">
<div class="row mb-4"> <div class="row mb-4">
<div class="col-md-6 mb-5"> <div class="col-md-6 mb-5">
<h2>Jilo status</h2> <h2>Jilo status</h2>
</div> </div>
<div class="row mb-4"> <div class="row mb-4">
<!-- jilo status --> <!-- jilo server status -->
<div class="card mt-3"> <div class="card mt-3">
<div class="card-header"> <div class="card-header">
<h4>Jilo server</h4> <h4>Jilo server</h4>