feat: add CPU vendor information to server types in Hetzner integration
This commit is contained in:
parent
009ac822ab
commit
ea584902ec
2 changed files with 29 additions and 3 deletions
|
|
@ -290,6 +290,23 @@ private function loadHetznerData(string $token)
|
|||
}
|
||||
}
|
||||
|
||||
private function getCpuVendorInfo(array $serverType): array
|
||||
{
|
||||
$name = strtolower($serverType['name'] ?? '');
|
||||
|
||||
if (str_starts_with($name, 'ccx')) {
|
||||
return ['vendor_info' => 'AMD Milan EPYC™'];
|
||||
} elseif (str_starts_with($name, 'cpx')) {
|
||||
return ['vendor_info' => 'AMD EPYC™'];
|
||||
} elseif (str_starts_with($name, 'cx')) {
|
||||
return ['vendor_info' => 'Intel® Xeon®'];
|
||||
} elseif (str_starts_with($name, 'cax')) {
|
||||
return ['vendor_info' => 'Ampere® Altra®'];
|
||||
}
|
||||
|
||||
return ['vendor_info' => null];
|
||||
}
|
||||
|
||||
public function getAvailableServerTypesProperty()
|
||||
{
|
||||
ray('Getting available server types', [
|
||||
|
|
@ -311,6 +328,12 @@ public function getAvailableServerTypesProperty()
|
|||
|
||||
return in_array($this->selected_location, $locationNames);
|
||||
})
|
||||
->map(function ($serverType) {
|
||||
$cpuInfo = $this->getCpuVendorInfo($serverType);
|
||||
$serverType['cpu_vendor_info'] = $cpuInfo['vendor_info'];
|
||||
|
||||
return $serverType;
|
||||
})
|
||||
->values()
|
||||
->toArray();
|
||||
|
||||
|
|
|
|||
|
|
@ -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']))
|
||||
-
|
||||
|
|
|
|||
Loading…
Reference in a new issue