diff options
Diffstat (limited to 'usecaseui-lcm/src/main/webapp/app/uui/fusion/scripts/controller/ServiceTemplateService.js')
-rw-r--r-- | usecaseui-lcm/src/main/webapp/app/uui/fusion/scripts/controller/ServiceTemplateService.js | 128 |
1 files changed, 102 insertions, 26 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 c9357618..9482597d 100644 --- a/usecaseui-lcm/src/main/webapp/app/uui/fusion/scripts/controller/ServiceTemplateService.js +++ b/usecaseui-lcm/src/main/webapp/app/uui/fusion/scripts/controller/ServiceTemplateService.js @@ -58,7 +58,7 @@ getServiceInstances: function (customerId, serviceType, processFun) { return $http({ - url: url+'/service-instances?customerId='+customerId+'&serviceType='+serviceType.value, + url: url+'/service-instances?customerId='+customerId+'&serviceType='+serviceType, method: 'GET', data: null, headers: uuiHeaders @@ -144,7 +144,7 @@ }); }, - createService: function (customer, serviceType, service, template) { + createService: function (customer, serviceType, service, template, successFun, failedFun) { var reqPara = []; service.segments.forEach(function (segment) { var reqParas = {}; @@ -203,7 +203,7 @@ }; console.log('request body: '); - console.log(requestBody); + console.log(JSON.stringify(requestBody)); return $http({ url: url+'/services', @@ -213,10 +213,14 @@ }).then(function(response){ console.log('create response...'); console.log(response.data); + + var serviceId = response.data.service.serviceId; + var operationId = response.data.service.operationId; + successFun(serviceId, operationId); }); }, - deleteService: function (serviceId) { + deleteService: function (serviceId, successFun) { return $http({ url: url+'/services/' + serviceId, method: 'DELETE', @@ -225,6 +229,26 @@ }).then(function(response){ console.log('delete response...'); console.log(response.data); + successFun(serviceId, response.data.operationId); + }); + }, + + queryServiceProgress: function (serviceId, operationId, progressFun) { + return $http({ + url: url+'/services/' + serviceId + '/operations/' + operationId, + method: 'GET', + data: null, + headers: uuiHeaders + }).then(function(response){ + console.log('get progress response...'); + console.log(response.data); + var op = response.data.operationStatus; + progressFun({ + result: op.result, + progress : op.progress, + operationContent: op.operationContent, + reason: op.reason + }); }); }, @@ -242,6 +266,7 @@ uuid: ns.uuid, invariantUUID: ns.invariantUUID, name: ns.name, + version: ns.version, type: 'NS' }) }); @@ -250,6 +275,7 @@ uuid: vnf.uuid, invariantUUID: vnf.invariantUUID, name: vnf.name, + version: vnf.version, type: 'VF' }) }); @@ -257,33 +283,83 @@ }); }, - packageOnboard: function (onboardPackage) { + nsPackageOnboard: function (onboardPackage, processFun) { console.log('onboard...'); console.log(onboardPackage); var requestBody = { csarId: onboardPackage.uuid }; - if(onboardPackage.type === 'NS') { - return $http({ - url: url+'/ns-packages', - method: 'POST', - data: JSON.stringify(requestBody), - headers: uuiHeaders - }).then(function(response){ - console.log('onboard ns package response...'); - console.log(response.data); - }); - } else { - return $http({ - url: url+'/vf-packages', - method: 'POST', - data: JSON.stringify(requestBody), - headers: uuiHeaders - }).then(function(response){ - console.log('onboard vf package response...'); - console.log(response.data); - }); - } + return $http({ + url: url+'/ns-packages', + method: 'POST', + data: JSON.stringify(requestBody), + headers: uuiHeaders + }).then(function(response){ + console.log('onboard ns package response...'); + console.log(response.data); + processFun(response.data); + }); + }, + + vfPackageOnboard: function (onboardPackage, processFun) { + console.log('onboard...'); + console.log(onboardPackage); + var requestBody = { + csarId: onboardPackage.uuid + }; + return $http({ + url: url+'/vf-packages', + method: 'POST', + data: JSON.stringify(requestBody), + headers: uuiHeaders + }).then(function(response){ + console.log('onboard vf package response...'); + console.log(response.data); + processFun(response.data); + }); + }, + + queryVfOnboardProgress: function (jobId, progressFun) { + return $http({ + url: url+'/jobs/' + jobId, + method: 'GET', + data: null, + headers: uuiHeaders + }).then(function(response){ + console.log('get progress response...'); + console.log(response.data); + progressFun(response.data.responseDescriptor); + }); + }, + + nsPackageDelete: function (deletePackage, processFun) { + console.log('delete package...'); + console.log(deletePackage); + return $http({ + url: url+'/ns-packages/' + deletePackage.uuid, + method: 'DELETE', + data: null, + headers: uuiHeaders + }).then(function(response){ + console.log('delete ns package response...'); + console.log(response.data); + processFun(response.data); + }); + }, + + vfPackageDelete: function (deletePackage, processFun) { + console.log('delete package...'); + console.log(deletePackage); + return $http({ + url: url+'/vf-packages/' + deletePackage.uuid, + method: 'DELETE', + data: null, + headers: uuiHeaders + }).then(function(response){ + console.log('delete vf package response...'); + console.log(response.data); + processFun(response.data); + }); } }; }); |