* Fix bug

This commit is contained in:
zhaoke
2022-12-16 08:17:23 +00:00
parent 06061a1b57
commit d6a903ccec
6 changed files with 16 additions and 29 deletions
+4 -8
View File
@@ -122,7 +122,7 @@ class zahost extends control
{
return $this->send(array('result' => 'fail', 'message' => dao::getError()));
}
elseif($hostID === false)
elseif($changes === false)
{
return $this->send(array('result' => 'fail', 'message' => array("extranet" => array($this->lang->zahost->netError))));
}
@@ -239,17 +239,13 @@ class zahost extends control
* Sent download image request to Host.
*
* @param int $hostID
* @param string $imageName
* @param int $imageID
* @access public
* @return object
*/
public function downloadImage($hostID, $imageName)
public function downloadImage($hostID, $imageID)
{
$image = $this->zahost->getImageByNameAndHostID($imageName, $hostID);
if(empty($image))
{
$image = $this->zahost->createImage($hostID, $imageName);
}
$image = $this->zahost->getImageByID($imageID);
$this->zahost->downloadImage($image);
if(dao::isError()) return $this->send(array('result' => 'fail', 'message' => $this->lang->zahost->image->downloadImageFail));
+1 -1
View File
@@ -2,4 +2,4 @@
.input-group-addon {border: 0px; width: 100px;}
#unit_chosen a {border-left: 0px; border-radius: 0 2px;}
html[lang='en'] .table-form > tbody > tr > th {width: 120px;}
#memory-addon{padding-left: 30px;text-align: left;width: 63px;}
#memory-addon{text-align: center;width: 63px;}
+1
View File
@@ -98,6 +98,7 @@ class zahostModel extends model
->batchCheck('cpuCores,diskSize', 'gt', 0)
->batchCheck('diskSize,memory', 'float')
->where('id')->eq($hostID)->exec();
var_dump(common::createChanges($oldHost, $hostInfo));die;
return common::createChanges($oldHost, $hostInfo);
}
+1 -1
View File
@@ -48,7 +48,7 @@
<td><?php echo $image->status == 'completed' ? zget($image, 'path', '') : '';?></td>
<td class="image-progress-<?php echo zget($image, 'id', 0);?>"><?php echo $image->status == 'completed' ? '100%' : '';?></td>
<td class='c-actions'>
<?php if(common::hasPriv('zahost', 'downloadImage')) echo html::a($this->createLink('zahost', 'downloadImage', "hostID={$hostID}&imageName={$image->name}&imageID={$image->id}"), '<i class="icon-download"></i>', 'hiddenwin', zget($image, 'downloadMisc', ''));?>
<?php if(common::hasPriv('zahost', 'downloadImage')) echo html::a($this->createLink('zahost', 'downloadImage', "hostID={$hostID}&id={$image->id}&imageID={$image->id}"), '<i class="icon-download"></i>', 'hiddenwin', zget($image, 'downloadMisc', ''));?>
<?php if(common::hasPriv('zahost', 'cancelDownload')) echo html::a($this->createLink('zahost', 'cancelDownload', "id={$image->id}"), '<i class="icon-close"></i>', 'hiddenwin', zget($image, 'cancelMisc', ''));?>
</td>
</tr>
+8 -15
View File
@@ -245,26 +245,19 @@ class zanode extends control
* @param int $nodeID
* @return void
*/
public function delete($nodeID, $confirm = 'no')
public function delete($nodeID)
{
if($confirm == 'no')
$error = $this->zanode->destroy($nodeID);
if($error)
{
return print(js::confirm($this->lang->zanode->confirmDelete, inlink('delete', "nodeID=$nodeID&confirm=yes")));
return print(js::alert($error));
}
else
{
$error = $this->zanode->destroy($nodeID);
if($error)
{
return print(js::alert($error));
}
else
{
if(isonlybody()) return print(js::alert($this->lang->zanode->actionSuccess) . js::reload('parent.parent'));
return print(js::alert($this->lang->zanode->actionSuccess) . js::reload('parent'));
}
}
if(isonlybody()) return print(js::alert($this->lang->zanode->actionSuccess) . js::reload('parent.parent'));
return print(js::alert($this->lang->zanode->actionSuccess) . js::reload('parent'));
}
}
/**
+1 -4
View File
@@ -210,10 +210,7 @@ class zanodemodel extends model
}
/* delete ZenAgent Node. */
$this->dao->update(TABLE_ZAHOST)
->set('deleted')->eq(1)
->where('id')->eq($id)
->exec();
$this->dao->delete()->from(TABLE_ZAHOST)->where('id')->eq($id)->exec();;
$this->loadModel('action')->create('zanode', $id, 'destroy');
return;
}