* Fix bug #31493
This commit is contained in:
@@ -21,7 +21,7 @@ function updateProgress() {
|
||||
var hasInprogress = false;
|
||||
for (var imageID in statusList) {
|
||||
if (statusList[imageID].statusCode) {
|
||||
if (statusList[imageID].statusCode == 'inprogress' || statusList[imageID].statusCode == 'created')
|
||||
if (statusList[imageID].statusCode == 'inprogress' || statusList[imageID].statusCode == 'created' || statusList[imageID].statusCode == 'pending')
|
||||
{
|
||||
hasInprogress = true;
|
||||
$('.image-download-' + imageID).addClass('disabled');
|
||||
|
||||
@@ -91,6 +91,7 @@ $lang->zahost->image->statusList['notDownloaded'] = 'Not Downloaded';
|
||||
$lang->zahost->image->statusList['created'] = 'Inprogress';
|
||||
$lang->zahost->image->statusList['canceled'] = 'Not Downloaded';
|
||||
$lang->zahost->image->statusList['inprogress'] = 'Inprogress';
|
||||
$lang->zahost->image->statusList['pending'] = 'Waiting for download';
|
||||
$lang->zahost->image->statusList['completed'] = 'Completed';
|
||||
$lang->zahost->image->statusList['failed'] = 'Failed';
|
||||
|
||||
|
||||
@@ -91,6 +91,7 @@ $lang->zahost->image->statusList['notDownloaded'] = 'Not Downloaded';
|
||||
$lang->zahost->image->statusList['created'] = 'Inprogress';
|
||||
$lang->zahost->image->statusList['canceled'] = 'Not Downloaded';
|
||||
$lang->zahost->image->statusList['inprogress'] = 'Inprogress';
|
||||
$lang->zahost->image->statusList['pending'] = 'Waiting for download';
|
||||
$lang->zahost->image->statusList['completed'] = 'Completed';
|
||||
$lang->zahost->image->statusList['failed'] = 'Failed';
|
||||
|
||||
|
||||
@@ -91,6 +91,7 @@ $lang->zahost->image->statusList['notDownloaded'] = 'Not Downloaded';
|
||||
$lang->zahost->image->statusList['created'] = 'Inprogress';
|
||||
$lang->zahost->image->statusList['canceled'] = 'Not Downloaded';
|
||||
$lang->zahost->image->statusList['inprogress'] = 'Inprogress';
|
||||
$lang->zahost->image->statusList['pending'] = 'Waiting for download';
|
||||
$lang->zahost->image->statusList['completed'] = 'Completed';
|
||||
$lang->zahost->image->statusList['failed'] = 'Failed';
|
||||
|
||||
|
||||
@@ -90,6 +90,7 @@ $lang->zahost->image->statusList['notDownloaded'] = 'Not Downloaded';
|
||||
$lang->zahost->image->statusList['created'] = 'Inprogress';
|
||||
$lang->zahost->image->statusList['canceled'] = 'Not Downloaded';
|
||||
$lang->zahost->image->statusList['inprogress'] = 'Inprogress';
|
||||
$lang->zahost->image->statusList['pending'] = 'Waiting for download';
|
||||
$lang->zahost->image->statusList['completed'] = 'Completed';
|
||||
$lang->zahost->image->statusList['failed'] = 'Failed';
|
||||
|
||||
|
||||
@@ -91,6 +91,7 @@ $lang->zahost->image->statusList['notDownloaded'] = '可下载';
|
||||
$lang->zahost->image->statusList['created'] = '下载中';
|
||||
$lang->zahost->image->statusList['canceled'] = '可下载';
|
||||
$lang->zahost->image->statusList['inprogress'] = '下载中';
|
||||
$lang->zahost->image->statusList['pending'] = '排队下载中';
|
||||
$lang->zahost->image->statusList['completed'] = '可使用';
|
||||
$lang->zahost->image->statusList['failed'] = '下载失败';
|
||||
|
||||
|
||||
+11
-1
@@ -323,10 +323,13 @@ class zahostModel extends model
|
||||
}
|
||||
|
||||
$currentTask = null;
|
||||
$is_finish = false;
|
||||
foreach($result->data as $status => $group)
|
||||
{
|
||||
if($is_finish) break;
|
||||
foreach($group as $task)
|
||||
{
|
||||
if($is_finish) break;
|
||||
if($task->task == $image->id)
|
||||
{
|
||||
$task->endDate = substr($task->endDate, 0, 19);
|
||||
@@ -334,6 +337,12 @@ class zahostModel extends model
|
||||
{
|
||||
$currentTask = $task;
|
||||
}
|
||||
if($task->status == 'inprogress')
|
||||
{
|
||||
$currentTask = $task;
|
||||
$is_finish = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -343,6 +352,8 @@ class zahostModel extends model
|
||||
$image->rate = $currentTask->rate;
|
||||
$image->status = $currentTask->status;
|
||||
|
||||
if(!empty($result->data->inprogress) && $currentTask->task != $result->data->inprogress[0]->task && $currentTask->status == 'created') $image->status = 'pending';
|
||||
|
||||
$this->dao->update(TABLE_IMAGE)
|
||||
->set('status')->eq($image->status)
|
||||
->set('path')->eq(!empty($currentTask->path) ? $currentTask->path : '')
|
||||
@@ -372,7 +383,6 @@ class zahostModel extends model
|
||||
|
||||
$response = json_decode(commonModel::http($statusApi, array(), array(CURLOPT_CUSTOMREQUEST => 'GET'), array("Authorization:$host->tokenSN"), 'json'));
|
||||
|
||||
a($response);
|
||||
if($response->code == 200) return true;
|
||||
|
||||
dao::$errors[] = $response->msg;
|
||||
|
||||
@@ -134,8 +134,9 @@
|
||||
<?php if(!empty($nodeList)): ?>
|
||||
<div class="detail">
|
||||
<div class="detail-title"><?php echo $lang->zahost->browseNode;?></div>
|
||||
<div class="detail-content article-content">
|
||||
<table class='table has-sort-head table-fixed' id='nodeList'>
|
||||
<div class="detail-content article-content" style="padding: 0px; max-height: 789px; overflow: visible; height: 306px;">
|
||||
<?php echo "<iframe width='100%' height='600px' id='urlIframe' src='" . $this->createLink('zanode', 'browse', "id=$zahost->id", '', true) . "' frameborder='no' allowfullscreen='true' mozallowfullscreen='true' webkitallowfullscreen='true' allowtransparency='true' scrolling='auto' style='width: 100%; height: 100%; left: 0px;'></iframe>";?>
|
||||
<!-- <table class='table has-sort-head table-fixed' id='nodeList'>
|
||||
<thead>
|
||||
<tr>
|
||||
<th class='c-name'><?php common::printOrderLink('name', $orderBy, $vars, $lang->zahost->name);?></th>
|
||||
@@ -158,7 +159,7 @@
|
||||
</tr>
|
||||
<?php endforeach;?>
|
||||
</tbody>
|
||||
</table>
|
||||
</table> -->
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
@@ -73,6 +73,7 @@ $lang->zanode->runCaseConfirm = 'The system detects the presence of an automatio
|
||||
|
||||
$lang->zanode->createImage = 'Create Image';
|
||||
$lang->zanode->createImaging = 'Creating';
|
||||
$lang->zanode->pending = 'Waiting for create';
|
||||
$lang->zanode->createImageNotice = 'The system will be created based on the current node,This process requires the ZenAgent Node to be shut down. Do you want to continue?';
|
||||
$lang->zanode->createImageSuccess = 'Successed, You can use this image to create node.';
|
||||
$lang->zanode->createImageFail = 'Failed to create';
|
||||
|
||||
@@ -73,6 +73,7 @@ $lang->zanode->runCaseConfirm = 'The system detects the presence of an automatio
|
||||
|
||||
$lang->zanode->createImage = 'Create Image';
|
||||
$lang->zanode->createImaging = 'Creating';
|
||||
$lang->zanode->pending = 'Waiting for create';
|
||||
$lang->zanode->createImageNotice = 'The system will be created based on the current node,This process requires the ZenAgent Node to be shut down. Do you want to continue?';
|
||||
$lang->zanode->createImageSuccess = 'Successed, You can use this image to create node.';
|
||||
$lang->zanode->createImageFail = 'Failed to create';
|
||||
|
||||
@@ -73,6 +73,7 @@ $lang->zanode->runCaseConfirm = 'The system detects the presence of an automatio
|
||||
|
||||
$lang->zanode->createImage = 'Create Image';
|
||||
$lang->zanode->createImaging = 'Creating';
|
||||
$lang->zanode->pending = 'Waiting for create';
|
||||
$lang->zanode->createImageNotice = 'The system will be created based on the current node,This process requires the ZenAgent Node to be shut down. Do you want to continue?';
|
||||
$lang->zanode->createImageSuccess = 'Successed, You can use this image to create node.';
|
||||
$lang->zanode->createImageFail = 'Failed to create';
|
||||
|
||||
@@ -73,6 +73,7 @@ $lang->zanode->runCaseConfirm = '系统检测到选择的用例存在自动化
|
||||
|
||||
$lang->zanode->createImage = '导出镜像';
|
||||
$lang->zanode->createImaging = '正在导出镜像';
|
||||
$lang->zanode->pending = '等待导出镜像';
|
||||
$lang->zanode->createImageNotice = '系统将基于当前执行节点导出镜像,该过程需要关闭该执行节点,确定要继续么?';
|
||||
$lang->zanode->createImageSuccess = '镜像导出成功,您可以使用此镜像创建执行节点。';
|
||||
$lang->zanode->createImageFail = '镜像导出失败';
|
||||
|
||||
@@ -675,6 +675,7 @@ class zanodemodel extends model
|
||||
|
||||
foreach($tasks as $task)
|
||||
{
|
||||
if(!empty($tasks['inprogress']) && $task->task != $tasks['inprogress'][0]->task && $task->status == 'created') $task->status = 'pending';
|
||||
if($type == $task->type and $taskID == $task->task) return $task;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
<?php if($task):?>
|
||||
<?php js::set('taskID', $task->task);?>
|
||||
<?php js::set('nodeID', $node->id);?>
|
||||
<?php js::set('zanodeLang', $lang->zanode); ?>
|
||||
<style>.body-modal #mainContent{width:90%}
|
||||
</style>
|
||||
<?php endif;?>
|
||||
@@ -26,7 +27,7 @@
|
||||
</h2>
|
||||
</div>
|
||||
<?php if($task):?>
|
||||
<h5 class='text-center'><?php echo $lang->zanode->createImaging;?></h5>
|
||||
<h5 class='text-center status-title'><?php echo $lang->zanode->pending;?></h5>
|
||||
<div class="progress progress-striped">
|
||||
<div class="progress-bar progress-bar-success rate" role="progressbar" aria-valuenow="<?php echo $task->rate;?>" aria-valuemin="0" aria-valuemax="100" style="width: <?php echo $task->rate;?>%">
|
||||
</div>
|
||||
@@ -82,8 +83,17 @@ function getTaskProgress()
|
||||
if(rate == 1 || status == 'completed') rate = 1;
|
||||
if(status == 'inprogress' && rate >= 1) rate = 0.97;
|
||||
|
||||
if(status == 'pending')
|
||||
{
|
||||
$('.status-title').text(zanodeLang.pending)
|
||||
}
|
||||
else
|
||||
{
|
||||
$('.status-title').text(zanodeLang.createImaging)
|
||||
}
|
||||
|
||||
$('.rate').css('width', rate*100 + '%');
|
||||
if(rate == 1 || (status != 'inprogress' && status != 'created'))
|
||||
if(rate == 1 || (status != 'inprogress' && status != 'created' && status != 'pending'))
|
||||
{
|
||||
updateStatus(data);
|
||||
clearInterval(setProgress);
|
||||
@@ -99,7 +109,7 @@ function updateStatus(data)
|
||||
$.post(url, postData, function(result)
|
||||
{
|
||||
if(data.status == 'completed') $('.success').removeClass('hide');
|
||||
else $('.fail').removeClass('hide');
|
||||
else $('.status-title').text(zanodeLang.createImageFail)
|
||||
}, 'json');
|
||||
}
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user