diff options
-rw-r--r-- | .gitreview | 4 | ||||
-rw-r--r-- | docs/index.rst | 2 | ||||
-rw-r--r-- | docs/release-notes.rst | 36 | ||||
-rw-r--r-- | docs/release-notes/bug-fixes.rst | 4 | ||||
-rw-r--r-- | docs/release-notes/index.rst | 16 | ||||
-rw-r--r-- | docs/release-notes/known-issues.rst | 4 | ||||
-rw-r--r-- | docs/release-notes/new-features.rst | 4 | ||||
-rw-r--r-- | docs/release-notes/security-issues.rst | 4 | ||||
-rw-r--r-- | docs/release-notes/upgrade-notes.rst | 4 | ||||
-rw-r--r-- | usecaseui-lcm/src/main/webapp/app/uui/fusion/scripts/controller/ServiceTemplateService.js | 128 | ||||
-rw-r--r-- | usecaseui-lcm/src/main/webapp/app/uui/fusion/scripts/controller/lcmController.js | 217 | ||||
-rw-r--r-- | usecaseui-lcm/src/main/webapp/app/uui/fusion/scripts/view-models/lifecyclemanagement.html | 4 | ||||
-rw-r--r-- | usecaseui-lcm/src/main/webapp/app/uui/fusion/scripts/view-models/progress-dialog.html | 31 |
13 files changed, 386 insertions, 72 deletions
diff --git a/.gitreview b/.gitreview new file mode 100644 index 00000000..8e879d06 --- /dev/null +++ b/.gitreview @@ -0,0 +1,4 @@ +[gerrit] +host=gerrit.onap.org +port=29418 +project=usecase-ui.git diff --git a/docs/index.rst b/docs/index.rst index a148dc5c..c976acc1 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -10,4 +10,4 @@ This document is aimed to give the users some brief introductions on Usecase-UI :maxdepth: 1 platform/index.rst - release-notes/index.rst + release-notes.rst diff --git a/docs/release-notes.rst b/docs/release-notes.rst new file mode 100644 index 00000000..05637587 --- /dev/null +++ b/docs/release-notes.rst @@ -0,0 +1,36 @@ +.. This work is licensed under a Creative Commons Attribution 4.0 International License. +.. http://creativecommons.org/licenses/by/4.0 + + +Release Notes +============= + +.. note:: + * This Release Notes must be updated each time the team decides to Release new artifacts. + * The scope of this Release Notes is for this particular component. In other words, each ONAP component has its Release Notes. + * This Release Notes is cumulative, the most recently Released artifact is made visible in the top of this Release Notes. + * Except the date and the version number, all the other sections are optional but there must be at least one section describing the purpose of this new release. + * This note must be removed after content has been added. + + +Version: x.y.z +-------------- + + +:Release Date: yyyy-mm-dd + + + +**New Features** + +Usecase UI is composed of two parts that are usecase-ui and usecase-ui-server. +It provides self-service management GUI and monitor GUI for operators and +end-users. This project targets identifying all GUI requirements which +operators and end-users need ONAP to support, coordinating GUI parts of +each ONAP subsystem, filling the gaps for improving GUI functionalities +for use cases. + + +=========== + +End of Release Notes diff --git a/docs/release-notes/bug-fixes.rst b/docs/release-notes/bug-fixes.rst deleted file mode 100644 index 4dc09fcd..00000000 --- a/docs/release-notes/bug-fixes.rst +++ /dev/null @@ -1,4 +0,0 @@ -.. This work is licensed under a Creative Commons Attribution 4.0 International License. - -Bug Fixes ---------- diff --git a/docs/release-notes/index.rst b/docs/release-notes/index.rst deleted file mode 100644 index c3fc707d..00000000 --- a/docs/release-notes/index.rst +++ /dev/null @@ -1,16 +0,0 @@ -.. This work is licensed under a Creative Commons Attribution 4.0 International License. - -Release-notes -------------- - -Usecase UI is composed of two parts that are usecase-ui and usecase-ui-server. It provides self-service management GUI and monitor GUI for operators and end-users. -This project targets identifying all GUI requirements which operators and end-users need ONAP to support, coordinating GUI parts of each ONAP subsystem, filling the gaps for improving GUI functionalities for use cases. - -.. toctree:: - :maxdepth: 1 - - new-features.rst - bug-fixes.rst - upgrade-notes.rst - security-issues.rst - known-issues.rst diff --git a/docs/release-notes/known-issues.rst b/docs/release-notes/known-issues.rst deleted file mode 100644 index f4341d77..00000000 --- a/docs/release-notes/known-issues.rst +++ /dev/null @@ -1,4 +0,0 @@ -.. This work is licensed under a Creative Commons Attribution 4.0 International License. - -Known Issues ------------- diff --git a/docs/release-notes/new-features.rst b/docs/release-notes/new-features.rst deleted file mode 100644 index f548910f..00000000 --- a/docs/release-notes/new-features.rst +++ /dev/null @@ -1,4 +0,0 @@ -.. This work is licensed under a Creative Commons Attribution 4.0 International License. - -New Features ------------- diff --git a/docs/release-notes/security-issues.rst b/docs/release-notes/security-issues.rst deleted file mode 100644 index 3a6cd9e4..00000000 --- a/docs/release-notes/security-issues.rst +++ /dev/null @@ -1,4 +0,0 @@ -.. This work is licensed under a Creative Commons Attribution 4.0 International License. - -Security Issues ---------------- diff --git a/docs/release-notes/upgrade-notes.rst b/docs/release-notes/upgrade-notes.rst deleted file mode 100644 index 29e67e58..00000000 --- a/docs/release-notes/upgrade-notes.rst +++ /dev/null @@ -1,4 +0,0 @@ -.. This work is licensed under a Creative Commons Attribution 4.0 International License. - -Upgrade Notes -------------- diff --git a/usecaseui-lcm/src/main/webapp/app/uui/fusion/scripts/controller/ServiceTemplateService.js b/usecaseui-lcm/src/main/webapp/app/uui/fusion/scripts/controller/ServiceTemplateService.js index c9357618..9482597d 100644 --- a/usecaseui-lcm/src/main/webapp/app/uui/fusion/scripts/controller/ServiceTemplateService.js +++ b/usecaseui-lcm/src/main/webapp/app/uui/fusion/scripts/controller/ServiceTemplateService.js @@ -58,7 +58,7 @@ getServiceInstances: function (customerId, serviceType, processFun) { return $http({ - url: url+'/service-instances?customerId='+customerId+'&serviceType='+serviceType.value, + url: url+'/service-instances?customerId='+customerId+'&serviceType='+serviceType, method: 'GET', data: null, headers: uuiHeaders @@ -144,7 +144,7 @@ }); }, - createService: function (customer, serviceType, service, template) { + createService: function (customer, serviceType, service, template, successFun, failedFun) { var reqPara = []; service.segments.forEach(function (segment) { var reqParas = {}; @@ -203,7 +203,7 @@ }; console.log('request body: '); - console.log(requestBody); + console.log(JSON.stringify(requestBody)); return $http({ url: url+'/services', @@ -213,10 +213,14 @@ }).then(function(response){ console.log('create response...'); console.log(response.data); + + var serviceId = response.data.service.serviceId; + var operationId = response.data.service.operationId; + successFun(serviceId, operationId); }); }, - deleteService: function (serviceId) { + deleteService: function (serviceId, successFun) { return $http({ url: url+'/services/' + serviceId, method: 'DELETE', @@ -225,6 +229,26 @@ }).then(function(response){ console.log('delete response...'); console.log(response.data); + successFun(serviceId, response.data.operationId); + }); + }, + + queryServiceProgress: function (serviceId, operationId, progressFun) { + return $http({ + url: url+'/services/' + serviceId + '/operations/' + operationId, + method: 'GET', + data: null, + headers: uuiHeaders + }).then(function(response){ + console.log('get progress response...'); + console.log(response.data); + var op = response.data.operationStatus; + progressFun({ + result: op.result, + progress : op.progress, + operationContent: op.operationContent, + reason: op.reason + }); }); }, @@ -242,6 +266,7 @@ uuid: ns.uuid, invariantUUID: ns.invariantUUID, name: ns.name, + version: ns.version, type: 'NS' }) }); @@ -250,6 +275,7 @@ uuid: vnf.uuid, invariantUUID: vnf.invariantUUID, name: vnf.name, + version: vnf.version, type: 'VF' }) }); @@ -257,33 +283,83 @@ }); }, - packageOnboard: function (onboardPackage) { + nsPackageOnboard: function (onboardPackage, processFun) { console.log('onboard...'); console.log(onboardPackage); var requestBody = { csarId: onboardPackage.uuid }; - if(onboardPackage.type === 'NS') { - return $http({ - url: url+'/ns-packages', - method: 'POST', - data: JSON.stringify(requestBody), - headers: uuiHeaders - }).then(function(response){ - console.log('onboard ns package response...'); - console.log(response.data); - }); - } else { - return $http({ - url: url+'/vf-packages', - method: 'POST', - data: JSON.stringify(requestBody), - headers: uuiHeaders - }).then(function(response){ - console.log('onboard vf package response...'); - console.log(response.data); - }); - } + return $http({ + url: url+'/ns-packages', + method: 'POST', + data: JSON.stringify(requestBody), + headers: uuiHeaders + }).then(function(response){ + console.log('onboard ns package response...'); + console.log(response.data); + processFun(response.data); + }); + }, + + vfPackageOnboard: function (onboardPackage, processFun) { + console.log('onboard...'); + console.log(onboardPackage); + var requestBody = { + csarId: onboardPackage.uuid + }; + return $http({ + url: url+'/vf-packages', + method: 'POST', + data: JSON.stringify(requestBody), + headers: uuiHeaders + }).then(function(response){ + console.log('onboard vf package response...'); + console.log(response.data); + processFun(response.data); + }); + }, + + queryVfOnboardProgress: function (jobId, progressFun) { + return $http({ + url: url+'/jobs/' + jobId, + method: 'GET', + data: null, + headers: uuiHeaders + }).then(function(response){ + console.log('get progress response...'); + console.log(response.data); + progressFun(response.data.responseDescriptor); + }); + }, + + nsPackageDelete: function (deletePackage, processFun) { + console.log('delete package...'); + console.log(deletePackage); + return $http({ + url: url+'/ns-packages/' + deletePackage.uuid, + method: 'DELETE', + data: null, + headers: uuiHeaders + }).then(function(response){ + console.log('delete ns package response...'); + console.log(response.data); + processFun(response.data); + }); + }, + + vfPackageDelete: function (deletePackage, processFun) { + console.log('delete package...'); + console.log(deletePackage); + return $http({ + url: url+'/vf-packages/' + deletePackage.uuid, + method: 'DELETE', + data: null, + headers: uuiHeaders + }).then(function(response){ + console.log('delete vf package response...'); + console.log(response.data); + processFun(response.data); + }); } }; }); diff --git a/usecaseui-lcm/src/main/webapp/app/uui/fusion/scripts/controller/lcmController.js b/usecaseui-lcm/src/main/webapp/app/uui/fusion/scripts/controller/lcmController.js index 78e32aea..0a23df92 100644 --- a/usecaseui-lcm/src/main/webapp/app/uui/fusion/scripts/controller/lcmController.js +++ b/usecaseui-lcm/src/main/webapp/app/uui/fusion/scripts/controller/lcmController.js @@ -16,6 +16,38 @@ app.controller('lcmCtrl', ['$scope', '$uibModal', '$log', '$http', '$timeout', '$interval', 'ServiceTemplateService', function ($scope, $uibModal, $log, $http, $timeout, $interval, ServiceTemplateService) { var ctrl = this; + ctrl.alerts = []; + ctrl.closeAlert = function(index) { + ctrl.alerts.splice(index, 1); + }; + var openServiceProgressDialog = function (serviceId, operationId, title, successFun, failFun) { + var serviceProgressInstance = $uibModal.open({ + ariaLabelledBy: 'modal-title', + ariaDescribedBy: 'modal-body', + templateUrl : 'app/uui/fusion/scripts/view-models/progress-dialog.html', + controller : 'ServiceProgressCtrl', + controllerAs : 'ctrl', + resolve: { + serviceId: function () { + return serviceId; + }, + operationId: function () { + return operationId; + }, + operationTitle: function () { + return title; + } + } + }); + serviceProgressInstance.result.then( + function (result) { + successFun(result); + }, + function (reason) { + failFun(reason); + } + ); + }; ctrl.openCreateServiceDialog = function () { var modalInstance = $uibModal.open({ ariaLabelledBy: 'modal-title', @@ -36,6 +68,16 @@ app.controller('lcmCtrl', ['$scope', '$uibModal', '$log', '$http', '$timeout', ' function(result) { console.log('receive ok button clicked!'); console.log(result); + var successFun = function (result) { + ctrl.alerts.push({type: 'success', msg: result}); + ServiceTemplateService.getServiceInstances(ctrl.customer.id, ctrl.serviceType.value, function (instances) { + ctrl.serviceInstances = instances; + }); + } + var failFun = function (reason) { + ctrl.alerts.push({type: 'danger',msg: reason}); + } + openServiceProgressDialog(result.serviceId, result.operationId, 'Create Service', successFun, failFun); }, function(reason) { console.log('receive cancel button clicked!'); @@ -79,17 +121,89 @@ app.controller('lcmCtrl', ['$scope', '$uibModal', '$log', '$http', '$timeout', ' }; ctrl.deleteService = function (serviceInstance) { - ServiceTemplateService.deleteService(serviceInstance.serviceInstanceId); + var successFun = function (serviceId, operationId) { + var successFun = function (result) { + ctrl.alerts.push({type: 'success', msg: result}); + ServiceTemplateService.getServiceInstances(ctrl.customer.id, ctrl.serviceType.value, function (instances) { + ctrl.serviceInstances = instances; + }); + } + var failFun = function (reason) { + ctrl.alerts.push({type: 'danger',msg: reason}); + } + openServiceProgressDialog(serviceId, operationId, 'Delete Service', successFun, failFun); + } + ServiceTemplateService.deleteService(serviceInstance.serviceInstanceId, successFun); }; ctrl.packageOnboard = function (onboardPackage) { - ServiceTemplateService.packageOnboard(onboardPackage); + if(onboardPackage.type === 'NS') { + var processFun = function (response) { + if('failed' === response.status) { + ctrl.alerts.push({type: 'danger',msg: 'Operation failed! ' + response.statusDescription}); + } else { + ctrl.alerts.push({type: 'success',msg: 'Operation is finished!'}); + } + }; + ServiceTemplateService.nsPackageOnboard(onboardPackage, processFun); + } else { + var openOnboardProgressDialog = function (jobId, title, successFun, failFun) { + var onboardProgressInstance = $uibModal.open({ + ariaLabelledBy: 'modal-title', + ariaDescribedBy: 'modal-body', + templateUrl : 'app/uui/fusion/scripts/view-models/progress-dialog.html', + controller : 'VfOnboardProgressCtrl', + controllerAs : 'ctrl', + resolve: { + jobId: function () { + return jobId; + }, + operationTitle: function () { + return title; + } + } + }); + onboardProgressInstance.result.then( + function (result) { + successFun(result); + }, + function (reason) { + failFun(reason); + } + ); + }; + var successFun = function (result) { + ctrl.alerts.push({type: 'success',msg: 'Operation is finished!'}); + }; + var failFun = function (reason) { + ctrl.alerts.push({type: 'danger',msg: 'Operation is failed! ' + reason}); + }; + var processFun = function (response) { + openOnboardProgressDialog(response.jobId, 'VF Onboarding', successFun, failFun); + }; + ServiceTemplateService.vfPackageOnboard(onboardPackage, processFun); + } + }; + + ctrl.packageDelete = function (deletePackage) { + var processFun = function (response) { + if('failed' === response.status) { + ctrl.alerts.push({type: 'danger',msg: 'Operation failed! ' + response.statusDescription}); + } else { + ctrl.alerts.push({type: 'success',msg: 'Operation is finished!'}); + } + }; + if(deletePackage.type === 'NS') { + ServiceTemplateService.nsPackageDelete(deletePackage, processFun); + } else { + ServiceTemplateService.vfPackageDelete(deletePackage, processFun); + } }; } ] ) -.controller('createServiceCtrl',['$scope', '$uibModalInstance', 'ServiceTemplateService', 'customer', 'serviceType', - function($scope, $uibModalInstance, ServiceTemplateService, customer, serviceType) { +.controller('createServiceCtrl',['$scope', '$uibModal','$uibModalInstance', 'ServiceTemplateService', 'customer', 'serviceType', + function($scope,$uibModal, $uibModalInstance, ServiceTemplateService, customer, serviceType) { var ctrl = this; ServiceTemplateService.getAllServiceTemplates(function (t) { @@ -165,12 +279,19 @@ app.controller('lcmCtrl', ['$scope', '$uibModal', '$log', '$http', '$timeout', ' console.log(customer); console.log(serviceType); console.log(ctrl.realTemplate); - ServiceTemplateService.createService(customer, serviceType, ctrl.service, ctrl.realTemplate); - var result = 'success.'; - $uibModalInstance.close(result); - }; - console.log($uibModalInstance); + + var errorMessage = function () { + + }; + var successFun = function (serviceId, operationId) { + $uibModalInstance.close({ + serviceId: serviceId, + operationId: operationId + }); + } + ServiceTemplateService.createService(customer, serviceType, ctrl.service, ctrl.realTemplate, successFun, errorMessage); + }; // cancel click ctrl.cancel = function() { $uibModalInstance.dismiss('cancel'); @@ -211,4 +332,82 @@ app.controller('lcmCtrl', ['$scope', '$uibModal', '$log', '$http', '$timeout', ' }; }] +).controller('ServiceProgressCtrl', ['$uibModalInstance', 'ServiceTemplateService', 'serviceId', 'operationId', 'operationTitle', '$q', '$interval', +function ($uibModalInstance, ServiceTemplateService, serviceId, operationId, operationTitle, $q, $interval) { + var ctrl = this; + ctrl.title = operationTitle; + ctrl.operation = ''; + ctrl.max = 100; + ctrl.dynamic = 0; + + var timerDeferred = $q.defer(); + var timerPromise = timerDeferred.promise; + + var progressFun = function (serviceProgress) { + if('finished' === serviceProgress.result || 'error' === serviceProgress.result) { + ctrl.dynamic = 100; + timerDeferred.resolve(); + if('finished' === serviceProgress.result) { + $uibModalInstance.close(operationTitle + ' finished!'); + } else if('error' === serviceProgress.result) { + $uibModalInstance.dismiss(operationTitle + ' failed! ' + serviceProgress.reason); + } + console.log('timer finished!'); + } else if('processing' === serviceProgress.result) { + ctrl.dynamic = serviceProgress.progress; + ctrl.operation = serviceProgress.operationContent; + console.log('timer processing ......'); + } + }; + + var timer = $interval(function () { + ServiceTemplateService.queryServiceProgress(serviceId, operationId, progressFun); + }, 1000); + + timerPromise.then(function () { + $interval.cancel(timer); + console.log('timer cancel ---- '); + },function () { + $interval.cancel(timer); + }); +}] +).controller('VfOnboardProgressCtrl', ['$uibModalInstance', 'ServiceTemplateService', 'jobId', 'operationTitle', '$q', '$interval', +function ($uibModalInstance, ServiceTemplateService, jobId, operationTitle, $q, $interval) { + var ctrl = this; + ctrl.title = operationTitle; + ctrl.operation = ''; + ctrl.max = 100; + ctrl.dynamic = 0; + + var timerDeferred = $q.defer(); + var timerPromise = timerDeferred.promise; + + var progressFun = function (responseDescriptor) { + if('finished' === responseDescriptor.status || 'error' === responseDescriptor.status) { + ctrl.dynamic = 100; + timerDeferred.resolve(); + if('finished' === responseDescriptor.status) { + $uibModalInstance.close(''); + } else if('error' === responseDescriptor.status) { + $uibModalInstance.dismiss(responseDescriptor.statusDescription); + } + console.log('timer finished!'); + } else if('processing' === responseDescriptor.status) { + ctrl.dynamic = responseDescriptor.progress; + ctrl.operation = responseDescriptor.statusDescription; + console.log('timer processing ......'); + } + }; + + var timer = $interval(function () { + ServiceTemplateService.queryVfOnboardProgress(jobId, progressFun); + }, 1000); + + timerPromise.then(function () { + $interval.cancel(timer); + console.log('timer cancel ---- '); + },function () { + $interval.cancel(timer); + }); +}] ); diff --git a/usecaseui-lcm/src/main/webapp/app/uui/fusion/scripts/view-models/lifecyclemanagement.html b/usecaseui-lcm/src/main/webapp/app/uui/fusion/scripts/view-models/lifecyclemanagement.html index 0f3c5759..24002d37 100644 --- a/usecaseui-lcm/src/main/webapp/app/uui/fusion/scripts/view-models/lifecyclemanagement.html +++ b/usecaseui-lcm/src/main/webapp/app/uui/fusion/scripts/view-models/lifecyclemanagement.html @@ -17,6 +17,7 @@ --> <div class="templatemo-content-wrapper" ng-controller="lcmCtrl as ctrl" ng-init="ctrl.init()"> <div class="templatemo-content"> + <div style="float:right;width:30%" uib-alert ng-repeat="alert in ctrl.alerts" ng-class="'alert-' + (alert.type || 'warning')" close="ctrl.closeAlert($index)" dismiss-on-timeout="10000">{{alert.msg}}</div> <h1 style="margin-bottom:40px">Life Cycle Manager</h1> <uib-tabset active="active"> @@ -66,6 +67,7 @@ <tr> <th>Name</th> <th>Type</th> + <th>Version</th> <th>Action</th> </tr> </thead> @@ -73,8 +75,10 @@ <tr ng-repeat="package in ctrl.packages"> <td>{{package.name}}</td> <td>{{package.type}}</td> + <td>{{package.version}}</td> <td> <button class="btn btn-primary onboard-button" ng-click="ctrl.packageOnboard(package)">Onboard</button> + <button class="btn btn-primary delete-button" ng-click="ctrl.packageDelete(package)">Delete</button> </td> </tr> </tbody> diff --git a/usecaseui-lcm/src/main/webapp/app/uui/fusion/scripts/view-models/progress-dialog.html b/usecaseui-lcm/src/main/webapp/app/uui/fusion/scripts/view-models/progress-dialog.html new file mode 100644 index 00000000..d89fa2be --- /dev/null +++ b/usecaseui-lcm/src/main/webapp/app/uui/fusion/scripts/view-models/progress-dialog.html @@ -0,0 +1,31 @@ +<!-- + + Copyright 2016-2017 ZTE Corporation. + + 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. + +--> +<div class="modal-header" style="margin-bottom: 15px;"> + <h4 class="modal-title" id="myModalLabel"> + <span>{{ctrl.title}}</span> + </h4> +</div> + +<div class="modal-body"> + <h5>{{ctrl.operation}}</h5> + <uib-progressbar max="ctrl.max" value="ctrl.dynamic"><span style="color:white; white-space:nowrap;">{{ctrl.dynamic}}%</span></uib-progressbar> +</div> + +<div class="modal-footer"> + +</div> |