Skip to content

Commit 0333225

Browse files
committed
2 parents 5a86546 + a5ac88d commit 0333225

4 files changed

Lines changed: 87 additions & 42 deletions

File tree

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#!/bin/bash
2+
# Licensed to the Apache Software Foundation (ASF) under one
3+
# or more contributor license agreements. See the NOTICE file
4+
# distributed with this work for additional information
5+
# regarding copyright ownership. The ASF licenses this file
6+
# to you under the Apache License, Version 2.0 (the
7+
# "License"); you may not use this file except in compliance
8+
# with the License. You may obtain a copy of the License at
9+
#
10+
# http://www.apache.org/licenses/LICENSE-2.0
11+
#
12+
# Unless required by applicable law or agreed to in writing,
13+
# software distributed under the License is distributed on an
14+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
# KIND, either express or implied. See the License for the
16+
# specific language governing permissions and limitations
17+
# under the License.
18+
19+
for i in $*
20+
do
21+
info=`/opt/cloud/bin/checks2svpn.sh $i`
22+
ret=$?
23+
echo -n "$i:$ret:$info&"
24+
done
25+

‎ui/index.jsp‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ under the License.
220220
</div>
221221

222222
<!-- Step 5: Network -->
223-
<div class="step network" wizard-step-id="network">
223+
<div class="step network always-load" wizard-step-id="network">
224224
<!-- 5a: Network description -->
225225
<div class="wizard-step-conditional nothing-to-select">
226226
<p id="from_instance_page_1"><fmt:message key="message.zone.no.network.selection"/></p>

‎ui/scripts/instanceWizard.js‎

Lines changed: 44 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -268,25 +268,30 @@
268268
}
269269

270270
if (selectedZoneObj.networktype == "Advanced") { //Advanced zone. Show network list.
271-
var $networkStep = $(".step.network:visible .nothing-to-select");
271+
var $networkStep = $(".step.network:visible .nothing-to-select");
272+
var $networkStepContainer = $('.step.network:visible');
273+
272274
if(args.initArgs.pluginForm != null && args.initArgs.pluginForm.name == "vpcTierInstanceWizard") { //from VPC Tier chart
273275
step5ContainerType = 'nothing-to-select';
274276
$networkStep.find("#from_instance_page_1").hide();
275277
$networkStep.find("#from_instance_page_2").hide();
276278
$networkStep.find("#from_vpc_tier").text("tier " + args.context.networks[0].name);
277279
$networkStep.find("#from_vpc_tier").show();
278-
}
279-
else { //from Instance page
280+
} else { //from Instance page
280281
if(selectedZoneObj.securitygroupsenabled != true) { // Advanced SG-disabled zone
281282
step5ContainerType = 'select-network';
282283
$networkStep.find("#from_instance_page_1").show();
283284
$networkStep.find("#from_instance_page_2").show();
284285
$networkStep.find("#from_vpc_tier").text("");
285286
$networkStep.find("#from_vpc_tier").hide();
287+
} else { // Advanced SG-enabled zone
288+
step5ContainerType = 'select-advanced-sg';
286289
}
287-
else { // Advanced SG-enabled zone
288-
step5ContainerType = 'select-security-group';
289-
}
290+
291+
if ($networkStepContainer.hasClass('next-use-security-groups')) {
292+
$networkStepContainer.removeClass('repeat next-use-security-groups loaded');
293+
step5ContainerType = 'select-security-group';
294+
}
290295
}
291296
}
292297
else { //Basic zone. Show securigy group list or nothing(when no SecurityGroup service in guest network)
@@ -320,7 +325,7 @@
320325
}
321326

322327
//step5ContainerType = 'nothing-to-select'; //for testing only, comment it out before checking in
323-
if(step5ContainerType == 'select-network') {
328+
if(step5ContainerType == 'select-network' || step5ContainerType == 'select-advanced-sg') {
324329
var defaultNetworkArray = [], optionalNetworkArray = [];
325330
var networkData = {
326331
zoneId: args.currentData.zoneid
@@ -379,6 +384,9 @@
379384
});
380385
//get network offerings (end) ***
381386

387+
if (step5ContainerType == 'select-advanced-sg') {
388+
$networkStepContainer.addClass('repeat next-use-security-groups');
389+
}
382390

383391
args.response.success({
384392
type: 'select-network',
@@ -545,41 +553,38 @@
545553

546554
if(checkedSecurityGroupIdArray.length > 0)
547555
array1.push("&securitygroupids=" + checkedSecurityGroupIdArray.join(","));
548-
549-
/*
550-
if(selectedZoneObj.networktype == "Advanced" && selectedZoneObj.securitygroupsenabled == true) { // Advanced SG-enabled zone
551-
var networkData = {
552-
zoneId: selectedZoneObj.id,
553-
type: 'Shared',
554-
supportedServices: 'SecurityGroup'
555-
};
556-
if (!(cloudStack.context.projects && cloudStack.context.projects[0])) {
557-
networkData.domainid = g_domainid;
558-
networkData.account = g_account;
559-
}
556+
557+
if(selectedZoneObj.networktype == "Advanced" && selectedZoneObj.securitygroupsenabled == true) { // Advanced SG-enabled zone
558+
var array2 = [];
559+
var myNetworks = $('.multi-wizard:visible form').data('my-networks'); //widget limitation: If using an advanced security group zone, get the guest networks like this
560+
var defaultNetworkId = $('.multi-wizard:visible form').find('input[name=defaultNetwork]:checked').val();
561+
562+
var checkedNetworkIdArray;
563+
if(typeof(myNetworks) == "object" && myNetworks.length != null) { //myNetworks is an array of string, e.g. ["203", "202"],
564+
checkedNetworkIdArray = myNetworks;
565+
}
566+
else if(typeof(myNetworks) == "string" && myNetworks.length > 0) { //myNetworks is a string, e.g. "202"
567+
checkedNetworkIdArray = [];
568+
checkedNetworkIdArray.push(myNetworks);
569+
}
570+
else { // typeof(myNetworks) == null
571+
checkedNetworkIdArray = [];
572+
}
560573

561-
var selectedNetworkObj = null;
562-
$.ajax({
563-
url: createURL('listNetworks'),
564-
data: networkData,
565-
async: false,
566-
success: function(json) {
567-
var networks = json.listnetworksresponse.network;
568-
if(networks != null && networks.length > 0) {
569-
selectedNetworkObj = networks[0]; //each Advanced SG-enabled zone has only one guest network that is Shared and has SecurityGroup service
570-
}
574+
//add default network first
575+
if(defaultNetworkId != null && defaultNetworkId.length > 0 && defaultNetworkId != 'new-network')
576+
array2.push(defaultNetworkId);
577+
578+
//then, add other checked networks
579+
if(checkedNetworkIdArray.length > 0) {
580+
for(var i=0; i < checkedNetworkIdArray.length; i++) {
581+
if(checkedNetworkIdArray[i] != defaultNetworkId) //exclude defaultNetworkId that has been added to array2
582+
array2.push(checkedNetworkIdArray[i]);
571583
}
572-
});
573-
if(selectedNetworkObj != null) {
574-
array1.push("&networkIds=" + selectedNetworkObj.id);
575584
}
576-
else {
577-
alert('unable to find any Shared network with SecurityGroup service. Therefore, unable to deploy VM in this Advanced SecurityGroup-enabled zone.');
578-
return;
579-
}
580-
}
581-
*/
582-
585+
586+
array1.push("&networkIds=" + array2.join(","));
587+
}
583588
}
584589
else if (step5ContainerType == 'nothing-to-select') {
585590
if(args.context.networks != null) { //from VPC tier

‎ui/scripts/ui-custom/instanceWizard.js‎

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -598,6 +598,8 @@
598598
response: {
599599
success: function(args) {
600600
var vpcs = args.data.vpcs;
601+
var addClass = args.addClass;
602+
var removeClass = args.removeClass;
601603

602604
// Populate VPC drop-down
603605
$vpcSelect.html('');
@@ -753,7 +755,8 @@
753755
)
754756
);
755757

756-
$targetStep.addClass('loaded');
758+
if (!$targetStep.hasClass('repeat') &&
759+
!$targetStep.hasClass('always-load')) $targetStep.addClass('loaded');
757760
}
758761

759762
// Show launch vm button if last step
@@ -806,6 +809,14 @@
806809

807810
//step 5 - select network
808811
if($activeStep.find('.wizard-step-conditional.select-network:visible').size() > 0) {
812+
var data = $activeStep.data('my-networks');
813+
814+
if (!data) {
815+
$activeStep.closest('form').data('my-networks', cloudStack.serializeForm(
816+
$activeStep.closest('form')
817+
)['my-networks']);
818+
}
819+
809820
if($activeStep.find('input[type=checkbox]:checked').size() == 0) { //if no checkbox is checked
810821
cloudStack.dialog.notice({ message: 'message.step.4.continue' });
811822
return false;
@@ -828,7 +839,11 @@
828839
}
829840
}
830841

831-
showStep($steps.filter(':visible').index() + 2);
842+
if ($activeStep.hasClass('repeat')) {
843+
showStep($steps.filter(':visible').index() + 1);
844+
} else {
845+
showStep($steps.filter(':visible').index() + 2);
846+
}
832847

833848
return false;
834849
}

0 commit comments

Comments
 (0)