Bug fixes in results, tastcases and header file 21/50421/3
authorthuva4 <tharma.thuva@gmail.com>
Thu, 11 Jan 2018 12:54:31 +0000 (18:24 +0530)
committerthuva4 <tharma.thuva@gmail.com>
Tue, 16 Jan 2018 04:11:26 +0000 (09:41 +0530)
Remove the profile, signout option in authenticate false made
Remove the sever request in authenticate false made
Remove stop date, start date in results page
Add build tag in results page
fix issue in test cases page

Change-Id: Ic3d16f53591017d2529926e4e3374aaa245c7dce
Signed-off-by: thuva4 <tharma.thuva@gmail.com>
testapi/opnfv_testapi/ui/app.js
testapi/opnfv_testapi/ui/components/profile/profileController.js
testapi/opnfv_testapi/ui/components/projects/project/testCases/testCases.html
testapi/opnfv_testapi/ui/components/projects/project/testCases/testCasesController.js
testapi/opnfv_testapi/ui/components/projects/projects.html
testapi/opnfv_testapi/ui/components/projects/projectsController.js
testapi/opnfv_testapi/ui/components/results/results.html
testapi/opnfv_testapi/ui/shared/header/header.html

index 3da12b1..d5cf0f9 100644 (file)
     function setup($http, $rootScope, $window, $state, testapiApiUrl, authenticate) {
 
         $rootScope.auth = {};
+        $rootScope.authenticate = authenticate
         $rootScope.auth.doSignIn = doSignIn;
         $rootScope.auth.doSignOut = doSignOut;
         $rootScope.auth.doSignCheck = doSignCheck;
 
         /** This function will initate a sign out. */
         function doSignOut() {
-            $rootScope.auth.currentUser = null;
-            $rootScope.auth.isAuthenticated = false;
-            $rootScope.auth.projectNames = [];
-            $window.location.href = sign_out_url;
+            if(authenticate){
+                $rootScope.auth.currentUser = null;
+                $rootScope.auth.isAuthenticated = false;
+                $rootScope.auth.projectNames = [];
+                $window.location.href = sign_out_url;
+            }else{
+                $state.go("home", {reload: true})
+            }
         }
 
         /**
          * authenticated.
          */
         function doSignCheck() {
-            return $http.get(profile_url, {withCredentials: true}).
-                success(function (data) {
-                    $rootScope.auth.currentUser = data;
-                    $rootScope.auth.isAuthenticated = true;
-                    if(authenticate){
+            if(authenticate){
+                return $http.get(profile_url, {withCredentials: true}).
+                    success(function (data) {
+                        $rootScope.auth.currentUser = data;
+                        $rootScope.auth.isAuthenticated = true;
                         $rootScope.auth.projectNames = $rootScope.auth.doSubmitterCheck(data.groups);
-                    }else{
-                        $rootScope.auth.projectNames = ["anonymous"]
-                    }
-                }).
-                error(function () {
-                    $rootScope.auth.currentUser = null;
-                    $rootScope.auth.isAuthenticated = false;
-                    $rootScope.auth.projectNames  = [];
-                });
+                    }).
+                    error(function () {
+                        $rootScope.auth.currentUser = null;
+                        $rootScope.auth.isAuthenticated = false;
+                        $rootScope.auth.projectNames  = [];
+                    });
+            }else{
+                $rootScope.auth.currentUser = null;
+                $rootScope.auth.isAuthenticated = true;
+                $rootScope.auth.projectNames = []
+            }
         }
 
         function doSubmitterCheck(groups){
index 5dbdf7b..e34e745 100644 (file)
@@ -35,7 +35,7 @@
 
     ProfileController.$inject = [
         '$scope', '$http', 'testapiApiUrl', 'PubKeys',
-        '$uibModal', 'raiseAlert', '$state'
+        '$uibModal', 'raiseAlert', '$state' , 'authenticate'
     ];
 
     /**
@@ -44,7 +44,7 @@
      * account-specific information.
      */
     function ProfileController($scope, $http, testapiApiUrl,
-        PubKeys, $uibModal, raiseAlert, $state) {
+        PubKeys, $uibModal, raiseAlert, $state, authenticate) {
 
         var ctrl = this;
 
@@ -53,7 +53,7 @@
         ctrl.openShowPubKeyModal = openShowPubKeyModal;
 
         // Must be authenticated to view this page.
-        if (!$scope.auth.isAuthenticated) {
+        if (!$scope.auth.isAuthenticated || !authenticate) {
             $state.go('home');
         }
 
                 ctrl.updatePubKeys();
             });
         }
-
-        ctrl.authRequest = $scope.auth.doSignCheck().then(ctrl.updatePubKeys);
+        if(authenticate){
+            ctrl.authRequest = $scope.auth.doSignCheck().then(ctrl.updatePubKeys);
+        }
     }
 
     angular
index 00dd0f1..ee87e0a 100644 (file)
@@ -47,9 +47,9 @@
                     {{testcase.name}}
                 </a>
             </td>
-            <td>{{ ctrl.data.tier}}</td>
-            <td>{{ctrl.data.blocking}}</td>
-            <td>{{ctrl.data.ci_loop}}</td>
+            <td>{{testcase.tier}}</td>
+            <td>{{testcase.blocking}}</td>
+            <td>{{testcase.ci_loop}}</td>
             <td ng-class="{'hidden': ! ((auth.projectNames.length>0) && auth.isAuthenticated)}">
                 <span class="podsTable-col">
                     <a class="text-warning" ng-click="testCasesCtrl.openUpdateTestModal(testcase.name)" title="Edit">
index 0045284..6d3c245 100644 (file)
             {label: 'blocking', type: 'text', required: false},
             {label: 'criteria', type: 'text', required: false},
             {label: 'domains', type: 'text', required: false},
+            {label: 'ci_loop', type: 'text', required: false},
             {label: 'catalog_description', type: 'text', required: false}
         ];
 
         ctrl.testcase = {name : null, description : null,version : null, tier : null, tags : null,
                      run : null, dependencies : null, trust : null, url : null, blocking : null,
-                 criteria : null, domains : null, catalog_description : null};
+                 criteria : null, domains : null, ci_loop: null,  catalog_description : null};
 
         if(ctrl.data.text=="Update"){
             ctrl.testcase = ctrl.data.testCase
index 8a27a57..5a3b421 100644 (file)
@@ -2,13 +2,13 @@
 
 <div class="row" style="margin-bottom:24px;"></div>
 <div class="row podsTable" style="vertical-align:middle">
-    <div class="col-sm-1 pull-right" ng-class="{ 'hidden': ! ((auth.projectNames.length>0) &&
-        auth.isAuthenticated) }" >
+    <div class="col-sm-1 pull-right" ng-class="{ 'hidden': !((auth.projectNames.length>0) &&
+        auth.isAuthenticated) && authenticate}" >
             <button type="button" class="btn btn-danger" ng-click="ctrl.openBatchDeleteModal()">
               <i class="fa fa-minus"></i> Delete</button>
     </div>
     <div class="col-sm-1 pull-right"  ng-class="{ 'hidden': ! ((auth.projectNames.length>0) &&
-        auth.isAuthenticated) }">
+        auth.isAuthenticated) && authenticate}">
         <button type="button" class="btn btn-success" ng-click="ctrl.openCreateModal()">
           <i class="fa fa-plus"></i> Create</button>
     </div>
@@ -40,7 +40,7 @@
             <th style="width: 1%;">Bulk Select</th>
             <th style="width: 19%;">Name</th>
             <th style="width: 70%;">Description</th>
-            <th style="width: 10%;" ng-class="{'hidden': ! ((auth.projectNames.length>0) && auth.isAuthenticated)}">Operations</th>
+            <th style="width: 10%;" ng-class="{'hidden': ! ((auth.projectNames.length>0) && auth.isAuthenticated) && authenticate}">Operations</th>
         </tr>
         </thead>
         <tbody>
@@ -52,7 +52,7 @@
             </td>
             <td><a class="text-info" ng-click="ctrl.viewProject(project.name)">{{project.name}}</a></td>
             <td>{{project.description}}</td>
-            <td ng-class="{'hidden': ! ((auth.projectNames.length>0) && auth.isAuthenticated)}">
+            <td ng-class="{'hidden': ! ((auth.projectNames.length>0) && auth.isAuthenticated) && authenticate}">
                 <span class="podsTable-col">
                     <a class="text-warning" ng-click="ctrl.openUpdateModal(project.name)" title="Edit" >
                         <i class="fa fa-pencil-square-o"></i></a>
index 38764ea..bb394c0 100644 (file)
@@ -21,7 +21,7 @@
 
         ProjectsController.$inject = [
         '$scope', '$http', '$filter', '$state', '$window', '$uibModal', 'testapiApiUrl',
-        'raiseAlert', 'confirmModal'
+        'raiseAlert', 'confirmModal', 'authenticate'
     ];
 
     /**
@@ -30,7 +30,7 @@
      * through projects declared in TestAPI.
      */
     function ProjectsController($scope, $http, $filter, $state, $window, $uibModal, testapiApiUrl,
-        raiseAlert, confirmModal) {
+        raiseAlert, confirmModal, authenticate) {
         var ctrl = this;
         ctrl.url = testapiApiUrl + '/projects';
 
index 7809065..b0c05ba 100644 (file)
                 <th>Version</th>
                 <th>Scenario</th>
                 <th>Criteria</th>
-                <th>Start Date</th>
-                <th>Stop Date</th>
+                <th>Build&nbsp;tag</th>
             </tr>
         </thead>
 
         <tbody>
             <tr ng-repeat-start="(index, result) in ctrl.data.results">
-                <td><a ng-click="ctrl.viewResult(result._id)">{{ result._id }}</a></td>
+                <td><a ng-click="ctrl.viewResult(result._id)">{{ result._id.substr(-8) }}</a></td>
                 <td>{{ result.pod_name }}</td>
                 <td>{{ result.project_name }}</td>
                 <td>{{ result.case_name }}</td>
                 <td>{{ result.version }}</td>
                 <td>{{ result.scenario }}</td>
                 <td>{{ result.criteria }}</td>
-                <td>{{ result.start_date }}</td>
-                <td>{{ result.stop_date }}</td>
+                <td>{{ result["build_tag"]}}</td>
             </tr>
             <tr ng-repeat-end=>
             </tr>
index d0501a2..2300594 100644 (file)
@@ -21,7 +21,7 @@ TestAPI
             <li ng-class="{ active: header.isActive('/projects')}"><a ui-sref="projects">Projects</a></li>
               <li ng-class="{ active: header.isActive('/results')}"><a ui-sref="results">Results</a></li>
           </ul>
-          <ul class="nav navbar-nav navbar-right">
+          <ul class="nav navbar-nav navbar-right" ng-class="{'hidden' : !authenticate}">
             <li ng-class="{ active: header.isActive('/profile')}" ng-if="auth.isAuthenticated"><a ui-sref="profile">Profile</a></li>
             <li ng-if="auth.isAuthenticated"><a href="" ng-click="auth.doSignOut()">Sign Out</a></li>
             <li ng-if="!auth.isAuthenticated"><a href="" ng-click="auth.doSignIn()">Sign In / Sign Up</a></li>