diff --git a/module/testcase/control.php b/module/testcase/control.php index c1100eaf7d..324f8dfada 100644 --- a/module/testcase/control.php +++ b/module/testcase/control.php @@ -395,6 +395,7 @@ class testcase extends control $this->loadModel('story'); if(!empty($_POST)) { + if(!empty($_FILES['scriptFile'])) unset($_FILES['scriptFile']); $response['result'] = 'success'; setcookie('lastCaseModule', (int)$this->post->module, $this->config->cookieLife, $this->config->webRoot, '', $this->config->cookieSecure, false); @@ -875,6 +876,8 @@ class testcase extends control if(!empty($_POST)) { + if(!empty($_FILES['scriptFile'])) unset($_FILES['scriptFile']); + $changes = array(); if($comment == false or $comment == 'false') { diff --git a/module/testcase/css/create.css b/module/testcase/css/create.css index 2ad82ff52e..40e076887a 100644 --- a/module/testcase/css/create.css +++ b/module/testcase/css/create.css @@ -14,6 +14,7 @@ #story_chosen .chosen-results > li.no-results {cursor: pointer;} #story_chosen .chosen-results > li.no-results:hover {color: #1a4f85; background-color: #ddd;} #story_chosen .chosen-results > li.no-results > span {font-weight: bold;} +#type_chosen {display: table-cell;} .row .col-sm-10 {width: 89%;} .row .col-sm-2 {padding-left: 0px; width: 11%;} @@ -42,4 +43,4 @@ .pri-selector > .dropdown-menu {padding: 10px;} .stageBox {padding-left: 15px !important;} -#refresh {margin-left: 7px;} \ No newline at end of file +#refresh {margin-left: 7px;} diff --git a/module/testcase/css/edit.css b/module/testcase/css/edit.css index a27479cd4d..0d16991789 100644 --- a/module/testcase/css/edit.css +++ b/module/testcase/css/edit.css @@ -7,3 +7,4 @@ [lang^=en] .detail > table > tbody th, [lang^=fr] .detail > table > tbody th {width: 100px !important;} [lang^=de] .detail > table > tbody th {width: 125px !important;} .linkCaseTitle, .linkBugTitle {white-space: nowrap;} + #type_chosen{display: table-cell;} diff --git a/module/testcase/model.php b/module/testcase/model.php index 76b0c65193..3c5d34e0c3 100644 --- a/module/testcase/model.php +++ b/module/testcase/model.php @@ -50,6 +50,16 @@ class testcaseModel extends model } } + if(!empty($_POST['auto'])) + { + $_POST['auto'] = 'auto'; + if($_POST['script']) $_POST['script'] = htmlentities($_POST['script']); + } + else + { + unset($_POST['script']); + } + $now = helper::now(); $status = $this->getStatus('create'); $case = fixer::input('post') @@ -61,7 +71,7 @@ class testcaseModel extends model ->setIF($this->app->tab == 'project', 'project', $this->session->project) ->setIF($this->app->tab == 'execution', 'execution', $this->session->execution) ->setIF($this->post->story != false, 'storyVersion', $this->loadModel('story')->getVersion((int)$this->post->story)) - ->remove('steps,expects,files,labels,stepType,forceNotReview') + ->remove('steps,expects,files,labels,stepType,forceNotReview,scriptFile,scriptName') ->setDefault('story', 0) ->cleanInt('story,product,branch,module') ->join('stage', ',') @@ -81,6 +91,8 @@ class testcaseModel extends model if(!$this->dao->isError()) { $caseID = $this->dao->lastInsertID(); + $this->config->dangers = ''; + $this->loadModel('file')->saveUpload('testcase', $caseID, 'autoscript', 'script', 'scriptName'); $this->loadModel('file')->saveUpload('testcase', $caseID); $parentStepID = 0; $this->loadModel('score')->create('testcase', 'create', $caseID); @@ -830,6 +842,17 @@ class testcaseModel extends model $version = $stepChanged ? $oldCase->version + 1 : $oldCase->version; + if(!empty($_POST['auto'])) + { + $_POST['auto'] = 'auto'; + if($_POST['script']) $_POST['script'] = htmlentities($_POST['script']); + } + else + { + $_POST['auto'] = 'no'; + $_POST['script'] = ''; + } + $case = fixer::input('post') ->add('id', $caseID) ->add('version', $version) @@ -845,7 +868,7 @@ class testcaseModel extends model ->setForce('status', $status) ->cleanInt('story,product,branch,module') ->stripTags($this->config->testcase->editor->edit['id'], $this->config->allowedTags) - ->remove('comment,steps,expects,files,labels,linkBug,stepType') + ->remove('comment,steps,expects,files,labels,linkBug,stepType,scriptFile,scriptName') ->get(); $requiredFields = $this->config->testcase->edit->requiredFields; diff --git a/module/testcase/view/automation.html.php b/module/testcase/view/automation.html.php index 85eebf00a3..9055ffb25e 100644 --- a/module/testcase/view/automation.html.php +++ b/module/testcase/view/automation.html.php @@ -28,6 +28,7 @@ testcase->product;?> + diff --git a/module/testcase/view/buildscriptform.php b/module/testcase/view/buildscriptform.php new file mode 100644 index 0000000000..0319c1c943 --- /dev/null +++ b/module/testcase/view/buildscriptform.php @@ -0,0 +1,124 @@ +loadModel('file'); +$filesName = 'scriptFile'; +$labelsName = 'scriptName'; +$maxUploadSize = strtoupper(ini_get('upload_max_filesize')); +$dangerFiles = 'zip'; + +js::set('scriptDangerExtensions', ',' . $dangerFiles . ','); +js::set('maxUploadSize', $maxUploadSize); +?> +
+
+
+
+ +
+ + +
+
+
+
+
+ + +
+
+ + +
+
+ +
+ file->maxUploadSize, $maxUploadSize);?> + + +
+ + + + diff --git a/module/testcase/view/caseheader.html.php b/module/testcase/view/caseheader.html.php index 9da6846a37..aa93e224c8 100644 --- a/module/testcase/view/caseheader.html.php +++ b/module/testcase/view/caseheader.html.php @@ -194,7 +194,7 @@
- " . $lang->testcase->automation, '', "class='btn btn-link iframe'", true, true)?> + " . $lang->testcase->automation, '', "class='btn btn-link iframe' data-width='50%'", true, true)?>
diff --git a/module/testcase/view/create.html.php b/module/testcase/view/create.html.php index cc9ff90ab8..c22b1b4bb9 100644 --- a/module/testcase/view/create.html.php +++ b/module/testcase/view/create.html.php @@ -70,7 +70,12 @@ foreach(explode(',', $config->testcase->create->requiredFields) as $field) testcase->type;?> testcase->typeList['unit']);?> - testcase->typeList, $type, "class='form-control chosen'");?> + + testcase->typeList, $type, "class='form-control chosen'");?> +
+ $lang->testcase->showAutoCase), '', "id='autocase' title='{$lang->testcase->showAutoCase}'");?> +
+ @@ -81,6 +86,10 @@ foreach(explode(',', $config->testcase->create->requiredFields) as $field) + + testcase->autoScript;?> + + testcase->lblStory;?> @@ -148,16 +157,10 @@ foreach(explode(',', $config->testcase->create->requiredFields) as $field) testcase->forceNotReview()):?> testcase->forceNotReview, '', "id='forceNotReview0'");?> -
- testcase->showAutoCase, '', "id='autocase' title='{$lang->testcase->showAutoCase}'");?> -
- - testcase->autoScript;?> - fetch('file', 'buildform', 'fileCount=1&percent=0.9&filesName=script');?> - + testcase->precondition;?> @@ -274,4 +277,15 @@ foreach(explode(',', $config->testcase->create->requiredFields) as $field)
testcase->module)?> + diff --git a/module/testcase/view/edit.html.php b/module/testcase/view/edit.html.php index 9666ee3081..2f8ab784ef 100644 --- a/module/testcase/view/edit.html.php +++ b/module/testcase/view/edit.html.php @@ -214,7 +214,16 @@ testcase->type;?> type != 'unit') unset($lang->testcase->typeList['unit']);?> - testcase->typeList, $case->type, "class='form-control chosen'");?> + + testcase->typeList, $case->type, "class='form-control chosen'");?> +
+ $lang->testcase->showAutoCase), $case->auto, "id='autocase' title='{$lang->testcase->showAutoCase}'");?> +
+ + + + testcase->autoScript;?> + testcase->stage;?> @@ -316,6 +325,24 @@ $(function() { $('#subNavbar [data-id=testcase]').addClass('active'); $('#navbar [data-id=testcase]').addClass('active'); + checkScript(); }) + +function checkScript() +{ + var autoScript = $(":checkbox[name^='auto']"); + if(autoScript.attr('checked')) + { + $('.autoScript').removeClass('hide') + }else + { + $('.autoScript').addClass('hide') + } + +} + +$(":checkbox[name^='auto']").on('click', function(){ + checkScript(); +}); diff --git a/module/testcase/view/showscript.html.php b/module/testcase/view/showscript.html.php index 8a99581506..0b679ec21c 100644 --- a/module/testcase/view/showscript.html.php +++ b/module/testcase/view/showscript.html.php @@ -24,7 +24,7 @@ js::import($jsRoot . 'misc/highlight/highlight.pack.js');
-
script, defined('ENT_SUBSTITUTE') ? ENT_QUOTES | ENT_SUBSTITUTE : ENT_QUOTES));?>
+
script;?>
diff --git a/module/testtask/view/results.html.php b/module/testtask/view/results.html.php index 12e46c718a..06b2fe7c66 100644 --- a/module/testtask/view/results.html.php +++ b/module/testtask/view/results.html.php @@ -46,7 +46,7 @@   #id?> date;?> node > 0):?> - testtask->runNode, zget($users, $result->lastRunner), $result->nodeName, !empty($result->ZTFResult) ? $lang->testtask->runCase : "{$lang->testtask->running}") . "  {$lang->testtask->auto}";?> + testtask->runNode, zget($users, $result->lastRunner), $result->nodeName, $lang->testtask->runCase) . "  {$lang->testtask->auto}";?> lastRunner) . ' ' . $lang->testtask->runCase;?> @@ -55,6 +55,9 @@ node == 0 || !empty($result->ZTFResult)):?> testcase->resultList[$result->caseResult];?> + node > 0 and empty($result->ZTFResult)):?> + testtask->running;?> + files)) echo html::a("#caseResult{$result->id}", $lang->files . $fileCount, '', "data-toggle='modal' data-type='iframe'")?> diff --git a/module/zahost/config.php b/module/zahost/config.php index c08a07d951..61c7fe052b 100644 --- a/module/zahost/config.php +++ b/module/zahost/config.php @@ -12,7 +12,7 @@ $config->zahost->imageListUrl = 'https://pkg.qucheng.com/zenagent/list.json'; $config->zahost->cpuCoreList = [1 => 1, 2 => 2, 4 => 4, 6 => 6, 8 => 8, 10 => 10, 12 => 12, 16 => 16, 24 => 24, 32 => 32, 64 => 64]; -$config->zahost->initBash = 'curl -sSL https://pkg.qucheng.com/zenagent/zagent.sh | bash /dev/stdin -k%s -z%s'; +$config->zahost->initBash = 'curl -sSL https://pkg.qucheng.com/zenagent/zagent.sh | bash /dev/stdin -k %s -z %s'; global $lang; $config->zahost->search['module'] = 'zahost'; diff --git a/module/zahost/css/view.css b/module/zahost/css/view.css index 484ad9551b..38097ee93a 100644 --- a/module/zahost/css/view.css +++ b/module/zahost/css/view.css @@ -12,5 +12,6 @@ .zahost-init{padding:15px;background: #f4f5f7;margin:10px 0;} .fail{color:red;} .dot-symbol{padding-right:10px;} -#statusContainer{margin:10px 0;} +#statusContainer{margin:0px 0px 10px 0px;} #checkServiceStatus{background-color:unset;} +.service-check{margin-top: 0px;} diff --git a/module/zahost/js/view.js b/module/zahost/js/view.js index e695139d6e..aaaa2fb28c 100644 --- a/module/zahost/js/view.js +++ b/module/zahost/js/view.js @@ -6,13 +6,18 @@ function ajaxGetServiceStatus() var resultData = JSON.parse(response); let html = ""; let isSuccess = true + var service = ''; for (let key in resultData.data) { + if(key == 'kvm') service = 'KVM'; + if(key == 'nginx') service = 'Nginx'; + if(key == 'novnc') service = 'noVNC'; + if(key == 'websockify') service = 'Websockify'; if(resultData.data[key] == 'ready'){ - html += "
● " + key + ' ' + zahostLang.init[resultData.data[key]] + "
" + html += "
● " + service + ' ' + zahostLang.init[resultData.data[key]] + "
" }else{ isSuccess = false - html += "
● " + key + ' ' + zahostLang.init[resultData.data[key]] + "
" + html += "
● " + service + ' ' + zahostLang.init[resultData.data[key]] + "
" } }; diff --git a/module/zahost/lang/de.php b/module/zahost/lang/de.php index 12c4b547e9..28bf968144 100644 --- a/module/zahost/lang/de.php +++ b/module/zahost/lang/de.php @@ -112,6 +112,8 @@ $lang->zahost->softwareList['kvm'] = 'KVM'; $lang->zahost->unitList['GB'] = 'GB'; $lang->zahost->unitList['TB'] = 'TB'; +$lang->zahost->cpuUnit = 'CORE'; + $lang->zahost->zaHostType = 'Type'; $lang->zahost->zaHostTypeList['physical'] = 'Physical'; diff --git a/module/zahost/lang/en.php b/module/zahost/lang/en.php index 12c4b547e9..28bf968144 100644 --- a/module/zahost/lang/en.php +++ b/module/zahost/lang/en.php @@ -112,6 +112,8 @@ $lang->zahost->softwareList['kvm'] = 'KVM'; $lang->zahost->unitList['GB'] = 'GB'; $lang->zahost->unitList['TB'] = 'TB'; +$lang->zahost->cpuUnit = 'CORE'; + $lang->zahost->zaHostType = 'Type'; $lang->zahost->zaHostTypeList['physical'] = 'Physical'; diff --git a/module/zahost/lang/fr.php b/module/zahost/lang/fr.php index 5b64e05f1a..e62e45edcd 100644 --- a/module/zahost/lang/fr.php +++ b/module/zahost/lang/fr.php @@ -112,6 +112,8 @@ $lang->zahost->softwareList['kvm'] = 'KVM'; $lang->zahost->unitList['GB'] = 'GB'; $lang->zahost->unitList['TB'] = 'TB'; +$lang->zahost->cpuUnit = 'CORE'; + $lang->zahost->zaHostType = 'Type'; $lang->zahost->zaHostTypeList['physical'] = 'Physical'; diff --git a/module/zahost/lang/zh-cn.php b/module/zahost/lang/zh-cn.php index 885642b408..11de845915 100644 --- a/module/zahost/lang/zh-cn.php +++ b/module/zahost/lang/zh-cn.php @@ -112,6 +112,8 @@ $lang->zahost->softwareList['kvm'] = 'KVM'; $lang->zahost->unitList['GB'] = 'GB'; $lang->zahost->unitList['TB'] = 'TB'; +$lang->zahost->cpuUnit = '核'; + $lang->zahost->zaHostType = '主机类型'; $lang->zahost->zaHostTypeList['physical'] = '实体主机'; diff --git a/module/zahost/view/view.html.php b/module/zahost/view/view.html.php index 07bcb94a36..8440eaf99b 100644 --- a/module/zahost/view/view.html.php +++ b/module/zahost/view/view.html.php @@ -44,14 +44,14 @@
-
zahost->zaHostType;?>:
-
zahost->zaHostTypeList[$zahost->hostType];?>
+
zahost->cpuCores;?>:
+
cpuCores . $lang->zahost->cpuUnit;?>
-
zahost->cpuCores;?>:
-
cpuCores;?>
+
zahost->zaHostType;?>:
+
zahost->zaHostTypeList[$zahost->hostType];?>
@@ -64,14 +64,14 @@
-
zahost->diskSize;?>:
-
diskSize;?>
+
zahost->memory;?>:
+
memory . $lang->zahost->unitList['GB'];;?>
-
zahost->memory;?>:
-
memory;?>
+
zahost->vsoft;?>:
+
zahost->softwareList, $zahost->vsoft);?>
@@ -84,8 +84,8 @@
-
zahost->vsoft;?>:
-
zahost->softwareList, $zahost->vsoft);?>
+
zahost->diskSize;?>:
+
diskSize . $lang->zahost->unitList['GB'];?>
@@ -103,12 +103,7 @@
-
-
在宿主机上安装必要服务后进行检测:
-
- - "; ?> -
+
●KVM
●Nginx
diff --git a/module/zanode/view/browse.html.php b/module/zanode/view/browse.html.php index f4b185128d..ac0e6eaf54 100644 --- a/module/zanode/view/browse.html.php +++ b/module/zanode/view/browse.html.php @@ -95,11 +95,11 @@ if($node->status == "shutoff") { - common::printLink('zanode', 'start', "zanodeID={$node->id}", " ", '', "class='btn '"); + common::printLink('zanode', 'start', "zanodeID={$node->id}", " ", '', "class='btn ' title='{$lang->zanode->boot}'"); } else { - common::printLink('zanode', 'close', "zanodeID={$node->id}", " ", '', "class='btn '"); + common::printLink('zanode', 'close', "zanodeID={$node->id}", " ", '', "class='btn ' title='{$lang->zanode->shutdown}'"); } common::printLink('zanode', 'reboot', "zanodeID={$node->id}", " ", '', $rebootAttr);