diff --git a/ui/index.jsp b/ui/index.jsp index d2381d54bdc..aa9f48b8fa2 100644 --- a/ui/index.jsp +++ b/ui/index.jsp @@ -209,8 +209,9 @@
-

-

+

+

+

diff --git a/ui/scripts/instanceWizard.js b/ui/scripts/instanceWizard.js index 9d3347a3677..8296ed604ab 100644 --- a/ui/scripts/instanceWizard.js +++ b/ui/scripts/instanceWizard.js @@ -231,8 +231,22 @@ } } - if (selectedZoneObj.networktype == "Advanced") { //Advanced zone. Show network list. - step5ContainerType = 'select-network'; + if (selectedZoneObj.networktype == "Advanced") { //Advanced zone. Show network list. + var $networkStep = $(".step.network:visible .nothing-to-select"); + if(args.initArgs.pluginForm != null && args.initArgs.pluginForm.name == "vpcTierInstanceWizard") { //from VPC Tier chart + step5ContainerType = 'nothing-to-select'; + $networkStep.find("#from_instance_page_1").hide(); + $networkStep.find("#from_instance_page_2").hide(); + $networkStep.find("#from_vpc_tier").text("tier " + args.context.tiers[0].name); + $networkStep.find("#from_vpc_tier").show(); + } + else { //from Instance page + step5ContainerType = 'select-network'; + $networkStep.find("#from_instance_page_1").show(); + $networkStep.find("#from_instance_page_2").show(); + $networkStep.find("#from_vpc_tier").text(""); + $networkStep.find("#from_vpc_tier").hide(); + } } else { //Basic zone. Show securigy group list or nothing(when no SecurityGroup service in guest network) var includingSecurityGroupService = false; @@ -370,14 +384,6 @@ } ], action: function(args) { -/* -var isValid = true; -isValid &= validateString("Name", $thisPopup.find("#wizard_vm_name"), $thisPopup.find("#wizard_vm_name_errormsg"), true); //optional -isValid &= validateString("Group", $thisPopup.find("#wizard_vm_group"), $thisPopup.find("#wizard_vm_group_errormsg"), true); //optional -if (!isValid) -return; -*/ - // Create a new VM!!!! var array1 = []; @@ -470,7 +476,11 @@ return; if(checkedSecurityGroupIdArray.length > 0) array1.push("&securitygroupids=" + checkedSecurityGroupIdArray.join(",")); } - + else if (step5ContainerType == 'nothing-to-select') { + if(args.context.tiers != null) //from VPC tier + array1.push("&networkIds=" + args.context.tiers[0].id); + } + var displayname = args.data.displayname; if(displayname != null && displayname.length > 0) { array1.push("&displayname="+todb(displayname)); diff --git a/ui/scripts/network.js b/ui/scripts/network.js index e484cec7ad4..632132e2f20 100644 --- a/ui/scripts/network.js +++ b/ui/scripts/network.js @@ -3140,7 +3140,12 @@ }, actions: { add: { - label: 'Add VPC', + label: 'Add VPC', + messages: { + notification: function(args) { + return 'Add VPC'; + } + }, createForm: { title: 'Add VPC', messages: { diff --git a/ui/scripts/ui-custom/instanceWizard.js b/ui/scripts/ui-custom/instanceWizard.js index 28bd39c75b6..3d82e484dc9 100644 --- a/ui/scripts/ui-custom/instanceWizard.js +++ b/ui/scripts/ui-custom/instanceWizard.js @@ -162,7 +162,9 @@ var dataProvider = function(step, providerArgs, callback) { // Call appropriate data provider args.steps[step - 1]($.extend(providerArgs, { - currentData: cloudStack.serializeForm($form) + currentData: cloudStack.serializeForm($form), + initArgs: args, + context: context })); }; diff --git a/ui/scripts/ui-custom/vpc.js b/ui/scripts/ui-custom/vpc.js index 0e4975a161b..cc9edab1f41 100644 --- a/ui/scripts/ui-custom/vpc.js +++ b/ui/scripts/ui-custom/vpc.js @@ -341,34 +341,31 @@ }, // Success - function(args) { - var newData = args.data ? args.data : {}; - var newTier = $.extend(true, {}, context.tiers[0], newData); - var newContext = $.extend(true, {}, context); - - // Update data - newContext.tiers = [newTier]; - - if (remove) { - $tier.remove(); - } else { - $loading.remove(); - } - - if (actionID == 'addVM') { - // Increment VM total - var $total = $tier.find('.vm-count .total'); - var prevTotal = parseInt($total.html()); - var newTotal = prevTotal + 1; - - $total.html(newTotal); - } - - filterActions({ - $actions: $actions, - actionPreFilter: actionPreFilter, - context: newContext - }); + function(args) { + if (actionID == 'addVM') { + // Increment VM total + var $total = $tier.find('.vm-count .total'); + var prevTotal = parseInt($total.html()); + var newTotal = prevTotal + 1; + $total.html(newTotal); + + $loading.remove(); + + var newVM = args.data; + var newContext = $.extend(true, {}, context, { + vms: [newVM] + }); + filterActions({ + $actions: $actions, + actionPreFilter: actionPreFilter, + context: newContext + }); + } + + else if (actionID == 'remove') { //remove tier + $tier.remove(); + } + }, {}, diff --git a/ui/scripts/vpc.js b/ui/scripts/vpc.js index e622c627062..c6cf08d58eb 100644 --- a/ui/scripts/vpc.js +++ b/ui/scripts/vpc.js @@ -483,8 +483,12 @@ addVM: { label: 'Add VM to tier', shortLabel: 'Add VM', - action: cloudStack.uiCustom.instanceWizard( - cloudStack.instanceWizard + action: cloudStack.uiCustom.instanceWizard( + $.extend(true, {}, cloudStack.instanceWizard, { + pluginForm: { + name: 'vpcTierInstanceWizard' + } + }) ), notification: { poll: pollAsyncJobResult @@ -535,7 +539,7 @@ } }); } - } + } args.response.success({ tiers: networks }); } });