mirror of https://github.com/apache/cloudstack.git
CS-15796: Disable security group dropdown when in advanced zone
This commit is contained in:
parent
b6e401b1fa
commit
945edac370
|
|
@ -9743,6 +9743,14 @@ div.ui-dialog div.acl div.multi-edit div.data div.data-body div.data-item table
|
|||
max-height: 600px;
|
||||
}
|
||||
|
||||
.ui-dialog div.autoscaler div.form-container div.form-item.disabled {
|
||||
/*+opacity:50%;*/
|
||||
filter: alpha(opacity=50);
|
||||
-ms-filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=50);
|
||||
-moz-opacity: 0.5;
|
||||
opacity: 0.5;
|
||||
}
|
||||
|
||||
.ui-dialog div.autoscaler .detail-actions {
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -17,6 +17,53 @@
|
|||
var totalScaleDownCondition = 0;
|
||||
|
||||
cloudStack.autoscaler = {
|
||||
preFilter: function(args) {
|
||||
var $autoscaler = args.$autoscaler;
|
||||
var isAdvancedZone = false;
|
||||
|
||||
// Hide fields for advanced zone
|
||||
$.ajax({
|
||||
url: createURL('listZones'),
|
||||
data: {
|
||||
id: args.context.networks[0].zoneid,
|
||||
listAll: true
|
||||
},
|
||||
async: false,
|
||||
success: function(json) {
|
||||
var zone = json.listzonesresponse.zone[0];
|
||||
|
||||
if (zone.networktype == 'Advanced') {
|
||||
isAdvancedZone = true;
|
||||
}
|
||||
else
|
||||
isAdvancedZone = false;
|
||||
}
|
||||
});
|
||||
|
||||
// Run pre-filter
|
||||
if (args.data == null) { //from a new LB rule
|
||||
$autoscaler.find('select[name=serviceOfferingId]').removeAttr('disabled');
|
||||
$autoscaler.find('select[name=securityGroups]').removeAttr('disabled');
|
||||
$autoscaler.find('select[name=diskOfferingId]').removeAttr('disabled');
|
||||
} else { //from an existing LB rule
|
||||
$autoscaler.find('select[name=serviceOfferingId]').attr('disabled', true);
|
||||
$autoscaler.find('select[name=securityGroups]').attr('disabled', true);
|
||||
$autoscaler.find('select[name=diskOfferingId]').attr('disabled', true);
|
||||
|
||||
if(args.data.isAdvanced != null) {
|
||||
$autoscaler.find('input[type=checkbox]').trigger('click');
|
||||
$autoscaler.find('input[type=checkbox]').attr('checked', 'checked');
|
||||
}
|
||||
}
|
||||
|
||||
if (isAdvancedZone) {
|
||||
$autoscaler.find('.form-item[rel=securityGroups]')
|
||||
.addClass('disabled')
|
||||
.attr('title', 'Security groups are only selectable for Basic zones');
|
||||
$autoscaler.find('select[name=securityGroups]').attr('disabled', true);
|
||||
}
|
||||
},
|
||||
|
||||
// UI actions to appear in dialog
|
||||
autoscaleActions: {
|
||||
enable: {
|
||||
|
|
|
|||
|
|
@ -366,20 +366,12 @@
|
|||
$loading.remove();
|
||||
renderDialogContent(args);
|
||||
|
||||
if (args.data == null) { //from a new LB rule
|
||||
$autoscalerDialog.find('select[name=serviceOfferingId]').removeAttr('disabled');
|
||||
$autoscalerDialog.find('select[name=securityGroups]').removeAttr('disabled');
|
||||
$autoscalerDialog.find('select[name=diskOfferingId]').removeAttr('disabled');
|
||||
}
|
||||
else { //from an existing LB rule
|
||||
$autoscalerDialog.find('select[name=serviceOfferingId]').attr('disabled', true);
|
||||
$autoscalerDialog.find('select[name=securityGroups]').attr('disabled', true);
|
||||
$autoscalerDialog.find('select[name=diskOfferingId]').attr('disabled', true);
|
||||
|
||||
if(args.data.isAdvanced != null) {
|
||||
$autoscalerDialog.find('input[type=checkbox]').trigger('click');
|
||||
$autoscalerDialog.find('input[type=checkbox]').attr('checked', 'checked');
|
||||
}
|
||||
if (cloudStack.autoscaler.preFilter) {
|
||||
cloudStack.autoscaler.preFilter({
|
||||
data: args.data,
|
||||
$autoscaler: $autoscalerDialog,
|
||||
context: context
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue