From 16e83d89c4d4d64188bf6d0249050b2740dfd913 Mon Sep 17 00:00:00 2001 From: thuva4 Date: Thu, 11 Jan 2018 18:24:31 +0530 Subject: Bug fixes in results, tastcases and header file 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 --- testapi/opnfv_testapi/ui/app.js | 43 +++++++++++++--------- .../ui/components/profile/profileController.js | 11 +++--- .../projects/project/testCases/testCases.html | 6 +-- .../project/testCases/testCasesController.js | 3 +- .../ui/components/projects/projects.html | 10 ++--- .../ui/components/projects/projectsController.js | 4 +- .../ui/components/results/results.html | 8 ++-- testapi/opnfv_testapi/ui/shared/header/header.html | 2 +- 8 files changed, 47 insertions(+), 40 deletions(-) diff --git a/testapi/opnfv_testapi/ui/app.js b/testapi/opnfv_testapi/ui/app.js index 3da12b1..d5cf0f9 100644 --- a/testapi/opnfv_testapi/ui/app.js +++ b/testapi/opnfv_testapi/ui/app.js @@ -144,6 +144,7 @@ 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; @@ -160,10 +161,14 @@ /** 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}) + } } /** @@ -171,21 +176,23 @@ * 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){ diff --git a/testapi/opnfv_testapi/ui/components/profile/profileController.js b/testapi/opnfv_testapi/ui/components/profile/profileController.js index 5dbdf7b..e34e745 100644 --- a/testapi/opnfv_testapi/ui/components/profile/profileController.js +++ b/testapi/opnfv_testapi/ui/components/profile/profileController.js @@ -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'); } @@ -115,8 +115,9 @@ ctrl.updatePubKeys(); }); } - - ctrl.authRequest = $scope.auth.doSignCheck().then(ctrl.updatePubKeys); + if(authenticate){ + ctrl.authRequest = $scope.auth.doSignCheck().then(ctrl.updatePubKeys); + } } angular diff --git a/testapi/opnfv_testapi/ui/components/projects/project/testCases/testCases.html b/testapi/opnfv_testapi/ui/components/projects/project/testCases/testCases.html index 00dd0f1..ee87e0a 100644 --- a/testapi/opnfv_testapi/ui/components/projects/project/testCases/testCases.html +++ b/testapi/opnfv_testapi/ui/components/projects/project/testCases/testCases.html @@ -47,9 +47,9 @@ {{testcase.name}} - {{ ctrl.data.tier}} - {{ctrl.data.blocking}} - {{ctrl.data.ci_loop}} + {{testcase.tier}} + {{testcase.blocking}} + {{testcase.ci_loop}} diff --git a/testapi/opnfv_testapi/ui/components/projects/project/testCases/testCasesController.js b/testapi/opnfv_testapi/ui/components/projects/project/testCases/testCasesController.js index 0045284..6d3c245 100644 --- a/testapi/opnfv_testapi/ui/components/projects/project/testCases/testCasesController.js +++ b/testapi/opnfv_testapi/ui/components/projects/project/testCases/testCasesController.js @@ -244,12 +244,13 @@ {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 diff --git a/testapi/opnfv_testapi/ui/components/projects/projects.html b/testapi/opnfv_testapi/ui/components/projects/projects.html index 8a27a57..5a3b421 100644 --- a/testapi/opnfv_testapi/ui/components/projects/projects.html +++ b/testapi/opnfv_testapi/ui/components/projects/projects.html @@ -2,13 +2,13 @@
-
+
+ auth.isAuthenticated) && authenticate}">
@@ -40,7 +40,7 @@ Bulk Select Name Description - Operations + Operations @@ -52,7 +52,7 @@
{{project.name}} {{project.description}} - + diff --git a/testapi/opnfv_testapi/ui/components/projects/projectsController.js b/testapi/opnfv_testapi/ui/components/projects/projectsController.js index 38764ea..bb394c0 100644 --- a/testapi/opnfv_testapi/ui/components/projects/projectsController.js +++ b/testapi/opnfv_testapi/ui/components/projects/projectsController.js @@ -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'; diff --git a/testapi/opnfv_testapi/ui/components/results/results.html b/testapi/opnfv_testapi/ui/components/results/results.html index 7809065..b0c05ba 100644 --- a/testapi/opnfv_testapi/ui/components/results/results.html +++ b/testapi/opnfv_testapi/ui/components/results/results.html @@ -103,14 +103,13 @@ Version Scenario Criteria - Start Date - Stop Date + Build tag - {{ result._id }} + {{ result._id.substr(-8) }} {{ result.pod_name }} {{ result.project_name }} {{ result.case_name }} @@ -118,8 +117,7 @@ {{ result.version }} {{ result.scenario }} {{ result.criteria }} - {{ result.start_date }} - {{ result.stop_date }} + {{ result["build_tag"]}} diff --git a/testapi/opnfv_testapi/ui/shared/header/header.html b/testapi/opnfv_testapi/ui/shared/header/header.html index d0501a2..2300594 100644 --- a/testapi/opnfv_testapi/ui/shared/header/header.html +++ b/testapi/opnfv_testapi/ui/shared/header/header.html @@ -21,7 +21,7 @@ TestAPI
  • Projects
  • Results
  • -