From 7ee21a2a19fb6ca4f94b4dbaf73346383cb256e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=B5=9C=EC=A4=80=ED=9D=A0?= Date: Tue, 25 Jul 2023 10:56:51 +0900 Subject: [PATCH] baseproject init... --- app/Controllers/Admin/HPILOController.php | 14 +++++++------- app/Helpers/Admin/HPILO_helper.php | 11 ++++++----- app/Language/kr/Admin/HPILO.php | 1 + app/Models/HPILOModel.php | 4 ++-- 4 files changed, 16 insertions(+), 14 deletions(-) diff --git a/app/Controllers/Admin/HPILOController.php b/app/Controllers/Admin/HPILOController.php index dae0b10..d5b8d11 100644 --- a/app/Controllers/Admin/HPILOController.php +++ b/app/Controllers/Admin/HPILOController.php @@ -45,19 +45,19 @@ class HPILOController extends \App\Controllers\Admin\AdminController } ////추가 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)); $this->_viewDatas['SessionKey'] = $ilo->console(); $this->_viewDatas['entity'] = $entity; return view($this->_viewPath . '/console_iframe', $this->_viewDatas); } - final public function reset(int $uid, string $type) + final public function reset($uid, string $type) { try { - $entity = $this->_model->getEntity($uid); + $entity = $this->_model->getEntity([$this->_model->getPrimaryKey() => $uid]); if (!in_array($type, ["On", "Off", "Restart"])) { throw new \Exception(__FUNCTION__ . "에서 {$type}은 기능은 없습니다."); } @@ -87,10 +87,10 @@ class HPILOController extends \App\Controllers\Admin\AdminController } return $entity; } - final public function reload(int $uid) + final public function reload($uid) { try { - $entity = $this->_model->getEntity($uid); + $entity = $this->_model->getEntity([$this->_model->getPrimaryKey() => $uid]); $ilo = new HPILO4($this->getAdapter($entity)); // throw new \Exception(var_export($ilo, true)); $entity = $this->refresh($ilo, $entity); @@ -98,7 +98,7 @@ class HPILOController extends \App\Controllers\Admin\AdminController log_message("info", "{$this->_viewDatas['title']} {$message}"); return alert_CommonHelper($message, $this->_session->get(SESSION_NAMES['RETURN_URL'])); } catch (\Exception $e) { - $message = "{$entity->getTitle()} " . __FUNCTION__ . " 실패하였습니다."; + $message = __FUNCTION__ . " 실패하였습니다.\n" . $e->getMessage(); log_message("warning", $message . "
\n{$e->getMessage()}"); log_message("info", "{$this->_viewDatas['title']} {$message}"); return alert_CommonHelper($message, 'back'); diff --git a/app/Helpers/Admin/HPILO_helper.php b/app/Helpers/Admin/HPILO_helper.php index f356256..c20a9bf 100644 --- a/app/Helpers/Admin/HPILO_helper.php +++ b/app/Helpers/Admin/HPILO_helper.php @@ -21,8 +21,12 @@ function getFieldForm_HPILOHelper($field, $value, array $formOptions, array $att return form_dropdown($field, $formOptions[$field], $value, $attributes); break; case 'passwd': - case 'confirmpassword': - return form_password($field, DEFAULTS['EMPTY'], $attributes); + return sprintf( + "%s %s %s", + form_password($field, DEFAULTS['EMPTY'], $attributes), + lang("Admin/Board.label.confirmpassword"), + form_password('confirmpassword', DEFAULTS['EMPTY'], $attributes), + ); break; case 'updated_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()) { switch ($field) { - case 'status': - return lang("Admin/HPILO." . strtoupper($field) . "." . $entity->$field); - break; case 'memory': return $entity->$field . "GB"; break; diff --git a/app/Language/kr/Admin/HPILO.php b/app/Language/kr/Admin/HPILO.php index 01e17a3..d997bcf 100644 --- a/app/Language/kr/Admin/HPILO.php +++ b/app/Language/kr/Admin/HPILO.php @@ -19,5 +19,6 @@ return [ 'updated_at' => "수정일", 'created_at' => "작성일" ], + "POWER" => ["On" => "On", "Off" => "Off", "Restart" => "Restart"], "STATUS" => FORM_OPTIONS['STATUS'], ]; diff --git a/app/Models/HPILOModel.php b/app/Models/HPILOModel.php index 9f11c9c..64c803b 100644 --- a/app/Models/HPILOModel.php +++ b/app/Models/HPILOModel.php @@ -19,7 +19,7 @@ class HPILOModel extends BaseModel switch ($action) { case "index": 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; case "view": 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 { - return ["status", ...$fields]; + return ["power", "status", ...$fields]; } protected function getFieldRule(string $field, array $rules, string $action = ""): array {