diff --git a/.changes/showed-an-error-on-the-vulnerabilities.md b/.changes/showed-an-error-on-the-vulnerabilities.md new file mode 100644 index 0000000000..0148a5120d --- /dev/null +++ b/.changes/showed-an-error-on-the-vulnerabilities.md @@ -0,0 +1,4 @@ +--- +type: fixed +--- +Showed an error on the `Vulnerabilities` page diff --git a/resources/views/livewire/image-scan/fleet-vulnerabilities.blade.php b/resources/views/livewire/image-scan/fleet-vulnerabilities.blade.php index 212d315ee4..dbb9cec56d 100644 --- a/resources/views/livewire/image-scan/fleet-vulnerabilities.blade.php +++ b/resources/views/livewire/image-scan/fleet-vulnerabilities.blade.php @@ -25,42 +25,58 @@

- @if (! $allowed) - - @else - @if ($serversNotScanning > 0) - @php - $serversKey = 'coolify.image-scan.servers-not-scanning-dismissed.'.currentTeam()->id.'.'.$serversNotScanning; - @endphp -
- - Go to servers - -
- @endif + @if ($serversNotScanning > 0) + @php + $serversKey = 'coolify.image-scan.servers-not-scanning-dismissed.'.currentTeam()->id.'.'.$serversNotScanning; + @endphp +
+ + Go to servers + +
+ @endif -
- - - - +
+ + + + - - Status - @foreach ($statusOptions as $option => $optionLabel) + + Status + @foreach ($statusOptions as $option => $optionLabel) + @php + $selected = in_array($option, $statuses, true); + @endphp + + @endforeach + @if ($serverOptions !== []) + Server + @foreach ($serverOptions as $uuid => $name) @php - $selected = in_array($option, $statuses, true); + $selected = in_array($uuid, $servers, true); @endphp - @endforeach - @if ($serverOptions !== []) - Server - @foreach ($serverOptions as $uuid => $name) - @php - $selected = in_array($uuid, $servers, true); - @endphp - - @endforeach - @endif - @if ($projectOptions !== []) - Project - @foreach ($projectOptions as $uuid => $name) - @php - $selected = in_array($uuid, $projects, true); - @endphp - - @endforeach - @endif - - - -
- - - @if ($items->isEmpty()) - @if ($searching) - - @elseif ($hasFilters) - - @elseif (! $hasResources) - - @elseif ($hidesNotChecked) - - @endif - @else -
-
- Resource - {{ $searching ? 'Match' : 'Status' }} - {{ $searching ? 'State' : 'Action' }} - Server - Checked -
- @foreach ($items as $entry) - @php - $resource = $entry['resource']; - $security = $entry['security']; - $status = $security->status; - $checkedAt = $security->checkedAt ?? $entry['scans']->max('scanned_at'); - $action = $searching ? null : \App\Services\ImageScan\TeamVulnerabilities::action($security); - $statusLabel = \App\Services\ImageScan\TeamVulnerabilities::statusLabel($status); - $badgeType = match ($status) { - \App\Enums\SecurityStatusType::UpdateNow => 'error', - \App\Enums\SecurityStatusType::UpdateAvailable => 'warning', - \App\Enums\SecurityStatusType::NoFix, \App\Enums\SecurityStatusType::CheckNeeded => 'neutral', - default => null, - }; - @endphp -
-
- - - -
-
- @if ($entry['link']) - {{ $resource->name }} - @else - {{ $resource->name }} - @endif - @if ($searching && $badgeType !== null) - - @endif -
- {{ $entry['project']?->name }} / {{ $entry['environment']?->name }} -
-
- - @if ($searching) - @php - $match = $entry['match']; - @endphp -
- - {{ $match['id'] }} · {{ $match['package'] }} {{ $match['version'] }} - @if ($match['more'] > 0) - +{{ number_format($match['more']) }} more - @endif -
- - {{ $stateLabels[$match['state']] }}@if ($match['state'] === 'fixed' && filled($match['fixedIn'])) → {{ $match['fixedIn'] }}@endif - - @else - @php - $imagesLine = \App\Services\ImageScan\TeamVulnerabilities::imagesLine($security, $entry['images']); - @endphp -
- @if ($badgeType !== null) - - @else - {{ $statusLabel }} - @endif - @if ($imagesLine !== null) - {{ $imagesLine }} - @endif -
-
- @if ($action !== null) - @php - $actionClass = $action['muted'] ? 'text-[12px] text-neutral-500 dark:text-fg-faint' : 'text-[12px] text-neutral-800 dark:text-fg'; - @endphp - @if ($action['link'] && $entry['link']) - {{ $action['text'] }} - @else - {{ $action['text'] }} - @endif - @endif -
- @endif - - {{ $entry['server']?->name }} - {{ $checkedAt?->diffForHumans() }} -
- @endforeach -
@endif -
+ @if ($projectOptions !== []) + Project + @foreach ($projectOptions as $uuid => $name) + @php + $selected = in_array($uuid, $projects, true); + @endphp + + @endforeach + @endif + + - - - - - +
+ - @if ($searchCapped) -
- Only the first {{ \App\Services\ImageScan\TeamVulnerabilities::MAX_DECODED_SCANS }} images with a match were searched. Filter by server or project to see the rest. -
- @endif - @if ($notScannedLine) -
- {{ $notScannedLine }} - @if ($notCheckedToggle !== null) - - @endif + @if ($items->isEmpty()) + @if ($searching) + + @elseif ($hasFilters) + + @elseif (! $hasResources) + + @elseif ($hidesNotChecked) + + @endif + @else +
+
+ Resource + {{ $searching ? 'Match' : 'Status' }} + {{ $searching ? 'State' : 'Action' }} + Server + Checked +
+ @foreach ($items as $entry) + @php + $resource = $entry['resource']; + $security = $entry['security']; + $status = $security->status; + $checkedAt = $security->checkedAt ?? $entry['scans']->max('scanned_at'); + $action = $searching ? null : \App\Services\ImageScan\TeamVulnerabilities::action($security); + $statusLabel = \App\Services\ImageScan\TeamVulnerabilities::statusLabel($status); + $badgeType = match ($status) { + \App\Enums\SecurityStatusType::UpdateNow => 'error', + \App\Enums\SecurityStatusType::UpdateAvailable => 'warning', + \App\Enums\SecurityStatusType::NoFix, \App\Enums\SecurityStatusType::CheckNeeded => 'neutral', + default => null, + }; + @endphp +
+
+ + + +
+
+ @if ($entry['link']) + {{ $resource->name }} + @else + {{ $resource->name }} + @endif + @if ($searching && $badgeType !== null) + + @endif +
+ {{ $entry['project']?->name }} / {{ $entry['environment']?->name }} +
+
+ + @if ($searching) + @php + $match = $entry['match']; + @endphp +
+ + {{ $match['id'] }} · {{ $match['package'] }} {{ $match['version'] }} + @if ($match['more'] > 0) + +{{ number_format($match['more']) }} more + @endif +
+ + {{ $stateLabels[$match['state']] }}@if ($match['state'] === 'fixed' && filled($match['fixedIn'])) → {{ $match['fixedIn'] }}@endif + + @else + @php + $imagesLine = \App\Services\ImageScan\TeamVulnerabilities::imagesLine($security, $entry['images']); + @endphp +
+ @if ($badgeType !== null) + + @else + {{ $statusLabel }} + @endif + @if ($imagesLine !== null) + {{ $imagesLine }} + @endif +
+
+ @if ($action !== null) + @php + $actionClass = $action['muted'] ? 'text-[12px] text-neutral-500 dark:text-fg-faint' : 'text-[12px] text-neutral-800 dark:text-fg'; + @endphp + @if ($action['link'] && $entry['link']) + {{ $action['text'] }} + @else + {{ $action['text'] }} + @endif + @endif +
+ @endif + + {{ $entry['server']?->name }} + {{ $checkedAt?->diffForHumans() }} +
+ @endforeach
@endif
- @endif + + + + + + + + @if ($searchCapped) +
+ Only the first {{ \App\Services\ImageScan\TeamVulnerabilities::MAX_DECODED_SCANS }} images with a match were searched. Filter by server or project to see the rest. +
+ @endif + @if ($notScannedLine) +
+ {{ $notScannedLine }} + @if ($notCheckedToggle !== null) + + @endif +
+ @endif +