Lior Vernia has uploaded a new change for review. Change subject: webadmin: Made profile name checks consistent ......................................................................
webadmin: Made profile name checks consistent Fixed the frontend validation to be as restrictive as the backend one (e.g. not allowing dots), as well as added a frontend validation of the profile names in the add/edit network dialog. Change-Id: Ided5e902faae928608a7558a08ed1768e3d8cb81 Bug-Url: https://bugzilla.redhat.com/1012032 Signed-off-by: Lior Vernia <lver...@redhat.com> --- M frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/datacenters/NetworkModel.java M frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/profiles/VnicProfileModel.java M frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/key_value/KeyValueModel.java 3 files changed, 13 insertions(+), 4 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/80/20180/1 diff --git a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/datacenters/NetworkModel.java b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/datacenters/NetworkModel.java index 2d938d4..8643090 100644 --- a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/datacenters/NetworkModel.java +++ b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/datacenters/NetworkModel.java @@ -383,8 +383,17 @@ getExternalProviders().validateSelectedItem(new IValidation[] { new NotEmptyValidation() }); + boolean profilesValid = true; + Iterable<VnicProfileModel> profiles = getProfiles().getItems(); + for (VnicProfileModel profileModel : profiles) { + if (!profileModel.validate()) { + profilesValid = false; + } + } + return getName().getIsValid() && getVLanTag().getIsValid() && getDescription().getIsValid() - && getMtu().getIsValid() && getExternalProviders().getIsValid() && getComment().getIsValid(); + && getMtu().getIsValid() && getExternalProviders().getIsValid() && getComment().getIsValid() + && profilesValid; } protected boolean firstInit = true; diff --git a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/profiles/VnicProfileModel.java b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/profiles/VnicProfileModel.java index 2bede08..7def287 100644 --- a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/profiles/VnicProfileModel.java +++ b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/profiles/VnicProfileModel.java @@ -29,7 +29,7 @@ import org.ovirt.engine.ui.uicommonweb.models.ListModel; import org.ovirt.engine.ui.uicommonweb.models.Model; import org.ovirt.engine.ui.uicommonweb.models.vms.key_value.KeyValueModel; -import org.ovirt.engine.ui.uicommonweb.validation.I18NNameValidation; +import org.ovirt.engine.ui.uicommonweb.validation.AsciiNameValidation; import org.ovirt.engine.ui.uicommonweb.validation.IValidation; import org.ovirt.engine.ui.uicommonweb.validation.NotEmptyValidation; import org.ovirt.engine.ui.uicompat.ConstantsManager; @@ -332,7 +332,7 @@ public boolean validate() { - getName().validateEntity(new IValidation[] { new NotEmptyValidation(), new I18NNameValidation() }); + getName().validateEntity(new IValidation[] { new NotEmptyValidation(), new AsciiNameValidation() }); return getName().getIsValid() && getCustomPropertySheet().validate(); } diff --git a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/key_value/KeyValueModel.java b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/key_value/KeyValueModel.java index 43e6234..8c4de88 100644 --- a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/key_value/KeyValueModel.java +++ b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/key_value/KeyValueModel.java @@ -315,7 +315,7 @@ } for (KeyValueLineModel keyValueLineModel : (List<KeyValueLineModel>) getKeyValueLines().getItems()) { String key = (String) keyValueLineModel.getKeys().getSelectedItem(); - if (key.equals(NO_KEYS) || key.equals(SELECT_KEY)) { + if (key == null || key.equals(NO_KEYS) || key.equals(SELECT_KEY)) { continue; } -- To view, visit http://gerrit.ovirt.org/20180 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ided5e902faae928608a7558a08ed1768e3d8cb81 Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Lior Vernia <lver...@redhat.com> _______________________________________________ Engine-patches mailing list Engine-patches@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-patches