Added new SUM cards for server specs

Added new SUM cards for server specs e.g Total CPU, ram, disk, bandwidth and different locations and providers
This commit is contained in:
cp6 2022-03-09 13:18:30 +11:00
parent 0ad3a2c812
commit 4688dd15ca
4 changed files with 117 additions and 14 deletions

View File

@ -161,18 +161,18 @@ or
## Screenshots for v2
[![My idlers screenshot1](https://cdn.write.corbpie.com/wp-content/uploads/2022/03/My-idlers-v2-home.jpg)](https://cdn.write.corbpie.com/wp-content/uploads/2022/03/My-idlers-v2-home.jpg)
[![My idlers screenshot1](https://cdn.write.corbpie.com/wp-content/uploads/2022/03/My-idlers-v2-home-2.jpg)](https://cdn.write.corbpie.com/wp-content/uploads/2022/03/My-idlers-v2-home-2.jpg)
[![My idlers screenshot1](https://cdn.write.corbpie.com/wp-content/uploads/2022/03/My-idlers-v2-server-view.jpg)](https://cdn.write.corbpie.com/wp-content/uploads/2022/03/My-idlers-v2-server-view.jpg)
[![My idlers screenshot2](https://cdn.write.corbpie.com/wp-content/uploads/2022/03/My-idlers-v2-server-view.jpg)](https://cdn.write.corbpie.com/wp-content/uploads/2022/03/My-idlers-v2-server-view.jpg)
[![My idlers screenshot1](https://cdn.write.corbpie.com/wp-content/uploads/2022/03/My-idlers-v2-servers-home.jpg)](https://cdn.write.corbpie.com/wp-content/uploads/2022/03/My-idlers-v2-servers-home.jpg)
[![My idlers screenshot3](https://cdn.write.corbpie.com/wp-content/uploads/2022/03/My-idlers-v2-servers-home.jpg)](https://cdn.write.corbpie.com/wp-content/uploads/2022/03/My-idlers-v2-servers-home.jpg)
[![My idlers screenshot1](https://cdn.write.corbpie.com/wp-content/uploads/2022/03/My-idlers-v2-YABs.jpg)](https://cdn.write.corbpie.com/wp-content/uploads/2022/03/My-idlers-v2-YABs.jpg)
[![My idlers screenshot4](https://cdn.write.corbpie.com/wp-content/uploads/2022/03/My-idlers-v2-YABs.jpg)](https://cdn.write.corbpie.com/wp-content/uploads/2022/03/My-idlers-v2-YABs.jpg)
[![My idlers screenshot1](https://cdn.write.corbpie.com/wp-content/uploads/2022/03/My-idlers-v2-add-server_2.png)](https://cdn.write.corbpie.com/wp-content/uploads/2022/03/My-idlers-v2-add-server_2.png)
[![My idlers screenshot5](https://cdn.write.corbpie.com/wp-content/uploads/2022/03/My-idlers-v2-add-server_2.png)](https://cdn.write.corbpie.com/wp-content/uploads/2022/03/My-idlers-v2-add-server_2.png)
[![My idlers screenshot1](https://cdn.write.corbpie.com/wp-content/uploads/2022/03/My-idlers-v2-servers-compare.jpg)](https://cdn.write.corbpie.com/wp-content/uploads/2022/03/My-idlers-v2-servers-compare.jpg)
[![My idlers screenshot6](https://cdn.write.corbpie.com/wp-content/uploads/2022/03/My-idlers-v2-servers-compare.jpg)](https://cdn.write.corbpie.com/wp-content/uploads/2022/03/My-idlers-v2-servers-compare.jpg)
[![My idlers screenshot1](https://cdn.write.corbpie.com/wp-content/uploads/2022/03/My-idlers-v2-Ips.jpg)](https://cdn.write.corbpie.com/wp-content/uploads/2022/03/My-idlers-v2-Ips.jpg)
[![My idlers screenshot7](https://cdn.write.corbpie.com/wp-content/uploads/2022/03/My-idlers-v2-Ips.jpg)](https://cdn.write.corbpie.com/wp-content/uploads/2022/03/My-idlers-v2-Ips.jpg)
[![My idlers screenshot1](https://cdn.write.corbpie.com/wp-content/uploads/2022/03/My-idlers-v2-labels.jpg)](https://cdn.write.corbpie.com/wp-content/uploads/2022/03/My-idlers-v2-labels.jpg)
[![My idlers screenshot8](https://cdn.write.corbpie.com/wp-content/uploads/2022/03/My-idlers-v2-labels.jpg)](https://cdn.write.corbpie.com/wp-content/uploads/2022/03/My-idlers-v2-labels.jpg)

View File

@ -50,6 +50,22 @@ class HomeController extends Controller
->get(['p.*', 's.hostname', 'd.domain', 'd.extension', 'r.main_domain as reseller', 'sh.main_domain', 'ms.name']);
});
$server_summary = Cache::remember('servers_summary', 1440, function () {
$cpu_sum = DB::table('servers')->get()->where('active', '=', 1)->sum('cpu');
$ram_mb = DB::table('servers')->get()->where('active', '=', 1)->sum('ram_as_mb');
$disk_gb = DB::table('servers')->get()->where('active', '=', 1)->sum('disk_as_gb');
$bandwidth = DB::table('servers')->get()->where('active', '=', 1)->sum('bandwidth');
$locations_sum = DB::table('servers')->get()->where('active', '=', 1)->groupBy('location_id')->count();
$providers_sum = DB::table('servers')->get()->where('active', '=', 1)->groupBy('provider_id')->count();
return array(
'cpu_sum' => $cpu_sum,
'ram_mb_sum' => $ram_mb,
'disk_gb_sum' => $disk_gb,
'bandwidth_sum' => $bandwidth,
'locations_sum' => $locations_sum,
'providers_sum' => $providers_sum,
);
});
//Check for past due date and refresh the due date if so:
$pricing = new Pricing();
@ -168,7 +184,8 @@ class HomeController extends Controller
'total_cost_2_yearly' => number_format(($total_cost_yearly * 2), 2),
'due_soon' => $due_soon,
'newest' => $recently_added,
'execution_time' => number_format($p->getTimeTaken(), 2)
'execution_time' => number_format($p->getTimeTaken(), 2),
'servers_summary' => $server_summary
);
return view('home', compact('information'));

View File

@ -184,6 +184,7 @@ class ServerController extends Controller
Cache::forget('recently_added');//Main page recently_added cache
Cache::forget('all_active_servers');//all servers cache
Cache::forget('non_active_servers');//all servers cache
Cache::forget('servers_summary');//servers summary cache
return redirect()->route('servers.index')
->with('success', 'Server Created Successfully.');
@ -327,6 +328,7 @@ class ServerController extends Controller
Cache::forget('recently_added');//Main page recently_added cache
Cache::forget('all_active_servers');//all servers cache
Cache::forget('non_active_servers');//all servers cache
Cache::forget('servers_summary');//servers summary cache
return redirect()->route('servers.index')
->with('success', 'Server Updated Successfully.');
@ -350,6 +352,7 @@ class ServerController extends Controller
Cache::forget('recently_added');//Main page recently_added cache
Cache::forget('all_active_servers');//all servers cache
Cache::forget('non_active_servers');//all servers cache
Cache::forget('servers_summary');//servers summary cache
return redirect()->route('servers.index')
->with('success', 'Server was deleted Successfully.');

View File

@ -131,6 +131,79 @@
</div>
</div>
<div class="row mt-3">
<div class="col-12 col-lg-2 mb-3">
<div class="card">
<div class="card-body text-center shadow">
<div class="row">
<h4>{{$information['servers_summary']['cpu_sum']}}</h4>
<p>CPU</p>
</div>
</div>
</div>
</div>
<div class="col-12 col-lg-2 mb-3">
<div class="card">
<div class="card-body text-center shadow">
<div class="row">
<h4>{{$information['servers_summary']['ram_mb_sum'] / 1000}} <small
class="text-muted">GB</small></h4>
<p>Ram</p>
</div>
</div>
</div>
</div>
<div class="col-12 col-lg-2 mb-3">
<div class="card">
<div class="card-body text-center shadow">
<div class="row">
<h4>
@if($information['servers_summary']['disk_gb_sum'] >= 1000)
{{$information['servers_summary']['disk_gb_sum'] / 1000}} <small
class="text-muted">TB</small>
@else
{{$information['servers_summary']['disk_gb_sum']}} <small
class="text-muted">GB</small>
@endif
</h4>
<p>Disk</p>
</div>
</div>
</div>
</div>
<div class="col-12 col-lg-2 mb-3">
<div class="card">
<div class="card-body text-center shadow">
<div class="row">
<h4>{{$information['servers_summary']['bandwidth_sum'] / 1000}} <small
class="text-muted">TB</small></h4>
<p>Bandwidth</p>
</div>
</div>
</div>
</div>
<div class="col-12 col-lg-2 mb-3">
<div class="card">
<div class="card-body text-center shadow">
<div class="row">
<h4>{{$information['servers_summary']['locations_sum']}}</h4>
<p>Locations</p>
</div>
</div>
</div>
</div>
<div class="col-12 col-lg-2 mb-3">
<div class="card">
<div class="card-body text-center shadow">
<div class="row">
<h4>{{$information['servers_summary']['providers_sum']}}</h4>
<p>Providers</p>
</div>
</div>
</div>
</div>
</div>
<h3 class="my-3">Due soon</h3>
@if(!empty($information['due_soon']))
@ -181,15 +254,25 @@
<td class="text-nowrap">{{$due_soon->price}} {{$due_soon->currency}} {{\App\Process::paymentTermIntToString($due_soon->term)}}</td>
<td class="text-nowrap text-center">
@if($due_soon->service_type === 1)
<a href="{{ route('servers.show', $due_soon->service_id) }}" class="text-body mx-1"><i class="fas fa-eye" title="view"></i></a>
<a href="{{ route('servers.show', $due_soon->service_id) }}"
class="text-body mx-1"><i class="fas fa-eye"
title="view"></i></a>
@elseif($due_soon->service_type === 2)
<a href="{{ route('shared.show', $due_soon->service_id) }}" class="text-body mx-1"><i class="fas fa-eye" title="view"></i></a>
<a href="{{ route('shared.show', $due_soon->service_id) }}"
class="text-body mx-1"><i class="fas fa-eye"
title="view"></i></a>
@elseif($due_soon->service_type === 3)
<a href="{{ route('reseller.show', $due_soon->service_id) }}" class="text-body mx-1"><i class="fas fa-eye" title="view"></i></a>
<a href="{{ route('reseller.show', $due_soon->service_id) }}"
class="text-body mx-1"><i class="fas fa-eye"
title="view"></i></a>
@elseif($due_soon->service_type === 4)
<a href="{{ route('domains.show', $due_soon->service_id) }}" class="text-body mx-1"><i class="fas fa-eye" title="view"></i></a>
<a href="{{ route('domains.show', $due_soon->service_id) }}"
class="text-body mx-1"><i class="fas fa-eye"
title="view"></i></a>
@elseif($due_soon->service_type === 5)
<a href="{{ route('misc.show', $due_soon->service_id) }}" class="text-body mx-1"><i class="fas fa-eye" title="view"></i></a>
<a href="{{ route('misc.show', $due_soon->service_id) }}"
class="text-body mx-1"><i class="fas fa-eye"
title="view"></i></a>
@endif
</td>
</tr>