62 lines
2.8 KiB
PHP
62 lines
2.8 KiB
PHP
<?php
|
|
|
|
namespace App\Cells\Equipment;
|
|
|
|
use App\Services\Equipment\ServerService;
|
|
|
|
class ServerCell extends EquipmentCell
|
|
{
|
|
|
|
public function __construct()
|
|
{
|
|
parent::__construct(new ServerService());
|
|
}
|
|
|
|
//서비스 방식에 따른 서비스별 Count
|
|
final public function totalCountDashboard(array $params): string
|
|
{
|
|
$totalCounts = [
|
|
'all' => [
|
|
'normal' => ['tokyo' => 0, 'chiba' => 0],
|
|
'defence' => ['tokyo' => 0, 'chiba' => 0],
|
|
'dedicated' => ['tokyo' => 0, 'chiba' => 0],
|
|
'alternative' => ['tokyo' => 0, 'chiba' => 0],
|
|
'vpn' => ['tokyo' => 0, 'chiba' => 0],
|
|
'event' => ['tokyo' => 0, 'chiba' => 0],
|
|
'test' => ['tokyo' => 0, 'chiba' => 0],
|
|
'summary_tokyo' => 0,
|
|
'summary_chiba' => 0,
|
|
'summary_all' => 0,
|
|
]
|
|
];
|
|
foreach (array_keys(SITES) as $site) {
|
|
$totalCounts[$site] = $this->getService()->getTotalServiceCount(['serviceinfo.site' => $site]);
|
|
$totalCounts['all']['normal']['tokyo'] += $totalCounts[$site]['normal']['tokyo'];
|
|
$totalCounts['all']['normal']['chiba'] += $totalCounts[$site]['normal']['chiba'];
|
|
$totalCounts['all']['defence']['tokyo'] += $totalCounts[$site]['defence']['tokyo'];
|
|
$totalCounts['all']['defence']['chiba'] += $totalCounts[$site]['defence']['chiba'];
|
|
$totalCounts['all']['dedicated']['tokyo'] += $totalCounts[$site]['dedicated']['tokyo'];
|
|
$totalCounts['all']['dedicated']['chiba'] += $totalCounts[$site]['dedicated']['chiba'];
|
|
$totalCounts['all']['alternative']['tokyo'] += $totalCounts[$site]['alternative']['tokyo'];
|
|
$totalCounts['all']['alternative']['chiba'] += $totalCounts[$site]['alternative']['chiba'];
|
|
$totalCounts['all']['vpn']['tokyo'] += $totalCounts[$site]['vpn']['tokyo'];
|
|
$totalCounts['all']['vpn']['chiba'] += $totalCounts[$site]['vpn']['chiba'];
|
|
$totalCounts['all']['event']['tokyo'] += $totalCounts[$site]['event']['tokyo'];
|
|
$totalCounts['all']['event']['chiba'] += $totalCounts[$site]['event']['chiba'];
|
|
$totalCounts['all']['test']['tokyo'] += $totalCounts[$site]['test']['tokyo'];
|
|
$totalCounts['all']['test']['chiba'] += $totalCounts[$site]['test']['chiba'];
|
|
$totalCounts['all']['summary_tokyo'] += $totalCounts[$site]['tokyo_summary'];
|
|
$totalCounts['all']['summary_chiba'] += $totalCounts[$site]['chiba_summary'];
|
|
$totalCounts['all']['summary_all'] = $totalCounts['all']['summary_tokyo'] + $totalCounts['all']['summary_chiba'];
|
|
}
|
|
$template = array_key_exists('template', $params) ? $params['template'] : __FUNCTION__;
|
|
return view('cells/server/' . $template, [
|
|
'serviceCellDatas' => [
|
|
'control' => $this->getService()->getControlDatas(),
|
|
'service' => $this->getService(),
|
|
'totalCounts' => $totalCounts,
|
|
]
|
|
]);
|
|
}
|
|
}
|