diff options
Diffstat (limited to 'usecaseui-lcm/src/main')
10 files changed, 0 insertions, 2913 deletions
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 deleted file mode 100644 index 9f813a36..00000000 --- a/usecaseui-lcm/src/main/webapp/app/uui/fusion/scripts/controller/ServiceTemplateService.js +++ /dev/null @@ -1,538 +0,0 @@ -/* - * 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. - */ - app.factory("ServiceTemplateService", function($http, $log) { - var url = '/api/usecaseui-server/v1/uui-lcm'; - var uuiHeaders = JSON.stringify({ - 'Content-Type': 'application/json' - // 'Authorization':'Basic dXNlY2FzZTp1c2VjYXNl' - }); - return { - getAllCustomers: function (processFun) { - console.log("customers") - return $http({ - url: url+'/customers', - method: 'GET', - data: null, - headers: uuiHeaders - }).then(function(response){ - console.log(response) - var customers = response.data; - var result = customers.map(function (customer) { - return { - name: customer['subscriber-name'], - id: customer['global-customer-id'], - }; - }); - processFun(result); - }); - }, - - getAllServiceTypes: function (customerId, processFun) { - return $http({ - url: url+'/customers/' + customerId + '/service-subscriptions', - method: 'GET', - data: null, - headers: uuiHeaders - }).then(function(response){ - var serviceSubscriptions = response.data; - var result = serviceSubscriptions.map(function (serviceSubscription) { - return { - name: serviceSubscription['service-type'], - value: serviceSubscription['service-type'] - }; - }); - processFun(result); - }); - }, - - getServiceInstances: function (customerId, serviceType, processFun) { - return $http({ - url: url+'/service-instances?customerId='+customerId+'&serviceType='+serviceType, - method: 'GET', - data: null, - headers: uuiHeaders - }).then(function(response){ - var serviceInstances = response.data; - console.log(serviceInstances); - var result = serviceInstances.map(function (serviceInstance) { - return { - serviceInstanceId: serviceInstance['service-instance-id'], - serviceInstanceName: serviceInstance['service-instance-name'], - serviceType: serviceInstance['service-type'], - }; - }); - processFun(result); - }); - }, - - getAllServiceTemplates: function (processFun) { - return $http({ - url: url+'/service-templates', - method: 'GET', - data: null, - headers: uuiHeaders - }).then(function(response){ - var templates = response.data; - var result = templates.map(function (template) { - return { - name: template.name, - id: template.uuid, - invariantUUID: template.invariantUUID, - version: template.version, - toscaModelURL: template.toscaModelURL - }; - }); - processFun(result); - }) - }, - - getupdateServiceTemplate:function(serviceInstanceId,processFun){ - return $http({ - url: url+'/xxxxxxx/'+ serviceInstanceId, - method: 'GET', - data: null, - headers: uuiHeaders - }).then(function(response){ - var template = response.data; - - processFun(template); - }) - }, - - getTemplateParameters: function (template, processFun) { - console.log(url+'/service-templates/' + template.id+'?toscaModelPath='+ template.toscaModelURL); - return $http({ - url: url+'/service-templates/' + template.id+'?toscaModelPath='+ template.toscaModelURL, - method: 'GET', - data: null, - headers: uuiHeaders - }).then(function(response){ - var inputRsp = response.data; - console.log(inputRsp); - processFun(inputRsp); - }); - }, - - getComparedTemplateParameters: function (serviceInstanceId,template, processFun) { - var requestBody = { - "model-invariant-id-target": template.invariantUUID, - "model-version-id-target": template.id - } - return $http({ - url: url+'/xxxxxxxxx/' + serviceInstanceId, - method: 'POST', - data: JSON.stringify(requestBody), - headers: uuiHeaders - }).then(function(response){ - var inputRsp = response.data; - console.log(inputRsp); - processFun(inputRsp); - }); - }, - - getAllVimInfo: function (processFun) { - return $http({ - url: url+'/locations/', - method: 'GET', - data: null, - headers: uuiHeaders - }).then(function(response){ - var vimInfos = response.data; - console.log(vimInfos); - var result = vimInfos.map(function (vim) { - return { - name: vim['cloud-owner'], //complex-name - value: vim['cloud-owner'] + '_' + vim['cloud-region-id'] - }; - }); - processFun(result); - }); - }, - - getAllSdnControllers: function (processFun) { - return $http({ - url: url+'/sdnc-controllers/', - method: 'GET', - data: null, - headers: uuiHeaders - }).then(function(response){ - var sdnControllers = response.data; - console.log(sdnControllers); - var result = sdnControllers.map(function (sdn) { - return { - name: sdn['thirdparty-sdnc-id'], - value: sdn['thirdparty-sdnc-id'] - }; - }); - processFun(result); - }); - }, - - createService: function (customer, serviceType, service, template, successFun, failedFun) { - var reqPara = []; - var newreqParas = {}; - service.segments.forEach(function (segment) { - var reqParas = {}; - var vfLocations = []; - segment.parameters.forEach(function (parameter) { - if(parameter.type === 'vf_location') { - // name is uuid for vf_location - var loc = { - vnfProfileId: parameter.name, - locationConstraints : { - vimId: parameter.value.value - } - }; - vfLocations.push(loc); - } else if(parameter.type === 'sdn_controller') { - if(parameter.value === undefined || parameter.value === null) { - reqParas[parameter.name] = ''; - } else { - reqParas[parameter.name] = parameter.value.value; - } - } else { - reqParas[parameter.name] = parameter.value; - } - }); - - var para = { - resourceName: segment.nodeTemplateName, - resourceInvariantUuid: segment.invariantUUID,//resourceDefId - resourceUuid: segment.uuid, - resourceCustomizationUuid: segment.customizationUuid, - parameters: { //nsParameters - locationConstraints: vfLocations, - // additionalParamForNs: reqParas, - resources:[], - requestInputs:reqParas - } - }; - reqPara.push(para); - }); - - var templateName = template.name; - if( template.version !== undefined && template.version !== null && template.version !== '' ) { - templateName = templateName + ":" + template.version; - } - - service.parameters.forEach(function(item){ - newreqParas[item.name] = item.value; - }) - - var requestBody = { - service: { - name: service.serviceName, - description: service.serviceDescription, - serviceInvariantUuid: template.invariantUUID, //serviceDefId - serviceUuid: template.uuid, // uuid ?? templateId - globalSubscriberId: customer.id, - serviceType: serviceType.value, - parameters: { - // globalSubscriberId: customer.id, - // subscriberName: customer.name, - // serviceType: serviceType.value, - // templateName: templateName, - locationConstraints:[], - resources: reqPara, - requestInputs:newreqParas - } - } - }; - - console.log(requestBody); - // console.log(JSON.stringify(requestBody)); - // return false; - return $http({ - url: url+'/services', - method: 'POST', - data: JSON.stringify(requestBody), - headers: uuiHeaders - }).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); - }); - }, - - updateService: function (customer, serviceType,serviceInstanceId, service, template, successFun, failedFun) { - var reqPara = []; - var newreqParas = {}; - service.segments.forEach(function (segment) { - var reqParas = {}; - var vfLocations = []; - segment.parameters.forEach(function (parameter) { - if(parameter.type === 'vf_location') { - // name is uuid for vf_location - var loc = { - vnfProfileId: parameter.name, - locationConstraints : { - vimId: parameter.value.value - } - }; - vfLocations.push(loc); - } else if(parameter.type === 'sdn_controller') { - if(parameter.value === undefined || parameter.value === null) { - reqParas[parameter.name] = ''; - } else { - reqParas[parameter.name] = parameter.value.value; - } - } else { - reqParas[parameter.name] = parameter.value; - } - }); - - var para = { - resourceName: segment.nodeTemplateName, - resourceInvariantUuid: segment.invariantUUID,//resourceDefId - resourceUuid: segment.uuid, - resourceCustomizationUuid: segment.customizationUuid, - parameters: { //nsParameters - locationConstraints: vfLocations, - // additionalParamForNs: reqParas, - resources:[], - requestInputs:reqParas - } - }; - reqPara.push(para); - }); - - var templateName = template.name; - if( template.version !== undefined && template.version !== null && template.version !== '' ) { - templateName = templateName + ":" + template.version; - } - - service.parameters.forEach(function(item){ - newreqParas[item.name] = item.value; - }) - - var requestBody = { - service: { - name: service.serviceName, - description: service.serviceDescription, - serviceInvariantUuid: template.invariantUUID, //serviceDefId - serviceUuid: template.uuid, // uuid ?? templateId - globalSubscriberId: customer.id, - serviceType: serviceType.value, - parameters: { - // globalSubscriberId: customer.id, - // subscriberName: customer.name, - // serviceType: serviceType.value, - // templateName: templateName, - locationConstraints:[], - resources: reqPara, - requestInputs:newreqParas - } - } - }; - - console.log(requestBody); - // console.log(JSON.stringify(requestBody)); - return false; - return $http({ - url: url+ '/services/updateService/' + serviceInstanceId, - method: 'POST', - data: JSON.stringify(requestBody), - headers: uuiHeaders - }).then(function(response){ - console.log('update response...'); - console.log(response.data); - // var serviceId = response.data.service.serviceId; - var operationId = response.data.service.operationId; - successFun(operationId); - }); - }, - - getScaleServiceDialog:function(customer,serviceType,serviceInstanceId,successFun){ - return $http({ - url:url+'/getServiceInstanceById?customerId=' + customer + '&serviceType=' + serviceType + '&serviceId=' + serviceInstanceId, - method:'GET' - }).then(function(response){ - successFun(response); - }) - }, - - scaleService: function (requestBody, successFun, failedFun) { - - console.log(requestBody); - console.log(JSON.stringify(requestBody)); - - return $http({ - url: url+'/services/scaleServices/'+requestBody.service.globalSubscriberId, - method: 'POST', - data: JSON.stringify(requestBody), - headers: uuiHeaders - }).then(function(response){ - // console.log('create response...'); - console.log(response); - var operationId = response.data.operationId; - if(operationId == null){ - console.log('error: operationId is null'); - return false; - } - successFun( operationId); - }); - }, - - deleteService: function (serviceId, customer, serviceType, successFun) { - var requestBody = { - globalSubscriberId: customer.id, - serviceType: serviceType.value - }; - return $http({ - url: url+'/services/' + serviceId, - method: 'DELETE', - data: JSON.stringify(requestBody), - headers: uuiHeaders - }).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 - }); - }); - }, - - getPackages: function (processFun) { - return $http({ - url: url+'/vf-ns-packages', - method: 'GET', - data: null, - headers: uuiHeaders - }).then(function(response){ - var packageRsp = response.data; - var packages = []; - packageRsp.nsPackage.forEach(function (ns) { - packages.push({ - uuid: ns.uuid, - invariantUUID: ns.invariantUUID, - name: ns.name, - version: ns.version, - type: 'NS' - }) - }); - packageRsp.vnfPackages.forEach(function (vnf) { - packages.push({ - uuid: vnf.uuid, - invariantUUID: vnf.invariantUUID, - name: vnf.name, - version: vnf.version, - type: 'VF' - }) - }); - processFun(packages); - }); - }, - - nsPackageOnboard: function (onboardPackage, processFun) { - console.log('onboard...'); - console.log(onboardPackage); - var requestBody = { - csarId: onboardPackage.uuid - }; - 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, responseId, progressFun) { - return $http({ - url: url+'/jobs/' + jobId + '?responseId=' + responseId, - 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 deleted file mode 100644 index 73dc6edb..00000000 --- a/usecaseui-lcm/src/main/webapp/app/uui/fusion/scripts/controller/lcmController.js +++ /dev/null @@ -1,822 +0,0 @@ -/* - * 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. - */ -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', - ariaDescribedBy: 'modal-body', - templateUrl: 'app/uui/fusion/scripts/view-models/create-service-dialog.html', - controller: 'createServiceCtrl', - controllerAs: 'ctrl', - resolve: { - customer: function () { - return ctrl.customer; - }, - serviceType: function () { - return ctrl.serviceType; - } - } - }); - modalInstance.result.then( - 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!'); - console.log(reason); - $log.info('Modal dismissed at: ' + new Date()); - } - ); - }; - - ctrl.init = function () { - ctrl.canCreateService = "true"; - ServiceTemplateService.getAllCustomers(function (customers) { - ctrl.customers = customers; - }); - ServiceTemplateService.getPackages(function (packages) { - ctrl.packages = packages; - }); - }; - - ctrl.customerChanged = function () { - if (ctrl.customer === undefined || ctrl.customer === null) { - ctrl.serviceTypes = []; - } else { - ServiceTemplateService.getAllServiceTypes(ctrl.customer.id, function (serviceTypes) { - ctrl.serviceTypes = serviceTypes; - }); - } - ctrl.serviceType = undefined; - ctrl.canCreateService = "true"; - }; - - ctrl.serviceTypeChanged = function () { - if (ctrl.serviceType === undefined || ctrl.serviceType === null || ctrl.customer === undefined || ctrl.customer === null) { - ctrl.canCreateService = "true"; - return; - } - ctrl.canCreateService = "false"; - ServiceTemplateService.getServiceInstances(ctrl.customer.id, ctrl.serviceType.value, function (instances) { - ctrl.serviceInstances = instances; - }); - }; - - ctrl.scaleService = function (serviceInstance) { - - var modalInstance = $uibModal.open({ - ariaLabelledBy: 'modal-title', - ariaDescribedBy: 'modal-body', - templateUrl: 'app/uui/fusion/scripts/view-models/scale-service-dialog.html', - controller: 'scaleServiceCtrl', - controllerAs: 'ctrl', - resolve: { - customer: function () { - return ctrl.customer; - }, - serviceType: function () { - return ctrl.serviceType; - }, - serviceInstance: serviceInstance - } - }); - modalInstance.result.then( - function (result) { - console.log(result); - console.log(serviceInstance); - 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) { - console.log(reason) - ctrl.alerts.push({ - type: 'danger', - msg: reason - }); - } - openServiceProgressDialog(result.serviceId, result.operationId, 'Scale Service', successFun, failFun); - }, - function (reason) { - console.log('receive cancel button clicked!'); - console.log(reason); - $log.info('Modal dismissed at: ' + new Date()); - } - ); - - }; - - ctrl.deleteService = function (serviceInstance) { - console.log(serviceInstance); - var deleteServiceName = serviceInstance.serviceInstanceName; - var modalInstance = $uibModal.open({ - ariaLabelledBy: 'modal-title', - ariaDescribedBy: 'modal-body', - template:(function(deleteServiceName){ - var strtemplate = - '<div class="modal-header" style="background-color:#eee;">'+ - '<h4 class="modal-title" id="myModalLabel">'+ - '<span>Delete Request</span>'+ - '</h4>'+ - '</div>'+ - '<div class="modal-body">'+ - '<h3 style="margin-top:10px;"> Are you sure you want to delete <span style="color:red">'+ deleteServiceName + '</span>? </h3>'+ - '</div>'+ - '<div class="modal-footer">'+ - '<button type="button" style="width:80px;" class="btn btn-primary" ng-click="ctrl.ok()" id="startToCreateService">'+ - '<span id="nfv-virtualApplication-iui-text-cancelBtn">YES</span>'+ - '</button>'+ - '<button type="button" style="width:80px;" class="btn btn-warning" ng-click="ctrl.cancel()">'+ - '<span id="nfv-virtualApplication-iui-text-previousBtn">NO</span>'+ - '</button>'+ - '</div>'; - return strtemplate; - })(deleteServiceName), - - controller: function($uibModalInstance){ - this.ok = function(){ - $uibModalInstance.close('delete implement'); - }; - this.cancel = function(){ - $uibModalInstance.dismiss('delete cancel'); - } - } , - controllerAs: 'ctrl', - }); - modalInstance.result.then( - function(res){ - console.log(res); - 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, ctrl.customer, ctrl.serviceType, successFun); - }, - function(reason){ - console.log(reason); - } - ) - }; - - ctrl.upDateService = function (serviceInstance) { - - var modalInstance = $uibModal.open({ - ariaLabelledBy: 'modal-title', - ariaDescribedBy: 'modal-body', - templateUrl: 'app/uui/fusion/scripts/view-models/update-service-dialog.html', - controller: 'updateServiceCtrl', - controllerAs: 'ctrl', - resolve: { - customer: function () { - return ctrl.customer; - }, - serviceType: function () { - return ctrl.serviceType; - }, - serviceInstance: serviceInstance - } - }); - modalInstance.result.then( - function (result) { - console.log(result); - console.log(serviceInstance); - 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) { - console.log(reason) - ctrl.alerts.push({ - type: 'danger', - msg: reason - }); - } - openServiceProgressDialog(result.serviceId, result.operationId, 'upDate Service', successFun, failFun); - }, - function (reason) { - console.log('receive cancel button clicked!'); - console.log(reason); - $log.info('Modal dismissed at: ' + new Date()); - } - ); - - }; - - ctrl.packageOnboard = function (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) { - if (deletePackage.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.nsPackageDelete(deletePackage, 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, 'Delete VF package', successFun, failFun); - }; - ServiceTemplateService.vfPackageDelete(deletePackage, processFun); - } - }; - - ctrl.jumpToUrl = function () { - var obj = $("#lm"); - angular.element(obj).scope().currentTab = "app/uui/fusion/scripts/view-models/device-topological.html"; - } - - } - ]) - .controller('createServiceCtrl', ['$scope', '$uibModal', '$uibModalInstance', 'ServiceTemplateService', 'customer', 'serviceType', - function ($scope, $uibModal, $uibModalInstance, ServiceTemplateService, customer, serviceType) { - var ctrl = this; - - ServiceTemplateService.getAllServiceTemplates(function (t) { - ctrl.templates = t; - }); - - ctrl.changeInput = function (serviceTemplate) { - var paras = serviceTemplate.inputs.map(function (input) { - return { - name: input.name, - type: input.type, - description: input.description, - defaultValue: input.defaultValue, - isRequired: input.isRequired, - readonly: "" - }; - }); - - var segmentsPara = serviceTemplate.nestedTemplates.map(function (nestedTemplate) { - var nestedParas = nestedTemplate.inputs.map(function (input) { - return { - name: input.name, - type: input.type, - description: input.description, - defaultValue: input.defaultValue, - isRequired: input.isRequired, - readonly: "" - }; - }); - return { - nodeTemplateName: nestedTemplate.name, - customizationUuid:nestedTemplate.customizationUuid, - invariantUUID: nestedTemplate.invariantUUID, - uuid: nestedTemplate.uuid, - type: nestedTemplate.type, - parameters: nestedParas - }; - }); - - var service = { - serviceName: ctrl.service.serviceName, - serviceDescription: ctrl.service.serviceDescription, - parameters: paras, - segments: segmentsPara - }; - ctrl.service = service; - console.log(service); - }; - ctrl.service = { - serviceName: '', - serviceDescription: '', - parameters: [], - segments: [] - }; - ctrl.sdnControllers = []; - ctrl.locations = []; - - ctrl.serviceTemplateChanged = function (template) { - console.log(template); - if (template === undefined || template === null) { - ctrl.service = undefined; - ctrl.realTemplate = undefined; - } else { - ServiceTemplateService.getTemplateParameters(template, function (templateRsp) { - ctrl.realTemplate = templateRsp; - ctrl.changeInput(ctrl.realTemplate); - }); - } - }; - - ctrl.ok = function () { - console.log('ok button clicked!'); - console.log('service: '); - console.log(customer); - console.log(serviceType); - console.log(ctrl.service); - console.log(ctrl.realTemplate); - - - 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'); - }; - - ServiceTemplateService.getAllVimInfo(function (vims) { - ctrl.locations = vims; - }); - - ServiceTemplateService.getAllSdnControllers(function (sdnControllers) { - ctrl.sdnControllers = sdnControllers; - }); - } - ]) - .controller('scaleServiceCtrl', ['$scope', '$uibModal', '$uibModalInstance', 'ServiceTemplateService', 'customer', 'serviceType','serviceInstance', - function ($scope, $uibModal, $uibModalInstance, ServiceTemplateService, customer, serviceType, serviceInstance) { - var ctrl = this; - console.log(ctrl); - console.log(customer); - console.log(serviceType); - console.log(serviceInstance); - - ServiceTemplateService.getScaleServiceDialog(customer.name,serviceType.name,serviceInstance.serviceInstanceId,function(data){ - console.log(data.data); - ctrl.nsData = data.data; - // console.log(ctrl) - }) - ctrl.scaleTypes = ["SCALE_NS","SCALE_VNF"]; - ctrl.scalingDirections = ["SCALE_IN","SCALE_OUT"]; - - ctrl.ok = function () { - - let resources = []; - ctrl.nsData.forEach(function(item){ - resources.push({ - "resourceInstanceId": item.netWorkServiceId, - "scaleType": item.scaleType, - "scaleNsData": { - "scaleNsByStepsData": { - "aspectId": item.aspectId, - "numberOfSteps": item.numberOfStep, - "scalingDirection": item.scalingDirection - } - } - }) - }) - var requestBody = { - "service":{ - "serviceInstanceName": serviceInstance.serviceInstanceName, - "serviceType": serviceType.value, - "globalSubscriberId": serviceInstance.serviceInstanceId, - "resources": resources - } - }; - var errorMessage = function () { - - }; - var successFun = function ( operationId) { - $uibModalInstance.close({ - serviceId:serviceInstance.serviceInstanceId, - operationId: operationId - }); - } - ServiceTemplateService.scaleService(requestBody, successFun, errorMessage); - - }; - // cancel click - ctrl.cancel = function () { - // $uibModalInstance.close("ok关闭效果"); - $uibModalInstance.dismiss('cancel'); - }; - - } - ]) - .controller('updateServiceCtrl', ['$scope', '$uibModal', '$uibModalInstance', 'ServiceTemplateService', 'customer', 'serviceType','serviceInstance', - function ($scope, $uibModal, $uibModalInstance, ServiceTemplateService, customer, serviceType,serviceInstance) { - var ctrl = this; - console.log(serviceInstance) - var serviceInstanceId = serviceInstance.serviceInstanceId; - ServiceTemplateService.getupdateServiceTemplate(serviceInstanceId,function(template){ - console.log(template); - ServiceTemplateService.getAllServiceTemplates(function (res) { - console.log(res) - var slectTemplates = []; - res.forEach(function(item){ - if(item.id === template.model-version-id && itme.invariantUUID !== template.model-invariant-id){ - slectTemplates.push(item); - } - }) - ctrl.templates = slectTemplates; - }); - }) - - - ctrl.changeInput = function (serviceTemplate) { - var paras = serviceTemplate.inputs.map(function (input) { - return { - name: input.name, - type: input.type, - description: input.description, - defaultValue: input.defaultValue, - isRequired: input.isRequired, - readonly: "" - }; - }); - - var segmentsPara = serviceTemplate.nestedTemplates.map(function (nestedTemplate) { - var nestedParas = nestedTemplate.inputs.map(function (input) { - return { - name: input.name, - type: input.type, - description: input.description, - defaultValue: input.defaultValue, - isRequired: input.isRequired, - readonly: "" - }; - }); - return { - nodeTemplateName: nestedTemplate.name, - customizationUuid:nestedTemplate.customizationUuid, - invariantUUID: nestedTemplate.invariantUUID, - uuid: nestedTemplate.uuid, - type: nestedTemplate.type, - parameters: nestedParas - }; - }); - - var service = { - serviceName: ctrl.service.serviceName, - serviceDescription: ctrl.service.serviceDescription, - parameters: paras, - segments: segmentsPara - }; - ctrl.service = service; - console.log(service); - }; - ctrl.service = { - serviceName: '', - serviceDescription: '', - parameters: [], - segments: [] - }; - ctrl.sdnControllers = []; - ctrl.locations = []; - - ctrl.serviceTemplateChanged = function (template) { - console.log('serviceTemplateChanged invoked... ' + template); - if (template === undefined || template === null) { - ctrl.service = undefined; - ctrl.realTemplate = undefined; - } else { - ServiceTemplateService.getComparedTemplateParameters(serviceInstanceId,template, function (templateRsp) { - ctrl.realTemplate = templateRsp; - ctrl.changeInput(ctrl.realTemplate); - }); - } - }; - - ctrl.ok = function () { - console.log('ok button clicked!'); - console.log('service: '); - console.log(customer); - console.log(serviceType); - console.log(ctrl.service); - console.log(ctrl.realTemplate); - - - var errorMessage = function () { - - }; - var successFun = function (operationId) { - $uibModalInstance.close({ - serviceId: serviceInstanceId, - operationId: operationId - }); - } - ServiceTemplateService.updateService(customer, serviceType,serviceInstanceId, ctrl.service, ctrl.realTemplate, successFun, errorMessage); - }; - // cancel click - ctrl.cancel = function () { - $uibModalInstance.dismiss('cancel'); - }; - - ServiceTemplateService.getAllVimInfo(function (vims) { - ctrl.locations = vims; - }); - - ServiceTemplateService.getAllSdnControllers(function (sdnControllers) { - ctrl.sdnControllers = sdnControllers; - }); - } - ]) - .controller('packageOnboardCtrl', ['$scope', '$uibModalInstance', 'ServiceTemplateService', 'onboardPackage', - function ($scope, $uibModalInstance, ServiceTemplateService, onboardPackage) { - var ctrl = this; - - ServiceTemplateService.getAllVimInfo(function (vims) { - ctrl.packageLocations = vims; - }); - - ctrl.ok = function () { - var proVims = []; - ctrl.packageLocations.forEach(function (location) { - if (location.productenv) { - proVims.push(location.name); - } - }); - ServiceTemplateService.packageOnboard(onboardPackage, { - testenv: ctrl.testenv, - productenv: proVims - }); - $uibModalInstance.close('successfully'); - }; - // cancel click - ctrl.cancel = function () { - $uibModalInstance.dismiss('cancel'); - }; - - } - ]) - .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) { - if(serviceProgress.progress > ctrl.dynamic){ - ctrl.dynamic = serviceProgress.progress; - } - ctrl.operation = serviceProgress.operationContent; - console.log('timer processing ......'); - } - }; - - var timer = $interval(function () { - ServiceTemplateService.queryServiceProgress(serviceId, operationId, progressFun); - }, 5000); - - 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 responseId = '0'; - 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 ......'); - responseId = responseDescriptor.responseId; - if (responseId === undefined) { - console.log('Cannot get responseId...'); - $uibModalInstance.close(''); - timerDeferred.resolve(); - } - } - }; - - var timer = $interval(function () { - ServiceTemplateService.queryVfOnboardProgress(jobId, responseId, progressFun); - }, 1000); - - timerPromise.then(function () { - $interval.cancel(timer); - console.log('timer cancel ---- '); - }, function () { - $interval.cancel(timer); - }); - } - ]);
\ No newline at end of file diff --git a/usecaseui-lcm/src/main/webapp/app/uui/fusion/scripts/view-models/create-service-dialog.html b/usecaseui-lcm/src/main/webapp/app/uui/fusion/scripts/view-models/create-service-dialog.html deleted file mode 100644 index 810fe81f..00000000 --- a/usecaseui-lcm/src/main/webapp/app/uui/fusion/scripts/view-models/create-service-dialog.html +++ /dev/null @@ -1,132 +0,0 @@ -<!-- - - 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>Create</span> - </h4> -</div> - -<div class="modal-body"> - <form class="form-horizontal" role="form" id="neForm"> - - <uib-tabset active="active"> - <uib-tab heading="Base"> - <div id="basicInfoTab" style="margin-top:20px;"> - <div class="mT15 form-group" style="margin-left:25px;"> - <label class="col-sm-3 control-label"> - <span>Service Name</span> - <span class="required">*</span> - </label> - <div class="col-sm-7"> - <input type="text" id="svcName" name="svcName" class="form-control" placeholder="Service Name" maxlength="256" ng-model="ctrl.service.serviceName"/> - </div> - </div> - <div class="mT15 form-group" style="margin-left:25px;"> - <label class="col-sm-3 control-label"> - <span>Service Description</span> - <span class="required">*</span> - </label> - <div class="col-sm-7"> - <input type="text" id="svcDesc" name="" class="form-control" placeholder="Service Description" maxlength="256" ng-model="ctrl.service.serviceDescription"/> - </div> - </div> - <div class="form-group" style="margin-left:25px;margin-bottom:15px;"> - <label class="col-sm-3 control-label"> - <span>Service Template</span> - <span class="required">*</span> - </label> - <div class="col-sm-7"> - <select class="form-control" style="padding-top: 0px;padding-bottom: 0px;" id="svcTempl" name="svcTempl" ng-change="ctrl.serviceTemplateChanged(ctrl.selectedTemplate)" ng-model="ctrl.selectedTemplate" ng-options="template.name for template in ctrl.templates"> - <option value="">--select--</option> - </select> - </div> - </div> - </div> - </uib-tab> - <uib-tab heading="Template Parameters"> - <div id='templateParasTab' style="margin-top:20px;"> - - <fieldset ng-repeat="segment in ctrl.service.segments" style="margin-left:25px;"> - <legend>{{segment.nodeTemplateName}}</legend> - <!-- <div class="form-group" style="margin-left:0px;margin-bottom:5px;"> - <label class="col-sm-5 control-label"> - <span>{{segment.location.name}}</span><span class="required">*</span> - </label> - <div class="col-sm-5"> - <select class="form-control" style ="padding-top: 0px;padding-bottom: 0px;" ng-model="segment.location.value" ng-options="option.value for option in ctrl.locations"> - <option value="">select</option> - </select> - </div> - </div> --> - <div ng-repeat="segment_parameter in segment.parameters" class="mT15 form-group" style="margin-left:0px;"> - <label ng-if="segment_parameter.type === 'vf_location'" class="col-sm-5 control-label"> - <span>{{segment_parameter.description}}</span><span ng-if="segment_parameter.isRequired" class="required">*</span> - </label> - <label ng-if="segment_parameter.type !== 'vf_location'" class="col-sm-5 control-label"> - <span>{{segment_parameter.name}}</span><span ng-if="segment_parameter.isRequired" class="required">*</span> - </label> - <div ng-if="segment_parameter.type === 'string' || segment_parameter.type === 'boolean' || segment_parameter.type === 'integer'" class="col-sm-5"> - <input type="text" name="{{segment_parameter.description}}" class="form-control" ng-model="segment_parameter.value" placeholder="{{segment_parameter.name}}" value="{{segment_parameter.defaultValue}}" ng-readonly="{{segment_parameter.readonly}}"/> - </div> - <div ng-if="segment_parameter.type === 'vf_location'" class="col-sm-5"> - <select class="form-control" style ="padding-top: 1px;padding-bottom: 0px;" ng-model="segment_parameter.value" ng-options="option.name for option in ctrl.locations"> - <option value="">--select--</option> - </select> - </div> - <div ng-if="segment_parameter.type === 'sdn_controller'" class="col-sm-5"> - <select class="form-control" style ="padding-top: 0px;padding-bottom: 0px;" ng-model="segment_parameter.value" ng-options="option.value for option in ctrl.sdnControllers"> - <option value="">--select--</option> - </select> - </div> - </div> - </fieldset> - <legend>Service Inputs</legend> - <div ng-repeat="parameter in ctrl.service.parameters" class="mT15 form-group" style="margin-left:0px;"> - <label class="col-sm-5 control-label"> - <span>{{parameter.name}}</span><span ng-if="parameter.isRequired" class="required">*</span> - </label> - <div ng-if="parameter.type === 'string' || parameter.type === 'boolean' || parameter.type === 'integer'" class="col-sm-5"> - <input type="text" name="{{parameter.description}}" class="form-control" ng-model="parameter.value" placeholder="{{parameter.name}}" value="{{parameter.defaultValue}}" ng-readonly="{{parameter.readonly}}"/> - </div> - <div ng-if="parameter.type === 'vf_location'" class="col-sm-5"> - <select class="form-control" style ="padding-top: 0px;padding-bottom: 0px;" ng-model="parameter.value" ng-options="option.name for option in ctrl.locations"> - <option value="">--select--</option> - </select> - </div> - <div ng-if="parameter.type === 'sdn_controller'" class="col-sm-5"> - <select class="form-control" style ="padding-top: 0px;padding-bottom: 0px;" ng-model="parameter.value" ng-options="option.value for option in ctrl.sdnControllers"> - <option value="">--select--</option> - </select> - </div> - </div> - - </div> - </uib-tab> - </uib-tabset> - -</form> -</div> - -<div class="modal-footer"> - <button type="button" style="width:80px;" class="btn btn-primary" ng-click="ctrl.ok()" id="startToCreateService"> - <span id="nfv-virtualApplication-iui-text-cancelBtn">OK</span> - </button> - <button type="button" style="width:80px;" class="btn btn-warning" ng-click="ctrl.cancel()"> - <span id="nfv-virtualApplication-iui-text-previousBtn">Cancel</span> - </button> -</div> 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 deleted file mode 100644 index 4f50651b..00000000 --- a/usecaseui-lcm/src/main/webapp/app/uui/fusion/scripts/view-models/lifecyclemanagement.html +++ /dev/null @@ -1,111 +0,0 @@ -<!-- - - 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="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"> - <uib-tab heading="Services"> - <div id="serviceTable" style="margin-top:20px;"> - <label> - <span>Customer</span> - <span class="required">*</span> - </label> - <select id="customer" ng-change="ctrl.customerChanged()" ng-model="ctrl.customer" ng-options="c.name for c in ctrl.customers"> - <option value="">--select--</option> - </select> - <label style="margin-left:10px"> - <span>Service Type</span> - <span class="required">*</span> - </label> - <select id="serviceType" ng-change="ctrl.serviceTypeChanged()" ng-model="ctrl.serviceType" ng-options="t.name for t in ctrl.serviceTypes"> - <option value="">--select--</option> - </select> - <button id="createService" class="btn btn-primary" style="margin-bottom:10px;margin-left:10px" ng-click="ctrl.openCreateServiceDialog()"> - <span>Create</span> - </button> - <table class="table table-striped table-hover table-bordered" style="margin:2px"> - <thead> - <tr> - <th>Service Instance Id</th> - <th>Service Name</th> - <th>Service Type</th> - <th>Action</th> - </tr> - </thead> - <tbody id="bb"> - <tr ng-repeat="serviceInstance in ctrl.serviceInstances" ng-if="serviceInstance.serviceType==='E2E Service'"> - <td>{{serviceInstance.serviceInstanceId}}</td> - <td>{{serviceInstance.serviceInstanceName}}</td> - <td>{{serviceInstance.serviceType}}</td> - <td> - <button class="btn btn-primary" ng-click="ctrl.scaleService(serviceInstance)">Scale</button> - <button class="btn btn-primary" ng-click="ctrl.deleteService(serviceInstance)">Delete</button> - <!-- <button class="btn btn-primary" ng-click="ctrl.upDateService(serviceInstance)">upDate</button> --> - </td> - </tr> - </tbody> - </table> - </div> - </uib-tab> - <uib-tab heading="Vnf/NS Packages"> - <div id="vnfNsPackages" style="margin-top:20px;"> - <table id="onbaordTable" class="table table-striped table-hover table-bordered"> - <thead> - <tr> - <th>Name</th> - <th>Type</th> - <th>Version</th> - <th>Action</th> - </tr> - </thead> - <tbody> - <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> - </table> - </div> - </uib-tab> - </uib-tabset> -</div> - -<!-- Modal --> -<div class="modal fade" id="confirmModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"> - <div class="modal-dialog"> - <div class="modal-content"> - <div class="modal-header"> - <button type="button" class="close" data-dismiss="modal"> - <span aria-hidden="true">×</span><span class="sr-only">Close</span> - </button> - <h4 class="modal-title" id="myModalLabel">Are you sure you want to sign out?</h4> - </div> - <div class="modal-footer"> - <a href="sign-in.html" class="btn btn-primary">Yes</a> - <button type="button" class="btn btn-default" data-dismiss="modal">No</button> - </div> - </div> - </div> -</div> 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 deleted file mode 100644 index d89fa2be..00000000 --- a/usecaseui-lcm/src/main/webapp/app/uui/fusion/scripts/view-models/progress-dialog.html +++ /dev/null @@ -1,31 +0,0 @@ -<!-- - - 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> diff --git a/usecaseui-lcm/src/main/webapp/app/uui/fusion/scripts/view-models/scale-service-dialog.html b/usecaseui-lcm/src/main/webapp/app/uui/fusion/scripts/view-models/scale-service-dialog.html deleted file mode 100644 index 19fa8edd..00000000 --- a/usecaseui-lcm/src/main/webapp/app/uui/fusion/scripts/view-models/scale-service-dialog.html +++ /dev/null @@ -1,84 +0,0 @@ -<!-- - - 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"> - <h4 class="modal-title" id="myModalLabel"> - <span>Scale</span> - </h4> - </div> - - <div class="modal-body"> - <div ng-repeat='nsdata in ctrl.nsData'> - <h4>{{nsdata.netWorkServiceName}}</h4> - <hr> - <form class="form-horizontal" role="form" id="neForm"> - - <div id="basicInfoTab" style="margin-top:20px;"> - <div class="mT15 form-group" style="margin-left:25px;"> - <label class="col-sm-3 control-label"> - <span>aspectId</span> - <span class="required">*</span> - </label> - <div class="col-sm-7"> - <input type="text" id="svcName" name="svcName" class="form-control" placeholder="aspectId" maxlength="256" ng-model="nsdata.aspectId"/> - </div> - </div> - <div class="mT15 form-group" style="margin-left:25px;"> - <label class="col-sm-3 control-label"> - <span>numberOfSteps</span> - <span class="required">*</span> - </label> - <div class="col-sm-7"> - <input type="text" id="svcDesc" name="" class="form-control" placeholder="numberOfStep" maxlength="256" ng-model="nsdata.numberOfStep"/> - </div> - </div> - <div class="form-group" style="margin-left:25px;margin-bottom:15px;"> - <label class="col-sm-3 control-label"> - <span>scaleType</span> - <span class="required">*</span> - </label> - <div class="col-sm-7"> - <select class="form-control" style="padding-top: 0px;padding-bottom: 0px;" id="svcTempl" name="svcTempl" ng-change="" ng-model="nsdata.scaleType" ng-options="template for template in ctrl.scaleTypes"> - <option value="">--select--</option> - </select> - </div> - </div> - <div class="form-group" style="margin-left:25px;margin-bottom:15px;"> - <label class="col-sm-3 control-label"> - <span>scalingDirection</span> - <span class="required">*</span> - </label> - <div class="col-sm-7"> - <select class="form-control" style="padding-top: 0px;padding-bottom: 0px;" id="svcTempl" name="svcTempl" ng-change="" ng-model="nsdata.scalingDirection" ng-options="template for template in ctrl.scalingDirections"> - <option value="">--select--</option> - </select> - </div> - </div> - </div> - - </form> - </div> - </div> - - <div class="modal-footer"> - <button type="button" style="width:80px;" class="btn btn-primary" ng-click="ctrl.ok()" id="startToCreateService"> - <span id="nfv-virtualApplication-iui-text-cancelBtn">OK</span> - </button> - <button type="button" style="width:80px;" class="btn btn-warning" ng-click="ctrl.cancel()"> - <span id="nfv-virtualApplication-iui-text-previousBtn">Cancel</span> - </button> - </div> diff --git a/usecaseui-lcm/src/main/webapp/app/uui/fusion/scripts/view-models/update-service-dialog.html b/usecaseui-lcm/src/main/webapp/app/uui/fusion/scripts/view-models/update-service-dialog.html deleted file mode 100644 index a8a92d45..00000000 --- a/usecaseui-lcm/src/main/webapp/app/uui/fusion/scripts/view-models/update-service-dialog.html +++ /dev/null @@ -1,132 +0,0 @@ -<!-- - - 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>upDate</span> - </h4> -</div> - -<div class="modal-body"> - <form class="form-horizontal" role="form" id="neForm"> - - <uib-tabset active="active"> - <uib-tab heading="Base"> - <div id="basicInfoTab" style="margin-top:20px;"> - <div class="mT15 form-group" style="margin-left:25px;"> - <label class="col-sm-3 control-label"> - <span>Service Name</span> - <span class="required">*</span> - </label> - <div class="col-sm-7"> - <input type="text" id="svcName" name="svcName" class="form-control" placeholder="Service Name" maxlength="256" ng-model="ctrl.service.serviceName"/> - </div> - </div> - <div class="mT15 form-group" style="margin-left:25px;"> - <label class="col-sm-3 control-label"> - <span>Service Description</span> - <span class="required">*</span> - </label> - <div class="col-sm-7"> - <input type="text" id="svcDesc" name="" class="form-control" placeholder="Service Description" maxlength="256" ng-model="ctrl.service.serviceDescription"/> - </div> - </div> - <div class="form-group" style="margin-left:25px;margin-bottom:15px;"> - <label class="col-sm-3 control-label"> - <span>Service Template</span> - <span class="required">*</span> - </label> - <div class="col-sm-7"> - <select class="form-control" style="padding-top: 0px;padding-bottom: 0px;" id="svcTempl" name="svcTempl" ng-change="ctrl.serviceTemplateChanged(ctrl.selectedTemplate)" ng-model="ctrl.selectedTemplate" ng-options="template.name for template in ctrl.templates"> - <option value="">--select--</option> - </select> - </div> - </div> - </div> - </uib-tab> - <uib-tab heading="Template Parameters"> - <div id='templateParasTab' style="margin-top:20px;"> - - <fieldset ng-repeat="segment in ctrl.service.segments" style="margin-left:25px;"> - <legend>{{segment.nodeTemplateName}}</legend> - <!-- <div class="form-group" style="margin-left:0px;margin-bottom:5px;"> - <label class="col-sm-5 control-label"> - <span>{{segment.location.name}}</span><span class="required">*</span> - </label> - <div class="col-sm-5"> - <select class="form-control" style ="padding-top: 0px;padding-bottom: 0px;" ng-model="segment.location.value" ng-options="option.value for option in ctrl.locations"> - <option value="">select</option> - </select> - </div> - </div> --> - <div ng-repeat="segment_parameter in segment.parameters" class="mT15 form-group" style="margin-left:0px;"> - <label ng-if="segment_parameter.type === 'vf_location'" class="col-sm-5 control-label"> - <span>{{segment_parameter.description}}</span><span ng-if="segment_parameter.isRequired" class="required">*</span> - </label> - <label ng-if="segment_parameter.type !== 'vf_location'" class="col-sm-5 control-label"> - <span>{{segment_parameter.name}}</span><span ng-if="segment_parameter.isRequired" class="required">*</span> - </label> - <div ng-if="segment_parameter.type === 'string' || segment_parameter.type === 'boolean' || segment_parameter.type === 'integer'" class="col-sm-5"> - <input type="text" name="{{segment_parameter.description}}" class="form-control" ng-model="segment_parameter.value" placeholder="{{segment_parameter.name}}" value="{{segment_parameter.defaultValue}}" ng-readonly="{{segment_parameter.readonly}}"/> - </div> - <div ng-if="segment_parameter.type === 'vf_location'" class="col-sm-5"> - <select class="form-control" style ="padding-top: 1px;padding-bottom: 0px;" ng-model="segment_parameter.value" ng-options="option.name for option in ctrl.locations"> - <option value="">--select--</option> - </select> - </div> - <div ng-if="segment_parameter.type === 'sdn_controller'" class="col-sm-5"> - <select class="form-control" style ="padding-top: 0px;padding-bottom: 0px;" ng-model="segment_parameter.value" ng-options="option.value for option in ctrl.sdnControllers"> - <option value="">--select--</option> - </select> - </div> - </div> - </fieldset> - <legend>Service Inputs</legend> - <div ng-repeat="parameter in ctrl.service.parameters" class="mT15 form-group" style="margin-left:0px;"> - <label class="col-sm-5 control-label"> - <span>{{parameter.name}}</span><span ng-if="parameter.isRequired" class="required">*</span> - </label> - <div ng-if="parameter.type === 'string' || parameter.type === 'boolean' || parameter.type === 'integer'" class="col-sm-5"> - <input type="text" name="{{parameter.description}}" class="form-control" ng-model="parameter.value" placeholder="{{parameter.name}}" value="{{parameter.defaultValue}}" ng-readonly="{{parameter.readonly}}"/> - </div> - <div ng-if="parameter.type === 'vf_location'" class="col-sm-5"> - <select class="form-control" style ="padding-top: 0px;padding-bottom: 0px;" ng-model="parameter.value" ng-options="option.name for option in ctrl.locations"> - <option value="">--select--</option> - </select> - </div> - <div ng-if="parameter.type === 'sdn_controller'" class="col-sm-5"> - <select class="form-control" style ="padding-top: 0px;padding-bottom: 0px;" ng-model="parameter.value" ng-options="option.value for option in ctrl.sdnControllers"> - <option value="">--select--</option> - </select> - </div> - </div> - - </div> - </uib-tab> - </uib-tabset> - -</form> -</div> - -<div class="modal-footer"> - <button type="button" style="width:80px;" class="btn btn-primary" ng-click="ctrl.ok()" id="startToCreateService"> - <span id="nfv-virtualApplication-iui-text-cancelBtn">OK</span> - </button> - <button type="button" style="width:80px;" class="btn btn-warning" ng-click="ctrl.cancel()"> - <span id="nfv-virtualApplication-iui-text-previousBtn">Cancel</span> - </button> -</div> diff --git a/usecaseui-lcm/src/main/webapp/app/uui/fusion/scripts/view-models/vnf-ns-onboard-dialog.html b/usecaseui-lcm/src/main/webapp/app/uui/fusion/scripts/view-models/vnf-ns-onboard-dialog.html deleted file mode 100644 index b0ba9faa..00000000 --- a/usecaseui-lcm/src/main/webapp/app/uui/fusion/scripts/view-models/vnf-ns-onboard-dialog.html +++ /dev/null @@ -1,48 +0,0 @@ -<!-- - - 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>Select VIM Onboard Image</span> - </h4> -</div> - -<div class="modal-body"> - <form class="form-horizontal" role="form" id="neForm"> - <div> - <table id="vnfVimNsSelection" class="table table-striped table-hover table-bordered"> - <thead><tr><th>VIM Name</th><th>Test Environment</th><th>Product Environment</th></tr></thead> - <tbody> - <tr ng-repeat="location in ctrl.packageLocations"> - <td>{{location.name}}</td> - <td><input type="radio" name="test-env" ng-model="$parent.ctrl.testenv" ng-checked="false" ng-value="location.name"/></td> - <td><input type="checkbox" ng-model="location.productenv" /></td> - </tr> - </tbody> - </table> - </div> - </form> -</div> - -<div class="modal-footer"> - <button type="button" style="width:80px;" class="btn btn-primary" ng-click="ctrl.ok()" id="startToCreateService"> - <span id="nfv-virtualApplication-iui-text-cancelBtn">OK</span> - </button> - <button type="button" style="width:80px;" class="btn btn-warning" ng-click="ctrl.cancel()"> - <span id="nfv-virtualApplication-iui-text-previousBtn">Cancel</span> - </button> -</div> diff --git a/usecaseui-lcm/src/main/webapp/html/lifecyclemanager.html b/usecaseui-lcm/src/main/webapp/html/lifecyclemanager.html deleted file mode 100644 index 0bd9a8d6..00000000 --- a/usecaseui-lcm/src/main/webapp/html/lifecyclemanager.html +++ /dev/null @@ -1,318 +0,0 @@ -<!DOCTYPE html> -<!-- - - 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. - ---> -<html> -<head> - <meta charset="utf-8"> - <!--[if IE]><meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"><![endif]--> - <title>UUI</title> - <meta name="keywords" content="" /> - <meta name="description" content="" /> - <meta name="viewport" content="width=device-width"> - <link rel="stylesheet" href="css/templatemo_main.css"> -</head> -<body> - <div id="main-wrapper"> - <div class="navbar " role="navigation"> - <div class="navbar-header"> - <div class="logo"><h1>UUI</h1></div> - <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse"> - <span class="sr-only">Toggle navigation</span> - <span class="icon-bar"></span> - <span class="icon-bar"></span> - <span class="icon-bar"></span> - </button> - </div> - </div> - <div class="template-page-wrapper"> - <div class="navbar-collapse collapse templatemo-sidebar"> - <ul class="templatemo-sidebar-menu"> - <li> - <form class="navbar-form"> - <input type="text" class="form-control" id="templatemo_search_box" placeholder="Search..."> - <span class="btn btn-default">Go</span> - </form> - </li> - - <li class="active"><a href="#"><i class="fa fa-cog"></i>Life Cycle Manager</a></li> - <li><a href="tables.html"><i class="fa fa-users"></i><span class="badge pull-right">NEW</span>Alarm</a></li> - <li><a href="preferences.html"><i class="fa fa-cog"></i>Preferences</a></li> - <li><a href="data-visualization.html"><i class="fa fa-cubes"></i>About Preferences froms</a></li> - <li><a href="javascript:;" data-toggle="modal" data-target="#confirmModal"><i class="fa fa-sign-out"></i>Sign Out</a></li> - </ul> - </div><!--/.navbar-collapse --> - - <div class="templatemo-content-wrapper"> - <div class="templatemo-content"> - - <h1 style="margin-bottom:40px">Life Cycle Manager</h1> - - <!--div class="container" style="padding:0px"> - <div class="row"> - <div class="col-md-2"> - <button id="createService" class="btn btn-primary">Create Service</button> - </div> - <div class="col-md-offset-6 col-md-2"> - <button class="btn btn-primary show-onboard">Vnf/NS Package Onboarding</button> - </div--> - <!--div class="col-md-2"> - <button class="btn btn-primary show-onboard">Delete Vnf/NS Package</button> - </div--> - <!--/div> - </div--> - - <div id="onboard"> - </div> - - <!--ul class="nav nav-tabs nav-justified vmapp-margin"--> - <ul class="nav nav-tabs nav-justified vmapp-margin" style="border-bottom-color:#66B3FF"> - <li class="active basic"> - <a href="#" style="margin-left:1px" onclick="showService();" id="serviceTab" - data-toggle="tab"> - <span>Services</span> - </a> - </li> - <li style="padding-right:2px;" class="para"> - <a href="#vnf-ns-onboard" onclick="hideService();" data-toggle="tab" id="vnfNsTab"> - <span>Vnf/NS Packages</span> - </a> - </li> - </ul> - - <div id="vnf-ns-onboard"> - <table id="onbaordTable" class="table table-striped table-hover table-bordered"> - <thead><tr><th>Name</th><th>Type</th><th>Action</th></tr></thead> - <tbody> - <tr><td>vBras</td><td>VNF</td><td><button class="btn btn-primary onboard-button">Onboard</button></td></tr> - <tr><td>network service</td><td>NS</td><td><button class="btn btn-primary onboard-button">Onboard</button></td></tr> - </tbody> - </table> - </div> - - - <!--ul id="list"> - <li><button class="btn btn-primary">Create Service</button></li> - <li><button class="btn btn-primary">Onboard Vnf/NS Package</button></li> - <li><button class="btn btn-primary">Delete Vnf/NS Package</button></li> - </ul--> - <div id="service-table"> - <!--button id="createService" style="margin-top: 20px" class="btn btn-default"><span class="glyphicon glyphicon-plus"></span></button--> - <a id="createService" href="#" style="font-size:20px"> - <span class="glyphicon glyphicon-plus" style="margin-top:20px;width:80px;margin-left:20px"></span> - </a> - <table class="table table-striped table-hover table-bordered" style="margin:2px"> - <thead> - <tr> - <th>Service Instance Id</th> - <th>Service Name</th> - <th>Service Type</th> - <th>Action</th> - </tr> - </thead> - <tbody id="bb"> - <tr> - <td>123</td> - <td>VoLTE Use Case 1</td> - <td>E2E Service</td> - <td><a href="#" class="btn btn-primary">Delete</a></td> - </tr> - <tr> - <td>456</td> - <td>VoLTE Use Case 2</td> - <td>E2E Service</td> - <td><a href="#" class="btn btn-primary">Delete</a></td> - </tr> - <tr> - <td>789</td> - <td>VoLTE Use Case 3</td> - <td>E2E Service</td> - <td><a href="#" class="btn btn-primary">Delete</a></td> - </tr> - </tbody> - </table> - <ul class="pagination pull-right"> - <li class="disabled"><a href="#">«</a></li> - <li class="active"><a href="#">1 <span class="sr-only">(current)</span></a></li> - <li><a href="#">2 <span class="sr-only">(current)</span></a></li> - <li><a href="#">3 <span class="sr-only">(current)</span></a></li> - <li><a href="#">4 <span class="sr-only">(current)</span></a></li> - <li><a href="#">5 <span class="sr-only">(current)</span></a></li> - <li><a href="#">»</a></li> - </ul> - </div> - - - </div> - </div> - </div> - - <!-- Modal --> - <div class="modal fade" id="confirmModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"> - <div class="modal-dialog"> - <div class="modal-content"> - <div class="modal-header"> - <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span><span class="sr-only">Close</span></button> - <h4 class="modal-title" id="myModalLabel">Are you sure you want to sign out?</h4> - </div> - <div class="modal-footer"> - <a href="sign-in.html" class="btn btn-primary">Yes</a> - <button type="button" class="btn btn-default" data-dismiss="modal">No</button> - </div> - </div> - </div> - </div> - - <div id="createServiceDialog" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="false"> - <div class="modal-dialog"> - <div class="modal-content"> - <div class="content"> - <div class="modal-header" style="margin-bottom: 15px;"> - <button type="button" class="close" data-dismiss="modal" aria-hidden="true">× - </button> - <h4 class="modal-title" id="myModalLabel"> - <span>Create</span> - </h4> - </div> - <form class="form-horizontal" role="form" id="neForm"> - <div id="wizard"> - <div class="modal-body"> - - <ul class="nav nav-tabs nav-justified vmapp-margin"> - <li class="active basic"> - <a href="#basicTab" style="margin-left:1px;" onclick="showBasic();" id="basicTab" - data-toggle="tab"> - <span>Base</span> - </a> - </li> - <li style="padding-right:2px;" class="para"> - <a href="#" onclick="hideBasic();" data-toggle="tab"> - <span>Template Parameters</span> - </a> - </li> - - </ul> - - <div id="basicInfoTab"> - <div class="mT15 form-group" style="margin-left:25px;" - ms-class="has-error:vmAppDialog.name==''"> - <label class="col-sm-3 control-label"> - <span>Service Name</span> - <span class="required">*</span> - </label> - <div class="col-sm-7"> - <input type="text" id="svcName" name="svcName" class="form-control" - placeholder="Service Name" maxlength="256"/> - </div> - </div> - <div class="mT15 form-group" style="margin-left:25px;" - ms-class="has-error:vmAppDialog.name==''"> - <label class="col-sm-3 control-label"> - <span>Service Description</span> - <span class="required">*</span> - </label> - <div class="col-sm-7"> - <input type="text" id="svcDesc" name="" class="form-control" - placeholder="Service Description" maxlength="256"/> - </div> - </div> - - <div class="form-group" style="margin-left:25px;margin-bottom:15px;" - ms-class="has-error:vmAppDialog.name==''"> - <label class="col-sm-3 control-label"> - <span>Service Template</span> - <span class="required">*</span> - </label> - <div class="col-sm-7"> - <select class="form-control" style="padding-top: 0px;padding-bottom: 0px;" - id="svcTempl" name="svcTempl" onchange="serviceTemplateChanged();"> - <option value="select">--select--</option> - <option value="1.1">1.1</option> - <option value="1.2">1.2</option> - </select> - </div> - </div> - </div> - - <div id="templateParameterTab"> - - </div> - - </div> - <div class="modal-footer"> - <button type="button" style="width:80px;" class="btn SDBtn" data-dismiss="modal" - aria-hidden="true" id="startToCreateService"> - <span id="nfv-virtualApplication-iui-text-cancelBtn">OK</span> - </button> - <button type="button" style="width:80px;" class="btn button-previous SDBtn" data-dismiss="modal"> - <span id="nfv-virtualApplication-iui-text-previousBtn">Cancel</span> - </button> - - </div> - </div> - </form> - </div> - </div> - </div> - </div> - - - <div id="vnf-ns-onboard-dialog" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="false"> - <div class="modal-dialog"> - <div class="modal-content"> - <div class="content"> - <div class="modal-header" style="margin-bottom: 15px;"> - <button type="button" class="close" data-dismiss="modal" aria-hidden="true">× - </button> - <h4 class="modal-title" id="myModalLabel"> - <span>Select VIM Onboard Image</span> - </h4> - </div> - <form class="form-horizontal" role="form" id="neForm"> - <div id="wizard"> - <div class="modal-body"> - <div id="vnf-ns-vim-table"></div> - </div> - <div class="modal-footer"> - <button type="button" style="width:80px;" class="btn SDBtn" data-dismiss="modal" - aria-hidden="true" id="startToCreateService"> - <span id="nfv-virtualApplication-iui-text-cancelBtn">OK</span> - </button> - <button type="button" style="width:80px;" class="btn button-previous SDBtn" data-dismiss="modal"> - <span id="nfv-virtualApplication-iui-text-previousBtn">Cancel</span> - </button> - - </div> - </div> - </form> - </div> - </div> - </div> - - - <script src="js/jquery.min.js"></script> - <script src="js/bootstrap.min.js"></script> - <script src="js/templatemo_script.js"></script> - <script src="js/lifecyclemanager.js"></script> - <script type="text/javascript"> - $(document).ready(function () { - new lcmHandler(); - showService(); - }) - </script> -</body> -</html> diff --git a/usecaseui-lcm/src/main/webapp/static/fusion/js/lifecyclemanager.js b/usecaseui-lcm/src/main/webapp/static/fusion/js/lifecyclemanager.js deleted file mode 100644 index 84863a58..00000000 --- a/usecaseui-lcm/src/main/webapp/static/fusion/js/lifecyclemanager.js +++ /dev/null @@ -1,697 +0,0 @@ -/* - * 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. - */ -var templateParameters = { - changed : true, - // the create params used for ui - paramJsonObj : {} -}; - -var lcmHandler = function() { - this._addOwnEvents(); -}; - -lcmHandler.prototype = { - showOnboardSelection: false, - - _addOwnEvents : function() { - $('#createService').click(function() { - console.log("create service..."); - $('#createServiceDialog').modal(); - }); - $('#startToCreateService').click(this.okAction); - // $('.show-onboard').click(function () { - // this.showOnboard = !this.showOnboard; - // if(this.showOnboard) { - // document.getElementById("onboard").innerHTML = generateVnfNsOnboardDialog({}); - // }else { - // document.getElementById("onboard").innerHTML = ''; - // } - // - // }); - $('.onboard-button').click(function () { - console.log("show vnf ns vims..."); - document.getElementById("vnf-ns-vim-table").innerHTML = generateVnfNsOnboardDialog({}); - $("#vnf-ns-onboard-dialog").modal(); - }); - }, - okAction : function() { - if (!checkInputs('create', templateParameters.paramJsonObj)) { - return; - } - var sengMsgObj = collectCreateParamfromUI('', 'create', templateParameters.paramJsonObj); - var gatewayService = '/openoapi/servicegateway/v1/services'; - $.when(createServiceInstance(sengMsgObj)) - .then(function(response) { - if (response.status === 'finished') { - $.when(queryService()).then(function(serviceInstance){ - $('#sai').bootstrapTable("append", serviceInstance); - }); - $('#vmAppDialog').removeClass('in').css('display','none'); - } else { - showErrorMessage('Create service failed',response); - } - }); - } -}; - -function hideBasic() { - $("#basicInfoTab").hide(); - initParameterTab(); - $("#templateParameterTab").show(); -} - -function showBasic() { - $("#basicInfoTab").show(); - $("#templateParameterTab").hide(); -} - -function hideService() { - console.log("hide service..."); - $("#serviceTab").css({"margin-left":"1px","border-bottom-style":"solid", "border-color": "", "background-color":"#F2F2F2", "border-bottom-color": "#66B3FF"}); - $("#service-table").hide(); - $("#vnfNsTab").css({"border-bottom-style":"none","border-color": "#66B3FF","background-color":"#F2F2F2"}); - $("#vnf-ns-onboard").show(); -} - -function showService() { - console.log("show service..."); - $("#serviceTab").css({"margin-left":"1px","border-bottom-style":"none","border-color": "#66B3FF", "background-color":"#F2F2F2"}); - $("#service-table").show(); - $("#vnfNsTab").css({"border-bottom-style":"solid", "border-color": "", "background-color":"#F2F2F2", "border-bottom-color": "#66B3FF"}); - $("#vnf-ns-onboard").hide(); -} - -function serviceTemplateChanged() { - templateParameters.changed = true; -} - -/** - * init parameter tab - * @returns - */ -function initParameterTab() { - // Service template was not changed. Do not re-initiate the parameter tab. - if (!templateParameters.changed) { - return; - } - var templateId = $("#svcTempl").val(); - if ('select' === templateId) { - document.getElementById("templateParameterTab").innerHTML = ''; - return; - } - $.when(fetchCreateParameters(templateId)) - .then(function(createParam) { - // set the create param object - templateParameters.paramJsonObj = createParam.parameters; - // convert the create param to UI. - var components = convertCreateParamsToUI('create', createParam.parameters); - document.getElementById("templateParameterTab").innerHTML = components; - templateParameters.changed = false; - }); -} - -/** - * generate the template to create parameters object - * - * @param templateId - * the template id - * @returns - */ -function fetchCreateParameters(templateId) { - //return $.getJSON("./conf/queryCreateParams.json"); - var uri = '/openoapi/servicegateway/v1/createparameters/' + templateId; - return $.ajax({ - type : "GET", - url : uri - }); -} - -/** - * convert the template params obj to html UI string - * - * @param identify the object identify, it should be '' when called - * @return the html component string - */ -function convertCreateParamsToUI(identify, createParam) { - var components = ''; - // convert host to UI - if (undefined != createParam.domainHost && 'enum' === createParam.domainHost.type) { - components = components - + generateParamComponent(createParam.nodeType, identify, - createParam.domainHost, false); - } - // convert own param to UI - createParam.additionalParamForNs - .forEach(function(param) { - components = components - + generateParamComponent(createParam.nodeType, - identify, param, false); - }); - // convert segments to UI - createParam.segments.forEach(function(segment) { - // each segment in a field set. - components = components + '<fieldset style="margin-left:25px;"><legend>' - + segment.nodeTemplateName + '</legend>'; - // the identify for segment - var segmentIdentify = '' == identify ? segment.nodeTemplateName - : identify + '_' + segment.nodeTemplateName; - // convert segment to UI - components = components - + convertCreateParamsToUI(segmentIdentify, segment); - components = components + '</fieldset>'; - }); - return components; -} - - -/** - * for each required parameter it could not be empty - * @param identify the identify of a segment - * @param createParam the create param object - * @returns the check result - */ -function checkInputs(identify, createParam) { - //check domain host - if (undefined != createParam.domainHost && 'enum' === createParam.domainHost.type) { - var value = collectParamValue(identify, createParam.domainHost); - if ('select' == value) { - var name = getParamLabel(createParam.nodeType, createParam.domainHost); - alert( name + ' is required.') - return false; - } - } - // check parameters - for(var i= 0; i < createParam.additionalParamForNs.length; i++){ - var param = createParam.additionalParamForNs[i]; - var value = collectParamValue(identify, param); - if(param.required && ('' === value || ('enum' == param.type && 'select' == value))){ - // the param resource key is nodeType.paramName - var name = getParamLabel(createParam.nodeType, param); - alert(name + ' is required.') - return false; - } - } - // get segments param value from UI - var segmentcheckResult = true; - for(var i= 0; i < createParam.segments.length; i++){ - var segment = createParam.segments[i]; - // the identify for segment - var segmentIdentify = '' == identify ? segment.nodeTemplateName - : identify + '_' + segment.nodeTemplateName; - segmentcheckResult = checkInputs(segmentIdentify, segment); - if (!segmentcheckResult) { - break; - } - } - return segmentcheckResult; -} - - -/** - * convert the template params obj to html UI string - * - * @param identify the object identify, it should be different every time - * @return the html component string - */ -function collectCreateParamfromUI(parentHost,identify, createParam) { - // the create params used for create msg - var paramSentObj = { - domainHost:'', - nodeTemplateName:'', - nodeType:'', - segments:[], - additionalParamForNs:{} - }; - // get the domain value - if (undefined != createParam.domainHost && 'enum' === createParam.domainHost.type) { - var domain = collectParamValue(identify, createParam.domainHost); - paramSentObj.domainHost = collectParamValue(identify, createParam.domainHost) - } - //if parent domainHost is not '' and local domain host is'', it should be setted as parent - if('' != parentHost && '' == paramSentObj.domainHost){ - paramSentObj.domainHost = parentHost; - } - paramSentObj.nodeTemplateName = createParam.nodeTemplateName; - paramSentObj.nodeType = createParam.nodeType; - - // get own param value from UI - createParam.additionalParamForNs.forEach(function(param) { - paramSentObj.additionalParamForNs[param.name] = collectParamValue(identify, param); - }); - // get segments param value from UI - createParam.segments.forEach(function(segment) { - // the identify for segment - var segmentIdentify = '' == identify ? segment.nodeTemplateName - : identify + '_' + segment.nodeTemplateName; - var segmentObj = collectCreateParamfromUI(paramSentObj.domainHost, segmentIdentify, segment); - paramSentObj.segments.push(segmentObj); - }); - return paramSentObj; -} - -/** - * get a param value - * @param identify the identify of a segment - * @param param the param object - * @returns the value of the param - */ -function collectParamValue(identify, param) { - var value = $('#' + getParamId(identify, param)).val(); - return value; -} - -/** - * get the param id in ui - * @param identify - * @param param - * @returns - */ -function getParamId(identify, param) { - return '' ===identify ? param.name : identify + '_' + param.name; -} - -/** - * get the resource string of a param. - * @param nodeType node type - * @param param param object - * @returns resource string - */ -function getParamLabel(nodeType, param) { - var name = $.i18n.prop(nodeType + '.' + param.name); - if (name.length === 0 || name.slice(0, 1) === '[') { - name = param.name; - } - return name; -} -/** - * convert combox component - * - * @param inputPara - * @param items - * @param stringReadOnly - * @returns - */ -function generateParamComponent(nodeType, identify, param, strReadOnly) { - // the param resource key is nodeType.paramName - var name = getParamLabel(nodeType, param); - var id = getParamId(identify,param); - var component = ''; - if (param.type === 'string') { - component = '<div class="mT15 form-group" style="margin-left:0px;">' - + '<label class="col-sm-5 control-label">' - + '<span>' + name + '</span>' + generateRequiredLabel(param) - + '</label>' - + '<div class="col-sm-5"><input type="text" id="' + id - + '" name="parameter description" class="form-control" placeholder="' - + name + '" value="' + param.defaultValue; - if(strReadOnly){ - component = component + '" readonly="' + strReadOnly + '"/>'+ '</div></div>'; - }else{ - component = component + '"/>'+ '</div></div>'; - } - - } else if (param.type === 'enum') { - component = '<div class="form-group" style="margin-left:0px;margin-bottom:5px;">' - + '<label class="col-sm-5 control-label">' - + '<span>' + name + '</span>' - + '<span class="required">*</span>' - + '</label>' - + '<div class="col-sm-5">' - + '<select class="form-control" style ="padding-top: 0px;padding-bottom: 0px;"' - + ' id="' + id + '" name="' + param.name + '" value="' + param.defaultValue - + '">' - + this.transformToOptions(param.range) - + '</select></div></div>'; - } - return component; -} - -/** - * transfer the enum range to html body - * @param items the map of the range - * @returns the html string - */ -function transformToOptions(items) { - var options = '<option value="select">--select--</option>'; - var i; - for ( var key in items) { - var option = '<option value="' + key + '">' + items[key] + '</option>'; - options = options + option; - } - return options; -} - -/** - * generate required identify to html string - * @param parameter the parameter object - * @returns the html string - */ -function generateRequiredLabel(parameter) { - var requiredLabel = ''; - if (parameter.required === 'true') { - requiredLabel = '<span class="required">*</span>'; - } - return requiredLabel; -} - -/** - * create service - * @param sengMsgObj the parameters - * @returns - */ -function createServiceInstance(sengMsgObj) { - var defer = $.Deferred(); - var parameter = { - 'service' : { - 'name' : $('#svcName').val(), - 'description' : $('#svcDesc').val(), - 'serviceDefId' : '', //no need now, reserved - 'templateId' : $("#svcTempl").val(), - 'parameters' : sengMsgObj - } - }; - var serviceGatewayUri = '/openoapi/servicegateway/v1/services'; - $.when($.ajax({ - type : "POST", - url : serviceGatewayUri, - contentType : "application/json", - dataType : "json", - data : JSON.stringify(parameter) - })) - .then(function(response) { - return queryProgress('create service', response.service.serviceId,response.service.operationId); - }).then(function(result){ - defer.resolve(result); - }); - return defer; -} - -/** - * - * @param rowId - * @param row - * @returns - */ -function deleteService(rowId, row) { - var deleteHandle = function(result) { - if (result) { - var serviceId = row.serviceId; - var remove = function() { - $('#sai').bootstrapTable('remove', { - field : 'serviceId', - values : [ serviceId ] - }); - }; - var failFun = function(responseDesc) { - $.isLoading("hide"); - showErrorMessage("Delete service failed", responseDesc); - } - $.when(deleteServiceInstance(serviceId)) - .then(function(response) { - if (response.status === 'finished') { - remove(); - } else { - showErrorMessage('Create service failed',response); - } - }); - ; - } - }; - bootbox.confirm("Do you confirm to delete service?", deleteHandle); -} - -/** - * sent delete instance msg - * @param serviceId the service id - * @returns - */ -function deleteServiceInstance(serviceId) { - var defer = $.Deferred(); - var deleteUrl = '/openoapi/servicegateway/v1/services/' + serviceId; - $.when($.ajax({ - type : "DELETE", - url : deleteUrl, - contentType : "application/json", - dataType : "json", - data : JSON.stringify(parameter) - })) - .then(function(response) { - return queryProgress('delete service', serviceId,response.operationId); - }).then(function(result){ - defer.resolve(result); - }); - return defer; -} - -/** - * query progress of the operation - * @param operation the operation string - * @param serviceId the service id - * @param operationId the operation id - * @returns - */ -function queryProgress(operation, serviceId, operationId) { - //show the progress dialog - $( "#idProgressTitle" ).text(operation); - $( "#progressContent" ).text('status:'); - $( "#progressbar" ).attr("style","width: 0%"); - $( "#progressDialog" ).modal({backdrop:'static', keyboard:false}); - //set a timer for query operation - var defer = $.Deferred(); - var queryProgressUril = '/openoapi/servicegateway/v1/services/' + serviceId + '/operations/' + operationId; - var timerDefer = $.Deferred(); - var timeout = 3600000; - var fun = function() { - if (timeout === 0) { - timerDefer.resolve({ - status : 'error', - reason : operation + ' timeout!', - }); - return; - } - timeout = timeout - 1000; - $.when($.ajax({ - type : "GET", - url : gsoServiceUri - })) - .then(function(response) { - //update progress - $( "#progressbar" ).attr("style","width: " + response.operation.progress.toString() + "%"); - $( "#progressValue" ).text(response.operation.progress.toString() + '%'); - $( "#progressContent" ).text('status: ' + response.operation.operationContent); - if (response.operation.result == 'finished' || response.operation.result == 'error') { - timerDefer.resolve({ - status : response.operation.result , - reason : response.operation.reason - }); - } - }); - }; - var timerId = setInterval(fun, 1000); - $.when(timerDefer) - .then(function(responseDesc) { - clearInterval(timerId); - $('#progressDialog').modal('hide'); - defer.resolve({ - status : responseDesc.status, - reason : responseDesc.reason, - serviceId:serviceId - }); - - }); - return defer; -} - - -/** - * convert the input parameters to ui - * @param identify the identify of a segment - * @param createParam the create param object - * @returns the check result - */ -function convertInputsToUI(parentHost, identify, serviceParam) { - var components = ''; - // convert host to UI - if (undefined != serviceParam.domainHost && '' != serviceParam.domainHost && parentHost != serviceParam.domainHost) { - var param ={ - name:'domainHost', - type:'string', - defaultValue:getShowVal('domainHost', serviceParam.domainHost), - required:false - } - components = components + generateParamComponent(serviceParam.nodeType, identify, - param, true); - } - // convert own param to UI - for(var key in serviceParam.additionalParamForNs ){ - var param ={ - name: key, - type:'string', - defaultValue:getShowVal(key, serviceParam.additionalParamForNs[key]), - required:false - } - components = components + generateParamComponent(serviceParam.nodeType, - identify, param, true); - } - // convert segments to UI - serviceParam.segments.forEach(function(segment) { - // each segment in a field set. - components = components + '<div class="mT15 form-group"><fieldset style="margin-left:25px;"><legend>' - + segment.nodeTemplateName + '</legend>'; - // the identify for segment - var segmentIdentify = '' == identify ? segment.nodeTemplateName - : identify + '_' + segment.nodeTemplateName; - // convert segment to UI - components = components - + convertInputsToUI(serviceParam.domainHost, segmentIdentify, segment); - components = components + '</fieldset></div>'; - }); - return components; -} - -function getShowVal(paramName, paramValue){ - if(paramName == 'domainHost'){ - return getHostNameByVal(paramValue); - } - else if(paramName == 'location'){ - return getVimNameById(paramValue); - } - else if(paramName == 'sdncontroller'){ - return getSdnControllerNameById(paramValue); - } - else{ - return paramValue; - } -} - -function getHostNameByVal(hostDomain){ - var requestUrl ="/openoapi/servicegateway/v1/domains"; - var returnObj = ''; - $.ajax({ - type : "GET", - async: false, - url : requestUrl, - contentType : "application/json", - success : function(jsonobj) { - jsonobj.forEach(function(host){ - if(host.host == hostDomain){ - returnObj = host.name; - } - }); - }, - error : function(xhr, ajaxOptions, thrownError) { - alert("Error on getting link data : " + xhr.responseText); - } - }); - return returnObj; -} - -//get the vim name by id. -function getVimNameById(vimId){ - var requestUrl ="/openoapi/extsys/v1/vims/" + vimId; - var returnObj; - $ - .ajax({ - type : "GET", - async: false, - url : requestUrl, - contentType : "application/json", - success : function(jsonobj) { - // TODO return according to the json data received. - returnObj = jsonobj; - }, - error : function(xhr, ajaxOptions, thrownError) { - alert("Error on getting link data : " + xhr.responseText); - } - }); - return returnObj; -} - -//get the sdn controller name by id. -function getSdnControllerNameById(sdnControllerId){ - var requestUrl ="/openoapi/extsys/v1/sdncontrollers/" + sdnControllerId; - var returnObj; - $ - .ajax({ - type : "GET", - async: false, - url : requestUrl, - contentType : "application/json", - success : function(jsonobj) { - // TODO return according to the json data received. - returnObj = jsonobj; - }, - error : function(xhr, ajaxOptions, thrownError) { - alert("Error on getting link data : " + xhr.responseText); - } - }); - return returnObj; -} - - - -/** - * show error dialog - * @param title the title - * @param result the result - * @returns - */ -function showErrorMessage(title, result) { - //show the error dialog - $( "#errorDialogTitle" ).text(title); - $( "#errorDialogReason" ).text(result.reason); - $( "#errorDialog" ).modal({backdrop:'static', keyboard:false}); -} - -/** - * generate the template to create parameters object - * - * @param templateId the template id - * @returns - */ -function queryService(serviceId) { - var uri = '/openoapi/servicegateway/v1/services/' + serviceId; - return $.ajax({ - type : "GET", - url : uri - }); -} - -// function generateVnfNsOnboardDialog(onboardData) { -// var component = '<div>' -// + '<table id="onbaordTable" class="table table-striped table-hover table-bordered">' -// + '<thead><tr><th>Name</th><th>Type</th><th>Action</th></tr></thead>' -// + '<tbody>' -// +'<tr><td>vBras</td><td>VNF</td><td><button class="btn btn-primary onboard-button">Onboard</button></td></tr>' -// +'<tr><td>network service</td><td>NS</td><td><button class="btn btn-primary onboard-button">Onboard</button></td></tr>' -// +'</tbody>' -// +'</table>' -// +'</div>'; -// return component; -// } - -function generateVnfNsOnboardDialog(onboardData) { - var component = '<div>' - + '<table id="vnfVimNsSelection" class="table table-striped table-hover table-bordered">' - + '<thead><tr><th>VIM Name</th><th>Test Environment</th><th>Product Environment</th></tr></thead>' - + '<tbody>' - +'<tr><td>VIM1</td><td><input type="radio" name="test-env" /></td><td><input type="checkbox" /></td></tr>' - +'<tr><td>VIM2</td><td><input type="radio" name="test-env" /></td><td><input type="checkbox" /></td></tr>' - +'</tbody>' - +'</table>' - +'</div>'; - return component; -} |