From 60622d7a28c2109c9858b4d9a0f6eb68e1c3aff0 Mon Sep 17 00:00:00 2001 From: Brian Federle Date: Thu, 20 Jun 2013 15:29:32 -0700 Subject: [PATCH] CLOUDSTACK-3045: Fix missing 'array2' from add cluster/add host --- ui/scripts/system.js | 91 ++++++++++++++++++++++---------------------- 1 file changed, 45 insertions(+), 46 deletions(-) diff --git a/ui/scripts/system.js b/ui/scripts/system.js index 387e6296828..cbced87efd3 100644 --- a/ui/scripts/system.js +++ b/ui/scripts/system.js @@ -10275,44 +10275,42 @@ var item = json.addclusterresponse.cluster[0]; clusterId= json.addclusterresponse.cluster[0].id; - //EXPLICIT DEDICATION - if(args.$form.find('.form-item[rel=isDedicated]').find('input[type=checkbox]').is(':Checked')== true){ - var array2 = []; + //EXPLICIT DEDICATION + var array2 = []; + if(args.$form.find('.form-item[rel=isDedicated]').find('input[type=checkbox]').is(':Checked')== true){ if(args.data.accountId != "") array2.push("&account=" +todb(args.data.accountId)); } if(clusterId != null){ $.ajax({ - url:createURL("dedicateCluster&clusterId=" +clusterId +"&domainId=" +args.data.domainId + array2.join("")), - dataType:"json", - success:function(json){ - var jid = json.dedicateclusterresponse.jobid; - args.response.success({ - _custom: - { jobId: jid - }, - notification: { - poll: pollAsyncJobResult - }, + url:createURL("dedicateCluster&clusterId=" +clusterId +"&domainId=" +args.data.domainId + array2.join("")), + dataType:"json", + success:function(json){ + var jid = json.dedicateclusterresponse.jobid; + args.response.success({ + _custom: + { jobId: jid + }, + notification: { + poll: pollAsyncJobResult + }, - data:$.extend(item, {state:'Enabled'}) - }); + data:$.extend(item, {state:'Enabled'}) + }); - }, + }, - error:function(json){ - args.response.error(parseXMLHttpResponse(XMLHttpResponse)); - } - }); - } + error:function(json){ + args.response.error(parseXMLHttpResponse(XMLHttpResponse)); + } + }); + } }, error: function(XMLHttpResponse) { var errorMsg = parseXMLHttpResponse(XMLHttpResponse); args.response.error(errorMsg); } - - }); }, @@ -11374,43 +11372,44 @@ data: data, success: function(json) { var item = json.addhostresponse.host[0]; + hostId = json.addhostresponse.host[0].id; + //EXPLICIT DEDICATION + var array2 = []; - //EXPLICIT DEDICATION - if(args.$form.find('.form-item[rel=isDedicated]').find('input[type=checkbox]').is(':Checked')== true){ - var array2 = []; + if(args.$form.find('.form-item[rel=isDedicated]').find('input[type=checkbox]').is(':Checked')== true){ if(args.data.accountId != "") array2.push("&account=" +todb(args.data.accountId)); } if(hostId != null){ $.ajax({ - url:createURL("dedicateHost&hostId=" +hostId +"&domainId=" +args.data.domainId + array2.join("")), - dataType:"json", - success:function(json){ - var jid = json.dedicatehostresponse.host.jobid; - args.response.success({ - _custom: - { jobId: jid - }, + url:createURL("dedicateHost&hostId=" +hostId +"&domainId=" +args.data.domainId + array2.join("")), + dataType:"json", + success:function(json){ + var jid = json.dedicatehostresponse.jobid; + args.response.success({ + _custom: + { jobId: jid + }, notification: { - poll: pollAsyncJobResult - }, + poll: pollAsyncJobResult + }, - data:item + data:item - }); + }); + }, + + error:function(json){ + args.response.error(parseXMLHttpResponse(XMLHttpResponse)); + } + }); + } }, - error:function(json){ - args.response.error(parseXMLHttpResponse(XMLHttpResponse)); - } - }); - } - }, - error: function(XMLHttpResponse) { var errorMsg = parseXMLHttpResponse(XMLHttpResponse); args.response.error(errorMsg);