baseproject init...

This commit is contained in:
최준흠 2023-07-25 10:56:51 +09:00
parent 65b40c450a
commit 7ee21a2a19
4 changed files with 16 additions and 14 deletions

View File

@ -45,19 +45,19 @@ class HPILOController extends \App\Controllers\Admin\AdminController
} }
////추가 Action ////추가 Action
final public function console(int $uid) final public function console($uid)
{ {
$entity = $this->_model->getEntity($uid); $entity = $this->_model->getEntity([$this->_model->getPrimaryKey() => $uid]);
$ilo = new HPILO4($this->getAdapter($entity)); $ilo = new HPILO4($this->getAdapter($entity));
$this->_viewDatas['SessionKey'] = $ilo->console(); $this->_viewDatas['SessionKey'] = $ilo->console();
$this->_viewDatas['entity'] = $entity; $this->_viewDatas['entity'] = $entity;
return view($this->_viewPath . '/console_iframe', $this->_viewDatas); return view($this->_viewPath . '/console_iframe', $this->_viewDatas);
} }
final public function reset(int $uid, string $type) final public function reset($uid, string $type)
{ {
try { try {
$entity = $this->_model->getEntity($uid); $entity = $this->_model->getEntity([$this->_model->getPrimaryKey() => $uid]);
if (!in_array($type, ["On", "Off", "Restart"])) { if (!in_array($type, ["On", "Off", "Restart"])) {
throw new \Exception(__FUNCTION__ . "에서 {$type}은 기능은 없습니다."); throw new \Exception(__FUNCTION__ . "에서 {$type}은 기능은 없습니다.");
} }
@ -87,10 +87,10 @@ class HPILOController extends \App\Controllers\Admin\AdminController
} }
return $entity; return $entity;
} }
final public function reload(int $uid) final public function reload($uid)
{ {
try { try {
$entity = $this->_model->getEntity($uid); $entity = $this->_model->getEntity([$this->_model->getPrimaryKey() => $uid]);
$ilo = new HPILO4($this->getAdapter($entity)); $ilo = new HPILO4($this->getAdapter($entity));
// throw new \Exception(var_export($ilo, true)); // throw new \Exception(var_export($ilo, true));
$entity = $this->refresh($ilo, $entity); $entity = $this->refresh($ilo, $entity);
@ -98,7 +98,7 @@ class HPILOController extends \App\Controllers\Admin\AdminController
log_message("info", "{$this->_viewDatas['title']} {$message}"); log_message("info", "{$this->_viewDatas['title']} {$message}");
return alert_CommonHelper($message, $this->_session->get(SESSION_NAMES['RETURN_URL'])); return alert_CommonHelper($message, $this->_session->get(SESSION_NAMES['RETURN_URL']));
} catch (\Exception $e) { } catch (\Exception $e) {
$message = "{$entity->getTitle()} " . __FUNCTION__ . " 실패하였습니다."; $message = __FUNCTION__ . " 실패하였습니다.\n" . $e->getMessage();
log_message("warning", $message . "<br>\n{$e->getMessage()}"); log_message("warning", $message . "<br>\n{$e->getMessage()}");
log_message("info", "{$this->_viewDatas['title']} {$message}"); log_message("info", "{$this->_viewDatas['title']} {$message}");
return alert_CommonHelper($message, 'back'); return alert_CommonHelper($message, 'back');

View File

@ -21,8 +21,12 @@ function getFieldForm_HPILOHelper($field, $value, array $formOptions, array $att
return form_dropdown($field, $formOptions[$field], $value, $attributes); return form_dropdown($field, $formOptions[$field], $value, $attributes);
break; break;
case 'passwd': case 'passwd':
case 'confirmpassword': return sprintf(
return form_password($field, DEFAULTS['EMPTY'], $attributes); "%s %s %s",
form_password($field, DEFAULTS['EMPTY'], $attributes),
lang("Admin/Board.label.confirmpassword"),
form_password('confirmpassword', DEFAULTS['EMPTY'], $attributes),
);
break; break;
case 'updated_at': case 'updated_at':
case 'created_at': case 'created_at':
@ -38,9 +42,6 @@ function getFieldForm_HPILOHelper($field, $value, array $formOptions, array $att
function getFieldView_HPILOHelper($field, $entity, array $fieldFilters, array $fieldFormOptions, array $attributes = array()) function getFieldView_HPILOHelper($field, $entity, array $fieldFilters, array $fieldFormOptions, array $attributes = array())
{ {
switch ($field) { switch ($field) {
case 'status':
return lang("Admin/HPILO." . strtoupper($field) . "." . $entity->$field);
break;
case 'memory': case 'memory':
return $entity->$field . "GB"; return $entity->$field . "GB";
break; break;

View File

@ -19,5 +19,6 @@ return [
'updated_at' => "수정일", 'updated_at' => "수정일",
'created_at' => "작성일" 'created_at' => "작성일"
], ],
"POWER" => ["On" => "On", "Off" => "Off", "Restart" => "Restart"],
"STATUS" => FORM_OPTIONS['STATUS'], "STATUS" => FORM_OPTIONS['STATUS'],
]; ];

View File

@ -19,7 +19,7 @@ class HPILOModel extends BaseModel
switch ($action) { switch ($action) {
case "index": case "index":
case "excel": case "excel":
return ['customer', 'ip', 'port', 'model', 'processor', 'memory', 'health', 'status', 'created_at']; return ['customer', 'ip', 'port', 'model', 'processor', 'memory', 'health', 'power', 'status', 'created_at'];
break; break;
case "view": case "view":
return ['customer', 'ip', 'port', 'id', 'model', 'processor', 'memory', 'health', 'power', 'detail', 'status', 'updated_at', 'created_at']; return ['customer', 'ip', 'port', 'id', 'model', 'processor', 'memory', 'health', 'power', 'detail', 'status', 'updated_at', 'created_at'];
@ -31,7 +31,7 @@ class HPILOModel extends BaseModel
} }
public function getFieldFilters(array $fields = array()): array public function getFieldFilters(array $fields = array()): array
{ {
return ["status", ...$fields]; return ["power", "status", ...$fields];
} }
protected function getFieldRule(string $field, array $rules, string $action = ""): array protected function getFieldRule(string $field, array $rules, string $action = ""): array
{ {