feat(servers): show the patch status of each server in the server list

- ServerSetting::patchStatus() summarizes the saved patch check
  (updates, security updates, reboot required, error). Results saved
  before security and reboot detection count as 0 and false.
- Grid cards show "N security updates", "N updates", "Patch check
  failed", and "Reboot required" badges; the table gets a Patches
  column from lg. The badge text is searchable.
- The toolbar shows a one-line team summary, for example "Patches: 2
  servers with updates · 1 with security updates · 1 needs a reboot".
- Badges and the summary are shown only for servers where the user can
  view the security pages (viewSecurity on the server), so members do
  not see them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Andras Bacsai
2026-10-19 10:41:59 +02:00
co-authored by Claude Opus 5.5
parent 4ca0b4415c
commit 83ea5cc1f7
3 changed files with 254 additions and 6 deletions
+24
View File
@@ -7,6 +7,7 @@ use App\Enums\TrafficIpMode;
use Illuminate\Contracts\Encryption\DecryptException;
use Illuminate\Database\Eloquent\Casts\Attribute;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Carbon;
use Illuminate\Support\Facades\Log;
use OpenApi\Attributes as OA;
@@ -450,4 +451,27 @@ class ServerSetting extends Model
}
);
}
/**
* Summary of the saved patch check, or null when the server was never checked.
* Results saved before security and reboot detection count as 0 and false.
*
* @return array{updates: int, security: int, reboot_required: bool, error: ?string, checked_at: Carbon}|null
*/
public function patchStatus(): ?array
{
if ($this->patch_checked_at === null) {
return null;
}
$result = $this->patch_check_result ?? [];
return [
'updates' => (int) ($result['total_updates'] ?? 0),
'security' => (int) ($result['security_updates'] ?? 0),
'reboot_required' => ($result['reboot_required'] ?? null) === true,
'error' => filled($this->patch_check_error) ? $this->patch_check_error : null,
'checked_at' => $this->patch_checked_at,
];
}
}