mirror of
https://github.com/pelican-dev/panel.git
synced 2025-05-19 21:04:44 +02:00

* add spatie health * change slug for health page * add check for panel version * only check for debug mode if env isn't local * add check for node versions * improve short summary * fix outdated check * run pint * fix health checks during tests * add count to ok message * fix typo * temp fix for phpstan job * fix pint... * improve "outdated" count Co-authored-by: MartinOscar <40749467+RMartinOscar@users.noreply.github.com> * run pint * skip node versions check if no nodes are created * auto run health checks if they didn't run before * small refactor * update navigation Co-authored-by: Charles <sir3lit@gmail.com> * fix errors if tests didn't run yet * fix disk usage check * remove plugin and use own page * use health status indicator from spatie * fix after merge * update icon * update color classes * fix after merge * add back imports oops... * wrong import oops²... * update spatie/laravel-health to latest * move Health page to correct namespace * update NodeVersionsCheck * use style instead of tailwind classes workaround until we have vite * cleanup custom checks --------- Co-authored-by: MartinOscar <40749467+RMartinOscar@users.noreply.github.com> Co-authored-by: Charles <sir3lit@gmail.com>
32 lines
982 B
PHP
32 lines
982 B
PHP
<?php
|
|
|
|
namespace App\Checks;
|
|
|
|
use App\Services\Helpers\SoftwareVersionService;
|
|
use Spatie\Health\Checks\Check;
|
|
use Spatie\Health\Checks\Result;
|
|
|
|
class PanelVersionCheck extends Check
|
|
{
|
|
public function __construct(private SoftwareVersionService $versionService) {}
|
|
|
|
public function run(): Result
|
|
{
|
|
$isLatest = $this->versionService->isLatestPanel();
|
|
$currentVersion = $this->versionService->currentPanelVersion();
|
|
$latestVersion = $this->versionService->latestPanelVersion();
|
|
|
|
$result = Result::make()
|
|
->meta([
|
|
'isLatest' => $isLatest,
|
|
'currentVersion' => $currentVersion,
|
|
'latestVersion' => $latestVersion,
|
|
])
|
|
->shortSummary($isLatest ? 'up-to-date' : 'outdated');
|
|
|
|
return $isLatest
|
|
? $result->ok('Panel is up-to-date.')
|
|
: $result->failed('Installed version is `:currentVersion` but latest is `:latestVersion`.');
|
|
}
|
|
}
|