From e58ff4d71bc00b7679110ef2757bf9ca00e6844d Mon Sep 17 00:00:00 2001 From: Brian Federle Date: Fri, 11 Nov 2011 14:19:11 -0800 Subject: [PATCH] Pull real form data for server calls --- ui/scripts/installWizard.js | 107 ++++++++++++++++++++++++++++-------- 1 file changed, 85 insertions(+), 22 deletions(-) diff --git a/ui/scripts/installWizard.js b/ui/scripts/installWizard.js index 4b74f7cb46b..86efc4a28cd 100644 --- a/ui/scripts/installWizard.js +++ b/ui/scripts/installWizard.js @@ -14,20 +14,84 @@ }); }, + changeUser: function(args) { + $.ajax({ + url: createURL('updateUser'), + data: { + id: cloudStack.context.users[0].userid, + password: md5Hashed ? $.md5(args.data.password) : args.data.password + }, + dataType: 'json', + async: true, + success: function(data) { + args.response.success({ + data: { newUser: data.updateuserresponse.user } + }); + } + }); + }, + + // Copy text + copy: { + whatIsCloudStack: function(args) { + args.response.success({ + text: 'CloudStack is open source software written in java that is designed to deploy and manage large networks of virtual machines, as a highly available, scalable cloud computing platform. CloudStack current supports the most popular open source hypervisors VMware, Oracle VM, KVM, XenServer and Xen Cloud Platform. CloudStack offers three ways to manage cloud computing environments: a easy-to-use web interface, command line and a full-featured RESTful API.' + }); + }, + + whatIsAZone: function(args) { + args.response.success({ + text: 'A zone is integral to the CloudStack platform -- your entire network is represented via a zone. More text goes here...' + }); + }, + + whatIsAPod: function(args) { + args.response.success({ + text: 'A pod is a part of a zone. More text goes here...' + }); + }, + + whatIsACluster: function(args) { + args.response.success({ + text: 'A cluster is a part of a zone. More text goes here...' + }); + }, + + whatIsAHost: function(args) { + args.response.success({ + text: 'A host is a part of a zone. More text goes here...' + }); + }, + + whatIsPrimaryStorage: function(args) { + args.response.success({ + text: 'Primary storage is a part of a zone. More text goes here...' + }); + }, + + whatIsSecondaryStorage: function(args) { + args.response.success({ + text: 'Secondary storage is a part of a zone. More text goes here...' + }); + } + }, + action: function(args) { var complete = args.response.success; + var data = args.data /** * Step 1: add zone */ var createZone = function(args) { + debugger; $.ajax({ url: createURL('createZone'), data: { - name: 'brian-zone', + name: data.zone.name, networktype: 'Basic', - dns1: '8.8.8.8', - internaldns1: '10.223.110.223' + internaldns1: data.zone.internaldns1, + internaldns2: data.zone.internaldns2 }, dataType: 'json', async: true, @@ -48,12 +112,12 @@ $.ajax({ url: createURL('createPod'), data: { - name: 'brian-pod', + name: data['pod-name'], zoneid: args.data.zone.id, - gateway: '10.223.183.1', - netmask: '255.255.255.0', - startip: '10.223.183.10', - endip: '10.223.183.20' + gateway: data['pod-gateway'], + netmask: data['pod-netmask'], + startip: data['pod-ip-range-start'], + endip: data['pod-ip-range-end'] }, dataType: 'json', async: true, @@ -74,13 +138,12 @@ $.ajax({ url: createURL('createVlanIpRange'), data: { - name: 'brian-zone', zoneid: args.data.zone.id, vlan: 'untagged', - gateway: '10.223.183.1', - netmask: '255.255.255.0', - startip: '10.223.183.50', - endip: '10.223.183.100' + gateway: data['guest-gateway'], + netmask: data['guest-netmask'], + startip: data['guest-ip-range-start'], + endip: data['guest-ip-range-end'] }, dataType: 'json', async: true, @@ -101,10 +164,10 @@ $.ajax({ url: createURL('addCluster'), data: { - clustername: 'brian-cluster-xen', + clustername: data.cluster.name, podid: args.data.pod.id, zoneid: args.data.zone.id, - hypervisor: 'XenServer', + hypervisor: data.cluster.hypervisor, clustertype: 'CloudManaged' }, dataType: 'json', @@ -126,14 +189,14 @@ $.ajax({ url: createURL('addHost'), data: { - clustername: 'brian-cluster-xen', + clustername: args.data.cluster.name, zoneid: args.data.zone.id, podid: args.data.pod.id, hypervisor: 'XenServer', clustertype: 'CloudManaged', - url: 'http://10.223.183.2', - username: 'root', - password: 'password' + url: 'http://' + data.host.hostname, + username: data.host.username, + password: data.host.password }, dataType: 'json', async: true, @@ -154,13 +217,13 @@ $.ajax({ url: createURL('createStoragePool'), data: { - name: 'brian-primary-storage', + name: data.primaryStorage.name, clusterid: args.data.cluster.id, zoneid: args.data.zone.id, podid: args.data.pod.id, hypervisor: 'XenServer', clustertype: 'CloudManaged', - url: 'nfs://10.223.110.232/export/home/bfederle/primary' + url: 'nfs://' + data.primaryStorage.server + data.primaryStorage.path }, dataType: 'json', async: true, @@ -183,7 +246,7 @@ data: { clusterid: args.data.cluster.id, zoneid: args.data.zone.id, - url: 'nfs://10.223.110.232/export/home/bfederle/secondary' + url: 'nfs://' + data.secondaryStorage.nfsServer + data.secondaryStorage.path }, dataType: 'json', async: true,