* Refactor zanode::edit.

This commit is contained in:
xieqiyu
2023-12-25 13:13:20 +08:00
parent fcfc1537ce
commit 0bd02a13e5
2 changed files with 16 additions and 6 deletions
+9
View File
@@ -16,3 +16,12 @@ $config->zanode->form->create['osName'] = array('type' => 'string', 'requ
$config->zanode->form->create['osNamePre'] = array('type' => 'string', 'required' => false);
$config->zanode->form->create['osNamePhysics'] = array('type' => 'string', 'required' => false);
$config->zanode->form->create['desc'] = array('type' => 'string', 'required' => false, 'control' => 'editor');
$config->zanode->form->edit = array();
$config->zanode->form->edit['name'] = array('type' => 'string', 'required' => false, 'filter' => 'trim');
$config->zanode->form->edit['extranet'] = array('type' => 'string', 'required' => false, 'filter' => 'trim');
$config->zanode->form->edit['memory'] = array('type' => 'float', 'required' => false);
$config->zanode->form->edit['diskSize'] = array('type' => 'float', 'required' => false);
$config->zanode->form->edit['osName'] = array('type' => 'string', 'required' => false);
$config->zanode->form->edit['desc'] = array('type' => 'string', 'required' => false, 'control' => 'editor');
+7 -6
View File
@@ -102,7 +102,7 @@ class zanode extends control
{
$nodeID = $this->zanode->create();
if(dao::isError()) return $this->send(array('result' => 'fail', 'message' => dao::getError()));
return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => inlink('view', "id=$nodeID")));
return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'load' => inlink('view', "id=$nodeID")));
}
$this->view->title = $this->lang->zanode->create;
@@ -113,13 +113,14 @@ class zanode extends control
}
/**
* 编辑执行节点。
* Edit node.
*
* @param int $id
* @access public
* @return void
*/
public function edit($id)
public function edit(int $id)
{
if($_POST)
{
@@ -132,8 +133,8 @@ class zanode extends control
if(!empty($changes)) $this->action->logHistory($actionID, $changes);
}
if(isInModal()) return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => 'parent'));
return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => inlink('browse')));
if(isInModal()) return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'closeModal' => true));
return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'load' => inlink('browse')));
}
$zanode = $this->zanode->getNodeByID($id);
@@ -142,8 +143,8 @@ class zanode extends control
$this->view->zanode = $zanode;
if($zanode->type == 'node')
{
$this->view->host = $this->zanode->getHostByID($this->view->zanode->parent);
$this->view->image = $this->zanode->getImageByID($this->view->zanode->image);
$this->view->host = $this->zanode->getHostByID($zanode->parent);
$this->view->image = $this->zanode->getImageByID($zanode->image);
}
$this->display();
}