Merge pull request #6863 from YaRissi/hetzner/cpu_vendor

feat(hetzner): add CPU vendor information to server types in Hetzner integration
This commit is contained in:
Andras Bacsai 2025-10-15 09:03:12 +02:00 committed by GitHub
commit 81455b1b5f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 28 additions and 3 deletions

View file

@ -290,6 +290,23 @@ private function loadHetznerData(string $token)
}
}
private function getCpuVendorInfo(array $serverType): string|null
{
$name = strtolower($serverType['name'] ?? '');
if (str_starts_with($name, 'ccx')) {
return 'AMD Milan EPYC™';
} elseif (str_starts_with($name, 'cpx')) {
return 'AMD EPYC™';
} elseif (str_starts_with($name, 'cx')) {
return 'Intel® Xeon®';
} elseif (str_starts_with($name, 'cax')) {
return 'Ampere® Altra®';
}
return null;
}
public function getAvailableServerTypesProperty()
{
ray('Getting available server types', [
@ -311,6 +328,11 @@ public function getAvailableServerTypesProperty()
return in_array($this->selected_location, $locationNames);
})
->map(function ($serverType) {
$serverType['cpu_vendor_info'] = $this->getCpuVendorInfo($serverType);
return $serverType;
})
->values()
->toArray();

View file

@ -68,11 +68,14 @@
@foreach ($this->availableServerTypes as $serverType)
<option value="{{ $serverType['name'] }}">
{{ $serverType['description'] }} -
{{ $serverType['cores'] }} vCPU,
{{ $serverType['memory'] }}GB RAM,
{{ $serverType['cores'] }} vCPU
@if (isset($serverType['cpu_vendor_info']) && $serverType['cpu_vendor_info'])
({{ $serverType['cpu_vendor_info'] }})
@endif
, {{ $serverType['memory'] }}GB RAM,
{{ $serverType['disk'] }}GB
@if (isset($serverType['architecture']))
({{ $serverType['architecture'] }})
[{{ $serverType['architecture'] }}]
@endif
@if (isset($serverType['prices']))
-