mirror of
https://github.com/solidtime-io/solidtime.git
synced 2026-08-18 05:02:14 +01:00
Added fallback for local env to server overview widget
This commit is contained in:
committed by
Gregor Vostrak
parent
2372ee0622
commit
7af1990935
@@ -16,18 +16,22 @@ class ServerOverview extends Widget
|
|||||||
*/
|
*/
|
||||||
protected function getViewData(): array
|
protected function getViewData(): array
|
||||||
{
|
{
|
||||||
$currentVersion = Cache::get('latest_version', null);
|
/** @var string|null $currentVersion */
|
||||||
|
$currentVersion = config('app.version');
|
||||||
|
/** @var string|null $build */
|
||||||
|
$build = config('app.build');
|
||||||
|
$latestVersion = Cache::get('latest_version', null);
|
||||||
|
|
||||||
$needsUpdate = false;
|
$needsUpdate = false;
|
||||||
if ($currentVersion !== null && version_compare($currentVersion, config('app.version')) > 0) {
|
if ($latestVersion !== null && $currentVersion !== null && version_compare($latestVersion, $currentVersion) > 0) {
|
||||||
$needsUpdate = true;
|
$needsUpdate = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return [
|
return [
|
||||||
'version' => config('app.version'),
|
'version' => $currentVersion,
|
||||||
'build' => config('app.build'),
|
'build' => $build,
|
||||||
'environment' => config('app.env'),
|
'environment' => config('app.env'),
|
||||||
'currentVersion' => $currentVersion,
|
'currentVersion' => $latestVersion,
|
||||||
'needsUpdate' => $needsUpdate,
|
'needsUpdate' => $needsUpdate,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,11 +1,23 @@
|
|||||||
<x-filament-widgets::widget>
|
<x-filament-widgets::widget>
|
||||||
<x-filament::section>
|
<x-filament::section>
|
||||||
<div>
|
<div>
|
||||||
<span class="text-gray-950 font-bold">Version</span> <span>v{{ $version }}</span><br>
|
<span class="text-gray-950 font-bold">Version</span>
|
||||||
<span class="text-gray-950 font-bold">Build</span> {{ $build }}
|
@if($version !== null)
|
||||||
|
<span>v{{ $version }}</span>
|
||||||
|
@else
|
||||||
|
<span>-</span>
|
||||||
|
@endif
|
||||||
|
<br>
|
||||||
|
<span class="text-gray-950 font-bold">Build</span>
|
||||||
|
@if($build !== null)
|
||||||
|
<span>{{ $build }}</span>
|
||||||
|
@else
|
||||||
|
<span>-</span>
|
||||||
|
@endif
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@if ($currentVersion !== null)
|
@if ($currentVersion !== null && $version !== null)
|
||||||
<div class="mt-4 inline-flex items-center justify-center gap-1">
|
<div class="mt-4 inline-flex items-center justify-center gap-1">
|
||||||
@if ($needsUpdate)
|
@if ($needsUpdate)
|
||||||
<span>
|
<span>
|
||||||
|
|||||||
Reference in New Issue
Block a user