diff --git a/app/Filament/Server/Widgets/ServerOverview.php b/app/Filament/Server/Widgets/ServerOverview.php index e11b7a4be9..0d23404e88 100644 --- a/app/Filament/Server/Widgets/ServerOverview.php +++ b/app/Filament/Server/Widgets/ServerOverview.php @@ -19,19 +19,22 @@ protected function getStats(): array return [ Stat::make('Name', $this->server->name) ->description($this->server->description), - Stat::make('Status', Str::title($this->server->condition)), - Stat::make('Uptime', $this->uptime()), + Stat::make('Status', $this->status()), + Stat::make('Address', $this->server->allocation->address), ]; } - private function uptime(): string + private function status(): string { + $status = Str::title($this->server->condition); $uptime = collect(cache()->get("servers.{$this->server->id}.uptime"))->last() ?? 0; if ($uptime === 0) { - return 'Offline'; + return $status; } - return now()->subMillis($uptime)->diffForHumans(syntax: CarbonInterface::DIFF_ABSOLUTE, short: true, parts: 2); + $uptime = now()->subMillis($uptime)->diffForHumans(syntax: CarbonInterface::DIFF_ABSOLUTE, short: true, parts: 2); + + return "$status ($uptime)"; } } diff --git a/app/Models/Allocation.php b/app/Models/Allocation.php index 4ec50e72d0..b8bbeb571a 100644 --- a/app/Models/Allocation.php +++ b/app/Models/Allocation.php @@ -20,6 +20,7 @@ * @property \Carbon\Carbon|null $updated_at * @property string $alias * @property bool $has_alias + * @property string $address * @property \App\Models\Server|null $server * @property \App\Models\Node $node *