dbmsv4 init...4
This commit is contained in:
parent
e8569194e4
commit
e767aa1450
@ -217,6 +217,7 @@ $routes->group('admin', ['namespace' => 'App\Controllers\Admin', 'filter' => 'au
|
||||
$routes->post('batchjob', 'ServerController::batchjob');
|
||||
$routes->post('batchjob_delete', 'ServerController::batchjob_delete');
|
||||
$routes->get('download/(:alpha)', 'ServerPartController::download/$1');
|
||||
$routes->post('console/(:num)', 'ServerController::console/$1');
|
||||
});
|
||||
$routes->group('serverpart', function ($routes) {
|
||||
$routes->get('/', 'ServerPartController::index');
|
||||
|
||||
@ -4,7 +4,6 @@ namespace App\Controllers;
|
||||
|
||||
use App\Entities\CommonEntity;
|
||||
use CodeIgniter\HTTP\RedirectResponse;
|
||||
use CodeIgniter\Validation\Exceptions\ValidationException;
|
||||
use RuntimeException;
|
||||
|
||||
/**
|
||||
|
||||
@ -6,6 +6,7 @@ use CodeIgniter\HTTP\RedirectResponse;
|
||||
use CodeIgniter\HTTP\RequestInterface;
|
||||
use CodeIgniter\HTTP\ResponseInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use RuntimeException;
|
||||
|
||||
class ServerController extends EquipmentController
|
||||
{
|
||||
@ -31,4 +32,17 @@ class ServerController extends EquipmentController
|
||||
{
|
||||
return $this->action_render_process($action, $this->getViewDatas(), $this->request->getVar('ActionTemplate') ?? 'server');
|
||||
}
|
||||
|
||||
public function console(int $uid): string
|
||||
{
|
||||
$entity = $this->service->getEntity($uid);
|
||||
if (!$entity instanceof ServerEntity) {
|
||||
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 오류발생: {$uid} 서버 정보를 찾을수 없습니다.");
|
||||
}
|
||||
$viewDatas = [
|
||||
'entity' => $entity,
|
||||
'title' => $entity->getTitle(),
|
||||
];
|
||||
return view('admin/server/console', $viewDatas);
|
||||
}
|
||||
}
|
||||
|
||||
@ -13,6 +13,7 @@ class ServerDTO extends CommonDTO
|
||||
public string $title = '';
|
||||
public string $type = '';
|
||||
public string $ip = '';
|
||||
public string $ilo_ip = '';
|
||||
public string $os = '';
|
||||
public int $price = 0;
|
||||
public string $manufactur_at = '';
|
||||
|
||||
@ -13,6 +13,7 @@ class ServerEntity extends EquipmentEntity
|
||||
'title' => '',
|
||||
'type' => '',
|
||||
'ip' => '',
|
||||
'ilo_ip' => '',
|
||||
'os' => '',
|
||||
'price' => 0,
|
||||
'manufactur_at' => '',
|
||||
@ -56,6 +57,10 @@ class ServerEntity extends EquipmentEntity
|
||||
{
|
||||
return $this->attributes['ip'] ?? '';
|
||||
}
|
||||
public function getIloIP(): string
|
||||
{
|
||||
return $this->attributes['ilo_ip'] ?? '';
|
||||
}
|
||||
public function getOS(): string
|
||||
{
|
||||
return $this->attributes['os'] ?? '';
|
||||
|
||||
@ -16,6 +16,7 @@ class ServerForm extends EquipmentForm
|
||||
"chassisinfo_uid",
|
||||
"switchinfo_uid",
|
||||
"ip",
|
||||
"ilo_ip",
|
||||
"title",
|
||||
"os",
|
||||
"price",
|
||||
@ -28,11 +29,12 @@ class ServerForm extends EquipmentForm
|
||||
"chassisinfo_uid",
|
||||
'switchinfo_uid',
|
||||
'ip',
|
||||
'ilo_ip',
|
||||
'os',
|
||||
"status",
|
||||
];
|
||||
$indexFilter = $filters;
|
||||
$batchjobFilters = ['type', 'switchinfo_uid', 'ip', 'os', 'status'];
|
||||
$batchjobFilters = ['type', 'switchinfo_uid', 'ip', 'ilo_ip', 'os', 'status'];
|
||||
switch ($action) {
|
||||
case 'create':
|
||||
case 'create_form':
|
||||
@ -51,6 +53,7 @@ class ServerForm extends EquipmentForm
|
||||
"type",
|
||||
"switchinfo_uid",
|
||||
"ip",
|
||||
"ilo_ip",
|
||||
"title",
|
||||
"os",
|
||||
"part",
|
||||
@ -87,6 +90,7 @@ class ServerForm extends EquipmentForm
|
||||
$formRules[$field] = "required|trim|string";
|
||||
break;
|
||||
case "ip": //ipv4 , ipv6 , both(ipv4,ipv6)
|
||||
case "ilo_ip": //ipv4 , ipv6 , both(ipv4,ipv6)
|
||||
$formRules[$field] = sprintf("permit_empty|trim|valid_ip[both]%s", in_array($action, ["create", "create_form"]) ? "|is_unique[{$this->getAttribute('table')}.{$field}]" : "");
|
||||
break;
|
||||
case "os":
|
||||
@ -110,6 +114,7 @@ class ServerForm extends EquipmentForm
|
||||
$entities = [];
|
||||
switch ($field) {
|
||||
case 'ip':
|
||||
case 'ilo_ip':
|
||||
if (in_array($action, ['create_form', 'modify_form'])) {
|
||||
if (array_key_exists($field, $formDatas)) {
|
||||
$where = sprintf("status = '%s' OR %s='%s'", STATUS['AVAILABLE'], $field, $formDatas[$field]);
|
||||
@ -166,7 +171,8 @@ class ServerForm extends EquipmentForm
|
||||
// dd($options);
|
||||
break;
|
||||
case 'ip': //key=value이 같음주의
|
||||
foreach ($this->getFormOption_process(service('part_ipservice'), $action, $field, $formDatas) as $tempEntity) {
|
||||
case 'ilo_ip': //key=value이 같음주의
|
||||
foreach ($this->getFormOption_process(service('part_ipservice'), $action, 'ip', $formDatas) as $tempEntity) {
|
||||
$tempOptions[$tempEntity->getTitle()] = $tempEntity->getTitle();
|
||||
// $options['attributes'][$tempEntity->getPK()] = ['data-role' => implode(DEFAULTS['DELIMITER_ROLE'], $tempEntity->getRole())];
|
||||
}
|
||||
|
||||
@ -30,6 +30,7 @@ class ServerHelper extends EquipmentHelper
|
||||
$form = form_input($field, $value ?? "", $extras);
|
||||
break;
|
||||
case 'ip':
|
||||
case 'ilo_ip':
|
||||
$extras['class'] = array_key_exists('class', $extras) ? $extras['class'] . ' select-field' : 'select-field';
|
||||
$form = parent::getFieldForm($field, $value, $viewDatas, $extras);
|
||||
break;
|
||||
@ -49,6 +50,7 @@ class ServerHelper extends EquipmentHelper
|
||||
$value = $viewDatas['formOptions'][$field]['options'][$value]['text'];
|
||||
break;
|
||||
case 'ip': //값 그대료 표시
|
||||
case 'ilo_ip': //값 그대료 표시
|
||||
break;
|
||||
case 'price':
|
||||
$value = number_format($value) . "원";
|
||||
@ -75,6 +77,7 @@ class ServerHelper extends EquipmentHelper
|
||||
switch ($field) {
|
||||
case 'switchinfo_uid':
|
||||
case 'ip':
|
||||
case 'ilo_ip':
|
||||
$extras['class'] = array_key_exists('class', $extras) ? $extras['class'] . ' select-field' : 'select-field';
|
||||
$filter = parent::getListFilter($field, $value, $viewDatas, $extras);
|
||||
break;
|
||||
|
||||
@ -9,6 +9,7 @@ return [
|
||||
'chassisinfo_uid' => "샷시명",
|
||||
'switchinfo_uid' => "스위치",
|
||||
'ip' => "IP",
|
||||
'ilo_ip' => "ILO IP",
|
||||
'os' => "OS",
|
||||
'part' => "부품",
|
||||
'title' => "모델명",
|
||||
|
||||
@ -23,6 +23,7 @@ class ServerModel extends EquipmentModel
|
||||
"chassisinfo_uid",
|
||||
"switchinfo_uid",
|
||||
"ip",
|
||||
"ilo_ip",
|
||||
"os",
|
||||
"title",
|
||||
"price",
|
||||
|
||||
@ -247,7 +247,8 @@ abstract class CommonService
|
||||
protected function create_process(array $formDatas): CommonEntity
|
||||
{
|
||||
try {
|
||||
if ($formService = $this->getFormService()) {
|
||||
$formService = $this->getFormService();
|
||||
if ($formService) {
|
||||
$formService->action_init_process('create', $formDatas);
|
||||
$formService->validate($formDatas);
|
||||
}
|
||||
@ -281,8 +282,10 @@ abstract class CommonService
|
||||
if (!$entity->hasChanged()) {
|
||||
return $entity;
|
||||
}
|
||||
if ($formService = $this->getFormService()) {
|
||||
$formService->validate($entity->toArray());
|
||||
$formService = $this->getFormService();
|
||||
if ($formService) {
|
||||
$formDatas = $entity->toArray();
|
||||
$formService->validate($formDatas);
|
||||
}
|
||||
return $this->save_process($entity);
|
||||
} catch (\Throwable $e) {
|
||||
|
||||
@ -8,7 +8,6 @@ use App\Entities\Equipment\ServerEntity;
|
||||
use App\Forms\Equipment\ServerForm;
|
||||
use App\Helpers\Equipment\ServerHelper;
|
||||
use App\Models\Equipment\ServerModel;
|
||||
use CodeIgniter\Database\Exceptions\DatabaseException;
|
||||
use RuntimeException;
|
||||
|
||||
class ServerService extends EquipmentService
|
||||
@ -177,6 +176,7 @@ class ServerService extends EquipmentService
|
||||
public function setSearchWord(string $word): void
|
||||
{
|
||||
$this->model->orLike($this->model->getTable() . '.ip', $word, 'both');
|
||||
$this->model->orLike($this->model->getTable() . '.ilo_ip', $word, 'both');
|
||||
parent::setSearchWord($word);
|
||||
}
|
||||
//OrderBy 처리
|
||||
|
||||
13
app/Views/admin/server/console.php
Normal file
13
app/Views/admin/server/console.php
Normal file
@ -0,0 +1,13 @@
|
||||
<?= $this->extend($viewDatas['layout']['layout']) ?>
|
||||
<?= $this->section('content') ?>
|
||||
<?= session('message') ? $viewDatas['helper']->alertTrait(session('message')) : ""; ?>
|
||||
<div id="container" class="content">
|
||||
<div class="form_top"><?= $this->include("{$viewDatas['layout']['template']}/form_content_top"); ?></div>
|
||||
<a href="https://<?= esc($viewDatas['entity']->getIloIP()) ?>" target="_blank">
|
||||
Open iLO HTML5 Console
|
||||
</a>
|
||||
<?php if (session('message')): ?>
|
||||
<div class="alert alert-danger text-start"><?= nl2br(session('message')) ?></div><?php endif; ?>
|
||||
<div class="form_bottom"><?= $this->include("{$viewDatas['layout']['template']}/form_content_bottom"); ?></div>
|
||||
</div>
|
||||
<?= $this->endSection() ?>
|
||||
Loading…
Reference in New Issue
Block a user