You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by bf...@apache.org on 2012/12/19 23:04:28 UTC
[36/50] [abbrv] git commit: 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.
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.
Project: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/commit/b7181bb4
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/b7181bb4
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/b7181bb4
Branch: refs/heads/ui-plugins
Commit: b7181bb4263dc39570b3811f5a06e630042df01b
Parents: 859412c
Author: Jessica Wang <je...@citrix.com>
Authored: Fri Dec 14 14:22:38 2012 -0800
Committer: Jessica Wang <je...@citrix.com>
Committed: Fri Dec 14 14:22:38 2012 -0800
----------------------------------------------------------------------
ui/scripts/system.js | 65 +++++++++++++++++++++++++----------------
ui/scripts/zoneWizard.js | 57 ++++++++++++++++++++----------------
2 files changed, 72 insertions(+), 50 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/b7181bb4/ui/scripts/system.js
----------------------------------------------------------------------
diff --git a/ui/scripts/system.js b/ui/scripts/system.js
index d018b8a..6733da1 100644
--- a/ui/scripts/system.js
+++ b/ui/scripts/system.js
@@ -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({
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/b7181bb4/ui/scripts/zoneWizard.js
----------------------------------------------------------------------
diff --git a/ui/scripts/zoneWizard.js b/ui/scripts/zoneWizard.js
index 0bfcaad..26838a1 100755
--- a/ui/scripts/zoneWizard.js
+++ b/ui/scripts/zoneWizard.js
@@ -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, {