mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
Instance wizard UI: Support conditional hide/show of add network box
Adds new function 'showAddNetwork' to instance wizard configuration, which conditionally hides the 'add network form' on the select network step. If it returns true, then show the box, otherwise false hides it.
This commit is contained in:
parent
83229aa460
commit
27fcb788e9
@ -25,6 +25,12 @@
|
||||
return g_capabilities.customdiskofferingmaxsize;
|
||||
},
|
||||
|
||||
// Determines whether 'add new network' box is shown.
|
||||
// -- return true to show, false to hide
|
||||
showAddNetwork: function(args) {
|
||||
return true;
|
||||
},
|
||||
|
||||
// Called in networks list, when VPC drop-down is changed
|
||||
// -- if vpcID given, return true if in network specified by vpcID
|
||||
// -- if vpcID == -1, return true if network is not associated with a VPC
|
||||
|
||||
@ -464,6 +464,16 @@
|
||||
},
|
||||
|
||||
'network': function($step, formData) {
|
||||
var showAddNetwork = true;
|
||||
|
||||
var checkShowAddNetwork = function($newNetwork) {
|
||||
if (!showAddNetwork) {
|
||||
$newNetwork.hide();
|
||||
} else {
|
||||
$newNetwork.show();
|
||||
}
|
||||
};
|
||||
|
||||
var originalValues = function(formData) {
|
||||
// Default networks
|
||||
$step.find('input[type=radio]').filter(function() {
|
||||
@ -523,6 +533,13 @@
|
||||
// Show relevant conditional sub-step if present
|
||||
$step.find('.wizard-step-conditional').hide();
|
||||
|
||||
if ($.isFunction(args.showAddNetwork)) {
|
||||
showAddNetwork = args.showAddNetwork({
|
||||
data: formData,
|
||||
context: context
|
||||
});
|
||||
}
|
||||
|
||||
// Filter network list by VPC ID
|
||||
var filterNetworkList = function(vpcID) {
|
||||
var $selects = $step.find('.my-networks .select-container .select');
|
||||
@ -546,6 +563,7 @@
|
||||
} else {
|
||||
$step.find('.my-networks .select-container').removeClass('single-select');
|
||||
$addNetworkForm.show();
|
||||
checkShowAddNetwork($addNetworkForm);
|
||||
}
|
||||
|
||||
$selects.find('input[type=checkbox]').attr('checked', false);
|
||||
@ -648,6 +666,7 @@
|
||||
);
|
||||
|
||||
originalValues(formData);
|
||||
checkShowAddNetwork($newNetwork);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user