Skip to content

Commit ca8ecc0

Browse files
GaborApatiNagyyadvr
authored andcommitted
CLOUDSTACK-7766: Field Validations Missing for Ingress and Egress Rules
(cherry picked from commit 94b16b3) Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
1 parent 0b317ea commit ca8ecc0

2 files changed

Lines changed: 37 additions & 6 deletions

File tree

ui/scripts/network.js

Lines changed: 28 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4459,11 +4459,19 @@
44594459
},
44604460
'startport': {
44614461
edit: true,
4462-
label: 'label.start.port'
4462+
label: 'label.start.port',
4463+
validation: {
4464+
number: true,
4465+
range: [0, 65535]
4466+
}
44634467
},
44644468
'endport': {
44654469
edit: true,
4466-
label: 'label.end.port'
4470+
label: 'label.end.port',
4471+
validation: {
4472+
number: true,
4473+
range: [0, 65535]
4474+
}
44674475
},
44684476
'icmptype': {
44694477
edit: true,
@@ -4478,7 +4486,10 @@
44784486
'cidr': {
44794487
edit: true,
44804488
label: 'label.cidr',
4481-
isHidden: true
4489+
isHidden: true,
4490+
validation: {
4491+
ipv4cidr: true
4492+
}
44824493
},
44834494
'accountname': {
44844495
edit: true,
@@ -4654,11 +4665,19 @@
46544665
},
46554666
'startport': {
46564667
edit: true,
4657-
label: 'label.start.port'
4668+
label: 'label.start.port',
4669+
validation: {
4670+
number: true,
4671+
range: [0, 65535]
4672+
}
46584673
},
46594674
'endport': {
46604675
edit: true,
4661-
label: 'label.end.port'
4676+
label: 'label.end.port',
4677+
validation: {
4678+
number: true,
4679+
range: [0, 65535]
4680+
}
46624681
},
46634682
'icmptype': {
46644683
edit: true,
@@ -4673,7 +4692,10 @@
46734692
'cidr': {
46744693
edit: true,
46754694
label: 'label.cidr',
4676-
isHidden: true
4695+
isHidden: true,
4696+
validation: {
4697+
ipv4cidr: true
4698+
}
46774699
},
46784700
'accountname': {
46794701
edit: true,

ui/scripts/ui/widgets/multiEdit.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -971,6 +971,10 @@
971971
.attr('disabled', field.isDisabled ? 'disabled' : false)
972972
.appendTo($td);
973973

974+
if (field.validation) {
975+
$td.find('input').first().data("validation-settings", field.validation );
976+
}
977+
974978
if (field.isDisabled) $input.hide();
975979
if (field.defaultValue) {
976980
$input.val(field.defaultValue);
@@ -1222,6 +1226,11 @@
12221226

12231227
$multiForm.validate();
12241228

1229+
var inputs = $multiForm.find('input');
1230+
$.each(inputs, function() {
1231+
if ($(this).data && $(this).data('validation-settings'))
1232+
$(this).rules('add', $(this).data('validation-settings'));
1233+
});
12251234
return this;
12261235
};
12271236

0 commit comments

Comments
 (0)