Updated Ram and Disk MB, GB and TB conversion to binary
Updated Ram and Disk MB, GB and TB conversion to binary
This commit is contained in:
parent
8195fba66e
commit
f3c3d3a9f3
|
@ -119,10 +119,10 @@ class ServerController extends Controller
|
|||
'location_id' => $request->location_id,
|
||||
'ram' => $request->ram,
|
||||
'ram_type' => $request->ram_type,
|
||||
'ram_as_mb' => ($request->ram_type === 'MB') ? $request->ram : ($request->ram / 1000),
|
||||
'ram_as_mb' => ($request->ram_type === 'MB') ? $request->ram : ($request->ram * 1024),
|
||||
'disk' => $request->disk,
|
||||
'disk_type' => $request->disk_type,
|
||||
'disk_as_gb' => ($request->disk_type === 'GB') ? $request->disk : ($request->disk * 1000),
|
||||
'disk_as_gb' => ($request->disk_type === 'GB') ? $request->disk : ($request->disk * 1024),
|
||||
'owned_since' => $request->owned_since,
|
||||
'ns1' => $request->ns1,
|
||||
'ns2' => $request->ns2,
|
||||
|
@ -268,10 +268,10 @@ class ServerController extends Controller
|
|||
'location_id' => $request->location_id,
|
||||
'ram' => $request->ram,
|
||||
'ram_type' => $request->ram_type,
|
||||
'ram_as_mb' => ($request->ram_type === 'MB') ? $request->ram : ($request->ram / 1000),
|
||||
'ram_as_mb' => ($request->ram_type === 'MB') ? $request->ram : ($request->ram * 1024),
|
||||
'disk' => $request->disk,
|
||||
'disk_type' => $request->disk_type,
|
||||
'disk_as_gb' => ($request->disk_type === 'GB') ? $request->disk : ($request->disk * 1000),
|
||||
'disk_as_gb' => ($request->disk_type === 'GB') ? $request->disk : ($request->disk * 1024),
|
||||
'owned_since' => $request->owned_since,
|
||||
'ns1' => $request->ns1,
|
||||
'ns2' => $request->ns2,
|
||||
|
|
|
@ -101,10 +101,10 @@ class YabsController extends Controller
|
|||
->update([
|
||||
'ram' => $yabs['ram'],
|
||||
'ram_type' => $yabs['ram_type'],
|
||||
'ram_as_mb' => ($yabs['ram_type'] === 'GB') ? ($yabs['ram'] * 1000) : $yabs['ram'],
|
||||
'ram_as_mb' => ($yabs['ram_type'] === 'GB') ? ($yabs['ram'] * 1024) : $yabs['ram'],
|
||||
'disk' => $yabs['disk'],
|
||||
'disk_type' => $yabs['disk_type'],
|
||||
'disk_as_gb' => ($yabs['disk_type'] === 'TB') ? ($yabs['disk'] * 1000) : $yabs['disk'],
|
||||
'disk_as_gb' => ($yabs['disk_type'] === 'TB') ? ($yabs['disk'] * 1024) : $yabs['disk'],
|
||||
'cpu' => $yabs['cpu_cores'],
|
||||
'has_yabs' => 1
|
||||
]);
|
||||
|
|
|
@ -94,9 +94,9 @@ class Process
|
|||
private function GBpstoMBps(string $gbps, bool $format = false): float
|
||||
{//Gigabits to Megabits
|
||||
if ($format) {
|
||||
return (float)number_format(((float)$gbps * 1000), 3);
|
||||
return (float)number_format(((float)$gbps * 1024), 3);
|
||||
}
|
||||
return (float)$gbps * 1000;
|
||||
return (float)$gbps * 1024;
|
||||
}
|
||||
|
||||
private function diskSpeedAsMbps(string $type, string $value): float
|
||||
|
@ -105,7 +105,7 @@ class Process
|
|||
return $this->GBpstoMBps($value);
|
||||
}
|
||||
if ($type === "KB/s") {
|
||||
return (float)($value / 1000);
|
||||
return (float)($value / 1024);
|
||||
}
|
||||
return $value;
|
||||
}
|
||||
|
|
|
@ -146,7 +146,7 @@
|
|||
<div class="card">
|
||||
<div class="card-body text-center shadow">
|
||||
<div class="row">
|
||||
<h4>{{$information['servers_summary']['ram_mb_sum'] / 1000}} <small
|
||||
<h4>{{$information['servers_summary']['ram_mb_sum'] / 1024}} <small
|
||||
class="text-muted">GB</small></h4>
|
||||
<p>Ram</p>
|
||||
</div>
|
||||
|
@ -159,7 +159,7 @@
|
|||
<div class="row">
|
||||
<h4>
|
||||
@if($information['servers_summary']['disk_gb_sum'] >= 1000)
|
||||
{{$information['servers_summary']['disk_gb_sum'] / 1000}} <small
|
||||
{{$information['servers_summary']['disk_gb_sum'] / 1024}} <small
|
||||
class="text-muted">TB</small>
|
||||
@else
|
||||
{{$information['servers_summary']['disk_gb_sum']}} <small
|
||||
|
@ -175,7 +175,7 @@
|
|||
<div class="card">
|
||||
<div class="card-body text-center shadow">
|
||||
<div class="row">
|
||||
<h4>{{$information['servers_summary']['bandwidth_sum'] / 1000}} <small
|
||||
<h4>{{$information['servers_summary']['bandwidth_sum'] / 1024}} <small
|
||||
class="text-muted">TB</small></h4>
|
||||
<p>Bandwidth</p>
|
||||
</div>
|
||||
|
|
|
@ -148,14 +148,14 @@
|
|||
<td class="text-center">{{$server->cpu}}</td>
|
||||
<td class="text-center">
|
||||
@if($server->ram_as_mb > 1024)
|
||||
{{ number_format(($server->ram_as_mb / 1000),0) }}<small>GB</small>
|
||||
{{ number_format(($server->ram_as_mb / 1024),0) }}<small>GB</small>
|
||||
@else
|
||||
{{$server->ram_as_mb}}<small>MB</small>
|
||||
@endif
|
||||
</td>
|
||||
<td class="text-center">
|
||||
@if($server->disk > 1000)
|
||||
{{ number_format(($server->disk / 1000),1) }}<small>TB</small>
|
||||
{{ number_format(($server->disk / 1024),1) }}<small>TB</small>
|
||||
@else
|
||||
{{$server->disk}}<small>GB</small>
|
||||
@endif
|
||||
|
|
|
@ -58,7 +58,7 @@
|
|||
</td>
|
||||
<td class="text-nowrap">
|
||||
@if($s->disk > 1000)
|
||||
{{ number_format(($s->disk / 1000),1) }}<small>TB</small>
|
||||
{{ number_format(($s->disk / 1024),1) }}<small>TB</small>
|
||||
@else
|
||||
{{$s->disk}}<small>GB</small>
|
||||
@endif
|
||||
|
|
Loading…
Reference in New Issue
Block a user