mirror of https://github.com/apache/cloudstack.git
CLOUDSTACK-537: cloudstack UI - Advanced SG-enabled zone - Instance wizard UI: Support advanced zone with security groups
For advanced zones with SG enabled, show both the add guest network step as well as the add security group step. reviewed-by: jessica
This commit is contained in:
parent
ce4b49d30b
commit
77bc04b90f
|
|
@ -220,7 +220,7 @@ under the License.
|
|||
</div>
|
||||
|
||||
<!-- Step 5: Network -->
|
||||
<div class="step network" wizard-step-id="network">
|
||||
<div class="step network always-load" wizard-step-id="network">
|
||||
<!-- 5a: Network description -->
|
||||
<div class="wizard-step-conditional nothing-to-select">
|
||||
<p id="from_instance_page_1"><fmt:message key="message.zone.no.network.selection"/></p>
|
||||
|
|
|
|||
|
|
@ -268,25 +268,30 @@
|
|||
}
|
||||
|
||||
if (selectedZoneObj.networktype == "Advanced") { //Advanced zone. Show network list.
|
||||
var $networkStep = $(".step.network:visible .nothing-to-select");
|
||||
var $networkStep = $(".step.network:visible .nothing-to-select");
|
||||
var $networkStepContainer = $('.step.network:visible');
|
||||
|
||||
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.networks[0].name);
|
||||
$networkStep.find("#from_vpc_tier").show();
|
||||
}
|
||||
else { //from Instance page
|
||||
} else { //from Instance page
|
||||
if(selectedZoneObj.securitygroupsenabled != true) { // Advanced SG-disabled zone
|
||||
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 { // Advanced SG-enabled zone
|
||||
step5ContainerType = 'select-advanced-sg';
|
||||
}
|
||||
else { // Advanced SG-enabled zone
|
||||
step5ContainerType = 'select-security-group';
|
||||
}
|
||||
|
||||
if ($networkStepContainer.hasClass('next-use-security-groups')) {
|
||||
$networkStepContainer.removeClass('repeat next-use-security-groups loaded');
|
||||
step5ContainerType = 'select-security-group';
|
||||
}
|
||||
}
|
||||
}
|
||||
else { //Basic zone. Show securigy group list or nothing(when no SecurityGroup service in guest network)
|
||||
|
|
@ -320,7 +325,7 @@
|
|||
}
|
||||
|
||||
//step5ContainerType = 'nothing-to-select'; //for testing only, comment it out before checking in
|
||||
if(step5ContainerType == 'select-network') {
|
||||
if(step5ContainerType == 'select-network' || step5ContainerType == 'select-advanced-sg') {
|
||||
var defaultNetworkArray = [], optionalNetworkArray = [];
|
||||
var networkData = {
|
||||
zoneId: args.currentData.zoneid
|
||||
|
|
@ -379,6 +384,9 @@
|
|||
});
|
||||
//get network offerings (end) ***
|
||||
|
||||
if (step5ContainerType == 'select-advanced-sg') {
|
||||
$networkStepContainer.addClass('repeat next-use-security-groups');
|
||||
}
|
||||
|
||||
args.response.success({
|
||||
type: 'select-network',
|
||||
|
|
@ -449,6 +457,15 @@
|
|||
// Create a new VM!!!!
|
||||
var array1 = [];
|
||||
|
||||
//
|
||||
// @jessica
|
||||
// If using an advanced security group zone, get the guest networks like this
|
||||
//
|
||||
// var myNetworks = $('.multi-wizard:visible form').data('my-networks');
|
||||
//
|
||||
// -- and get the security groups from args.data['security-groups']
|
||||
//
|
||||
|
||||
//step 1 : select zone
|
||||
array1.push("&zoneId=" + args.data.zoneid);
|
||||
|
||||
|
|
|
|||
|
|
@ -598,6 +598,8 @@
|
|||
response: {
|
||||
success: function(args) {
|
||||
var vpcs = args.data.vpcs;
|
||||
var addClass = args.addClass;
|
||||
var removeClass = args.removeClass;
|
||||
|
||||
// Populate VPC drop-down
|
||||
$vpcSelect.html('');
|
||||
|
|
@ -753,7 +755,8 @@
|
|||
)
|
||||
);
|
||||
|
||||
$targetStep.addClass('loaded');
|
||||
if (!$targetStep.hasClass('repeat') &&
|
||||
!$targetStep.hasClass('always-load')) $targetStep.addClass('loaded');
|
||||
}
|
||||
|
||||
// Show launch vm button if last step
|
||||
|
|
@ -806,6 +809,14 @@
|
|||
|
||||
//step 5 - select network
|
||||
if($activeStep.find('.wizard-step-conditional.select-network:visible').size() > 0) {
|
||||
var data = $activeStep.data('my-networks');
|
||||
|
||||
if (!data) {
|
||||
$activeStep.closest('form').data('my-networks', cloudStack.serializeForm(
|
||||
$activeStep.closest('form')
|
||||
)['my-networks']);
|
||||
}
|
||||
|
||||
if($activeStep.find('input[type=checkbox]:checked').size() == 0) { //if no checkbox is checked
|
||||
cloudStack.dialog.notice({ message: 'message.step.4.continue' });
|
||||
return false;
|
||||
|
|
@ -828,7 +839,11 @@
|
|||
}
|
||||
}
|
||||
|
||||
showStep($steps.filter(':visible').index() + 2);
|
||||
if ($activeStep.hasClass('repeat')) {
|
||||
showStep($steps.filter(':visible').index() + 1);
|
||||
} else {
|
||||
showStep($steps.filter(':visible').index() + 2);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue