diff --git a/app/Filament/Admin/Pages/Health.php b/app/Filament/Admin/Pages/Health.php index 651883dcf7..b1fd1c4262 100644 --- a/app/Filament/Admin/Pages/Health.php +++ b/app/Filament/Admin/Pages/Health.php @@ -8,6 +8,7 @@ use Filament\Pages\Page; use Illuminate\Support\Facades\Artisan; use Spatie\Health\Commands\RunHealthChecksCommand; +use Spatie\Health\Enums\Status; use Spatie\Health\ResultStores\ResultStore; class Health extends Page @@ -122,4 +123,37 @@ public static function getNavigationIcon(): string return $results->containsFailingCheck() ? 'tabler-heart-exclamation' : 'tabler-heart-check'; } + + public function backgroundColor(string $str): string + { + return match ($str) { + Status::ok()->value => 'bg-success-100 dark:bg-success-200', + Status::warning()->value => 'bg-warning-100 dark:bg-warning-200', + Status::skipped()->value => 'bg-info-100 dark:bg-info-200', + Status::failed()->value, Status::crashed()->value => 'bg-danger-100 dark:bg-danger-200', + default => 'bg-gray-100 dark:bg-gray-200' + }; + } + + public function iconColor(string $str): string + { + return match ($str) { + Status::ok()->value => 'text-success-500 dark:text-success-600', + Status::warning()->value => 'text-warning-500 dark:text-warning-600', + Status::skipped()->value => 'text-info-500 dark:text-info-600', + Status::failed()->value, Status::crashed()->value => 'text-danger-500 dark:text-danger-600', + default => 'text-gray-500 dark:text-gray-600' + }; + } + + public function icon(string $str): string + { + return match ($str) { + Status::ok()->value => 'tabler-circle-check', + Status::warning()->value => 'tabler-exclamation-circle', + Status::skipped()->value => 'tabler-circle-chevron-right', + Status::failed()->value, Status::crashed()->value => 'tabler-circle-x', + default => 'tabler-help-circle' + }; + } } diff --git a/resources/views/filament/pages/health.blade.php b/resources/views/filament/pages/health.blade.php index f81d2ef7a1..798a51e983 100644 --- a/resources/views/filament/pages/health.blade.php +++ b/resources/views/filament/pages/health.blade.php @@ -1,50 +1,10 @@ -@php - if(! function_exists('backgroundColor')) { - function backgroundColor($status) { - return match ($status) { - Spatie\Health\Enums\Status::ok()->value => 'bg-success-100 dark:bg-success-200', - Spatie\Health\Enums\Status::warning()->value => 'bg-warning-100 dark:bg-warning-200', - Spatie\Health\Enums\Status::skipped()->value => 'bg-info-100 dark:bg-info-200', - Spatie\Health\Enums\Status::failed()->value, Spatie\Health\Enums\Status::crashed()->value => 'bg-danger-100 dark:bg-danger-200', - default => 'bg-gray-100 dark:bg-gray-200' - }; - } - } - - if(! function_exists('iconColor')) { - function iconColor($status) - { - return match ($status) { - Spatie\Health\Enums\Status::ok()->value => 'text-success-500 dark:text-success-600', - Spatie\Health\Enums\Status::warning()->value => 'text-warning-500 dark:text-warning-600', - Spatie\Health\Enums\Status::skipped()->value => 'text-info-500 dark:text-info-600', - Spatie\Health\Enums\Status::failed()->value, Spatie\Health\Enums\Status::crashed()->value => 'text-danger-500 dark:text-danger-600', - default => 'text-gray-500 dark:text-gray-600' - }; - } - } - - if(! function_exists('icon')) { - function icon($status) - { - return match ($status) { - Spatie\Health\Enums\Status::ok()->value => 'tabler-circle-check', - Spatie\Health\Enums\Status::warning()->value => 'tabler-exclamation-circle', - Spatie\Health\Enums\Status::skipped()->value => 'tabler-circle-chevron-right', - Spatie\Health\Enums\Status::failed()->value, Spatie\Health\Enums\Status::crashed()->value => 'tabler-circle-x', - default => 'tabler-help-circle' - }; - } - } -@endphp - @if (count($checkResults?->storedCheckResults ?? [])) @foreach ($checkResults->storedCheckResults as $result)
-
- +
+