mirror of https://github.com/apache/cloudstack.git
CS-15953: cloudstack 3.0 UI - autoscale - add UI validation to validate value in those fields is a number: Min Instances, Max Instances, Polling Interval, Quiet Time, Destroy VM grace period, SNMP Port, Scale Up Policy duration, Scale Down Policy duration.
This commit is contained in:
parent
b9f2e9b93a
commit
91e934efbb
|
|
@ -324,13 +324,19 @@
|
|||
minInstance: {
|
||||
label: 'Min Instances',
|
||||
defaultValue: '3',
|
||||
validation: { required: true }
|
||||
validation: {
|
||||
required: true,
|
||||
number: true
|
||||
}
|
||||
},
|
||||
|
||||
maxInstance: {
|
||||
label: 'Max Instances',
|
||||
defaultValue: '10',
|
||||
validation: { required: true }
|
||||
validation: {
|
||||
required: true,
|
||||
number: true
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
|
|
@ -339,13 +345,19 @@
|
|||
interval: {
|
||||
label: 'Polling Interval (in sec)',
|
||||
defaultValue: '30',
|
||||
validation: { required: true }
|
||||
validation: {
|
||||
required: true,
|
||||
number: true
|
||||
}
|
||||
},
|
||||
|
||||
quietTime: {
|
||||
label: 'Quiet Time (in sec)',
|
||||
defaultValue: '300',
|
||||
validation: { required: true }
|
||||
validation: {
|
||||
required: true,
|
||||
number: true
|
||||
}
|
||||
},
|
||||
|
||||
destroyVMgracePeriod: {
|
||||
|
|
@ -353,7 +365,10 @@
|
|||
defaultValue: '30',
|
||||
isHidden:true,
|
||||
dependsOn:'isAdvanced',
|
||||
validation: { required: true }
|
||||
validation: {
|
||||
required: true,
|
||||
number: true
|
||||
}
|
||||
},
|
||||
securityGroups: {
|
||||
label: 'label.menu.security.groups',
|
||||
|
|
@ -412,7 +427,10 @@
|
|||
dependsOn: 'isAdvanced',
|
||||
label: 'SNMP Port',
|
||||
defaultValue: '161',
|
||||
validation: { required: true }
|
||||
validation: {
|
||||
required: true,
|
||||
number: true
|
||||
}
|
||||
},
|
||||
|
||||
username: {
|
||||
|
|
@ -558,51 +576,7 @@
|
|||
args.response.success({
|
||||
data: scaleUpData
|
||||
});
|
||||
}
|
||||
/*actions: {
|
||||
destroy: {
|
||||
label: '',
|
||||
action: function(args) {
|
||||
$.ajax({
|
||||
url: createURL("deleteCondition&id=" + args.context.multiRule[0].counterid),
|
||||
dataType: 'json',
|
||||
async: true,
|
||||
success: function(data) {
|
||||
var jobId = data.deleteconditionresponse.jobid;
|
||||
|
||||
args.response.success({
|
||||
_custom: {
|
||||
jobId: jobId
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
ignoreEmptyFields: true,
|
||||
dataProvider: function(args) {
|
||||
$.ajax({
|
||||
url: createURL('listConditions'),
|
||||
dataType: 'json',
|
||||
async: true,
|
||||
success: function(data) {
|
||||
args.response.success({
|
||||
data: $.map(
|
||||
data.listconditionsresponse.condition ?
|
||||
data.listconditionsresponse.condition : [],
|
||||
function(elem) {
|
||||
return {
|
||||
counterid: elem.id,
|
||||
relationaloperator: elem.relationaloperator,
|
||||
threshold: elem.threshold
|
||||
};
|
||||
}
|
||||
)
|
||||
});
|
||||
}
|
||||
});
|
||||
}*/
|
||||
}
|
||||
},
|
||||
|
||||
scaleDownPolicy: {
|
||||
|
|
@ -767,7 +741,11 @@
|
|||
if(args.data.scaleUpDuration == null || args.data.scaleUpDuration.length == 0) {
|
||||
args.response.error("Duration of Scale Up Policy is required.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
if(isNaN(args.data.scaleUpDuration)) {
|
||||
args.response.error("Duration of Scale Up Policy should be a number.");
|
||||
return;
|
||||
}
|
||||
if(args.data.scaleUpDuration < args.data.interval) {
|
||||
args.response.error("Duration of Scale Up Policy can not be less than Polling Interval.");
|
||||
return;
|
||||
|
|
@ -782,6 +760,10 @@
|
|||
args.response.error("Duration of Scale Down Policy is required.");
|
||||
return;
|
||||
}
|
||||
if(isNaN(args.data.scaleDownDuration)) {
|
||||
args.response.error("Duration of Scale Down Policy should be a number.");
|
||||
return;
|
||||
}
|
||||
if(args.data.scaleDownDuration < args.data.interval) {
|
||||
args.response.error("Duration of Scale Down Policy can not be less than Polling Interval.");
|
||||
return;
|
||||
|
|
|
|||
Loading…
Reference in New Issue