mirror of https://github.com/apache/cloudstack.git
CLOUDSTACK-642: cloudstack UI - Add Host step in zone wizard, Add Host diaog in hosts listView - call addHost API by type POST instead of type GET, remove parameters from URL.
This commit is contained in:
parent
859412c1ce
commit
b7181bb426
|
|
@ -8250,54 +8250,69 @@
|
|||
},
|
||||
|
||||
action: function(args) {
|
||||
var array1 = [];
|
||||
array1.push("&zoneid=" + args.data.zoneid);
|
||||
array1.push("&podid=" + args.data.podId);
|
||||
array1.push("&clusterid=" + args.data.clusterId);
|
||||
array1.push("&hypervisor=" + todb(selectedClusterObj.hypervisortype));
|
||||
var clustertype = selectedClusterObj.clustertype;
|
||||
array1.push("&clustertype=" + todb(clustertype));
|
||||
array1.push("&hosttags=" + todb(args.data.hosttags));
|
||||
var data = {
|
||||
zoneid: args.data.zoneid,
|
||||
podid: args.data.podId,
|
||||
clusterid: args.data.clusterId,
|
||||
hypervisor: selectedClusterObj.hypervisortype,
|
||||
clustertype: selectedClusterObj.clustertype,
|
||||
hosttags: args.data.hosttags
|
||||
};
|
||||
|
||||
if(selectedClusterObj.hypervisortype == "VMware") {
|
||||
array1.push("&username=");
|
||||
array1.push("&password=");
|
||||
$.extend(data,{
|
||||
username: '',
|
||||
password: ''
|
||||
});
|
||||
|
||||
var hostname = args.data.vcenterHost;
|
||||
var url;
|
||||
if(hostname.indexOf("http://")==-1)
|
||||
url = "http://" + hostname;
|
||||
else
|
||||
url = hostname;
|
||||
array1.push("&url=" + todb(url));
|
||||
|
||||
$.extend(data, {
|
||||
url: url
|
||||
});
|
||||
}
|
||||
else {
|
||||
array1.push("&username=" + todb(args.data.username));
|
||||
array1.push("&password=" + todb(args.data.password));
|
||||
|
||||
$.extend(data, {
|
||||
username: args.data.username,
|
||||
password: args.data.password
|
||||
});
|
||||
|
||||
var hostname = args.data.hostname;
|
||||
|
||||
var url;
|
||||
if(hostname.indexOf("http://")==-1)
|
||||
url = "http://" + hostname;
|
||||
else
|
||||
url = hostname;
|
||||
array1.push("&url="+todb(url));
|
||||
|
||||
|
||||
$.extend(data, {
|
||||
url: url
|
||||
});
|
||||
|
||||
if (selectedClusterObj.hypervisortype == "BareMetal") {
|
||||
array1.push("&cpunumber=" + todb(args.data.baremetalCpuCores));
|
||||
array1.push("&cpuspeed=" + todb(args.data.baremetalCpu));
|
||||
array1.push("&memory=" + todb(args.data.baremetalMemory));
|
||||
array1.push("&hostmac=" + todb(args.data.baremetalMAC));
|
||||
$.extend(data, {
|
||||
cpunumber: args.data.baremetalCpuCores,
|
||||
cpuspeed: args.data.baremetalCpu,
|
||||
memory: args.data.baremetalMemory,
|
||||
hostmac: args.data.baremetalMAC
|
||||
});
|
||||
}
|
||||
else if(selectedClusterObj.hypervisortype == "Ovm") {
|
||||
array1.push("&agentusername=" + todb(args.data.agentUsername));
|
||||
array1.push("&agentpassword=" + todb(args.data.agentPassword));
|
||||
$.extend(data, {
|
||||
agentusername: args.data.agentUsername,
|
||||
agentpassword: args.data.agentPassword
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
url: createURL("addHost" + array1.join("")),
|
||||
dataType: "json",
|
||||
url: createURL("addHost"),
|
||||
type: "POST",
|
||||
data: data,
|
||||
success: function(json) {
|
||||
var item = json.addhostresponse.host[0];
|
||||
args.response.success({
|
||||
|
|
|
|||
|
|
@ -2896,41 +2896,48 @@
|
|||
addHost: function(args) {
|
||||
message(dictionary['message.adding.host']);
|
||||
|
||||
var array1 = [];
|
||||
array1.push("&zoneid=" + args.data.returnedZone.id);
|
||||
array1.push("&podid=" + args.data.returnedPod.id);
|
||||
array1.push("&clusterid=" + args.data.returnedCluster.id);
|
||||
array1.push("&hypervisor=" + todb(args.data.returnedCluster.hypervisortype));
|
||||
var clustertype = args.data.returnedCluster.clustertype;
|
||||
array1.push("&clustertype=" + todb(clustertype));
|
||||
array1.push("&hosttags=" + todb(args.data.host.hosttags));
|
||||
array1.push("&username=" + todb(args.data.host.username));
|
||||
array1.push("&password=" + todb(args.data.host.password));
|
||||
var data = {
|
||||
zoneid: args.data.returnedZone.id,
|
||||
podid: args.data.returnedPod.id,
|
||||
clusterid: args.data.returnedCluster.id,
|
||||
hypervisor: args.data.returnedCluster.hypervisortype,
|
||||
clustertype: args.data.returnedCluster.clustertype,
|
||||
hosttags: args.data.host.hosttags,
|
||||
username: args.data.host.username,
|
||||
password: args.data.host.password
|
||||
};
|
||||
|
||||
var hostname = args.data.host.hostname;
|
||||
|
||||
var url;
|
||||
if(hostname.indexOf("http://")==-1)
|
||||
if(hostname.indexOf("http://")==-1) {
|
||||
url = "http://" + hostname;
|
||||
else
|
||||
url = hostname;
|
||||
array1.push("&url="+todb(url));
|
||||
|
||||
}
|
||||
else {
|
||||
url = hostname;
|
||||
}
|
||||
$.extend(data,{
|
||||
url: url
|
||||
});
|
||||
|
||||
if (args.data.cluster.hypervisor == "BareMetal") {
|
||||
array1.push("&cpunumber=" + todb(args.data.host.baremetalCpuCores));
|
||||
array1.push("&cpuspeed=" + todb(args.data.host.baremetalCpu));
|
||||
array1.push("&memory=" + todb(args.data.host.baremetalMemory));
|
||||
array1.push("&hostmac=" + todb(args.data.host.baremetalMAC));
|
||||
$.extend(data, {
|
||||
cpunumber: args.data.host.baremetalCpuCores,
|
||||
cpuspeed: args.data.host.baremetalCpu,
|
||||
memory: args.data.host.baremetalMemory,
|
||||
hostmac: args.data.host.baremetalMAC
|
||||
});
|
||||
}
|
||||
else if(args.data.cluster.hypervisor == "Ovm") {
|
||||
array1.push("&agentusername=" + todb(args.data.host.agentUsername));
|
||||
array1.push("&agentpassword=" + todb(args.data.host.agentPassword));
|
||||
$.extend(data, {
|
||||
agentusername: args.data.host.agentUsername,
|
||||
agentpassword: args.data.host.agentPassword
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
$.ajax({
|
||||
url: createURL("addHost" + array1.join("")),
|
||||
dataType: "json",
|
||||
url: createURL("addHost"),
|
||||
type: "POST",
|
||||
data: data,
|
||||
success: function(json) {
|
||||
stepFns.addPrimaryStorage({
|
||||
data: $.extend(args.data, {
|
||||
|
|
|
|||
Loading…
Reference in New Issue