mirror of
https://codeberg.org/PostERG/xamxam.git
synced 2026-06-25 16:19:19 +02:00
- Remove overtype-webcomponent.min.js (zero references) - Extract copyLogContent + fallbackCopy + HTMX tab-updater → app/admin-logs.js (removes duplicate from both system.php and parametres.php) - Extract copyUrl → app/clipboard.js (shared by acces.php) - Extract tag/language pill-search logic → app/pill-search.js Generalized with data-pill-search attributes, auto-inits via DOMContentLoaded + htmx:afterSwap - Extract access-request form handler → app/access-request.js (was inline in templates/public/tfe.php) Files created: admin-logs.js, clipboard.js, pill-search.js, access-request.js Files modified: 9 templates/controllers to drop inline scripts and reference external JS files
115 lines
6.1 KiB
PHP
115 lines
6.1 KiB
PHP
<main id="main-content">
|
|
<h1>Système</h1>
|
|
|
|
<p class="sys-refresh-note">
|
|
Affiché le <?= date('d/m/Y à H:i:s') ?> —
|
|
<a href="?tab=<?= htmlspecialchars($activeTab) ?>&n=<?= $selectedN ?>">Rafraîchir</a> —
|
|
<a href="?tab=<?= htmlspecialchars($activeTab) ?>&n=<?= $selectedN ?>&refresh=1">Forcer actualisation</a>
|
|
</p>
|
|
|
|
<!-- ════════════════════════════════════════════════════════════════════
|
|
STATUS SECTION — always visible above tabs
|
|
════════════════════════════════════════════════════════════════════ -->
|
|
<section class="sys-status-section" aria-label="Statut du système">
|
|
<div class="sys-status-header">
|
|
<h2 class="srv-section-title srv-section-title--compact">Statut
|
|
<?php if ($statusCached && $statusCacheAge !== null): ?>
|
|
<span class="sys-cache-badge sys-cache-badge--hit" title="Données en cache">
|
|
⚡ Cache — il y a <?= $statusCacheAge ?>s
|
|
</span>
|
|
<?php else: ?>
|
|
<span class="sys-cache-badge sys-cache-badge--miss" title="Données fraîches">
|
|
⟳ Actualisé
|
|
</span>
|
|
<?php endif; ?>
|
|
</h2>
|
|
<button id="sys-status-toggle" class="sys-status-toggle"
|
|
aria-expanded="<?= $statusInitiallyCollapsed ? 'false' : 'true' ?>" aria-controls="sys-status-body"
|
|
type="button"
|
|
onclick="var b=document.getElementById('sys-status-body');var c=b.hidden;b.hidden=!c;this.setAttribute('aria-expanded',c);this.textContent=c?'▲ Réduire':'▼ Développer';document.cookie='sys_collapsed='+(!c)+';path=/;max-age=31536000';return false">
|
|
<?= $statusInitiallyCollapsed ? '▼ Développer' : '▲ Réduire' ?>
|
|
</button>
|
|
</div>
|
|
|
|
<div id="sys-status-body"<?= $statusInitiallyCollapsed ? ' hidden' : '' ?>>
|
|
<div class="srv-grid">
|
|
<?php foreach ($checks as $check): ?>
|
|
<?php $st = $check['status'] ?? 'unknown'; ?>
|
|
<div class="srv-card">
|
|
<div class="srv-card__header">
|
|
<span class="srv-card__name"><?= htmlspecialchars($check['label']) ?></span>
|
|
<span class="<?= SystemController::statusClass($st) ?>"><?= SystemController::statusLabel($st) ?></span>
|
|
</div>
|
|
<?php if (!empty($check['detail'])): ?>
|
|
<div class="srv-card__detail"><?= htmlspecialchars($check['detail']) ?></div>
|
|
<?php endif; ?>
|
|
</div>
|
|
<?php endforeach; ?>
|
|
</div>
|
|
|
|
<div class="sys-status-meta">
|
|
<div>
|
|
<h3 class="srv-section-title srv-section-title--sub">Environnement PHP</h3>
|
|
<div class="php-grid php-grid--flush">
|
|
<?php foreach ($phpInfo as $key => $val): ?>
|
|
<div class="php-item">
|
|
<div class="php-item__key"><?= htmlspecialchars($key) ?></div>
|
|
<div class="php-item__val"><?= htmlspecialchars($val) ?></div>
|
|
</div>
|
|
<?php endforeach; ?>
|
|
</div>
|
|
</div>
|
|
<div>
|
|
<h3 class="srv-section-title srv-section-title--sub">Espace disque</h3>
|
|
<div class="disk-bar-wrap">
|
|
<div class="disk-bar" style="--disk-pct:<?= $diskPct ?>%;--disk-color:<?= $diskColor ?>"></div>
|
|
</div>
|
|
<div class="disk-stats">
|
|
<span><?= SystemController::humanBytes($diskUsed) ?> utilisé (<?= $diskPct ?>%)</span>
|
|
<span><?= SystemController::humanBytes($diskFree) ?> libre / <?= SystemController::humanBytes($diskTotal) ?></span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</section>
|
|
|
|
<!-- ── Tab bar ─────────────────────────────────────────────────────── -->
|
|
<nav class="sys-tabs" aria-label="Journaux et configuration">
|
|
<?php foreach (SystemController::LOG_FILES as $key => $def): ?>
|
|
<a href="?tab=<?= htmlspecialchars($key) ?>&n=<?= $selectedN ?>"
|
|
class="sys-tab <?= $activeTab === $key ? 'active' : '' ?>"
|
|
hx-get="/admin/system-fragment.php?tab=<?= htmlspecialchars($key) ?>&n=<?= $selectedN ?>"
|
|
hx-target="#sys-tab-panel"
|
|
hx-push-url="?tab=<?= htmlspecialchars($key) ?>&n=<?= $selectedN ?>"
|
|
hx-swap="innerHTML"
|
|
hx-indicator="#sys-tab-panel"
|
|
data-tab="<?= htmlspecialchars($key) ?>"
|
|
<?= $activeTab === $key ? 'aria-current="page"' : '' ?>>
|
|
<?= htmlspecialchars($def['label']) ?>
|
|
</a>
|
|
<?php endforeach; ?>
|
|
<a href="?tab=nginx_config"
|
|
class="sys-tab <?= $activeTab === 'nginx_config' ? 'active' : '' ?>"
|
|
hx-get="/admin/system-fragment.php?tab=nginx_config"
|
|
hx-target="#sys-tab-panel"
|
|
hx-push-url="?tab=nginx_config"
|
|
hx-swap="innerHTML"
|
|
hx-indicator="#sys-tab-panel"
|
|
data-tab="nginx_config"
|
|
<?= $activeTab === 'nginx_config' ? 'aria-current="page"' : '' ?>>nginx — config</a>
|
|
</nav>
|
|
|
|
<!-- Tab panel — content swapped by HTMX -->
|
|
<div id="sys-tab-panel">
|
|
|
|
<?php if ($activeTab === 'nginx_config'): ?>
|
|
<?php include APP_ROOT . '/templates/admin/partials/system-nginx-config-panel.php'; ?>
|
|
<?php else: ?>
|
|
<?php include APP_ROOT . '/templates/admin/partials/system-log-panel.php'; ?>
|
|
<?php endif; ?>
|
|
|
|
</div><!-- #sys-tab-panel -->
|
|
|
|
</main>
|
|
<script src="/assets/js/app/admin-logs.js"></script>
|