You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by je...@apache.org on 2014/02/28 23:59:49 UTC
git commit: updated refs/heads/master to d5dc6aa
Repository: cloudstack
Updated Branches:
refs/heads/master d9a4e038a -> d5dc6aab6
CLOUDSTACK-6190: UI > VM Wizard > select network step > support specifying IP Address for every network. Change to use ipToNetworkList parameter instead of networkIds parameter of deployVM API.
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/d5dc6aab
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/d5dc6aab
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/d5dc6aab
Branch: refs/heads/master
Commit: d5dc6aab614a345da48b97453650461b8672c0d1
Parents: d9a4e03
Author: Jessica Wang <je...@apache.org>
Authored: Fri Feb 28 14:58:18 2014 -0800
Committer: Jessica Wang <je...@apache.org>
Committed: Fri Feb 28 14:58:18 2014 -0800
----------------------------------------------------------------------
ui/scripts/instanceWizard.js | 60 ++++++++++++++++++++++++++++++++-------
1 file changed, 50 insertions(+), 10 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/d5dc6aab/ui/scripts/instanceWizard.js
----------------------------------------------------------------------
diff --git a/ui/scripts/instanceWizard.js b/ui/scripts/instanceWizard.js
index 4a740c6..e9296a9 100644
--- a/ui/scripts/instanceWizard.js
+++ b/ui/scripts/instanceWizard.js
@@ -665,6 +665,7 @@
//step 6: select network
if (step6ContainerType == 'select-network' || step6ContainerType == 'select-advanced-sg') {
var array2 = [];
+ var array3 = [];
var defaultNetworkId = args.data.defaultNetwork; //args.data.defaultNetwork might be equal to string "new-network" or a network ID
var checkedNetworkIdArray;
@@ -710,23 +711,62 @@
}
//create new network ends here
- //add default network first
- if (defaultNetworkId != null && defaultNetworkId.length > 0) {
- array2.push(defaultNetworkId);
- }
- //then, add other checked networks
+ if (defaultNetworkId == null) {
+ cloudStack.dialog.notice({
+ message: "Please select a default network in Network step."
+ });
+ return;
+ }
+
if (checkedNetworkIdArray.length > 0) {
for (var i = 0; i < checkedNetworkIdArray.length; i++) {
- if (checkedNetworkIdArray[i] != defaultNetworkId) //exclude defaultNetworkId that has been added to array2
+ if (checkedNetworkIdArray[i] == defaultNetworkId) {
+ array2.unshift(defaultNetworkId);
+
+ var ipToNetwork = {
+ networkid: defaultNetworkId
+ };
+ if (args.data["new-network"] == "create-new-network") {
+ if (args.data['new-network-ip'] != null && args.data['new-network-ip'].length > 0) {
+ $.extend(ipToNetwork, {
+ ip: args.data['new-network-ip']
+ });
+ }
+ } else {
+ if (args.data["my-network-ips"][i] != null && args.data["my-network-ips"][i].length > 0) {
+ $.extend(ipToNetwork, {
+ ip: args.data["my-network-ips"][i]
+ });
+ }
+ }
+ array3.unshift(ipToNetwork);
+
+ } else {
array2.push(checkedNetworkIdArray[i]);
+
+ var ipToNetwork = {
+ networkid: checkedNetworkIdArray[i]
+ };
+ if (args.data["my-network-ips"][i] != null && args.data["my-network-ips"][i].length > 0) {
+ $.extend(ipToNetwork, {
+ ip: args.data["my-network-ips"][i]
+ });
+ }
+ array3.push(ipToNetwork);
+ }
}
}
- $.extend(deployVmData, {
- networkids : array2.join(",")
- });
-
+ //deployVmData.push("&networkIds=" + array2.join(",")); //ipToNetworkMap can't be specified along with networkIds or ipAddress
+
+ for (var k = 0; k < array3.length; k++) {
+ deployVmData["iptonetworklist[" + k + "].networkid"] = array3[k].networkid;
+ if (array3[k].ip != undefined && array3[k].ip.length > 0) {
+ deployVmData["iptonetworklist[" + k + "].ip"] = array3[k].ip;
+ }
+ }
+
} else if (step6ContainerType == 'select-security-group') {
var checkedSecurityGroupIdArray;
if (typeof(args.data["security-groups"]) == "object" && args.data["security-groups"].length != null) { //args.data["security-groups"] is an array of string, e.g. ["2375f8cc-8a73-4b8d-9b26-50885a25ffe0", "27c60d2a-de7f-4bb7-96e5-a602cec681df","c6301d77-99b5-4e8a-85e2-3ea2ab31c342"],