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