summaryrefslogtreecommitdiffstats
path: root/3rd_party/static/testapi-ui/components/results
diff options
context:
space:
mode:
authorPanagiotis Karalis <pkaralis@intracom-telecom.com>2019-01-24 15:04:15 +0200
committerPanagiotis Karalis <pkaralis@intracom-telecom.com>2019-04-10 18:06:01 +0300
commit71bdc6752f47b7da7282f786570fbe717973fb6d (patch)
treef8bc25e843293b52bd7012d9861941498f7a1b58 /3rd_party/static/testapi-ui/components/results
parentc64b58a5a89ae7ac51f4f7b41e2842980e112346 (diff)
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 <pkaralis@intracom-telecom.com>
Diffstat (limited to '3rd_party/static/testapi-ui/components/results')
-rw-r--r--3rd_party/static/testapi-ui/components/results/modal/applicationModal.html191
-rw-r--r--3rd_party/static/testapi-ui/components/results/modal/applicationView.html107
-rw-r--r--3rd_party/static/testapi-ui/components/results/modal/reviewsModal.html41
-rw-r--r--3rd_party/static/testapi-ui/components/results/results.html57
-rw-r--r--3rd_party/static/testapi-ui/components/results/resultsController.js262
5 files changed, 626 insertions, 32 deletions
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/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 @@
<div class="container-fluid common-main-container">
<h3>{{ctrl.pageHeader}}</h3>
<p>{{ctrl.pageParagraph}}</p>
- <form class="form-inline" ng-show="ctrl.isUserResults">
+ <form class="form-inline" ng-show="ctrl.isUserResults"
+ ng-if="auth.isAuthenticated && auth.currentUser.role.indexOf('user') != -1">
<h4>Upload Results
<i class="glyphicon glyphicon-question-sign opnfv-blue"
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 +37,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 +64,52 @@
<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"
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 +119,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..1fb4f0d 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,10 +137,17 @@
// 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 (!$scope.auth.isAuthenticated) {
+ $state.go('home');
+ }
+
+ // Should only be on user-results-page if authenticated.
if (ctrl.isUserResults && !$scope.auth.isAuthenticated) {
$state.go('home');
}
@@ -167,6 +201,216 @@
});
}
+ 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
+ };
+
+ $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;
+ }
+ 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 +433,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,20 +531,24 @@
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');
+ 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';
+ } else {
+ content_url += '&status={"$ne":"private"}&review';
}
+
ctrl.resultsRequest =
$http.get(content_url).success(function (data) {
ctrl.data = data;