From 71bdc6752f47b7da7282f786570fbe717973fb6d Mon Sep 17 00:00:00 2001 From: Panagiotis Karalis Date: Thu, 24 Jan 2019 15:04:15 +0200 Subject: Enhanced OVP Web Portal The OVP web portal is updated with some improvements. Those improvements are focused on the styling part of the portal as well as on the introduction of new functions related to the reviews, applications and the generally flow. JIRA: DOVETAIL-670 JIRA: DOVETAIL-760 Change-Id: Ic5ca90eaaee36de43486ff55ad9aa788136587c6 Signed-off-by: Panagiotis Karalis --- 3rd_party/static/testapi-ui/app.js | 24 +- .../static/testapi-ui/assets/css/cvp-style.css | 28 +++ .../components/application/application.html | 231 +----------------- .../application/applicationController.js | 198 +++++++++------- .../testapi-ui/components/profile/profile.html | 61 +++++ .../components/profile/profileController.js | 26 ++ .../components/results/modal/applicationModal.html | 191 +++++++++++++++ .../components/results/modal/applicationView.html | 107 +++++++++ .../components/results/modal/reviewsModal.html | 41 ++++ .../testapi-ui/components/results/results.html | 57 +++-- .../components/results/resultsController.js | 262 ++++++++++++++++++++- 3rd_party/static/testapi-ui/index.html | 4 +- .../static/testapi-ui/shared/header/header.html | 7 +- opnfv_testapi/resources/test_handlers.py | 5 - opnfv_testapi/router/url_mappings.py | 1 + 15 files changed, 892 insertions(+), 351 deletions(-) create mode 100644 3rd_party/static/testapi-ui/components/results/modal/applicationModal.html create mode 100644 3rd_party/static/testapi-ui/components/results/modal/applicationView.html create mode 100644 3rd_party/static/testapi-ui/components/results/modal/reviewsModal.html diff --git a/3rd_party/static/testapi-ui/app.js b/3rd_party/static/testapi-ui/app.js index edf7663..55603aa 100644 --- a/3rd_party/static/testapi-ui/app.js +++ b/3rd_party/static/testapi-ui/app.js @@ -55,11 +55,11 @@ templateUrl: 'testapi-ui/components/guidelines/guidelines.html', controller: 'GuidelinesController as ctrl' }). - // state('communityResults', { - // url: '/community_results', - // templateUrl: 'testapi-ui/components/results/results.html', - // controller: 'ResultsController as ctrl' - // }). + state('communityResults', { + url: '/community_results', + templateUrl: 'testapi-ui/components/results/results.html', + controller: 'ResultsController as ctrl' + }). state('userResults', { url: '/user_results', templateUrl: 'testapi-ui/components/results/results.html', @@ -173,12 +173,26 @@ $rootScope.auth.doSignIn = doSignIn; $rootScope.auth.doSignOut = doSignOut; $rootScope.auth.doSignCheck = doSignCheck; + $rootScope.auth.canReview = canReview; var sign_in_url = testapiApiUrl + '/auth/signin'; var sign_out_url = testapiApiUrl + '/auth/signout'; var profile_url = testapiApiUrl + '/profile'; + function canReview(user) { + if (typeof user.role == undefined) { + return false; + } else if (user.role.indexOf('administrator') != -1) { + return true; + } else if (user.role.indexOf('reviewer') != -1) { + return true; + } else { + return false; + } + } + + /** This function initiates a sign in. */ function doSignIn(type) { $rootScope.auth.type = type; diff --git a/3rd_party/static/testapi-ui/assets/css/cvp-style.css b/3rd_party/static/testapi-ui/assets/css/cvp-style.css index ed1d938..e6d3ab1 100644 --- a/3rd_party/static/testapi-ui/assets/css/cvp-style.css +++ b/3rd_party/static/testapi-ui/assets/css/cvp-style.css @@ -2,6 +2,15 @@ font-size: 18px; } +.nav>li>a:hover, +.nav>li>a:focus, +.nav>li.active, +.nav>li.active>a { + background-color: #27CFC3; + color: #1C1C1C; +} + + table { font-size: 15px; } @@ -96,3 +105,22 @@ table .btn.medium { a { cursor: pointer; } + +.btn-success-cust { +color: #fff; +background-color: #27CFC3; +border-color: #27CFC3; +} + +.btn-success-cust:focus, .btn-success-cust:hover { +border-color: #1FA79C; +background-color: #1FA79C; +} + +input:invalid { + border: 2px dashed red; +} + +input:valid { + border: 2px solid black; +} diff --git a/3rd_party/static/testapi-ui/components/application/application.html b/3rd_party/static/testapi-ui/components/application/application.html index 0b45ab3..5e78546 100644 --- a/3rd_party/static/testapi-ui/components/application/application.html +++ b/3rd_party/static/testapi-ui/components/application/application.html @@ -1,207 +1,4 @@
-
-
-

Complete this application then start your CVP journey

-
-
- -
-
-
- -
-
- - -
- -
-
-
- - -
- -
-
-
- -
- - -
- -
-
-
- - -
- -
-
-
- - -
- -
-
-
- - -
- -
-
-
- - -
- -
-
-
- - -
- -
-
-
- - -
- -
-
-
- - -
- -
-
-
- - -
- -
-
-
- - -
- -
-
-
- - -
- -
-
-
- - -
- -
-
-
- - -
- -
-
-
- - -
- -
-
-
- - -
- -
-
-
- - -
- -
-
-
- - -
- -
-
-
-
- - - -
-
- - - -
-
- - - -
-
- - - -
-
-
-
-
-
-
- -
@@ -217,7 +14,7 @@ - + @@ -225,7 +22,6 @@ - @@ -284,7 +80,6 @@ - @@ -315,20 +116,4 @@ - -
-
-

Company Logo Upload for Directory

-
-
- -
- - -
diff --git a/3rd_party/static/testapi-ui/components/application/applicationController.js b/3rd_party/static/testapi-ui/components/application/applicationController.js index e2a4f75..6ae157e 100644 --- a/3rd_party/static/testapi-ui/components/application/applicationController.js +++ b/3rd_party/static/testapi-ui/components/application/applicationController.js @@ -28,35 +28,36 @@ $uibModal, testapiApiUrl, raiseAlert, ngDialog, $scope) { var ctrl = this; - ctrl.uploadLogo = uploadLogo; +// ctrl.uploadLogo = uploadLogo; function init() { - ctrl.organization_name = null; - ctrl.organization_web = null; - ctrl.product_name = null; - ctrl.product_spec = null; - ctrl.product_documentation = null; - ctrl.product_categories = "soft&hard"; - ctrl.prim_name = null; - ctrl.prim_email = null; - ctrl.prim_address = null; - ctrl.prim_phone = null; - ctrl.description = null; - ctrl.sut_version = null; - ctrl.sut_hw_version = null; - ctrl.ovp_version = "2018.01"; - ctrl.ovp_category = "Infrastructure"; - ctrl.company_logo = null; - ctrl.approve_date = null; - ctrl.approved = "false"; - ctrl.test_id = null; - ctrl.lab_location = "internal"; - ctrl.lab_name = null; - ctrl.lab_email = null; - ctrl.lab_address = null; - ctrl.lab_phone = null; ctrl.applications = []; - ctrl.showApplications = []; +// ctrl.organization_name = null; +// ctrl.organization_web = null; +// ctrl.product_name = null; +// ctrl.product_spec = null; +// ctrl.product_documentation = null; +// ctrl.product_categories = "soft&hard"; +// ctrl.prim_name = null; +// ctrl.prim_email = null; +// ctrl.prim_address = null; +// ctrl.prim_phone = null; +// ctrl.description = null; +// ctrl.sut_version = null; +// ctrl.sut_hw_version = null; +// ctrl.ovp_version = "2018.01"; +// ctrl.ovp_category = "Infrastructure"; +// ctrl.company_logo = null; +// ctrl.approve_date = null; +// ctrl.approved = "false"; +// ctrl.test_id = null; +// ctrl.lab_location = "internal"; +// ctrl.lab_name = null; +// ctrl.lab_email = null; +// ctrl.lab_address = null; +// ctrl.lab_phone = null; +// ctrl.applications = []; +// ctrl.showApplications = []; ctrl.totalItems = null; ctrl.currentPage = 1; @@ -70,52 +71,52 @@ } - ctrl.submitForm = function() { - var data = { - "organization_name": ctrl.organization_name, - "organization_web": ctrl.organization_web, - "product_name": ctrl.product_name, - "product_spec": ctrl.product_spec, - "product_documentation": ctrl.product_documentation, - "product_categories": ctrl.product_categories, - "prim_name": ctrl.prim_name, - "prim_email": ctrl.prim_email, - "prim_address": ctrl.prim_address, - "prim_phone": ctrl.prim_phone, - "description": ctrl.description, - "sut_version": ctrl.sut_version, - "sut_hw_version": ctrl.sut_hw_version, - "ovp_version": ctrl.ovp_version, - "ovp_category": ctrl.ovp_category, - "company_logo": ctrl.company_logo, - "approve_date": ctrl.approve_date, - "approved": ctrl.approved, - "test_id": ctrl.test_id, - "lab_location": ctrl.lab_location, - "lab_email": ctrl.lab_email, - "lab_address": ctrl.lab_address, - "lab_phone": ctrl.lab_phone - }; - $http.post(testapiApiUrl + "/cvp/applications", data).then(function(resp) { - if (resp.data.code && resp.data.code != 0) { - alert(resp.data.msg); - return; - } - getApplication(); - }, function(error) { - }); - } - - ctrl.openConfirmModal = function() { - var resp = confirm("Are you sure to submit?"); - if (resp) { - ctrl.submitForm(); - } - } - - ctrl.cancelSubmit = function() { - ngDialog.close(); - } +// ctrl.submitForm = function() { +// var data = { +// "organization_name": ctrl.organization_name, +// "organization_web": ctrl.organization_web, +// "product_name": ctrl.product_name, +// "product_spec": ctrl.product_spec, +// "product_documentation": ctrl.product_documentation, +// "product_categories": ctrl.product_categories, +// "prim_name": ctrl.prim_name, +// "prim_email": ctrl.prim_email, +// "prim_address": ctrl.prim_address, +// "prim_phone": ctrl.prim_phone, +// "description": ctrl.description, +// "sut_version": ctrl.sut_version, +// "sut_hw_version": ctrl.sut_hw_version, +// "ovp_version": ctrl.ovp_version, +// "ovp_category": ctrl.ovp_category, +// "company_logo": ctrl.company_logo, +// "approve_date": ctrl.approve_date, +// "approved": ctrl.approved, +// "test_id": ctrl.test_id, +// "lab_location": ctrl.lab_location, +// "lab_email": ctrl.lab_email, +// "lab_address": ctrl.lab_address, +// "lab_phone": ctrl.lab_phone +// }; +// $http.post(testapiApiUrl + "/cvp/applications", data).then(function(resp) { +// if (resp.data.code && resp.data.code != 0) { +// alert(resp.data.msg); +// return; +// } +// getApplication(); +// }, function(error) { +// }); +// } + +// ctrl.openConfirmModal = function() { +// var resp = confirm("Are you sure to submit?"); +// if (resp) { +// ctrl.submitForm(); +// } +// } +// +// ctrl.cancelSubmit = function() { +// ngDialog.close(); +// } ctrl.updatePage = function() { getApplication(); @@ -136,23 +137,52 @@ }); } - function uploadLogo() { - var file = $scope.logoFile; - var fd = new FormData(); - fd.append('file', file); + ctrl.toggleApproveApp = function(id, approved) { + if (approved === 'true') { + var text = 'Are you sure you want to approve this application?'; + } else { + var text = 'Are you sure you want to remove approval of this application?'; + } + + var resp = confirm(text); + if (!resp) + return; - $http.post(testapiApiUrl + "/cvp/applications/uploadlogo", fd, { + var updateUrl = testapiApiUrl + "/cvp/applications/" + id; + var data = {}; + data['item'] = 'approved'; + data['approved'] = approved; + + $http.put(updateUrl, JSON.stringify(data), { transformRequest: angular.identity, - headers: {'Content-Type': undefined} - }).then(function(resp) { - if (resp.data.code && resp.data.code != 0) { - alert(resp.data.msg); - return; - } + headers: {'Content-Type': 'application/json'}}).then(function(ret) { + if (ret.data.code && ret.data.code != 0) { + alert(ret.data.msg); + return; + } + getApplication(); }, function(error) { + alert('Error when update data'); }); + } - }; +// function uploadLogo() { +// var file = $scope.logoFile; +// var fd = new FormData(); +// fd.append('file', file); +// +// $http.post(testapiApiUrl + "/cvp/applications/uploadlogo", fd, { +// transformRequest: angular.identity, +// headers: {'Content-Type': undefined} +// }).then(function(resp) { +// if (resp.data.code && resp.data.code != 0) { +// alert(resp.data.msg); +// return; +// } +// }, function(error) { +// }); +// +// }; function getApplication() { $http.get(testapiApiUrl + "/cvp/applications?page=" + ctrl.currentPage + "&signed&per_page=" + ctrl.itemsPerPage).then(function(response) { diff --git a/3rd_party/static/testapi-ui/components/profile/profile.html b/3rd_party/static/testapi-ui/components/profile/profile.html index 563adbf..cfcc79a 100644 --- a/3rd_party/static/testapi-ui/components/profile/profile.html +++ b/3rd_party/static/testapi-ui/components/profile/profile.html @@ -23,6 +23,67 @@
Primary business email Primary postal address Primary phone numberOwnerUser ID Description SUT version SUT HW versionOVP category Company logo Approve dateApproved Test ID Location Operation{{ app.ovp_category }} {{ app.company_logo }} {{ app.approve_date }}{{ app.approved }} {{ app.test_id }} - + + + +
+
+
+

Organization Details

+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
Company Name + +
Company website + +
Primary Contact Name + +
Primary Contact Business email + +
Primary Contact Postal Address + +
Primary Contact Phone Number + +
diff --git a/3rd_party/static/testapi-ui/components/profile/profileController.js b/3rd_party/static/testapi-ui/components/profile/profileController.js index 0660e19..506771d 100644 --- a/3rd_party/static/testapi-ui/components/profile/profileController.js +++ b/3rd_party/static/testapi-ui/components/profile/profileController.js @@ -51,12 +51,38 @@ ctrl.updatePubKeys = updatePubKeys; ctrl.openImportPubKeyModal = openImportPubKeyModal; ctrl.openShowPubKeyModal = openShowPubKeyModal; + ctrl.changeProfileDetails = changeProfileDetails; // Must be authenticated to view this page. if (!$scope.auth.isAuthenticated) { $state.go('home'); } + ctrl.authRequest = $scope.auth.doSignCheck(); + ctrl.profile = $scope.auth.currentUser; + + function changeProfileDetails(profile, key, newValue){ + if (profile[key] === newValue) { + return; + } + var updateUrl = testapiApiUrl + "/profile"; + + var data = {}; + data[key] = newValue; + + $http.put(updateUrl, JSON.stringify(data), { + transformRequest: angular.identity, + headers: {'Content-Type': 'application/json'}}).then(function(ret) { + if (ret.data.code && ret.data.code != 0) { + alert(ret.data.msg); + } else { + profile[key] = newValue; + } + }, function(error) { + alert("Error when update data"); + }); + } + /** * This function will fetch all the user's public keys from the * server and store them in an array. diff --git a/3rd_party/static/testapi-ui/components/results/modal/applicationModal.html b/3rd_party/static/testapi-ui/components/results/modal/applicationModal.html new file mode 100644 index 0000000..e7c4609 --- /dev/null +++ b/3rd_party/static/testapi-ui/components/results/modal/applicationModal.html @@ -0,0 +1,191 @@ +
+
+
+

Complete this application then start your CVP journey

+
+
+ +
+
+ +
+
+ + +
+ +
+
+
+ + +
+ +
+
+
+ + +
+ +
+
+
+ + +
+ +
+
+
+ + +
+ +
+
+
+ + +
+ +
+
+
+ + +
+ +
+
+
+ + +
+ +
+
+
+ + +
+ +
+
+
+ + +
+ +
+
+
+ + +
+ +
+
+
+ + +
+ +
+
+
+ + +
+ +
+
+
+ + +
+ +
+
+
+ + +
+ +
+
+
+ + +
+ +
+
+
+ + +
+ +
+
+
+
+ + + +
+
+ + + +
+
+ + + +
+
+ + + +
+
+
+
+
+ +
+ + diff --git a/3rd_party/static/testapi-ui/components/results/modal/applicationView.html b/3rd_party/static/testapi-ui/components/results/modal/applicationView.html new file mode 100644 index 0000000..3cbbcb5 --- /dev/null +++ b/3rd_party/static/testapi-ui/components/results/modal/applicationView.html @@ -0,0 +1,107 @@ +
+
+
+

Application Details

+
+
+ +
+
+ +
+
+ +
{{ ctrl.application.organization_name }}
+
+
+ +
{{ ctrl.application.company_logo }}
+
+
+ +
{{ ctrl.application.organization_web }}
+
+
+ +
{{ ctrl.application.product_name }}
+
+
+ +
{{ ctrl.application.product_spec }}
+
+
+ +
{{ ctrl.application.product_documentation }}
+
+
+ +
{{ ctrl.application.product_categories }}
+
+
+ +
{{ ctrl.application.prim_name }}
+
+
+ +
{{ ctrl.application.prim_email }}
+
+
+ +
{{ ctrl.application.prim_address }}
+
+
+ +
{{ ctrl.application.prim_phone }}
+
+
+ +
{{ ctrl.application.description }}
+
+
+ +
{{ ctrl.application.sut_version }}
+
+
+ +
{{ ctrl.application.sut_label }}
+
+
+ +
{{ ctrl.application.sut_hw_version }}
+
+
+ +
{{ ctrl.application.ovp_category }}
+
+
+ +
{{ ctrl.application.lab_location }}
+
+
+
+ +
{{ ctrl.application.lab_name }}
+
+
+ +
{{ ctrl.application.lab_email }}
+
+
+ +
{{ ctrl.application.lab_address }}
+
+
+ +
{{ ctrl.application.lab_phone }}
+
+
+
+
+
+
+ + diff --git a/3rd_party/static/testapi-ui/components/results/modal/reviewsModal.html b/3rd_party/static/testapi-ui/components/results/modal/reviewsModal.html new file mode 100644 index 0000000..c93d1ef --- /dev/null +++ b/3rd_party/static/testapi-ui/components/results/modal/reviewsModal.html @@ -0,0 +1,41 @@ +
+
+
+

Community Reviews

+
+
+ +
+
+
+
+ + + + + + + + + + + + + + + + + + + +
ReviewerLinux Foundation OpenIdEmailReview DateOutcome
{{ review.reviewer_name }}{{ review.reviewer_openid }}{{ review.reviewer_email }}{{ review.creation_date | limitTo:19}}{{ review.outcome }}
+
+
+
+
+ + diff --git a/3rd_party/static/testapi-ui/components/results/results.html b/3rd_party/static/testapi-ui/components/results/results.html index bc15169..30bcd94 100644 --- a/3rd_party/static/testapi-ui/components/results/results.html +++ b/3rd_party/static/testapi-ui/components/results/results.html @@ -1,17 +1,18 @@

{{ctrl.pageHeader}}

{{ctrl.pageParagraph}}

-
+

Upload Results

-
@@ -36,7 +37,8 @@ Status Log SUT - SUT Version + Application + Review Status Operation Share List @@ -62,43 +64,52 @@ logs info - + View Application +
Not created
+ + View Reviews +
- Operation