Files
breadcrumb-the-shire/pages/admin/system-info/index(default).phtml
fs 87652e55da refactor(system-info): reduce to Stripe-style status page
Reduce admin/system-info to a single focused status view: overall
status banner, components list from existing health checks, and an
environment meta table. Drops the Modules and Permissions tabs —
those were dev-diagnostics already available via CLI.

- Remove SystemInfoService + its test; wire the action directly to
  SystemHealthService and build meta inline
- Extend SystemHealthService with per-check label + description so
  the UI speaks in customer terms while the CLI doctor path stays
  compatible
- Rebuild the view on existing app-stats-table + app-empty-state
  primitives; add a small app-status-banner component for the
  headline signal
- Align help-center nav label and i18n keys (de/en)

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-24 16:32:46 +02:00

101 lines
3.1 KiB
PHTML

<?php
/**
* @var list<array{status: string, name: string, message: string, label: string, description: string}> $checks
* @var string $overall
* @var array{php_version: string, environment: string} $meta
* @var string $lastChecked
*/
$checks = $checks ?? [];
$overall = $overall ?? 'ok';
$meta = $meta ?? ['php_version' => '', 'environment' => ''];
$lastChecked = $lastChecked ?? '';
$bannerTitles = [
'ok' => t('All systems operational'),
'warn' => t('Degraded service'),
'fail' => t('System outage detected'),
];
$bannerIcons = [
'ok' => 'bi-check-circle-fill',
'warn' => 'bi-exclamation-triangle-fill',
'fail' => 'bi-x-circle-fill',
];
$bannerVariants = [
'ok' => 'success',
'warn' => 'warn',
'fail' => 'danger',
];
$statusBadgeLabel = [
'ok' => t('OK'),
'warn' => t('Warning'),
'fail' => t('Fail'),
];
$bannerTitle = $bannerTitles[$overall] ?? $bannerTitles['ok'];
$bannerIcon = $bannerIcons[$overall] ?? $bannerIcons['ok'];
$bannerVariant = $bannerVariants[$overall] ?? $bannerVariants['ok'];
?>
<div class="app-dashboard-titlebar">
<h1><?php e(t('System status')); ?></h1>
</div>
<section class="app-status-banner" data-variant="<?php e($bannerVariant); ?>" aria-live="polite">
<i class="bi <?php e($bannerIcon); ?>" aria-hidden="true"></i>
<div class="app-status-banner-text">
<h2><?php e($bannerTitle); ?></h2>
<small><?php e(t('Last checked')); ?>: <?php e($lastChecked); ?></small>
</div>
</section>
<div class="app-stats-table">
<div class="app-stats-table-header">
<small><?php e(t('Components')); ?></small>
</div>
<?php if (empty($checks)): ?>
<?php $emptyState = ['message' => t('No health checks available.'), 'size' => 'compact']; require templatePath('partials/app-empty-state.phtml'); ?>
<?php else: ?>
<table>
<tbody>
<?php foreach ($checks as $check):
$status = (string) ($check['status'] ?? 'fail');
$label = (string) ($check['label'] ?? $check['name'] ?? '');
$description = (string) ($check['description'] ?? $check['message'] ?? '');
$variant = $bannerVariants[$status] ?? 'danger';
$badgeLabel = $statusBadgeLabel[$status] ?? t('Fail');
?>
<tr>
<td>
<strong><?php e(t($label)); ?></strong>
<small class="app-status-description"><?php e(t($description)); ?></small>
</td>
<td class="app-status-badge-cell">
<span class="badge" data-variant="<?php e($variant); ?>"><?php e($badgeLabel); ?></span>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<?php endif; ?>
</div>
<div class="app-stats-table">
<div class="app-stats-table-header">
<small><?php e(t('Environment')); ?></small>
</div>
<table>
<tbody>
<tr>
<th scope="row"><?php e(t('PHP version')); ?></th>
<td><?php e($meta['php_version']); ?></td>
</tr>
<tr>
<th scope="row"><?php e(t('Environment')); ?></th>
<td><?php e($meta['environment']); ?></td>
</tr>
</tbody>
</table>
</div>