You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by bh...@apache.org on 2014/11/25 15:51:44 UTC
[08/18] git commit: updated refs/heads/4.3 to b8a28df
CLOUDSTACK-7766: Field Validations Missing for Ingress and Egress Rules
(cherry picked from commit 94b16b3bd5f8b3b7635f07e9304e461cd2dc2275)
Signed-off-by: Rohit Yadav <ro...@shapeblue.com>
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/ca8ecc04
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/ca8ecc04
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/ca8ecc04
Branch: refs/heads/4.3
Commit: ca8ecc0470191eb35788429a7afcf604ee3d389c
Parents: 0b317ea
Author: Gabor Apati-Nagy <ga...@citrix.com>
Authored: Tue Oct 28 19:06:14 2014 +0000
Committer: Rohit Yadav <ro...@shapeblue.com>
Committed: Tue Nov 25 18:42:56 2014 +0530
----------------------------------------------------------------------
ui/scripts/network.js | 34 +++++++++++++++++++++++++++------
ui/scripts/ui/widgets/multiEdit.js | 9 +++++++++
2 files changed, 37 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/ca8ecc04/ui/scripts/network.js
----------------------------------------------------------------------
diff --git a/ui/scripts/network.js b/ui/scripts/network.js
index 8e70034..511ad41 100755
--- a/ui/scripts/network.js
+++ b/ui/scripts/network.js
@@ -4459,11 +4459,19 @@
},
'startport': {
edit: true,
- label: 'label.start.port'
+ label: 'label.start.port',
+ validation: {
+ number: true,
+ range: [0, 65535]
+ }
},
'endport': {
edit: true,
- label: 'label.end.port'
+ label: 'label.end.port',
+ validation: {
+ number: true,
+ range: [0, 65535]
+ }
},
'icmptype': {
edit: true,
@@ -4478,7 +4486,10 @@
'cidr': {
edit: true,
label: 'label.cidr',
- isHidden: true
+ isHidden: true,
+ validation: {
+ ipv4cidr: true
+ }
},
'accountname': {
edit: true,
@@ -4654,11 +4665,19 @@
},
'startport': {
edit: true,
- label: 'label.start.port'
+ label: 'label.start.port',
+ validation: {
+ number: true,
+ range: [0, 65535]
+ }
},
'endport': {
edit: true,
- label: 'label.end.port'
+ label: 'label.end.port',
+ validation: {
+ number: true,
+ range: [0, 65535]
+ }
},
'icmptype': {
edit: true,
@@ -4673,7 +4692,10 @@
'cidr': {
edit: true,
label: 'label.cidr',
- isHidden: true
+ isHidden: true,
+ validation: {
+ ipv4cidr: true
+ }
},
'accountname': {
edit: true,
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/ca8ecc04/ui/scripts/ui/widgets/multiEdit.js
----------------------------------------------------------------------
diff --git a/ui/scripts/ui/widgets/multiEdit.js b/ui/scripts/ui/widgets/multiEdit.js
index 873775d..8f49da2 100755
--- a/ui/scripts/ui/widgets/multiEdit.js
+++ b/ui/scripts/ui/widgets/multiEdit.js
@@ -971,6 +971,10 @@
.attr('disabled', field.isDisabled ? 'disabled' : false)
.appendTo($td);
+ if (field.validation) {
+ $td.find('input').first().data("validation-settings", field.validation );
+ }
+
if (field.isDisabled) $input.hide();
if (field.defaultValue) {
$input.val(field.defaultValue);
@@ -1222,6 +1226,11 @@
$multiForm.validate();
+ var inputs = $multiForm.find('input');
+ $.each(inputs, function() {
+ if ($(this).data && $(this).data('validation-settings'))
+ $(this).rules('add', $(this).data('validation-settings'));
+ });
return this;
};