diff options
Diffstat (limited to '3rd_party/static/testapi-ui')
44 files changed, 1253 insertions, 391 deletions
diff --git a/3rd_party/static/testapi-ui/app.js b/3rd_party/static/testapi-ui/app.js index edf7663..635c0ac 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,22 @@ $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 (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/ascend.css b/3rd_party/static/testapi-ui/assets/css/ascend.css index 0c1bbe6..5e0d7bb 100644 --- a/3rd_party/static/testapi-ui/assets/css/ascend.css +++ b/3rd_party/static/testapi-ui/assets/css/ascend.css @@ -1,3 +1,12 @@ +/*******************************************************************************
+ * Copyright (c) 2019 opnfv.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Apache License, Version 2.0
+ * which accompanies this distribution, and is available at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *******************************************************************************/
+
.ascend .container-wrap,
.ascend .project-title,
body .vc_text_separator div,
@@ -1166,5 +1175,5 @@ body.rtl .carousel-wrap[data-full-width="false"] .control-wrap { }
body a {
- color: #27CCC0;
+ color: #1080A7;
}
diff --git a/3rd_party/static/testapi-ui/assets/css/combine.css b/3rd_party/static/testapi-ui/assets/css/combine.css index 5b3ed96..90b9fb2 100644 --- a/3rd_party/static/testapi-ui/assets/css/combine.css +++ b/3rd_party/static/testapi-ui/assets/css/combine.css @@ -1,3 +1,12 @@ +/******************************************************************************* + * Copyright (c) 2019 opnfv. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Apache License, Version 2.0 + * which accompanies this distribution, and is available at + * http://www.apache.org/licenses/LICENSE-2.0 + *******************************************************************************/ + html { overflow-y: scroll; } @@ -1000,7 +1009,7 @@ h5 { a, a:visited { - color: #27CCC0; + color: #1080A7; } .lead { @@ -3132,7 +3141,7 @@ ul.resource-links li a:hover { /* site banner */ .top-site-banner { - background-color: #27CCC0; + background-color: #1080A7; color: #fff; padding-top: 10px; } 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..cb6d024 100644 --- a/3rd_party/static/testapi-ui/assets/css/cvp-style.css +++ b/3rd_party/static/testapi-ui/assets/css/cvp-style.css @@ -1,7 +1,25 @@ +/******************************************************************************* + * Copyright (c) 2019 opnfv. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Apache License, Version 2.0 + * which accompanies this distribution, and is available at + * http://www.apache.org/licenses/LICENSE-2.0 + *******************************************************************************/ + .nav>li>a { 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; } @@ -29,7 +47,7 @@ th { .dropdown-menu>li>a:focus, .dropdown-menu>li>a:hover { font-size: 15px; - color: #27CFC3; + color: #1080A7; text-decoration: none; background-color: #1C1C1C; } @@ -41,8 +59,8 @@ th { .pagination>.active>span:focus, .pagination>.active>span:hover { color: #fff; - background-color: #27CFC3; - border-color: #27CFC3; + background-color: #1080A7; + border-color: #1080A7; } @@ -66,12 +84,12 @@ th { .badge-info { color: #fff; - background-color: #27CFC3; - border-color: #27CFC3; + background-color: #1080A7; + border-color: #1080A7; } .opnfv-blue { - color: #27CFC3; + color: #1080A7; } .field { @@ -83,7 +101,7 @@ table .btn.medium { } .cvp-btn { - background-color: #27CFC3; + background-color: #1080A7; font-weight: 700; font-size: 12px; } @@ -96,3 +114,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/assets/css/header.css b/3rd_party/static/testapi-ui/assets/css/header.css index 9eb03c1..23c9668 100644 --- a/3rd_party/static/testapi-ui/assets/css/header.css +++ b/3rd_party/static/testapi-ui/assets/css/header.css @@ -1,3 +1,12 @@ +/******************************************************************************* + * Copyright (c) 2019 opnfv. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Apache License, Version 2.0 + * which accompanies this distribution, and is available at + * http://www.apache.org/licenses/LICENSE-2.0 + *******************************************************************************/ + .header-container-1 { height: 80px; background-color: #383A35; @@ -33,5 +42,5 @@ .header-splitline { height: 5px; - background-color: #27CFC3; + background-color: #1080A7; } diff --git a/3rd_party/static/testapi-ui/assets/css/home/home.css b/3rd_party/static/testapi-ui/assets/css/home/home.css index ed0e3f4..79c10c7 100644 --- a/3rd_party/static/testapi-ui/assets/css/home/home.css +++ b/3rd_party/static/testapi-ui/assets/css/home/home.css @@ -1,3 +1,12 @@ +/******************************************************************************* + * Copyright (c) 2019 opnfv. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Apache License, Version 2.0 + * which accompanies this distribution, and is available at + * http://www.apache.org/licenses/LICENSE-2.0 + *******************************************************************************/ + .home-container { padding-left: 0px; padding-right: 0px; diff --git a/3rd_party/static/testapi-ui/assets/css/index.css b/3rd_party/static/testapi-ui/assets/css/index.css index 3140fce..9906291 100644 --- a/3rd_party/static/testapi-ui/assets/css/index.css +++ b/3rd_party/static/testapi-ui/assets/css/index.css @@ -1,3 +1,12 @@ +/******************************************************************************* + * Copyright (c) 2019 opnfv. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Apache License, Version 2.0 + * which accompanies this distribution, and is available at + * http://www.apache.org/licenses/LICENSE-2.0 + *******************************************************************************/ + .index-header { padding-left: 0px; padding-right: 0px; diff --git a/3rd_party/static/testapi-ui/assets/img/icon.png b/3rd_party/static/testapi-ui/assets/img/icon.png Binary files differindex 9c3417b..8484cad 100644 --- a/3rd_party/static/testapi-ui/assets/img/icon.png +++ b/3rd_party/static/testapi-ui/assets/img/icon.png diff --git a/3rd_party/static/testapi-ui/components/about/about.html b/3rd_party/static/testapi-ui/components/about/about.html index b8d152d..708d35d 100644 --- a/3rd_party/static/testapi-ui/components/about/about.html +++ b/3rd_party/static/testapi-ui/components/about/about.html @@ -1,3 +1,12 @@ +<!-- + Copyright (c) 2019 opnfv. + + All rights reserved. This program and the accompanying materials + are made available under the terms of the Apache License, Version 2.0 + which accompanies this distribution, and is available at + http://www.apache.org/licenses/LICENSE-2.0 +--> + <hr> <div class="about-sidebar"> <a> diff --git a/3rd_party/static/testapi-ui/components/about/templates/README.html b/3rd_party/static/testapi-ui/components/about/templates/README.html index 4be7c8d..5f128aa 100644 --- a/3rd_party/static/testapi-ui/components/about/templates/README.html +++ b/3rd_party/static/testapi-ui/components/about/templates/README.html @@ -1,3 +1,12 @@ +<!-- + Copyright (c) 2019 opnfv. + + All rights reserved. This program and the accompanying materials + are made available under the terms of the Apache License, Version 2.0 + which accompanies this distribution, and is available at + http://www.apache.org/licenses/LICENSE-2.0 +--> + <h2>Executive Summary</h2> <p>OPNFV® is offering OPNFV compliance verification through its Compliance Verification Program (CVP). The CVP verifies products (“Offerings”) that claim compliance to OPNFV.</p> diff --git a/3rd_party/static/testapi-ui/components/application/application.html b/3rd_party/static/testapi-ui/components/application/application.html index 0b45ab3..f9f05cd 100644 --- a/3rd_party/static/testapi-ui/components/application/application.html +++ b/3rd_party/static/testapi-ui/components/application/application.html @@ -1,207 +1,13 @@ -<div class="container-fluid common-main-container"> - <div class="top-site-banner"> - <div class="container"> - <p class="p1">Complete this application then start your CVP journey</p> - </div> - </div> +<!-- + Copyright (c) 2019 opnfv. - <div class="row" style="margin-top: 20px;"> - <div class="col-lg-12 container"> - <form id="OsLogoProgramForm_Form" action="/brand/logo-request/Form" method="post" - enctype="application/x-www-form-urlencoded"> - <p id="OsLogoProgramForm_Form_error" class="message" style="display: none;"></p> - <fieldset> - <div class="field text col-md-4"> - <label class="left" >Organization name</label> - <i uib-tooltip="Organization name" class="glyphicon glyphicon-question-sign opnfv-blue"></i> - <div class="middleColumn"> - <input type="text" class="text form-control" ng-model="ctrl.organization_name" required="required" - aria-required="true"> - </div> - </div> - <div class="field text col-md-4"> - <label class="left">Organization website (if public)</label> - <i uib-tooltip="Organization website if it is public" - class="glyphicon glyphicon-question-sign opnfv-blue"></i> - <div class="middleColumn"> - <input type="text" class="text form-control" ng-model="ctrl.organization_web" required="required" - aria-required="true"> - </div> - </div> - <div class="col-md-4"></div> - <div class="field email text col-md-4"> - <label class="left">Product name and/or identifier</label> - <i uib-tooltip="Product name and/or identifier" class="glyphicon glyphicon-question-sign opnfv-blue"></i> - <div class="middleColumn"> - <input type="text" class="email text form-control" ng-model="ctrl.product_name" required="required" - aria-required="true"> - </div> - </div> - <div class="field text col-md-4"> - <label class="left">Product specifications</label> - <i uib-tooltip="A link of product specifications" - class="glyphicon glyphicon-question-sign opnfv-blue"></i> - <div class="middleColumn"> - <input type="text" class="text form-control" ng-model="ctrl.product_spec" required="required" - aria-required="true"> - </div> - </div> - <div class="field text col-md-4"> - <label class="left">Product public documentation</label> - <i uib-tooltip="A link of product public documentation" - class="glyphicon glyphicon-question-sign opnfv-blue"></i> - <div class="middleColumn"> - <input type="text" class="text form-control" ng-model="ctrl.product_documentation" required="required" - aria-required="true"> - </div> - </div> - <div class="field text col-md-4"> - <label class="left">Product categories</label> - <i uib-tooltip="Product categories" class="glyphicon glyphicon-question-sign opnfv-blue"></i> - <div class="middleColumn"> - <select class="form-control" ng-model="ctrl.product_categories"> - <option value="soft&hard">software and hardware</option> - <option value="soft&3rd">software and third party hardware</option> - </select> - </div> - </div> - <div class="field text col-md-4"> - <label class="left">Primary contact name</label> - <i uib-tooltip="Primary contact name" class="glyphicon glyphicon-question-sign opnfv-blue"></i> - <div class="middleColumn"> - <input type="text" class="text form-control" ng-model="ctrl.prim_name" required="required" - aria-required="true"> - </div> - </div> - <div class="field text col-md-4"> - <label class="left">Primary business email</label> - <i uib-tooltip="Only the Business email address should be used for official communication with OPNFV CVP" - class="glyphicon glyphicon-question-sign opnfv-blue"></i> - <div class="middleColumn"> - <input type="text" class="text form-control" ng-model="ctrl.prim_email" required="required" - aria-required="true"> - </div> - </div> - <div class="field text col-md-4"> - <label class="left">Primary postal address</label> - <i uib-tooltip="Primary postal address" class="glyphicon glyphicon-question-sign opnfv-blue"></i> - <div class="middleColumn"> - <input type="text" class="text form-control" ng-model="ctrl.prim_address" required="required" - aria-required="true"> - </div> - </div> - <div class="field text col-md-4"> - <label class="left">Primary phone number</label> - <i uib-tooltip="Primary phone number" class="glyphicon glyphicon-question-sign opnfv-blue"></i> - <div class="middleColumn"> - <input type="text" class="text form-control" ng-model="ctrl.prim_phone" required="required" - aria-required="true"> - </div> - </div> - <div class="field text col-md-4"> - <label class="left">Description</label> - <i uib-tooltip="Product Description" class="glyphicon glyphicon-question-sign opnfv-blue"></i> - <div class="middleColumn"> - <input type="text" class="text form-control" ng-model="ctrl.description"> - </div> - </div> - <div class="field text col-md-4"> - <label class="left">SUT Version</label> - <i uib-tooltip="SUT Version" class="glyphicon glyphicon-question-sign opnfv-blue"></i> - <div class="middleColumn"> - <input type="text" class="text form-control" ng-model="ctrl.sut_version"> - </div> - </div> - <div class="field text col-md-4"> - <label class="left">SUT HW Version</label> - <i uib-tooltip="SUT HW Version - leave blank if not applicable" - class="glyphicon glyphicon-question-sign opnfv-blue"></i> - <div class="middleColumn"> - <input type="text" class="text form-control" ng-model="ctrl.sut_hw_version"> - </div> - </div> - <div class="field text col-md-4"> - <label class="left">OVP Version</label> - <i uib-tooltip="OVP Version" class="glyphicon glyphicon-question-sign opnfv-blue"></i> - <div class="middleColumn"> - <input type="text" class="text form-control" ng-model="ctrl.ovp_version"> - </div> - </div> - <div class="field text col-md-4"> - <label class="left">OVP Category</label> - <i uib-tooltip="OVP Category" class="glyphicon glyphicon-question-sign opnfv-blue"></i> - <div class="middleColumn"> - <input type="text" class="text form-control" ng-model="ctrl.ovp_category"> - </div> - </div> - <div class="field text col-md-4"> - <label class="left">Company Logo</label> - <i uib-tooltip="Company Logo" class="glyphicon glyphicon-question-sign opnfv-blue"></i> - <div class="middleColumn"> - <input type="text" class="text form-control" ng-model="ctrl.company_logo"> - </div> - </div> - <div class="field text col-md-4"> - <label class="left">Approve Date</label> - <i uib-tooltip="Approve Date - YYYY-MM-DD" class="glyphicon glyphicon-question-sign opnfv-blue"></i> - <div class="middleColumn"> - <input type="text" class="text form-control" ng-model="ctrl.approve_date"> - </div> - </div> - <div class="field text col-md-4"> - <label class="left">Approved</label> - <i uib-tooltip="Approved - insert true or false" class="glyphicon glyphicon-question-sign opnfv-blue"></i> - <div class="middleColumn"> - <input type="text" class="text form-control" ng-model="ctrl.approved"> - </div> - </div> - <div class="field text col-md-4"> - <label class="left">Test ID</label> - <i uib-tooltip="Test ID - enter approved test_id" - class="glyphicon glyphicon-question-sign opnfv-blue"></i> - <div class="middleColumn"> - <input type="text" class="text form-control" ng-model="ctrl.test_id"> - </div> - </div> - <div class="field text col-md-4"> - <label class="left">Location</label> - <i uib-tooltip="Location" class="glyphicon glyphicon-question-sign opnfv-blue"></i> - <div class="middleColumn"> - <select class="form-control" ng-model="ctrl.lab_location"> - <option value="internal">internal vendor lab</option> - <option value="third">third-party lab</option> - </select> - </div> - </div> - <div ng-if="ctrl.lab_location=='third'" class="field text"> - <div class="field text col-md-4"> - <label class="left">Lab Name</label> - <i uib-tooltip="Lab Name" class="glyphicon glyphicon-question-sign opnfv-blue"></i> - <input type="text" class="text form-control" ng-model="ctrl.lab_name"> - </div> - <div class="field text col-md-4"> - <label class="left">Lab Email</label> - <i uib-tooltip="Lab Email" class="glyphicon glyphicon-question-sign opnfv-blue"></i> - <input type="text" class="text form-control" ng-model="ctrl.lab_email"> - </div> - <div class="field text col-md-4"> - <label class="left">Lab Address</label> - <i uib-tooltip="Lab Address" class="glyphicon glyphicon-question-sign opnfv-blue"></i> - <input type="text" class="text form-control" ng-model="ctrl.lab_address"> - </div> - <div class="field text col-md-4"> - <label class="left">Lab Phone Number</label> - <i uib-tooltip="Lab Phone Number" class="glyphicon glyphicon-question-sign opnfv-blue"></i> - <input type="text" class="text form-control" ng-model="ctrl.lab_phone"> - </div> - </div> - </fieldset> - </form> - </div> - </div> - <div class="Actions"> - <button class="btn btn-success cvp-btn" ng-click="ctrl.openConfirmModal()">Submit</button> - </div> + All rights reserved. This program and the accompanying materials + are made available under the terms of the Apache License, Version 2.0 + which accompanies this distribution, and is available at + http://www.apache.org/licenses/LICENSE-2.0 +--> + +<div class="container-fluid common-main-container"> <div class="results-table" style="margin-top: 30px; overflow: scroll;"> <table class="table table-striped table-hover"> <thead> @@ -217,7 +23,7 @@ <th>Primary business email</th> <th>Primary postal address</th> <th>Primary phone number</th> - <th>Owner</th> + <th>User ID</th> <th>Description</th> <th>SUT version</th> <th>SUT HW version</th> @@ -225,7 +31,6 @@ <th>OVP category</th> <th>Company logo</th> <th>Approve date</th> - <th>Approved</th> <th>Test ID</th> <th>Location</th> <th>Operation</th> @@ -264,7 +69,8 @@ </div> </script> <tbody style="white-space: nowrap; overflow: hidden; text-overflow: ellipsis;"> - <tr ng-repeat="app in ctrl.applications"> + <tr ng-if="auth.currentUser.role.indexOf('administrator') != -1" + ng-repeat="app in ctrl.applications"> <td>{{ app.creation_date | limitTo: 10 }}</td> <td>{{ app.organization_name }}</td> <td><a href="{{app.organization_web}}">{{ app.organization_web }}</a></td> @@ -284,7 +90,6 @@ <td>{{ app.ovp_category }}</td> <td>{{ app.company_logo }}</td> <td>{{ app.approve_date }}</td> - <td>{{ app.approved }}</td> <td>{{ app.test_id }}</td> <td> <span popover-enable="app.lab_location != 'internal'" uib-popover-template="ctrl.lab_tpl" @@ -293,7 +98,13 @@ <i ng-if="app.lab_location != 'internal'" class="glyphicon glyphicon-info-sign opnfv-blue"></i> </td> <td> - <a ng-click="ctrl.deleteApp(app._id)" class="badge badge-info"> + <a ng-click="ctrl.toggleApproveApp(app._id, 'true', app.owner)" class="badge badge-info" + ng-if="app.approved == 'false'" + data-toggle="tooltip" title="Approve Application"> + <i class="glyphicon glyphicon-ok" ></i> + </a> + <a ng-click="ctrl.deleteApp(app._id)" class="badge badge-info" + data-toggle="tooltip" title="Delete Application"> <i class="glyphicon glyphicon-remove" ></i> </a> </td> @@ -315,20 +126,4 @@ </uib-pagination> </div> </div> - - <div> - <br> - <h3>Company Logo Upload for Directory</h3> - <form enctype="multipart/form-data" method="post"> - <div class="form-group col-m-3"> - <input class="form-contrl btn btn-success cvp-btn medium accent-color regular-button" file-model="logoFile" - type="file"> - </div> - <div class="form-group col-m-3"> - <a class="btn btn-success cvp-btn medium accent-color regular-button" ng-click="ctrl.uploadLogo()"> - <span>Upload Logo</span> - </a> - </div> - </form> - </div> </div> diff --git a/3rd_party/static/testapi-ui/components/application/applicationController.js b/3rd_party/static/testapi-ui/components/application/applicationController.js index e2a4f75..366863c 100644 --- a/3rd_party/static/testapi-ui/components/application/applicationController.js +++ b/3rd_party/static/testapi-ui/components/application/applicationController.js @@ -20,43 +20,28 @@ .controller('ApplicationController', ApplicationController); ApplicationController.$inject = [ - '$http', '$stateParams', '$window', '$sce', + '$http', '$state', '$stateParams', '$window', '$sce', '$uibModal', 'testapiApiUrl', 'raiseAlert', 'ngDialog', '$scope' ]; - function ApplicationController ($http, $stateParams, $window, $sce, + function ApplicationController ($http, $state, $stateParams, $window, $sce, $uibModal, testapiApiUrl, raiseAlert, ngDialog, $scope) { var ctrl = this; - ctrl.uploadLogo = uploadLogo; + + /** Check to see if this page should display community results. */ + ctrl.isAdministrator = $scope.auth.currentUser.role.indexOf('administrator') != -1; + // Should only be on user-results-page if authenticated. + if (!$scope.auth.isAuthenticated) { + $state.go('home'); + } + // Should only be on applications if administrator + if (!ctrl.isAdministrator) { + $state.go('home'); + } 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.totalItems = null; ctrl.currentPage = 1; @@ -64,59 +49,10 @@ ctrl.numPages = null; ctrl.lab_tpl = "lab.tpl.html"; ctrl.product_tpl = "product.tpl.html"; - //ctrl.lab_html=$sce.trustAsHtml('<div>{{app.lab_email}}</div><div>{{app.lab_address}}</div><div>{{app.lab_phone}}</div>'); getApplication(); } - - 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,26 +72,38 @@ }); } - function uploadLogo() { - var file = $scope.logoFile; - var fd = new FormData(); - fd.append('file', file); + ctrl.toggleApproveApp = function(id, approved, owner) { + 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; + + var updateUrl = testapiApiUrl + "/cvp/applications/" + id; + var data = {}; + data['item'] = 'approved'; + data['approved'] = approved; + data['owner'] = owner; - $http.post(testapiApiUrl + "/cvp/applications/uploadlogo", fd, { + $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 getApplication() { - $http.get(testapiApiUrl + "/cvp/applications?page=" + ctrl.currentPage + "&signed&per_page=" + ctrl.itemsPerPage).then(function(response) { + $http.get(testapiApiUrl + "/cvp/applications?page=" + ctrl.currentPage + "&signed&per_page=" + ctrl.itemsPerPage + "&applications").then(function(response) { ctrl.applications = response.data.applications; ctrl.totalItems = response.data.pagination.total_pages * ctrl.itemsPerPage; ctrl.currentPage = response.data.pagination.current_page; diff --git a/3rd_party/static/testapi-ui/components/application/modal/confirmModal.html b/3rd_party/static/testapi-ui/components/application/modal/confirmModal.html index fddb7fb..b8f8fb3 100644 --- a/3rd_party/static/testapi-ui/components/application/modal/confirmModal.html +++ b/3rd_party/static/testapi-ui/components/application/modal/confirmModal.html @@ -1,3 +1,12 @@ +<!-- + Copyright (c) 2019 opnfv. + + All rights reserved. This program and the accompanying materials + are made available under the terms of the Apache License, Version 2.0 + which accompanies this distribution, and is available at + http://www.apache.org/licenses/LICENSE-2.0 +--> + <div> <div class="row" style="margin-top:20px"> <div class="col-sm-offset-1 col-sm-11"> diff --git a/3rd_party/static/testapi-ui/components/auth/authPortal.html b/3rd_party/static/testapi-ui/components/auth/authPortal.html index f3aab41..1a8a26a 100644 --- a/3rd_party/static/testapi-ui/components/auth/authPortal.html +++ b/3rd_party/static/testapi-ui/components/auth/authPortal.html @@ -1,3 +1,12 @@ +<!-- + Copyright (c) 2019 opnfv. + + All rights reserved. This program and the accompanying materials + are made available under the terms of the Apache License, Version 2.0 + which accompanies this distribution, and is available at + http://www.apache.org/licenses/LICENSE-2.0 +--> + <h3>Sign In</h3> <strong>Please choose your account provider:</strong> <div class="row"> diff --git a/3rd_party/static/testapi-ui/components/directory/directory.html b/3rd_party/static/testapi-ui/components/directory/directory.html index b48e90d..e274af8 100644 --- a/3rd_party/static/testapi-ui/components/directory/directory.html +++ b/3rd_party/static/testapi-ui/components/directory/directory.html @@ -1,3 +1,12 @@ +<!-- + Copyright (c) 2019 opnfv. + + All rights reserved. This program and the accompanying materials + are made available under the terms of the Apache License, Version 2.0 + which accompanies this distribution, and is available at + http://www.apache.org/licenses/LICENSE-2.0 +--> + <div class="container-fluid common-main-container"> <h3>OPNFV Verified Product Directory</h3> <div> diff --git a/3rd_party/static/testapi-ui/components/guidelines/data/gen.py b/3rd_party/static/testapi-ui/components/guidelines/data/gen.py index 34fb694..3ecceb9 100644 --- a/3rd_party/static/testapi-ui/components/guidelines/data/gen.py +++ b/3rd_party/static/testapi-ui/components/guidelines/data/gen.py @@ -1,3 +1,12 @@ +############################################################################## +# Copyright (c) 2019 opnfv. +# +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 +############################################################################## + import json with open('danube.json') as f: diff --git a/3rd_party/static/testapi-ui/components/guidelines/guidelines.html b/3rd_party/static/testapi-ui/components/guidelines/guidelines.html index 1cd2b51..b23811c 100644 --- a/3rd_party/static/testapi-ui/components/guidelines/guidelines.html +++ b/3rd_party/static/testapi-ui/components/guidelines/guidelines.html @@ -1,3 +1,12 @@ +<!-- + Copyright (c) 2019 opnfv. + + All rights reserved. This program and the accompanying materials + are made available under the terms of the Apache License, Version 2.0 + which accompanies this distribution, and is available at + http://www.apache.org/licenses/LICENSE-2.0 +--> + <h3>OPNFV Ready™ Guidelines</h3> <!-- Guideline Filters --> diff --git a/3rd_party/static/testapi-ui/components/guidelines/partials/guidelineDetails.html b/3rd_party/static/testapi-ui/components/guidelines/partials/guidelineDetails.html index 385fafe..21d1742 100644 --- a/3rd_party/static/testapi-ui/components/guidelines/partials/guidelineDetails.html +++ b/3rd_party/static/testapi-ui/components/guidelines/partials/guidelineDetails.html @@ -1,4 +1,13 @@ <!-- + Copyright (c) 2019 opnfv. + + All rights reserved. This program and the accompanying materials + are made available under the terms of the Apache License, Version 2.0 + which accompanies this distribution, and is available at + http://www.apache.org/licenses/LICENSE-2.0 +--> + +<!-- HTML for guidelines page for all OpenStack Powered (TM) guideline schemas This expects the JSON data of the guidelines file to be stored in scope variable 'guidelines'. diff --git a/3rd_party/static/testapi-ui/components/guidelines/partials/testListModal.html b/3rd_party/static/testapi-ui/components/guidelines/partials/testListModal.html index c8dae33..03c21a0 100644 --- a/3rd_party/static/testapi-ui/components/guidelines/partials/testListModal.html +++ b/3rd_party/static/testapi-ui/components/guidelines/partials/testListModal.html @@ -1,3 +1,12 @@ +<!-- + Copyright (c) 2019 opnfv. + + All rights reserved. This program and the accompanying materials + are made available under the terms of the Apache License, Version 2.0 + which accompanies this distribution, and is available at + http://www.apache.org/licenses/LICENSE-2.0 +--> + <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" aria-hidden="true" ng-click="modal.close()">×</button> diff --git a/3rd_party/static/testapi-ui/components/home/home.html b/3rd_party/static/testapi-ui/components/home/home.html index c482b9c..11eb1a6 100644 --- a/3rd_party/static/testapi-ui/components/home/home.html +++ b/3rd_party/static/testapi-ui/components/home/home.html @@ -1,3 +1,12 @@ +<!-- + Copyright (c) 2019 opnfv. + + All rights reserved. This program and the accompanying materials + are made available under the terms of the Apache License, Version 2.0 + which accompanies this distribution, and is available at + http://www.apache.org/licenses/LICENSE-2.0 +--> + <div class="container-fluid"> <div class="row"> <div class="col-md-2 home-category" ng-style="{'height': ctrl.height}"> @@ -140,18 +149,20 @@ <a target="_blank" rel="noopener" href="https://www.lfnetworking.org/OVP">OPNFV Verification Program (OVP) page</a> for more information</p></li> <li><p class="home-content-text"> - From the home page, Submit the Participation Form</p></li> + From the home page, submit the + <a target="_blank" rel="noopener" href="https://na3.docusign.net/Member/PowerFormSigning.aspx?PowerFormId=034ffa32-3c2d-4a78-b2ed-af63c3acf192&env=na3-eu1&v=2"> + Participation Form</a></p></li> <li><p class="home-content-text"> Follow the step-by-step instructions in the doc: - <a href="https://opnfv-dovetail.readthedocs.io/en/latest/testing/user/certificationworkflow/index.html">OVP + <a target="_blank" rel="noopener" href="https://opnfv-dovetail.readthedocs.io/en/latest/testing/user/certificationworkflow/index.html">OVP Workflow</a></p></li> <li><p class="home-content-text"> Use this portal to upload your NFVI test results when ready</p></li> </ul> <p class="home-content-text" style="padding-bottom: 40px;"> - Please send any questions to <a href="mailto:verified@opnfv.org">verified@opnfv.org</a>. + Please send any questions to <a href="mailto:ovp-support@lfnetworking.org">ovp-support@lfnetworking.org</a>. </p> </div> </div> diff --git a/3rd_party/static/testapi-ui/components/logout/logout.html b/3rd_party/static/testapi-ui/components/logout/logout.html index 38a5c36..135784e 100644 --- a/3rd_party/static/testapi-ui/components/logout/logout.html +++ b/3rd_party/static/testapi-ui/components/logout/logout.html @@ -1 +1,10 @@ +<!-- + Copyright (c) 2019 opnfv. + + All rights reserved. This program and the accompanying materials + are made available under the terms of the Apache License, Version 2.0 + which accompanies this distribution, and is available at + http://www.apache.org/licenses/LICENSE-2.0 +--> + <div cg-busy="{promise:ctrl.redirectWait,message:'Logging you out...'}"></div> diff --git a/3rd_party/static/testapi-ui/components/profile/importPubKeyModal.html b/3rd_party/static/testapi-ui/components/profile/importPubKeyModal.html index 3a5be54..35c1e8d 100644 --- a/3rd_party/static/testapi-ui/components/profile/importPubKeyModal.html +++ b/3rd_party/static/testapi-ui/components/profile/importPubKeyModal.html @@ -1,3 +1,12 @@ +<!-- + Copyright (c) 2019 opnfv. + + All rights reserved. This program and the accompanying materials + are made available under the terms of the Apache License, Version 2.0 + which accompanies this distribution, and is available at + http://www.apache.org/licenses/LICENSE-2.0 +--> + <div class="modal-header"> <h4>Import Public Key</h4> <p>Instructions for adding a public key and signature can be found diff --git a/3rd_party/static/testapi-ui/components/profile/profile.html b/3rd_party/static/testapi-ui/components/profile/profile.html index 563adbf..bece01f 100644 --- a/3rd_party/static/testapi-ui/components/profile/profile.html +++ b/3rd_party/static/testapi-ui/components/profile/profile.html @@ -1,3 +1,12 @@ +<!-- + Copyright (c) 2019 opnfv. + + All rights reserved. This program and the accompanying materials + are made available under the terms of the Apache License, Version 2.0 + which accompanies this distribution, and is available at + http://www.apache.org/licenses/LICENSE-2.0 +--> + <div class="container-fluid common-main-container"> <h3>User profile</h3> <div cg-busy="{promise:ctrl.authRequest,message:'Loading'}"></div> @@ -23,6 +32,67 @@ </tbody> </table> </div> + <br> + <br> + <h3>Organization Details</h3> + <table class="table table-striped table-hover"> + <tbody> + <tr> + <td>Company Name</td> + <td> + <div class="popover-wrapper"> + <a editable-theme="bs3" onbeforesave="ctrl.changeProfileDetails(ctrl.profile, 'companyName', $data)" + editable-text="ctrl.profile.companyName">{{ ctrl.profile.companyName || "None" }}</a> + </div> + </td> + </tr> + <tr> + <td>Company website</td> + <td> + <div class="popover-wrapper"> + <a editable-theme="bs3" onbeforesave="ctrl.changeProfileDetails(ctrl.profile, 'companyWebsite', $data)" + editable-url="ctrl.profile.companyWebsite">{{ ctrl.profile.companyWebsite || "None" }}</a> + </div> + </td> + </tr> + <tr> + <td>Primary Contact Name</td> + <td> + <div class="popover-wrapper"> + <a editable-theme="bs3" onbeforesave="ctrl.changeProfileDetails(ctrl.profile, 'primaryContactName', $data)" + editable-text="ctrl.profile.primaryContactName">{{ ctrl.profile.primaryContactName || "None" }}</a> + </div> + </td> + </tr> + <tr> + <td>Primary Contact Business email</td> + <td> + <div class="popover-wrapper"> + <a editable-theme="bs3" onbeforesave="ctrl.changeProfileDetails(ctrl.profile, 'primaryBusinessEmail', $data)" + editable-email="ctrl.profile.primaryBusinessEmail">{{ ctrl.profile.primaryBusinessEmail || "None" }}</a> + </div> + </td> + </tr> + <tr> + <td>Primary Contact Postal Address</td> + <td> + <div class="popover-wrapper"> + <a editable-theme="bs3" onbeforesave="ctrl.changeProfileDetails(ctrl.profile, 'primaryPostalAddress', $data)" + editable-text="ctrl.profile.primaryPostalAddress">{{ ctrl.profile.primaryPostalAddress || "None" }}</a> + </div> + </td> + </tr> + <tr> + <td>Primary Contact Phone Number</td> + <td> + <div class="popover-wrapper"> + <a editable-theme="bs3" onbeforesave="ctrl.changeProfileDetails(ctrl.profile, 'primaryPhoneNumber', $data)" + editable-tel="ctrl.profile.primaryPhoneNumber">{{ ctrl.profile.primaryPhoneNumber || "None" }}</a> + </div> + </td> + </tr> + </tbody> + </table> <div ng-show="ctrl.pubkeys"> <div class="container-fluid"> <div class="row"> 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/profile/showPubKeyModal.html b/3rd_party/static/testapi-ui/components/profile/showPubKeyModal.html index d397091..ed2e31d 100644 --- a/3rd_party/static/testapi-ui/components/profile/showPubKeyModal.html +++ b/3rd_party/static/testapi-ui/components/profile/showPubKeyModal.html @@ -1,3 +1,12 @@ +<!-- + Copyright (c) 2019 opnfv. + + All rights reserved. This program and the accompanying materials + are made available under the terms of the Apache License, Version 2.0 + which accompanies this distribution, and is available at + http://www.apache.org/licenses/LICENSE-2.0 +--> + <div class="modal-header"> <h4>Public Key</h4> </div> diff --git a/3rd_party/static/testapi-ui/components/results-report/partials/editTestModal.html b/3rd_party/static/testapi-ui/components/results-report/partials/editTestModal.html index d9758fe..2212dac 100644 --- a/3rd_party/static/testapi-ui/components/results-report/partials/editTestModal.html +++ b/3rd_party/static/testapi-ui/components/results-report/partials/editTestModal.html @@ -1,3 +1,12 @@ +<!-- + Copyright (c) 2019 opnfv. + + All rights reserved. This program and the accompanying materials + are made available under the terms of the Apache License, Version 2.0 + which accompanies this distribution, and is available at + http://www.apache.org/licenses/LICENSE-2.0 +--> + <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" aria-hidden="true" ng-click="modal.close()">×</button> diff --git a/3rd_party/static/testapi-ui/components/results-report/partials/fullTestListModal.html b/3rd_party/static/testapi-ui/components/results-report/partials/fullTestListModal.html index e2d2909..61483ab 100644 --- a/3rd_party/static/testapi-ui/components/results-report/partials/fullTestListModal.html +++ b/3rd_party/static/testapi-ui/components/results-report/partials/fullTestListModal.html @@ -1,3 +1,12 @@ +<!-- + Copyright (c) 2019 opnfv. + + All rights reserved. This program and the accompanying materials + are made available under the terms of the Apache License, Version 2.0 + which accompanies this distribution, and is available at + http://www.apache.org/licenses/LICENSE-2.0 +--> + <div class="modal-content"> <div class="modal-header"> <h4>All Passed Tests ({{modal.tests.length}})</h4> diff --git a/3rd_party/static/testapi-ui/components/results-report/partials/reportDetails.html b/3rd_party/static/testapi-ui/components/results-report/partials/reportDetails.html index dee4624..2edc77d 100644 --- a/3rd_party/static/testapi-ui/components/results-report/partials/reportDetails.html +++ b/3rd_party/static/testapi-ui/components/results-report/partials/reportDetails.html @@ -1,4 +1,13 @@ <!-- + Copyright (c) 2019 opnfv. + + All rights reserved. This program and the accompanying materials + are made available under the terms of the Apache License, Version 2.0 + which accompanies this distribution, and is available at + http://www.apache.org/licenses/LICENSE-2.0 +--> + +<!-- HTML for each accordion group that separates the status types on the results report page. --> diff --git a/3rd_party/static/testapi-ui/components/results-report/resultsReport.html b/3rd_party/static/testapi-ui/components/results-report/resultsReport.html index 0d85875..453e191 100644 --- a/3rd_party/static/testapi-ui/components/results-report/resultsReport.html +++ b/3rd_party/static/testapi-ui/components/results-report/resultsReport.html @@ -1,3 +1,12 @@ +<!-- + Copyright (c) 2019 opnfv. + + All rights reserved. This program and the accompanying materials + are made available under the terms of the Apache License, Version 2.0 + which accompanies this distribution, and is available at + http://www.apache.org/licenses/LICENSE-2.0 +--> + <div class="container-fluid common-main-container"> <h3>Test Run Results</h3> diff --git a/3rd_party/static/testapi-ui/components/results-report/resultsReportController.js b/3rd_party/static/testapi-ui/components/results-report/resultsReportController.js index 0c99962..3a20227 100644 --- a/3rd_party/static/testapi-ui/components/results-report/resultsReportController.js +++ b/3rd_party/static/testapi-ui/components/results-report/resultsReportController.js @@ -90,8 +90,27 @@ } function gotoResultLog(case_name) { - var case_area = case_name.split(".")[1]; + function openFile(log_url) { + var is_reachable = false; + + $.ajax({ + url: log_url, + async: false, + success: function (response) { + is_reachable = true; + }, + error: function (response){ + alert("Log file could not be found. Please confirm this case has been executed successfully."); + } + }); + + if(is_reachable == true){ + window.open(log_url); + } + } + var log_url = "/logs/"+ctrl.testId+"/results/"; + var case_area = case_name.split(".")[1]; if (ctrl.version == '2018.01') { if (case_area == "vping") { log_url += "functest.log"; @@ -100,29 +119,39 @@ } else { log_url += case_area+"_logs/"+case_name+".log"; } - } else { + openFile(log_url); + } else if (ctrl.version == '2018.09') { log_url += case_area + "_logs/"; if (case_area == "tempest" || case_area == "security") { log_url += case_name + ".html"; } else { log_url += case_name + ".log"; } - } - var is_reachable = false; - - $.ajax({ - url: log_url, - async: false, - success: function (response) { - is_reachable = true; - }, - error: function (response){ - alert("Log file could not be found. Please confirm this case has been executed successfully."); - } - }); - - if(is_reachable == true){ - window.open(log_url); + openFile(log_url); + } else { + var test_url = testapiApiUrl + '/tests/' + ctrl.innerId; + $http.get(test_url).then(function(test_resp){ + var result_url = testapiApiUrl + '/results/' + test_resp.data.results[0]; + $http.get(result_url).then(function(result_resp){ + var keepGoing = true; + angular.forEach(result_resp.data.testcases_list, function(testcase, index) { + if (keepGoing == true) { + if (testcase.name == case_name) { + log_url += testcase.portal_key_file; + openFile(log_url); + keepGoing = false; + } + } + }); + if (keepGoing == true) { + alert("Log file could not be found. Please confirm this case has been executed successfully."); + } + }, function(result_error) { + alert('Error when get result record'); + }); + }, function(test_error) { + alert('Error when get test record'); + }); } } @@ -148,7 +177,7 @@ ctrl.data.mandatory[name].skip += 1; ctrl.statistics.mandatory.skip += 1; ctrl.statistics.skip += 1; - }else if(ctrl.case_list_fail.indexOf(sub_case) > -1){ + }else { ctrl.data.mandatory[name].fail += 1; ctrl.statistics.mandatory.fail += 1; ctrl.statistics.fail += 1; @@ -173,7 +202,7 @@ ctrl.data.optional[name].skip += 1; ctrl.statistics.optional.skip += 1; ctrl.statistics.skip += 1; - }else if(ctrl.case_list_fail.indexOf(sub_case) > -1){ + }else { ctrl.data.optional[name].fail += 1; ctrl.statistics.optional.fail += 1; ctrl.statistics.fail += 1; @@ -262,7 +291,7 @@ case_list.push(result.case_name); } else if(ele.benchmark.data.sla_skip == 1){ case_list_skip.push(result.case_name); - } else if(ele.benchmark.data.sla_fail == 1){ + } else { case_list_fail.push(result.case_name); } } @@ -291,7 +320,7 @@ case_list.push(result.case_name); } else if(result.criteria == 'SKIP'){ case_list_skip.push(result.case_name); - } else if(result.criteria == 'FAIL') { + } else { case_list_fail.push(result.case_name); } } @@ -308,7 +337,7 @@ else if(result.sub_testcase.length == 0 && result.result == "SKIP") { case_list_skip.push(result.name); } - else if(result.sub_testcase.length == 0 && result.result == "FAIL") { + else if(result.sub_testcase.length == 0) { case_list_fail.push(result.name); } else { @@ -317,7 +346,7 @@ case_list.push(subtest.name); } else if(subtest.result == "SKIP") { case_list_skip.push(subtest.name); - } else if(subtest.result == "FAIL") { + } else { case_list_fail.push(subtest.name); } }); 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 @@ +<div class="container-fluid common-main-container"> + <div class="top-site-banner"> + <div class="container"> + <p class="p1">Complete this application then start your CVP journey</p> + </div> + </div> + + <div class="row" style="margin-top: 20px;"> + <div class="col-lg-12 container"> + <p class="message" style="display: none;"></p> + <fieldset> + <div class="field text col-md-4"> + <label class="left" >Organization name</label> + <i uib-tooltip="Organization name" class="glyphicon glyphicon-question-sign opnfv-blue"></i> + <div class="middleColumn"> + <input type="text" class="text form-control" ng-model="ctrl.organization_name" + ng-init="ctrl.organization_name=auth.currentUser.companyName" required + aria-required="true"> + </div> + </div> + <div class="field text col-md-4"> + <label class="left">Company Logo</label> + <i uib-tooltip="Required dimensions (Max Values): {width: 165pixels, height: 40pixels}" class="glyphicon glyphicon-question-sign opnfv-blue"></i> + <div class="middleColumn"> + <input class="form-control btn btn-success-cust cvp-btn medium accent-color regular-button" + modal-file-model="logoFile" type="file" style="padding: 0;" required> + </div> + </div> + <div class="field text col-md-4"> + <label class="left">Organization website</label> + <i uib-tooltip="Organization website if it is public" + class="glyphicon glyphicon-question-sign opnfv-blue"></i> + <div class="middleColumn"> + <input type="url" class="text form-control" ng-model="ctrl.organization_web" + ng-init="ctrl.organization_web=auth.currentUser.companyWebsite" required + aria-required="true"> + </div> + </div> + <div class="field text col-md-4"> + <label class="left">Product name and/or identifier</label> + <i uib-tooltip="Product name and/or identifier" class="glyphicon glyphicon-question-sign opnfv-blue"></i> + <div class="middleColumn"> + <input type="text" class="email text form-control" ng-model="ctrl.product_name" required + aria-required="true"> + </div> + </div> + <div class="field text col-md-4"> + <label class="left">Product specifications</label> + <i uib-tooltip="A link of product specifications" + class="glyphicon glyphicon-question-sign opnfv-blue"></i> + <div class="middleColumn"> + <input type="text" class="text form-control" ng-model="ctrl.product_spec" required + aria-required="true"> + </div> + </div> + <div class="field text col-md-4"> + <label class="left">Product public documentation</label> + <i uib-tooltip="A link of product public documentation" + class="glyphicon glyphicon-question-sign opnfv-blue"></i> + <div class="middleColumn"> + <input type="text" class="text form-control" ng-model="ctrl.product_documentation" required + aria-required="true"> + </div> + </div> + <div class="field text col-md-4"> + <label class="left">Product categories</label> + <i uib-tooltip="Product categories" class="glyphicon glyphicon-question-sign opnfv-blue"></i> + <div class="middleColumn"> + <select class="form-control" ng-model="ctrl.product_categories" ng-init="ctrl.product_categories='soft&hard'"> + <option value="soft&hard">software and hardware</option> + <option value="soft&3rd">software and third party hardware</option> + </select> + </div> + </div> + <div class="field text col-md-4"> + <label class="left">Primary contact name</label> + <i uib-tooltip="Primary contact name" class="glyphicon glyphicon-question-sign opnfv-blue"></i> + <div class="middleColumn"> + <input type="text" class="text form-control" ng-model="ctrl.prim_name" + ng-init="ctrl.prim_name=auth.currentUser.primaryContactName" required + aria-required="true"> + </div> + </div> + <div class="field text col-md-4"> + <label class="left">Primary business email</label> + <i uib-tooltip="Only the Business email address should be used for official communication with OPNFV CVP" + class="glyphicon glyphicon-question-sign opnfv-blue"></i> + <div class="middleColumn"> + <input type="email" class="text form-control" ng-model="ctrl.prim_email" + ng-init="ctrl.prim_email=auth.currentUser.primaryBusinessEmail" required + aria-required="true"> + </div> + </div> + <div class="field text col-md-4"> + <label class="left">Primary postal address</label> + <i uib-tooltip="Primary postal address" class="glyphicon glyphicon-question-sign opnfv-blue"></i> + <div class="middleColumn"> + <input type="text" class="text form-control" ng-model="ctrl.prim_address" + ng-init="ctrl.prim_address=auth.currentUser.primaryPostalAddress" required + aria-required="true"> + </div> + </div> + <div class="field text col-md-4"> + <label class="left">Primary phone number</label> + <i uib-tooltip="Primary phone number" class="glyphicon glyphicon-question-sign opnfv-blue"></i> + <div class="middleColumn"> + <input type="text" class="text form-control" ng-model="ctrl.prim_phone" + ng-init="ctrl.prim_phone=auth.currentUser.primaryPhoneNumber" required + aria-required="true"> + </div> + </div> + <div class="field text col-md-4"> + <label class="left">Description</label> + <i uib-tooltip="Product Description" class="glyphicon glyphicon-question-sign opnfv-blue"></i> + <div class="middleColumn"> + <input type="text" class="text form-control" ng-model="ctrl.description" required> + </div> + </div> + <div class="field text col-md-4"> + <label class="left">SUT Version</label> + <i uib-tooltip="SUT Version" class="glyphicon glyphicon-question-sign opnfv-blue"></i> + <div class="middleColumn"> + <input type="text" class="text form-control" ng-model="ctrl.sut_version" required> + </div> + </div> + <div class="field text col-md-4"> + <label class="left">SUT Label</label> + <i uib-tooltip="SUT Label" class="glyphicon glyphicon-question-sign opnfv-blue"></i> + <div class="middleColumn"> + <input type="text" class="text form-control" ng-model="ctrl.sut_label" required> + </div> + </div> + <div class="field text col-md-4"> + <label class="left">SUT HW Version</label> + <i uib-tooltip="SUT HW Version - leave blank if not applicable" + class="glyphicon glyphicon-question-sign opnfv-blue"></i> + <div class="middleColumn"> + <input type="text" class="text form-control" ng-model="ctrl.sut_hw_version" required> + </div> + </div> + <div class="field text col-md-4"> + <label class="left">OVP Category</label> + <i uib-tooltip="OVP Category" class="glyphicon glyphicon-question-sign opnfv-blue"></i> + <div class="middleColumn"> + <input type="text" class="text form-control" ng-model="ctrl.ovp_category" required> + </div> + </div> + <div class="field text col-md-4"> + <label class="left">Location</label> + <i uib-tooltip="Location" class="glyphicon glyphicon-question-sign opnfv-blue"></i> + <div class="middleColumn"> + <select class="form-control" ng-model="ctrl.lab_location" ng-init="ctrl.lab_location='internal'"> + <option value="internal">internal vendor lab</option> + <option value="third">third-party lab</option> + </select> + </div> + </div> + <div ng-if="ctrl.lab_location=='third'" class="field text"> + <div class="field text col-md-4"> + <label class="left">Lab Name</label> + <i uib-tooltip="Lab Name" class="glyphicon glyphicon-question-sign opnfv-blue"></i> + <input type="text" class="text form-control" ng-model="ctrl.lab_name" required> + </div> + <div class="field text col-md-4"> + <label class="left">Lab Email</label> + <i uib-tooltip="Lab Email" class="glyphicon glyphicon-question-sign opnfv-blue"></i> + <input type="text" class="text form-control" ng-model="ctrl.lab_email" required> + </div> + <div class="field text col-md-4"> + <label class="left">Lab Address</label> + <i uib-tooltip="Lab Address" class="glyphicon glyphicon-question-sign opnfv-blue"></i> + <input type="text" class="text form-control" ng-model="ctrl.lab_address" required> + </div> + <div class="field text col-md-4"> + <label class="left">Lab Phone Number</label> + <i uib-tooltip="Lab Phone Number" class="glyphicon glyphicon-question-sign opnfv-blue"></i> + <input type="text" class="text form-control" ng-model="ctrl.lab_phone" required> + </div> + </div> + </fieldset> + </div> + </div> + <button class="btn btn-default" + ng-click="ctrl.openConfirmModal(ctrl.tempResult)">Submit</button> +</div> + +<style type="text/css"> + .ngdialog.custom-background .ngdialog-content { + background: #ffffff; + } +</style> 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 @@ +<div class="container-fluid common-main-container"> + <div class="top-site-banner"> + <div class="container"> + <p class="p1">Application Details</p> + </div> + </div> + + <div class="row" style="margin-top: 20px;"> + <div class="col-lg-12 container"> + <p class="message" style="display: none;"></p> + <fieldset> + <div class="field text col-md-4"> + <label class="left">Organization name</label> + <div class="middleColumn">{{ ctrl.application.organization_name }}</div> + </div> + <div class="field text col-md-4"> + <label class="left">Company Logo</label> + <div class="middleColumn">{{ ctrl.application.company_logo }}</div> + </div> + <div class="field text col-md-4"> + <label class="left">Organization website</label> + <div class="middleColumn">{{ ctrl.application.organization_web }}</div> + </div> + <div class="field text col-md-4"> + <label class="left">Product name and/or identifier</label> + <div class="middleColumn">{{ ctrl.application.product_name }}</div> + </div> + <div class="field text col-md-4"> + <label class="left">Product specifications</label> + <div class="middleColumn">{{ ctrl.application.product_spec }}</div> + </div> + <div class="field text col-md-4"> + <label class="left">Product public documentation</label> + <div class="middleColumn">{{ ctrl.application.product_documentation }}</div> + </div> + <div class="field text col-md-4"> + <label class="left">Product categories</label> + <div class="middleColumn">{{ ctrl.application.product_categories }}</div> + </div> + <div class="field text col-md-4"> + <label class="left">Primary contact name</label> + <div class="middleColumn">{{ ctrl.application.prim_name }}</div> + </div> + <div class="field text col-md-4"> + <label class="left">Primary business email</label> + <div class="middleColumn">{{ ctrl.application.prim_email }}</div> + </div> + <div class="field text col-md-4"> + <label class="left">Primary postal address</label> + <div class="middleColumn">{{ ctrl.application.prim_address }}</div> + </div> + <div class="field text col-md-4"> + <label class="left">Primary phone number</label> + <div class="middleColumn">{{ ctrl.application.prim_phone }}</div> + </div> + <div class="field text col-md-4"> + <label class="left">Description</label> + <div class="middleColumn">{{ ctrl.application.description }}</div> + </div> + <div class="field text col-md-4"> + <label class="left">SUT Version</label> + <div class="middleColumn">{{ ctrl.application.sut_version }}</div> + </div> + <div class="field text col-md-4"> + <label class="left">SUT Label</label> + <div class="middleColumn">{{ ctrl.application.sut_label }}</div> + </div> + <div class="field text col-md-4"> + <label class="left">SUT HW Version</label> + <div class="middleColumn">{{ ctrl.application.sut_hw_version }}</div> + </div> + <div class="field text col-md-4"> + <label class="left">OVP Category</label> + <div class="middleColumn">{{ ctrl.application.ovp_category }}</div> + </div> + <div class="field text col-md-4"> + <label class="left">Location</label> + <div class="middleColumn">{{ ctrl.application.lab_location }}</div> + </div> + <div ng-if="ctrl.lab_location=='third'" class="field text"> + <div class="field text col-md-4"> + <label class="left">Lab Name</label> + <div>{{ ctrl.application.lab_name }}</div> + </div> + <div class="field text col-md-4"> + <label class="left">Lab Email</label> + <div>{{ ctrl.application.lab_email }}</div> + </div> + <div class="field text col-md-4"> + <label class="left">Lab Address</label> + <div>{{ ctrl.application.lab_address }}</div> + </div> + <div class="field text col-md-4"> + <label class="left">Lab Phone Number</label> + <div>{{ ctrl.application.lab_phone }}</div> + </div> + </div> + </fieldset> + </div> + </div> +</div> + +<style type="text/css"> + .ngdialog.custom-background .ngdialog-content { + background: #ffffff; + } +</style> 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 @@ +<div class="container-fluid common-main-container"> + <div class="top-site-banner"> + <div class="container"> + <p class="p1">Community Reviews</p> + </div> + </div> + + <div class="row" style="margin-top: 20px;"> + <div class="col-lg-12 container"> + <div cg-busy="{promise:ctrl.reviewsRequest,message:'Loading'}"></div> + <div ng-show="ctrl.reviews" class="results-table" style="width: 100%; overflow-x: scroll;"> + <table ng-data="ctrl.reviews" ng-show="ctrl.reviews" class="table table-striped table-hover"> + <thead> + <tr> + <th>Reviewer</th> + <th>Linux Foundation OpenId</th> + <th>Email</th> + <th>Review Date</th> + <th>Outcome</th> + </tr> + </thead> + <tbody style="white-space: nowrap; overflow: hidden; text-overflow: ellipsis;"> + <tr ng-repeat="(index, review) in ctrl.reviews"> + <td>{{ review.reviewer_name }}</td> + <td>{{ review.reviewer_openid }}</td> + <td>{{ review.reviewer_email }}</td> + <td>{{ review.creation_date | limitTo:19}}</td> + <td>{{ review.outcome }}</td> + </tr> + </tbody> + </table> + </div> + </div> + </div> +</div> + +<style type="text/css"> + .ngdialog.custom-background .ngdialog-content { + background: #ffffff; + } +</style> diff --git a/3rd_party/static/testapi-ui/components/results/modal/sharedModal.html b/3rd_party/static/testapi-ui/components/results/modal/sharedModal.html index 021a355..a029aa5 100644 --- a/3rd_party/static/testapi-ui/components/results/modal/sharedModal.html +++ b/3rd_party/static/testapi-ui/components/results/modal/sharedModal.html @@ -1,3 +1,12 @@ +<!-- + Copyright (c) 2019 opnfv. + + All rights reserved. This program and the accompanying materials + are made available under the terms of the Apache License, Version 2.0 + which accompanies this distribution, and is available at + http://www.apache.org/licenses/LICENSE-2.0 +--> + <div> <h4>Enter user name or email</h4> <input type="text" ng-model="ctrl.userName"> diff --git a/3rd_party/static/testapi-ui/components/results/results.html b/3rd_party/static/testapi-ui/components/results/results.html index bc15169..77d16ec 100644 --- a/3rd_party/static/testapi-ui/components/results/results.html +++ b/3rd_party/static/testapi-ui/components/results/results.html @@ -1,3 +1,12 @@ +<!-- + Copyright (c) 2019 opnfv. + + All rights reserved. This program and the accompanying materials + are made available under the terms of the Apache License, Version 2.0 + which accompanies this distribution, and is available at + http://www.apache.org/licenses/LICENSE-2.0 +--> + <div class="container-fluid common-main-container"> <h3>{{ctrl.pageHeader}}</h3> <p>{{ctrl.pageParagraph}}</p> @@ -7,11 +16,11 @@ uib-tooltip="results file is logs.xxx.tar.gz under your dovetail installation path"></i> </h4> <div class="form-group col-m-3"> - <input class="form-contrl btn btn-success cvp-btn medium accent-color regular-button" type="file" + <input class="form-contrl btn btn-success-cust cvp-btn medium accent-color regular-button" type="file" file-model="resultFile"> </div> <div class="form-group col-m-3"> - <a class="btn btn-success cvp-btn medium accent-color regular-button" ng-click="ctrl.uploadFile()"> + <a class="btn btn-success-cust cvp-btn medium accent-color regular-button" ng-click="ctrl.uploadFile()"> <span>upload result</span> </a> </div> @@ -36,7 +45,8 @@ <th>Status</th> <th>Log</th> <th>SUT</th> - <th>SUT Version</th> + <th>Application</th> + <th>Review Status</th> <th class="col-md-2">Operation</th> <th class="col-md-2">Share List</th> </tr> @@ -62,43 +72,53 @@ <td><a ng-click="ctrl.downloadLogs(result.id)">logs</a></td> <td><a ng-click="ctrl.gotoSUT(result.id)">info</a></td> <td> - <div class="popover-wrapper"> - <a editable-theme="bs3" onbeforesave="ctrl.changeLabel(result, 'sut_label', $data)" - editable-text="result.sut_label">{{ result.sut_label || "None" }}</a> - </div> + <a ng-if="result.status !='private'" ng-click="ctrl.openApplicationView(result)">View Application</a> + <div ng-if="result.status == 'private'">Not created</div> + </td> + <td><a ng-if="result.status !='private'" ng-click="ctrl.openReviewsModal(result.id)">View Reviews</a> + <div ng-if="result.status == 'private'"></div> </td> <td> <div class="btn-group" uib-dropdown> - <a id="single-button" type="button" class="btn btn-success cvp-btn medium accent-color regular-button" + <a id="single-button" type="button" class="btn btn-success-cust cvp-btn medium accent-color regular-button" uib-dropdown-toggle> Operation<span class="caret"></span> </a> <ul class="dropdown-menu" uib-dropdown-menu role="menu" aria-labelledby="single-button"> - <li role="menuitem" ng-if="auth.currentUser.openid == result.owner" + <li role="menuitem" ng-if="auth.currentUser.openid == result.owner && ctrl.isUserResults" class="menu-item menu-item-type-post_type menu-item-object-page"> - <a ng-class="{'hide': result.status == 'private'}" - ng-click="ctrl.toPrivate(result, 'private')">withdraw submit</a> + <a ng-class="{'hide': result.status != 'review'}" + ng-click="ctrl.deleteApplication(result)">withdraw submit</a> </li> - <li role="menuitem" ng-if="auth.currentUser.openid == result.owner" + <li role="menuitem" + ng-if="auth.currentUser.openid == result.owner && ctrl.isUserResults && auth.currentUser.role.indexOf('user') != -1" class="menu-item menu-item-type-post_type menu-item-object-page"> <a ng-class="{'hide': result.status != 'private'}" - ng-click="ctrl.toReview(result, 'review')">submit to review</a> + ng-click="ctrl.openApplicationModal(result)">submit to review</a> + </li> + <li role="menuitem" + ng-if="auth.currentUser.role.indexOf('reviewer') != -1 && !ctrl.isUserResults" + class="menu-item menu-item-type-post_type menu-item-object-page"> + <a ng-class="{'hide': (result.voted == 'true') || (result.status != 'review')}" + ng-click="ctrl.toApprove(result)">approve</a> </li> - <li role="menuitem" ng-if="auth.currentUser.role.indexOf('administrator') != -1" + <li role="menuitem" + ng-if="auth.currentUser.role.indexOf('reviewer') != -1 && !ctrl.isUserResults" class="menu-item menu-item-type-post_type menu-item-object-page"> - <a ng-class="{'hide': result.status == 'approved' || result.status == 'private'}" - ng-click="ctrl.toggleCheck(result, 'status', 'approved')">approve</a> + <a ng-class="{'hide': (result.voted == 'true') || (result.status != 'review')}" + ng-click="ctrl.toDisapprove(result)">not approve</a> </li> - <li role="menuitem" ng-if="auth.currentUser.role.indexOf('administrator') != -1" + <li role="menuitem" + ng-if="auth.currentUser.role.indexOf('reviewer') != -1 && !ctrl.isUserResults" class="menu-item menu-item-type-post_type menu-item-object-page"> - <a ng-class="{'hide': result.status == 'not approved' || result.status == 'private'}" - ng-click="ctrl.toggleCheck(result, 'status', 'not approved')">not approve</a> + <a ng-class="{'hide': (result.voted == 'false') || (result.status != 'review')}" + ng-click="ctrl.toUndo(result)">undo</a> </li> - <li role="menuitem" ng-if="auth.currentUser.openid == result.owner" + <li role="menuitem" ng-if="auth.currentUser.openid == result.owner && ctrl.isUserResults" class="menu-item menu-item-type-post_type menu-item-object-page"> <a ng-click="ctrl.openSharedModal(result)">share with</a> </li> - <li role="menuitem" ng-if="auth.currentUser.openid == result.owner" + <li role="menuitem" ng-if="auth.currentUser.openid == result.owner && ctrl.isUserResults" class="menu-item menu-item-type-post_type menu-item-object-page"> <a ng-click="ctrl.deleteTest(result._id)">delete</a> </li> @@ -108,7 +128,7 @@ <td> <div class="btn-group" uib-dropdown> <a id="single-button-two" type="button" - class="btn btn-success cvp-btn medium accent-color regular-button" style="width: 130px;" + class="btn btn-success-cust cvp-btn medium accent-color regular-button" style="width: 130px;" uib-dropdown-toggle> Share List<span class="caret"></span> </a> diff --git a/3rd_party/static/testapi-ui/components/results/resultsController.js b/3rd_party/static/testapi-ui/components/results/resultsController.js index 6e4e0ac..482d3a9 100644 --- a/3rd_party/static/testapi-ui/components/results/resultsController.js +++ b/3rd_party/static/testapi-ui/components/results/resultsController.js @@ -37,6 +37,24 @@ }; }]); + angular + .module('testapiApp') + .directive('modalFileModel', ['$parse', function ($parse) { + return { + restrict: 'A', + link: function(scope, element, attrs) { + var model = $parse(attrs.modalFileModel); + var modelSetter = model.assign; + + element.bind('change', function(){ + scope.$apply(function(){ + modelSetter(scope.$parent, element[0].files[0]); + }); + }); + } + }; + }]); + ResultsController.$inject = [ '$scope', '$http', '$filter', '$state', 'testapiApiUrl','raiseAlert', 'ngDialog', '$resource' ]; @@ -62,7 +80,6 @@ ctrl.gotoSUT = gotoSUT; ctrl.gotoResultDetail = gotoResultDetail; ctrl.toggleCheck = toggleCheck; - ctrl.changeLabel = changeLabel; ctrl.toReview = toReview; ctrl.toPrivate = toPrivate; ctrl.removeSharedUser = removeSharedUser; @@ -70,6 +87,16 @@ ctrl.openSharedModal = openSharedModal; ctrl.downloadLogs = downloadLogs; ctrl.deleteTest = deleteTest; + ctrl.deleteApplication = deleteApplication; + ctrl.openApplicationModal = openApplicationModal; + ctrl.toApprove = toApprove; + ctrl.toDisapprove = toDisapprove; + ctrl.toUndo = toUndo; + ctrl.openConfirmModal = openConfirmModal; + ctrl.openApplicationView = openApplicationView; + ctrl.submitApplication = submitApplication; + ctrl.openReviewsModal = openReviewsModal; + ctrl.doReview = doReview; /** Mappings of Interop WG components to marketing program names. */ ctrl.targetMappings = { @@ -110,11 +137,18 @@ // ctrl.isUserResults = $state.current.name === 'userResults'; // need auth to browse ctrl.isUserResults = $state.current.name === 'userResults'; + ctrl.isReviewer = $scope.auth.currentUser.role.indexOf('reviewer') != -1; + ctrl.isAdministrator = $scope.auth.currentUser.role.indexOf('administrator') != -1; ctrl.currentUser = $scope.auth.currentUser ? $scope.auth.currentUser.openid : null; // Should only be on user-results-page if authenticated. - if (ctrl.isUserResults && !$scope.auth.isAuthenticated) { + if (!$scope.auth.isAuthenticated) { + $state.go('home'); + } + + // Should only be on user-results-page if authenticated. + if (!ctrl.isUserResults && !ctrl.isReviewer) { $state.go('home'); } @@ -167,6 +201,261 @@ }); } + function deleteApplication (result) { + var resp = confirm('Are you sure you want to delete this application?'); + if (!resp) + return; + + $http.get(testapiApiUrl + "/cvp/applications?test_id=" + result.id).then(function(response) { + ctrl.application = response.data.applications[0]; + var app_id = ctrl.application._id; + var delUrl = testapiApiUrl + "/cvp/applications/" + app_id; + $http.delete(delUrl) + .then(function(ret) { + if (ret.data.code && ret.data.code != 0) { + alert(ret.data.msg); + return; + } + result['status'] = 'private'; + }); + + }, function(error) { + /* do nothing */ + }); + + } + + function submitApplication(result) { + var file = $scope.logoFile; + var logo_name = null; + if (typeof file !== 'undefined') { + var fd = new FormData(); + fd.append('file', file); + fd.append('company_name', ctrl.organization_name) + + $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; + } else { + logo_name = resp.data.filename; + 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_label": ctrl.sut_label, + "sut_hw_version": ctrl.sut_hw_version, + "ovp_version": result.version, + "ovp_category": ctrl.ovp_category, + "company_logo": logo_name, + "approve_date": "", + "approved": "false", + "test_id": result.id, + "lab_location": ctrl.lab_location, + "lab_email": ctrl.lab_email, + "lab_address": ctrl.lab_address, + "lab_phone": ctrl.lab_phone + }; + + if(ctrl.organization_name == null || + ctrl.organization_web == null || + ctrl.product_name == null || + ctrl.product_spec == null || + ctrl.product_documentation == null || + 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_label == null || + ctrl.sut_hw_version == null || + ctrl.ovp_category == null) { + + alert('There are empty required fields in the application form'); + + } else if (ctrl.lab_location == 'third') { + if (ctrl.lab_name == null || + ctrl.lab_email == null || + ctrl.lab_address == null || + ctrl.lab_phone == null) { + alert('There are empty required fields in the application form'); + } else { + + $http.post(testapiApiUrl + "/cvp/applications", data).then(function(resp) { + if (resp.data.code && resp.data.code != 0) { + alert(resp.data.msg); + return; + } + toggleCheck(result, 'status', 'review'); + }, function(error) { + /* do nothing */ + }); + + } + + } else { + + $http.post(testapiApiUrl + "/cvp/applications", data).then(function(resp) { + if (resp.data.code && resp.data.code != 0) { + alert(resp.data.msg); + return; + } + toggleCheck(result, 'status', 'review'); + }, function(error) { + /* do nothing */ + }); + + } + } + }, function(error) { + /* do nothing */ + }); + logo_name = file.name; + } + + if (typeof file === 'undefined') { + alert('There are empty required fields in the application form'); + } + ngDialog.close(); + } + + function openConfirmModal(result) { + var resp = confirm("Are you sure to submit?"); + if (resp) { + ctrl.submitApplication(result); + } + } + + function openApplicationModal(result) { + ctrl.tempResult = result; + ngDialog.open({ + preCloseCallback: function(value) { + }, + template: 'testapi-ui/components/results/modal/applicationModal.html', + scope: $scope, + className: 'ngdialog-theme-default custom-background', + width: 950, + showClose: true, + closeByDocument: true + }); + } + + function openApplicationView(result) { + $http.get(testapiApiUrl + "/cvp/applications?test_id=" + result.id).then(function(response) { + ctrl.application = response.data.applications[0]; + }, function(error) { + /* do nothing */ + }); + + ctrl.tempResult = result; + ngDialog.open({ + preCloseCallback: function(value) { + }, + template: 'testapi-ui/components/results/modal/applicationView.html', + scope: $scope, + className: 'ngdialog-theme-default custom-background', + width: 950, + showClose: true, + closeByDocument: true + }); + } + + function getReviews(test) { + var reviews_url = testapiApiUrl + '/reviews?test_id=' + test; + ctrl.reviewsRequest = + $http.get(reviews_url).success(function (data) { + ctrl.reviews = data.reviews; + }).error(function (error) { + ctrl.reviews = null; + }); + } + + function openReviewsModal(test) { + getReviews(test); + ngDialog.open({ + preCloseCallback: function(value) { + }, + template: 'testapi-ui/components/results/modal/reviewsModal.html', + scope: $scope, + className: 'ngdialog-theme-default custom-background', + width: 950, + showClose: true, + closeByDocument: true + }); + } + + function doReview(test, outcome) { + var createUrl = testapiApiUrl + "/reviews"; + var data = { + 'test_id': test.id, + 'outcome': outcome + }; + + $http.post(createUrl, 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 { + if (outcome === null) { + test.voted = 'false'; + } else { + test.voted = 'true'; + } + } + }, function(error) { + alert('Error when creating review'); + }); + } + + function toApprove(test) { + var resp = confirm('Once you approve a test result, your action will become visible. Do you want to proceed?'); + if (resp) { + doReview(test, 'positive'); + } + } + + function toDisapprove(test) { + var resp = confirm('Once you disapprove a test result, your action will become visible. Do you want to proceed?'); + if (resp) { + doReview(test, 'negative'); + } + } + + function toUndo(test) { + var resp = confirm('Once you undo your previous vote, your action will become visible. Do you want to proceed?'); + if (resp) { + doReview(test, null); + } + } + + function toReview(result, value){ + var resp = confirm('Once you submit a test result for review, it will become readable to all OVP reviewers. Do you want to proceed?'); + if(resp){ + toggleCheck(result, 'status', value); + } + } + + function toPrivate(result, value){ + var resp = confirm('Do you want to proceed?'); + if(resp){ + toggleCheck(result, 'status', value); + } + } + function toggleCheck(result, item, newValue) { var id = result._id; var updateUrl = testapiApiUrl + "/tests/"+ id; @@ -189,10 +478,6 @@ }); } - function changeLabel(result, key, data){ - toggleCheck(result, key, data); - } - function toReview(result, value){ var resp = confirm('Once you submit a test result for review, it will become readable to all OVP reviewers. Do you want to proceed?'); if(resp){ @@ -291,26 +576,51 @@ function update() { ctrl.showError = false; // Construct the API URL based on user-specified filters. - var content_url = testapiApiUrl + '/tests' + - '?page=' + ctrl.currentPage; + var content_url = testapiApiUrl + '/tests'; var start = $filter('date')(ctrl.startDate, 'yyyy-MM-dd'); + var end = $filter('date')(ctrl.endDate, 'yyyy-MM-dd'); + ctrl.PageName = null; + content_url += '?page=' + ctrl.currentPage; + content_url += '&per_page=' + ctrl.itemsPerPage; if (start) { content_url = content_url + '&from=' + start + ' 00:00:00'; } - var end = $filter('date')(ctrl.endDate, 'yyyy-MM-dd'); if (end) { content_url = content_url + '&to=' + end + ' 23:59:59'; } if (ctrl.isUserResults) { - content_url = content_url + '&signed'+'&per_page='+ ctrl.itemsPerPage; + content_url += '&signed'; + ctrl.PageName = 'MyResults'; + } else { + content_url += '&status={"$ne":"private"}&review'; } + ctrl.resultsRequest = $http.get(content_url).success(function (data) { ctrl.data = data; ctrl.totalItems = ctrl.data.pagination.total_pages * ctrl.itemsPerPage; ctrl.currentPage = ctrl.data.pagination.current_page; ctrl.numPages = ctrl.data.pagination.total_pages; + if (ctrl.PageName === 'MyResults') { + for (var i=0; i<data.tests.length; i++) { + if (data.tests[i].owner !== ctrl.currentUser) { + var sharing = false; + if (data.tests[i].shared !== null){ + for (var j=0; j<data.tests[i].shared.length; j++) { + if (data.tests[i].shared[j] === ctrl.currentUser){ + sharing = true; + } + } + } + if (sharing == false){ + data.tests.splice(i,1); + i = i - 1; + } + } + } + ctrl.data = data; + } }).error(function (error) { ctrl.data = null; ctrl.totalItems = 0; diff --git a/3rd_party/static/testapi-ui/components/sut/sut.html b/3rd_party/static/testapi-ui/components/sut/sut.html index 9b5e278..eaa6862 100644 --- a/3rd_party/static/testapi-ui/components/sut/sut.html +++ b/3rd_party/static/testapi-ui/components/sut/sut.html @@ -1,3 +1,12 @@ +<!-- + Copyright (c) 2019 opnfv. + + All rights reserved. This program and the accompanying materials + are made available under the terms of the Apache License, Version 2.0 + which accompanies this distribution, and is available at + http://www.apache.org/licenses/LICENSE-2.0 +--> + <div class="container-fluid common-main-container"> <h2>Endpoints</h2> <div class="results-table" style="margin-top: 30px;"> diff --git a/3rd_party/static/testapi-ui/index.html b/3rd_party/static/testapi-ui/index.html index 59d2ae7..f016a7c 100644 --- a/3rd_party/static/testapi-ui/index.html +++ b/3rd_party/static/testapi-ui/index.html @@ -30,6 +30,7 @@ <link rel="stylesheet" href="testapi-ui/node_modules/ng-dialog/css/ngDialog.min.css"> <link rel="stylesheet" href="testapi-ui/node_modules/ng-dialog/css/ngDialog-theme-default.min.css"> <link rel="stylesheet" href="testapi-ui/node_modules/angular-xeditable/dist/css/xeditable.min.css"> + <link rel="stylesheet" href="testapi-ui/assets/css/combine.css"> <!-- CSS Internal Code --> <link rel="stylesheet" href="testapi-ui/assets/css/cvp-style.css"> @@ -75,7 +76,8 @@ </head> <body class="container-fluid home page-template-default page page-id-6 do-etfw tribe-no-js ascend wpb-js-composer - js-comp-ver-5.2.1 vc_responsive index-header"> + js-comp-ver-5.2.1 vc_responsive index-header" + ng-controller="HeaderController as header"> <header ng-include src="'testapi-ui/shared/header/header.html'"></header> <div ui-view></div> <footer ng-include src="'testapi-ui/shared/footer/footer.html'"></footer> diff --git a/3rd_party/static/testapi-ui/robots.txt b/3rd_party/static/testapi-ui/robots.txt index 93c4420..4f47368 100644 --- a/3rd_party/static/testapi-ui/robots.txt +++ b/3rd_party/static/testapi-ui/robots.txt @@ -1,3 +1,12 @@ +############################################################################## +# Copyright (c) 2019 opnfv. +# +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 +############################################################################## + # robotstxt.org User-agent: * diff --git a/3rd_party/static/testapi-ui/shared/alerts/alertModal.html b/3rd_party/static/testapi-ui/shared/alerts/alertModal.html index 5d1a097..b42dac6 100644 --- a/3rd_party/static/testapi-ui/shared/alerts/alertModal.html +++ b/3rd_party/static/testapi-ui/shared/alerts/alertModal.html @@ -1,3 +1,12 @@ +<!-- + Copyright (c) 2019 opnfv. + + All rights reserved. This program and the accompanying materials + are made available under the terms of the Apache License, Version 2.0 + which accompanies this distribution, and is available at + http://www.apache.org/licenses/LICENSE-2.0 +--> + <div class="modal-body" style="padding:0px"> <div class="alert alert-{{alert.data.mode}}" style="margin-bottom:0px"> <button type="button" class="close" data-ng-click="alert.close()" > diff --git a/3rd_party/static/testapi-ui/shared/alerts/confirmModal.html b/3rd_party/static/testapi-ui/shared/alerts/confirmModal.html index bf5640c..b93a8a3 100644 --- a/3rd_party/static/testapi-ui/shared/alerts/confirmModal.html +++ b/3rd_party/static/testapi-ui/shared/alerts/confirmModal.html @@ -1,3 +1,12 @@ +<!-- + Copyright (c) 2019 opnfv. + + All rights reserved. This program and the accompanying materials + are made available under the terms of the Apache License, Version 2.0 + which accompanies this distribution, and is available at + http://www.apache.org/licenses/LICENSE-2.0 +--> + <div class="modal-header"> <h3 class="modal-title">Confirm</h3> </div> diff --git a/3rd_party/static/testapi-ui/shared/alerts/confirmModalFactory.js b/3rd_party/static/testapi-ui/shared/alerts/confirmModalFactory.js index 76c74df..2ee3640 100644 --- a/3rd_party/static/testapi-ui/shared/alerts/confirmModalFactory.js +++ b/3rd_party/static/testapi-ui/shared/alerts/confirmModalFactory.js @@ -1,3 +1,12 @@ +/******************************************************************************* + * Copyright (c) 2019 opnfv. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Apache License, Version 2.0 + * which accompanies this distribution, and is available at + * http://www.apache.org/licenses/LICENSE-2.0 + *******************************************************************************/ + (function () { 'use strict'; diff --git a/3rd_party/static/testapi-ui/shared/footer/footer.html b/3rd_party/static/testapi-ui/shared/footer/footer.html index c0f1b70..f82de88 100644 --- a/3rd_party/static/testapi-ui/shared/footer/footer.html +++ b/3rd_party/static/testapi-ui/shared/footer/footer.html @@ -1,3 +1,12 @@ +<!-- + Copyright (c) 2019 opnfv. + + All rights reserved. This program and the accompanying materials + are made available under the terms of the Apache License, Version 2.0 + which accompanies this distribution, and is available at + http://www.apache.org/licenses/LICENSE-2.0 +--> + <div> <span class="hide">version: web.cvp.0.7.0</span> </div> diff --git a/3rd_party/static/testapi-ui/shared/header/header.html b/3rd_party/static/testapi-ui/shared/header/header.html index 54470e7..002f632 100644 --- a/3rd_party/static/testapi-ui/shared/header/header.html +++ b/3rd_party/static/testapi-ui/shared/header/header.html @@ -1,3 +1,12 @@ +<!-- + Copyright (c) 2019 opnfv. + + All rights reserved. This program and the accompanying materials + are made available under the terms of the Apache License, Version 2.0 + which accompanies this distribution, and is available at + http://www.apache.org/licenses/LICENSE-2.0 +--> + <div class="header-container-1"> <div class="row header-container-row"> <div class="col-md-3"> @@ -19,6 +28,10 @@ ng-if="auth.isAuthenticated && auth.currentUser.role.indexOf('administrator') != -1"> <a ui-sref="application">Applications</a> </li> + <li ng-class="{ active: header.isActive('/community_results')}" + ng-if="auth.isAuthenticated && auth.canReview(auth.currentUser)"> + <a ui-sref="communityResults">Incoming Reviews</a> + </li> <li ng-class="{ active: header.isActive('/user_results')}" ng-if="auth.isAuthenticated"> <a ui-sref="userResults">My Results</a> </li> |