Don't allow user change SUT version to None after submitting 91/50891/4
authorchenjiankun <chenjiankun1@huawei.com>
Mon, 22 Jan 2018 02:11:31 +0000 (02:11 +0000)
committerLeo wang <grakiss.wanglei@huawei.com>
Wed, 24 Jan 2018 06:19:51 +0000 (06:19 +0000)
We don't allow SUT version to be None when submitting test.
So we also not allow user to change it to Nonw after submitting.

In this patch, I also make the result table self-adaption.

Change-Id: I5c391592dcbdbd9eb8697e44d7bb5dda41431bd6
Signed-off-by: chenjiankun <chenjiankun1@huawei.com>
cvp/3rd_party/static/testapi-ui/components/results/results.html
cvp/opnfv_testapi/resources/test_handlers.py

index f53023d..719e689 100644 (file)
@@ -17,7 +17,7 @@
 <div cg-busy="{promise:ctrl.authRequest,message:'Loading'}"></div>
 <div cg-busy="{promise:ctrl.resultsRequest,message:'Loading'}"></div>
 
-<div ng-show="ctrl.data" class="results-table">
+<div ng-show="ctrl.data" class="results-table" style="width:100%;overflow-x:scroll">
     <table ng-data="ctrl.data.result" ng-show="ctrl.data" class="table table-striped table-hover">
         <thead>
             <tr>
index b28a15d..77656ae 100644 (file)
@@ -196,10 +196,16 @@ class TestsGURHandler(GenericTestHandler):
             return
 
         curr_user = self.get_secure_cookie(auth_const.OPENID)
-        if item in {"shared", "label"}:
+        if item in {"shared", "label", "sut_label"}:
             query['owner'] = curr_user
             db_keys.append('owner')
 
+        if item == 'sut_label':
+            if test['status'] != 'private' and not value:
+                msg = 'SUT version cannot be changed to None after submitting.'
+                self.finish_request({'code': 403, 'msg': msg})
+                return
+
         if item == "status":
             if value in {'approved', 'not approved'}:
                 if test['status'] == 'private':