diff options
author | pkaralis <pkaralis@intracom-telecom.com> | 2018-12-06 00:43:12 +0200 |
---|---|---|
committer | Panagiotis Karalis <pkaralis@intracom-telecom.com> | 2019-03-20 15:28:23 +0200 |
commit | d0bbf3b8952379883550c6eb2062476a6d15043e (patch) | |
tree | 106f65b223054077279bda7ff988a73bea314a34 /3rd_party/static/onap-ui/components/application | |
parent | 5f20495d6e3ec984c4e86fd76399ddf0d042b336 (diff) |
Enable Web Portal for ONAP results
The web portal needs to be able to read test results of the ONAP
compliance program and display them.
In order for the above goal to be achieved, the following two parts
should be impacted:
1- A new front-end should be prepared in order to handle and display
the results
2- The REST API should be extended in order to support the aforementioned
operation.
JIRA: DOVETAIL-669
Change-Id: I36bbb6e602a67020d7e27aedbfc776f5cf4f3dc3
Signed-off-by: pkaralis <pkaralis@intracom-telecom.com>
Co-Authored-By: Stamatis Katsaounis <mokats@intracom-telecom.com>
Diffstat (limited to '3rd_party/static/onap-ui/components/application')
-rw-r--r-- | 3rd_party/static/onap-ui/components/application/application.html | 111 | ||||
-rw-r--r-- | 3rd_party/static/onap-ui/components/application/applicationController.js | 110 |
2 files changed, 221 insertions, 0 deletions
diff --git a/3rd_party/static/onap-ui/components/application/application.html b/3rd_party/static/onap-ui/components/application/application.html new file mode 100644 index 0000000..2238ca4 --- /dev/null +++ b/3rd_party/static/onap-ui/components/application/application.html @@ -0,0 +1,111 @@ +<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> + <tr> + <th>Create Date</th> + <th>Owner</th> + <th>ONAP version</th> + <th>Company Name</th> + <th>Company logo</th> + <th>Company Website</th> + <th>Approve date</th> + <th>Test ID</th> + <th>xNF Version</th> + <th>xNF Name</th> + <th>xNF Type</th> + <th>xNF Description</th> + <th>xNF Id</th> + <th>xNF Model Language</th> + <th>xNF Checksum (SHA256)</th> + <th>Test Period</th> + <th>Location</th> + <th>Operation</th> + </tr> + </thead> + <script type="text/ng-template" id="product.tpl.html"> + <div class="input-group"> + <span class="input-group-addon"><i class="glyphicon glyphicon-user"></i></span> + <input type="text" value="{{app.product_spec}}"> + </div> + <div class="input-group"> + <span class="input-group-addon">@</span> + <input type="text" value="{{app.product_documentation}}"> + </div> + <div class="input-group"> + <span class="input-group-addon"><i class="glyphicon glyphicon-map-marker"></i></span> + <input type="text" value="{{app.product_categories | category}}"> + </div> + </script> + <script type="text/ng-template" id="lab.tpl.html"> + <div class="input-group"> + <span class="input-group-addon"><i class="glyphicon glyphicon-user"></i></span> + <input type="text" value="{{app.lab_name}}"> + </div> + <div class="input-group"> + <span class="input-group-addon">@</span> + <input type="text" value="{{app.lab_email}}"> + </div> + <div class="input-group"> + <span class="input-group-addon"><i class="glyphicon glyphicon-map-marker"></i></span> + <input type="text" value="{{app.lab_address}}"> + </div> + <div class="input-group"> + <span class="input-group-addon"><i class="glyphicon glyphicon-phone"></i></span> + <input type="text" value="{{app.lab_phone}}"> + </div> + </script> + <tbody style="white-space: nowrap; overflow: hidden; text-overflow: ellipsis;"> + <tr ng-if="results.status != 'review'" ng-repeat="app in ctrl.applications"> + <td>{{ app.creation_date | limitTo: 10 }}</td> + <td>{{ app.owner }}</td> + <td>{{ app.onap_version }}</td> + <td>{{ app.company_name }}</td> + <td>{{ app.company_logo }}</td> + <td>{{ app.company_website }}</td> + <td>{{ app.approve_date | limitTo: 10 }}</td> + <td>{{ app.test_id }}</td> + <td>{{ app.xnf_version }}</td> + <td>{{ app.xnf_name }}</td> + <td>{{ app.xnf_type }}</td> + <td>{{ app.xnf_description }}</td> + <td>{{ app.xnfd_id }}</td> + <td>{{ app.xnfd_model_lang }}</td> + <td>{{ app.xnf_checksum }}</td> + <td>{{ app.xnf_test_period }}</td> + <td> + <span popover-enable="app.lab_location != 'internal'" uib-popover-template="ctrl.lab_tpl" + popover-title="Lab Info" popover-placement="top" + popover-trigger="mouseenter">{{ app.lab_location | labLocation}}</span> + <i ng-if="app.lab_location != 'internal'" class="glyphicon glyphicon-info-sign opnfv-blue"></i> + </td> + <td> + <a ng-click="ctrl.toggleApproveApp(app._id, 'true')" 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> + </tr> + </tbody> + </table> + + <div class="pages"> + <uib-pagination + total-items="ctrl.totalItems" + ng-model="ctrl.currentPage" + items-per-page="ctrl.itemsPerPage" + max-size="ctrl.maxSize" + class="pagination-sm" + boundary-links="true" + rotate="false" + num-pages="ctrl.numPages" + ng-change="ctrl.updatePage()"> + </uib-pagination> + </div> + </div> +</div> diff --git a/3rd_party/static/onap-ui/components/application/applicationController.js b/3rd_party/static/onap-ui/components/application/applicationController.js new file mode 100644 index 0000000..094ffdc --- /dev/null +++ b/3rd_party/static/onap-ui/components/application/applicationController.js @@ -0,0 +1,110 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +(function () { + 'use strict'; + + angular + .module('testapiApp') + .controller('ApplicationController', ApplicationController); + + ApplicationController.$inject = [ + '$http', '$stateParams', '$window', '$sce', + '$uibModal', 'testapiApiUrl', 'raiseAlert', 'ngDialog', '$scope' + ]; + + /** + */ + function ApplicationController($http, $stateParams, $window, $sce, + $uibModal, testapiApiUrl, raiseAlert, ngDialog, $scope) { + + var ctrl = this; + + function init() { + ctrl.applications = []; + + ctrl.totalItems = null; + ctrl.currentPage = 1; + ctrl.itemsPerPage = 5; + ctrl.numPages = null; + + ctrl.lab_tpl = "lab.tpl.html"; + ctrl.product_tpl = "product.tpl.html"; + + getApplication(); + } + + ctrl.updatePage = function() { + getApplication(); + } + + ctrl.deleteApp = function(id) { + var resp = confirm('Are you sure you want to delete this application?'); + if (!resp) + return; + + var delUrl = testapiApiUrl + "/cvp/applications/" + id; + $http.delete(delUrl) + .then(function(ret) { + if (ret.data.code && ret.data.code != 0) { + alert(ret.data.msg); + return; + } + getApplication(); + }); + } + + ctrl.toggleApproveApp = function(id, approved) { + if (approved === 'true') { + var text = 'Are you sure you want to approve this application?'; + } else { + var text = 'Are you sure you want to remove approval of this application?'; + } + + var resp = confirm(text); + if (!resp) + return; + + var updateUrl = testapiApiUrl + "/cvp/applications/" + id; + var data = {}; + data['item'] = 'approved'; + data['approved'] = approved; + + $http.put(updateUrl, JSON.stringify(data), { + transformRequest: angular.identity, + headers: {'Content-Type': '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 + "/onap/cvp/applications?page=" + ctrl.currentPage + "&signed&per_page=" + ctrl.itemsPerPage).then(function(response) { + ctrl.applications = response.data.applications; + ctrl.totalItems = response.data.pagination.total_pages * ctrl.itemsPerPage; + ctrl.currentPage = response.data.pagination.current_page; + ctrl.numPages = response.data.pagination.total_pages; + }, function(error) { + /* do nothing */ + }); + } + + init(); + } +})(); |