aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjin xin <j00101220@huawei.com>2016-11-02 08:08:44 +0000
committerGerrit Code Review <gerrit@open-o.org>2016-11-02 08:08:44 +0000
commitec50ab686203fa7a1775f62220752b5e5aeffc52 (patch)
treeb6864784a4bb10ad7cbfcdd5bb95f52c2a5fb936
parentf6263fbed38be500dea717ab0ba4238839f4f7bf (diff)
parent4d64f0ecc371737acce296367cf03a90c23fc1d0 (diff)
Merge "fix issue: GSO-95" into sun
-rw-r--r--openo-portal/portal-lifecyclemgr/src/main/webapp/lifecyclemgr/js/gsolcm.js91
1 files changed, 84 insertions, 7 deletions
diff --git a/openo-portal/portal-lifecyclemgr/src/main/webapp/lifecyclemgr/js/gsolcm.js b/openo-portal/portal-lifecyclemgr/src/main/webapp/lifecyclemgr/js/gsolcm.js
index 7173f644..fb554463 100644
--- a/openo-portal/portal-lifecyclemgr/src/main/webapp/lifecyclemgr/js/gsolcm.js
+++ b/openo-portal/portal-lifecyclemgr/src/main/webapp/lifecyclemgr/js/gsolcm.js
@@ -58,7 +58,7 @@ lcmHandler.prototype = {
function(response) {
$.isLoading('hide');
if(response.status === 'success') {
- updateTable(response.serviceInstance);
+ updateTable(response.instance);
$('#vmAppDialog').removeClass('in').css('display', 'none');
} else {
showErrorMessage('Create service failed', response.errorResult);
@@ -518,9 +518,51 @@ function createGsoServiceInstance(gatewayService, serviceInstance, serviceTempla
})).then(function(response) {
if(response.result.status === 'success') {
serviceInstance.serviceId = response.serviceId;
- defer.resolve({status: 'success', instance: serviceInstance});
+ var gsoServiceUri = '/openoapi/gso/v1/services/' + response.serviceId;
+ var timerDefer = $.Deferred();
+ var timeout = 600000;
+ var fun = function() {
+ if(timeout === 0) {
+ timerDefer.resolve({
+ status: 'fail',
+ statusDescription: 'Operation is timeout!',
+ errorCode: ''
+ });
+ return;
+ }
+ timeout = timeout - 1000;
+ $.when(
+ $.ajax({
+ type: "GET",
+ url: gsoServiceUri
+ })
+ ).then(
+ function(response) {
+ if(response.result === 'success' || response.result === 'failed') {
+ timerDefer.resolve(response);
+ }
+ }
+ );
+ };
+ var timerId = setInterval(fun, 1000);
+ $.when(timerDefer).then(
+ function(responseDesc) {
+ clearInterval(timerId);
+ if(responseDesc.result === 'success') {
+ defer.resolve({status: 'success', instance: serviceInstance});
+ } else {
+ defer.resolve({
+ status: 'fail',
+ errorResult: {
+ status: responseDesc.result,
+ statusDescription: 'fail to create the service',
+ errorCode: ''
+ }});
+ }
+ }
+ );
} else {
- defer.resolve({status: 'fail', errorResult: response.result});
+ defer.resolve({status: 'fail', errorResult: {status:'fail', statusDescription: 'fail to create the service', errorCode: ''}});
}
});
return defer;
@@ -669,7 +711,7 @@ function deleteNe(rowId, row) {
showErrorMessage("Delete service failed", responseDesc);
}
if(serviceType === 'GSO') {
- deleteGsoServiceInstance(gatewayService, instanceId, remove);
+ deleteGsoServiceInstance(gatewayService, instanceId, remove, failFun);
} else if (serviceType === 'NFVO') {
var nfvoLcmUri = '/openoapi/nslcm/v1';
deleteNonGsoServiceInstance(gatewayService, nfvoLcmUri, instanceId, remove, failFun);
@@ -682,13 +724,48 @@ function deleteNe(rowId, row) {
bootbox.confirm("Do you confirm to delete service?", deleteHandle);
}
-function deleteGsoServiceInstance(gatewayService, instanceId, remove) {
+function deleteGsoServiceInstance(gatewayService, instanceId, remove, failFun) {
var gsoLcmUri = '/openoapi/gso/v1/services';
$.when(
deleteNetworkServiceInstance(gatewayService, gsoLcmUri, instanceId)
).then(
- function() {
- remove();
+ function(response) {
+ var gsoServiceUri = '/openoapi/gso/v1/services/toposequence/' + instanceId;
+ var timerDefer = $.Deferred();
+ var timeout = 600000;
+ var fun = function() {
+ if(timeout === 0) {
+ timerDefer.resolve({
+ status: 'fail',
+ statusDescription: 'Operation is timeout!',
+ errorCode: ''
+ });
+ return;
+ }
+ timeout = timeout - 1000;
+ $.when(
+ $.ajax({
+ type: "GET",
+ url: gsoServiceUri
+ })
+ ).then(
+ function(response) {
+ if(response.length == 0) {
+ timerDefer.resolve({status:'success', statusDescription: 'success to delete the service', errorCode: ''});
+ }
+ }
+ );
+ };
+ var timerId = setInterval(fun, 1000);
+ $.when(timerDefer).then(
+ function(responseDesc) {
+ clearInterval(timerId);
+ remove();
+ if(responseDesc.status != 'success'){
+ failFun({status: "fail", statusDescription: "delete service failed.", errorCode: "500"});
+ }
+ }
+ );
}
);
}