Gilad Chaplik has posted comments on this change.

Change subject: webadmin: Add validation for create/edit pool (#849426)
......................................................................


Patch Set 2: I would prefer that you didn't submit this

(8 inline comments)

....................................................
Commit Message
Line 10: 
Line 11: The VM name length is limited. When the new pool
Line 12: is created, the names of the VMs in the pool is
Line 13: limited as well. When the limit is, say 6 chars,
Line 14: than when you create a pool with name like 'pool'
/s/than/then
Line 15: with 10 VMs in it, the names of the VMs will be
Line 16: pool-1, pool-2,..., pool-10. But the pool-10
Line 17: is 7 chars long and the creation of such a VM fails.
Line 18: 


....................................................
File 
frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/ExistingPoolModelBehavior.java
Line 61:         return new IValidation[] { new 
ExistingPoolNameLengthValidation(
Line 62:                 (String) getModel().getName().getEntity(),
Line 63:                 getModel().getAssignedVms().AsConvertible().Integer()
Line 64:                         + 
getModel().getNumOfDesktops().AsConvertible().Integer(),
Line 65:                 (VmOsType) getModel().getOSType().getSelectedItem()
do not use AsConvertible.
we need to use generics for entityModel.
currently use casting for getEntity()
Line 66:                 ) };
Line 67:     }
Line 68: 
Line 69:     @Override


Line 67:     }
Line 68: 
Line 69:     @Override
Line 70:     protected IValidation[] getPoolNameSpecificValidations() {
Line 71:         return new IValidation[] { new DummyValidation() };
return new IValidation[] { new IValidation() {

            @Override
            public ValidationResult Validate(Object value) {
                return new ValidationResult();
            }
        } };
Line 72:     }
Line 73: 


....................................................
File 
frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/NewPoolModelBehavior.java
Line 40:     }
Line 41: 
Line 42:     @Override
Line 43:     protected IValidation[] getNumOfDesktopsSpecificValidations() {
Line 44:         return new IValidation[] { new DummyValidation() };
return new IValidation[] { new IValidation() {

            @Override
            public ValidationResult Validate(Object value) {
                return new ValidationResult();
            }
        } };
Line 45:     }
Line 46: 
Line 47:     @Override
Line 48:     protected IValidation[] getPoolNameSpecificValidations() {


Line 47:     @Override
Line 48:     protected IValidation[] getPoolNameSpecificValidations() {
Line 49:         return new IValidation[] { new NewPoolNameLengthValidation(
Line 50:                 (String) getModel().getName().getEntity(),
Line 51:                 
getModel().getNumOfDesktops().AsConvertible().Integer(),
same.
Line 52:                 (VmOsType) getModel().getOSType().getSelectedItem()
Line 53:                 ) };
Line 54:     }


....................................................
File 
frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/PoolModelBehaviorBase.java
Line 318:                         new LengthValidation(4),
Line 319:                         new IntegerValidation(isNew ? 1 : 0, isNew ? 
maxAllowedVms : maxAllowedVms - assignedVms)
Line 320:                 },
Line 321: 
Line 322:                         getNumOfDesktopsSpecificValidations()
after the former validation, add this line:
if(getModel().getNumOfDesktops().getIsValid()){
            getModel().getNumOfDesktops().ValidateEntity(
}

remove union (like you did in name validation)
Line 323:                 )
Line 324:                 );
Line 325: 
Line 326:         getModel().getPrestartedVms().ValidateEntity(


....................................................
File 
frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/validation/DummyValidation.java
Line 1: package org.ovirt.engine.ui.uicommonweb.validation;
Line 2: 
Line 3: public class DummyValidation implements IValidation {
don't think this class is necessary
Line 4: 
Line 5:     @Override
Line 6:     public ValidationResult Validate(Object value) {
Line 7:         ValidationResult res = new ValidationResult();


....................................................
File 
frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/validation/ExistingPoolNameLengthValidation.java
Line 18: 
Line 19:     private int generateMaxLength() {
Line 20:         return doGenerateMaxLength(getMaxNameLength(), 
getPoolName().length());
Line 21:     }
Line 22: 
'doGenerateMaxLength' access modifier?
Line 23:     int doGenerateMaxLength(int maxNameLengt, int poolNameLength) {
Line 24:         int allowedLength = maxNameLengt - poolNameLength - 1;
Line 25:         StringBuilder sb = new StringBuilder("");
Line 26: 


--
To view, visit http://gerrit.ovirt.org/7649
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I66f765ceb0567beb006d1ef4f45db3902ef95ea6
Gerrit-PatchSet: 2
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Tomas Jelinek <[email protected]>
Gerrit-Reviewer: Daniel Erez <[email protected]>
Gerrit-Reviewer: Gilad Chaplik <[email protected]>
Gerrit-Reviewer: Tomas Jelinek <[email protected]>
Gerrit-Reviewer: oVirt Jenkins CI Server
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to