diff options
author | Luji7 <lu.ji3@zte.com.cn> | 2017-10-22 16:03:20 +0800 |
---|---|---|
committer | Luji7 <lu.ji3@zte.com.cn> | 2017-10-22 16:03:26 +0800 |
commit | 24ce28e83cb4faf805a88f0cb4c98a73ed633a57 (patch) | |
tree | bed65621e35b369dc050a74b902fc44008e45d6d /usecaseui-lcm/src | |
parent | ac675fe158efff6093625101157acfa89d8a7942 (diff) |
Fix create dialog para issue.
Change-Id: I2ec050b14e3b17f73e1b44e18db3d62690dcb75d
Issue-id: USECASEUI-53
Signed-off-by: Luji7 <lu.ji3@zte.com.cn>
Diffstat (limited to 'usecaseui-lcm/src')
3 files changed, 91 insertions, 39 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 index 141c012f..908113a2 100644 --- a/usecaseui-lcm/src/main/webapp/app/uui/fusion/scripts/controller/ServiceTemplateService.js +++ b/usecaseui-lcm/src/main/webapp/app/uui/fusion/scripts/controller/ServiceTemplateService.js @@ -126,44 +126,78 @@ }); }, + getAllSdnControllers: function (processFun) { + return $http({ + url: url+'/sdnc-controllers/', + method: 'GET', + data: null, + headers: uuiHeaders + }).then(function(response){ + var sdnControllers = response.data; + 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) { - function translateInputs(t, customer,serviceType, c) { + function translateInputs(t, customer,serviceType, c, isE2E) { var reqParas = { - subscriptionServiceType: serviceType.value + subscriptionServiceType: serviceType.id }; + var vfLocations = []; c[t.name].parameters.forEach(function (parameter) { - reqParas[parameter.name] = parameter.value;// todo + if(parameter.type === 'vf_location') { + var loc = {}; + loc[parameter.name] = 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; + } }); + if(t.type === 'VF') { + reqParas.vnfProfileId = vfLocations; + } var nestedSegments = t.nestedTemplates.map(function (nestedTemplate) { - return translateInputs(nestedTemplate,customer,serviceType, c); + return translateInputs(nestedTemplate,customer,serviceType, c, false); }); - return { - domainHost: c[t.name].location.value,// ??? - nodeTemplateName: t.name+':'+t.version, - nodeType: 'service', - 'GLOBALSUBSCIBERID': customer.id, - 'SUBSCIBERNAME': customer.name, - requestParameters: reqParas, - segments: nestedSegments - }; - } + var request = {}; + if(isE2E) { + request.domainHost = 'localhost'; + } + request.nodeTemplateName = t.name+':'+t.version; + request.nodeType = 'service'; + request['GLOBALSUBSCIBERID'] = customer.id; + request['SUBSCIBERNAME'] = customer.name; + request.requestParameters = reqParas; + request.segments = nestedSegments; + return request; + } var cache = {}; cache[template.name] = { - location: service.location.value, parameters: service.parameters }; service.segments.forEach(function (segment) { cache[segment.nodeTemplateName] = { - location: segment.location.value, parameters: segment.parameters } }); console.log('cache ----'); console.log(cache); - var reqPara = translateInputs(template,customer, serviceType, cache); + var reqPara = translateInputs(template,customer, serviceType, cache, true); var requestBody = { service: { name: service.serviceName, diff --git a/usecaseui-lcm/src/main/webapp/app/uui/fusion/scripts/controller/lcmController.js b/usecaseui-lcm/src/main/webapp/app/uui/fusion/scripts/controller/lcmController.js index 3f67584d..498f93e0 100644 --- a/usecaseui-lcm/src/main/webapp/app/uui/fusion/scripts/controller/lcmController.js +++ b/usecaseui-lcm/src/main/webapp/app/uui/fusion/scripts/controller/lcmController.js @@ -110,7 +110,7 @@ app.controller('lcmCtrl', ['$scope', '$uibModal', '$log', '$http', '$timeout', ' function($scope, $uibModalInstance, ServiceTemplateService, customer, serviceType) { var ctrl = this; - ctrl.templates = ServiceTemplateService.getAllServiceTemplates(function (t) { + ServiceTemplateService.getAllServiceTemplates(function (t) { ctrl.templates = t; }); @@ -118,6 +118,7 @@ app.controller('lcmCtrl', ['$scope', '$uibModal', '$log', '$http', '$timeout', ' var paras = serviceTemplate.inputs.map(function (input) { return { name: input.name, + type: input.type, description: input.description, defaultValue: input.defaultValue, isRequired: input.isRequired, @@ -129,6 +130,7 @@ app.controller('lcmCtrl', ['$scope', '$uibModal', '$log', '$http', '$timeout', ' var nestedParas = nestedTemplate.inputs.map(function (input) { return { name: input.name, + type: input.type, description: input.description, defaultValue: input.defaultValue, isRequired: input.isRequired, @@ -137,9 +139,6 @@ app.controller('lcmCtrl', ['$scope', '$uibModal', '$log', '$http', '$timeout', ' }); return { nodeTemplateName: nestedTemplate.name, - location: { - name: nestedTemplate.name + " location",// ??? - }, parameters: nestedParas }; }); @@ -147,14 +146,19 @@ app.controller('lcmCtrl', ['$scope', '$uibModal', '$log', '$http', '$timeout', ' var service = { serviceName: ctrl.service.serviceName, serviceDescription: ctrl.service.serviceDescription, - location: { - name: "local host" // ??? - }, parameters: paras, segments: segmentsPara }; ctrl.service = service; }; + ctrl.service = { + serviceName: '', + serviceDescription: '', + parameters: [], + segments: [] + }; + ctrl.sdnControllers = []; + ctrl.locations = []; ctrl.serviceTemplateChanged = function (template) { console.log('serviceTemplateChanged invoked... ' + template); @@ -190,6 +194,10 @@ app.controller('lcmCtrl', ['$scope', '$uibModal', '$log', '$http', '$timeout', ' 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) { 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 index 760a067f..295bcfd0 100644 --- 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 @@ -60,43 +60,53 @@ </uib-tab> <uib-tab heading="Template Parameters"> <div id='templateParasTab' style="margin-top:20px;"> - <div ng-if="ctrl.service !== undefined" class="form-group" style="margin-left:0px;margin-bottom:5px;"> - <label class="col-sm-5 control-label"> - <span>{{ctrl.service.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="ctrl.service.location.value" ng-options="option.value for option in ctrl.locations"> - <option value="">--select--</option> - </select> - </div> - </div> <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 class="col-sm-5"> + <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.value 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> <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;"> + <!-- <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> + <option value="">select</option> </select> </div> - </div> + </div> --> <div ng-repeat="segment_parameter in segment.parameters" class="mT15 form-group" style="margin-left:0px;"> <label class="col-sm-5 control-label"> <span>{{segment_parameter.name}}</span><span ng-if="segment_parameter.isRequired" class="required">*</span> </label> - <div class="col-sm-5"> + <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: 0px;padding-bottom: 0px;" ng-model="segment_parameter.value" ng-options="option.value 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> </div> |