summaryrefslogtreecommitdiffstats
path: root/cvp/3rd_party
diff options
context:
space:
mode:
authorgrakiss <grakiss.wanglei@huawei.com>2017-11-17 06:34:15 +0000
committerLeo wang <grakiss.wanglei@huawei.com>2017-11-20 02:35:45 +0000
commit29547a92197f88a732420761ee72d92dcc4b9972 (patch)
tree8e7d373d51de43d966e466e791c6541b16b8eb46 /cvp/3rd_party
parent2b090511832f1898f7d15cc33a6b9b20a8d88e07 (diff)
[cvp-web] Bugfix:return 500 when upload a tarball file with no results.json
JIRA: DOVETAIL-558 The Web portal will return 500 code when upload a tarball file with no results.json When all test cases failed or report with wrong DB url, there may be no results.json. Check this and alert users instead of returning 500 status code. Change-Id: Ie13d9c3c62044c525f5dbb3fca9b6123d0b5acce Signed-off-by: grakiss <grakiss.wanglei@huawei.com>
Diffstat (limited to 'cvp/3rd_party')
-rw-r--r--cvp/3rd_party/static/testapi-ui/components/application/application.html2
-rw-r--r--cvp/3rd_party/static/testapi-ui/components/results/resultsController.js31
2 files changed, 19 insertions, 14 deletions
diff --git a/cvp/3rd_party/static/testapi-ui/components/application/application.html b/cvp/3rd_party/static/testapi-ui/components/application/application.html
index acf8ea3e..bb79340a 100644
--- a/cvp/3rd_party/static/testapi-ui/components/application/application.html
+++ b/cvp/3rd_party/static/testapi-ui/components/application/application.html
@@ -159,7 +159,7 @@ urpose. Once we understand more about your product or service, we can determine
</div>
</div>
<div class="Actions">
- <a class="btn btn-success cvp-btn medium accent-color regular-button" ng-click="ctrl.openConfirmModal()" />submit</a>
+ <button class="btn btn-success cvp-btn" ng-click="ctrl.openConfirmModal()">Submit</button>
</div>
<div class="results-table" style="margin-top:30px;overflow:scroll">
<table class="table table-striped table-hover">
diff --git a/cvp/3rd_party/static/testapi-ui/components/results/resultsController.js b/cvp/3rd_party/static/testapi-ui/components/results/resultsController.js
index 4476618c..0b0bbbc8 100644
--- a/cvp/3rd_party/static/testapi-ui/components/results/resultsController.js
+++ b/cvp/3rd_party/static/testapi-ui/components/results/resultsController.js
@@ -254,23 +254,28 @@
$http.post(uploadUrl, fd, {
transformRequest: angular.identity,
headers: {'Content-Type': undefined}
- })
- .success(function(data){
+ }).then(function(data){
+
+ if(data.data.code && data.data.code != 0){
+ alert(data.data.msg);
+ return;
+ }
+
ctrl.uploadState = "";
- data.filename = file.name;
+ data.data.filename = file.name;
var createTestUrl = testapiApiUrl + "/tests"
- $http.post(createTestUrl, data)
- .success(function(data, status){
- if (data.code && data.code != 0) {
- alert(data.msg);
- } else {
- ctrl.update();
- }
+
+ $http.post(createTestUrl, data.data).then(function(data){
+ if (data.data.code && data.data.code != 0) {
+ alert(data.data.msg);
+ } else {
+ ctrl.update();
+ }
+ }, function(error){
});
- })
- .error(function(data, status){
- ctrl.uploadState = "Upload failed. Error code is " + status;
+ }, function(error){
+ ctrl.uploadState = "Upload failed. Error code is " + error.status;
});
}