Explicit Dedication - Cluster UI/API Integration code

This commit is contained in:
Pranav Saxena 2013-05-15 11:19:18 +05:30
parent 79e41fa718
commit f4d9a8aaf6
1 changed files with 29 additions and 3 deletions

View File

@ -8895,21 +8895,47 @@
clusterName = hostname + "/" + dcName + "/" + clusterName; //override clusterName
}
array1.push("&clustername=" + todb(clusterName));
var clusterId = null;
$.ajax({
url: createURL("addCluster" + array1.join("")),
dataType: "json",
async: true,
success: function(json) {
var item = json.addclusterresponse.cluster[0];
args.response.success({
clusterId= json.addclusterresponse.cluster[0].id;
/* args.response.success({
data: $.extend(item, { state: 'Enabled' })
});
},
error: function(XMLHttpResponse) {
var errorMsg = parseXMLHttpResponse(XMLHttpResponse);
args.response.error(errorMsg);
}
}*/
//EXPLICIT DEDICATION
if(args.$form.find('.form-item[rel=isDedicated]').find('input[type=checkbox]').is(':Checked')== true){
var array2 = [];
if(args.data.accountId != "")
array2.push("&accountId=" +todb(args.data.accountId));
}
if(hostId != null){
$.ajax({
url:createURL("dedicateCluster&clusterId=" +clusterId +"&domainId=" +args.data.domainId + array2.join("")),
dataType:"json",
success:function(json){
var dedicatedObj = json.dedicateclusterresponse.cluster;
args.response.success({ data: $.extend(item, dedicatedObj , {state:'Enabled'}) });
},
error:function(json){
args.response.error(parseXMLHttpResponse(XMLHttpResponse));
}
});
}
}
});
},