mirror of
https://codeberg.org/PostERG/xamxam.git
synced 2026-09-25 01:53:03 +02:00
- Increase padding in admin log dropdown selects - Move admin log filters above the Journaux tabs
96 lines
4.3 KiB
PHP
96 lines
4.3 KiB
PHP
<div class="log-toolbar">
|
|
<form id="lines-form" hx-get="/admin/system-fragment.php"
|
|
hx-target="#sys-log-view"
|
|
hx-swap="innerHTML"
|
|
hx-indicator="#sys-log-view"
|
|
hx-trigger="change"
|
|
hx-vals='{"tab":"<?= htmlspecialchars($activeTab) ?>","date":"<?= htmlspecialchars($selectedDate ?? '') ?>"}'>
|
|
<label for="lines-select">Afficher</label>
|
|
<select id="lines-select" name="n" aria-label="Nombre de lignes">
|
|
<?php foreach (SystemController::ALLOWED_LINES as $opt): ?>
|
|
<option value="<?= $opt ?>" <?= $opt === $selectedN ? 'selected' : '' ?>><?= $opt ?> dernières lignes</option>
|
|
<?php endforeach; ?>
|
|
</select>
|
|
</form>
|
|
|
|
<?php if (!empty($logDates)): ?>
|
|
<form id="date-form" hx-get="/admin/system-fragment.php"
|
|
hx-target="#sys-log-view"
|
|
hx-swap="innerHTML"
|
|
hx-indicator="#sys-log-view"
|
|
hx-trigger="change"
|
|
hx-vals='{"tab":"<?= htmlspecialchars($activeTab) ?>","n":<?= $selectedN ?>}'>
|
|
<label for="date-select">Jour</label>
|
|
<select id="date-select" name="date" aria-label="Jour du journal">
|
|
<?php foreach ($logDates as $d): ?>
|
|
<option value="<?= htmlspecialchars($d['date']) ?>" <?= ($selectedDate ?? null) === $d['date'] ? 'selected' : '' ?>><?= htmlspecialchars($d['label']) ?></option>
|
|
<?php endforeach; ?>
|
|
</select>
|
|
</form>
|
|
<?php endif; ?>
|
|
|
|
<?php if ($logLines !== null && count($logLines) > 0): ?>
|
|
<span class="log-count-badge"><?= count($logLines) ?> ligne(s)</span>
|
|
<?php endif; ?>
|
|
</div>
|
|
|
|
<nav class="sys-tabs" aria-label="Journaux et configuration">
|
|
<?php foreach (SystemController::LOG_FILES as $key => $def): ?>
|
|
<a href="?tab=<?= htmlspecialchars($key) ?>&date=<?= htmlspecialchars($selectedDate ?? '') ?>&n=<?= $selectedN ?>"
|
|
class="sys-tab <?= $activeTab === $key ? 'active' : '' ?>"
|
|
hx-get="/admin/system-fragment.php?tab=<?= htmlspecialchars($key) ?>&date=<?= htmlspecialchars($selectedDate ?? '') ?>&n=<?= $selectedN ?>"
|
|
hx-target="#sys-log-view"
|
|
hx-push-url="?tab=<?= htmlspecialchars($key) ?>&date=<?= htmlspecialchars($selectedDate ?? '') ?>&n=<?= $selectedN ?>"
|
|
hx-swap="innerHTML"
|
|
hx-indicator="#sys-log-view"
|
|
data-tab="<?= htmlspecialchars($key) ?>"
|
|
<?= $activeTab === $key ? 'aria-current="page"' : '' ?>>
|
|
<?= htmlspecialchars($def['label']) ?>
|
|
</a>
|
|
<?php endforeach; ?>
|
|
</nav>
|
|
|
|
<?php if ($logFileMeta): ?>
|
|
<div class="log-meta">
|
|
<span data-label="Fichier"><?= htmlspecialchars($logFileMeta['path']) ?></span>
|
|
<span data-label="Taille"><?= $logFileMeta['size'] ?></span>
|
|
<span data-label="Modifié"><?= $logFileMeta['mtime'] ?></span>
|
|
</div>
|
|
<?php endif; ?>
|
|
|
|
<?php if ($logError !== null): ?>
|
|
<div class="log-unavailable">
|
|
<strong>Journaux non disponibles</strong>
|
|
<div class="log-unavail-path"><?= $logError ?></div>
|
|
<?php if (php_sapi_name() === 'cli-server' && str_starts_with($activeTab, 'nginx')): ?>
|
|
<div class="log-unavail-dev">
|
|
En environnement de développement, les logs nginx ne sont pas disponibles.
|
|
Cette page est pleinement fonctionnelle sur le serveur de production.
|
|
</div>
|
|
<?php endif; ?>
|
|
</div>
|
|
|
|
<?php elseif (!empty($notYet)): ?>
|
|
<div class="log-empty">
|
|
Aucune entrée pour le moment.<br>
|
|
<span class="log-unavail-path">Le journal sera créé automatiquement au premier événement.</span>
|
|
</div>
|
|
|
|
<?php elseif (empty($logLines)): ?>
|
|
<div class="log-empty">Le fichier journal est vide.</div>
|
|
|
|
<?php else: ?>
|
|
<div class="log-output-wrapper">
|
|
<button class="btn btn--secondary btn--sm log-copy-btn" id="log-copy-btn" type="button" title="Copier le contenu"
|
|
onclick="copyLogContent(this);return false">
|
|
Copier
|
|
</button>
|
|
<div class="log-output" id="log-output" role="log" aria-live="off" aria-label="Contenu du journal">
|
|
<?php foreach ($logLines as $i => $line): ?>
|
|
<span class="log-line <?= SystemController::logLineClass($line) ?>"
|
|
data-n="<?= count($logLines) - $i ?>"><?= htmlspecialchars($line, ENT_QUOTES | ENT_SUBSTITUTE) ?></span>
|
|
<?php endforeach; ?>
|
|
</div>
|
|
</div>
|
|
<?php endif; ?>
|