Martin Mucha has uploaded a new change for review. Change subject: userportal,webadmin: macPool per DC, textbox for pool configuration ......................................................................
userportal,webadmin: macPool per DC, textbox for pool configuration add ranges textbox into DC editation popup Change-Id: Id36188ef4b51d9b255c2adf230ca20bcf5979513 Bug-Url: https://bugzilla.redhat.com/1078844 Signed-off-by: Martin Mucha <mmu...@redhat.com> --- M backend/manager/modules/restapi/interface/definition/src/main/resources/api.xsd M backend/manager/modules/restapi/types/src/main/java/org/ovirt/engine/api/restapi/types/DataCenterMapper.java M frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/CommonApplicationConstants.java M frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/datacenters/DataCenterListModel.java M frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/datacenters/DataCenterModel.java A frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/validation/MacAddressRangesValidation.java M frontend/webadmin/modules/uicompat/src/main/java/org/ovirt/engine/ui/uicompat/UIConstants.java M frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/ApplicationConstants.java M frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/datacenter/DataCenterPopupView.java M frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/datacenter/DataCenterPopupView.ui.xml 10 files changed, 87 insertions(+), 2 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/96/26796/1 diff --git a/backend/manager/modules/restapi/interface/definition/src/main/resources/api.xsd b/backend/manager/modules/restapi/interface/definition/src/main/resources/api.xsd index 039a381..6b14342 100644 --- a/backend/manager/modules/restapi/interface/definition/src/main/resources/api.xsd +++ b/backend/manager/modules/restapi/interface/definition/src/main/resources/api.xsd @@ -275,6 +275,12 @@ </xs:sequence> </xs:complexType> + <xs:element name="mac_pool_ranges" type="MacPoolRanges"/> + + <xs:simpleType name="MacPoolRanges"> + <xs:restriction base="xs:string"/> + </xs:simpleType> + <xs:element name="usages" type="Usages" /> <xs:complexType name="Usages"> @@ -1186,6 +1192,7 @@ <xs:element name="version" type="Version" minOccurs="0" /> <xs:element name="supported_versions" type="SupportedVersions" minOccurs="0" /> <xs:element ref="status" minOccurs="0" maxOccurs="1" /> + <xs:element ref="mac_pool_ranges" minOccurs="0" maxOccurs="1"/> <!-- also rel="files" and rel="storagedomains" links --> </xs:sequence> </xs:extension> diff --git a/backend/manager/modules/restapi/types/src/main/java/org/ovirt/engine/api/restapi/types/DataCenterMapper.java b/backend/manager/modules/restapi/types/src/main/java/org/ovirt/engine/api/restapi/types/DataCenterMapper.java index 3169a6c..83bfff8 100644 --- a/backend/manager/modules/restapi/types/src/main/java/org/ovirt/engine/api/restapi/types/DataCenterMapper.java +++ b/backend/manager/modules/restapi/types/src/main/java/org/ovirt/engine/api/restapi/types/DataCenterMapper.java @@ -47,6 +47,9 @@ entity.setcompatibility_version(new org.ovirt.engine.core.compat.Version(model.getVersion().getMajor(), model.getVersion().getMinor())); } + + entity.setMacPoolRanges(model.getMacPoolRanges()); + return entity; } @@ -77,6 +80,9 @@ model.setStorageFormat(storageFormat.value()); } } + + model.setMacPoolRanges(entity.getMacPoolRanges()); + return model; } diff --git a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/CommonApplicationConstants.java b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/CommonApplicationConstants.java index bd3d05a..6bca098 100644 --- a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/CommonApplicationConstants.java +++ b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/CommonApplicationConstants.java @@ -535,6 +535,9 @@ @DefaultStringValue("Reason") String reasonLabel(); + @DefaultStringValue("MacPoolRanges") //TODO MM: why's this duplicated over ther hierarchy? + String macPoolRanges(); + @DefaultStringValue("Based on Template") String basedOnTemplateVmPopup(); diff --git a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/datacenters/DataCenterListModel.java b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/datacenters/DataCenterListModel.java index fac733d..5f0c2b4 100644 --- a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/datacenters/DataCenterListModel.java +++ b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/datacenters/DataCenterListModel.java @@ -322,6 +322,7 @@ model.getDescription().setEntity(dataCenter.getdescription()); model.getComment().setEntity(dataCenter.getComment()); + model.getMacPoolRanges().setEntity(dataCenter.getMacPoolRanges()); model.setOriginalName(dataCenter.getName()); AsyncDataProvider.getStorageDomainList(new AsyncQuery(this, @@ -750,6 +751,7 @@ dataCenter.setName(model.getName().getEntity()); dataCenter.setdescription(model.getDescription().getEntity()); dataCenter.setComment(model.getComment().getEntity()); + dataCenter.setMacPoolRanges(model.getMacPoolRanges().getEntity()); dataCenter.setIsLocal(model.getStoragePoolType().getSelectedItem()); dataCenter.setcompatibility_version(model.getVersion().getSelectedItem()); dataCenter.setQuotaEnforcementType(model.getQuotaEnforceTypeListModel() diff --git a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/datacenters/DataCenterModel.java b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/datacenters/DataCenterModel.java index 24b99a4..af30e23 100644 --- a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/datacenters/DataCenterModel.java +++ b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/datacenters/DataCenterModel.java @@ -1,7 +1,6 @@ package org.ovirt.engine.ui.uicommonweb.models.datacenters; import java.util.ArrayList; - import java.util.Arrays; import java.util.List; @@ -20,6 +19,7 @@ import org.ovirt.engine.ui.uicommonweb.validation.AsciiOrNoneValidation; import org.ovirt.engine.ui.uicommonweb.validation.IValidation; import org.ovirt.engine.ui.uicommonweb.validation.LengthValidation; +import org.ovirt.engine.ui.uicommonweb.validation.MacAddressRangesValidation; import org.ovirt.engine.ui.uicommonweb.validation.NotEmptyValidation; import org.ovirt.engine.ui.uicommonweb.validation.SpecialAsciiI18NOrNoneValidation; import org.ovirt.engine.ui.uicompat.Event; @@ -112,6 +112,16 @@ privateComment = value; } + private EntityModel<String> privateMacPoolRanges; + + public EntityModel<String> getMacPoolRanges() { + return privateMacPoolRanges; + } + + public void setMacPoolRanges(EntityModel<String> privateMacPoolRanges) { + this.privateMacPoolRanges = privateMacPoolRanges; + } + private ListModel<Boolean> storagePoolType; public ListModel<Boolean> getStoragePoolType() @@ -164,6 +174,7 @@ setDescription(new EntityModel<String>()); setComment(new EntityModel<String>()); setVersion(new ListModel<Version>()); + setMacPoolRanges(new EntityModel<String>()); setStoragePoolType(new ListModel<Boolean>()); getStoragePoolType().getSelectedItemChangedEvent().addListener(this); @@ -295,6 +306,10 @@ getComment().validateEntity(new IValidation[] { new SpecialAsciiI18NOrNoneValidation() }); + getMacPoolRanges().validateEntity(new IValidation[] { + new LengthValidation(255), + new MacAddressRangesValidation(true) }); + // TODO: add this code to async validate. // string name = (string)Name.Entity; // if (String.Compare(name, OriginalName, true) != 0 && !DataProvider.IsDataCenterNameUnique(name)) @@ -304,7 +319,7 @@ // } return getName().getIsValid() && getDescription().getIsValid() && getComment().getIsValid() - && getVersion().getIsValid(); + && getVersion().getIsValid() && getMacPoolRanges().getIsValid(); } } diff --git a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/validation/MacAddressRangesValidation.java b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/validation/MacAddressRangesValidation.java new file mode 100644 index 0000000..ead032a --- /dev/null +++ b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/validation/MacAddressRangesValidation.java @@ -0,0 +1,38 @@ +package org.ovirt.engine.ui.uicommonweb.validation; + +import org.ovirt.engine.ui.uicompat.ConstantsManager; + +public class MacAddressRangesValidation extends RegexValidation { + + private final boolean canBeNull; + + public MacAddressRangesValidation() { + this(false); + } + + public MacAddressRangesValidation(boolean canBeNull) { + this.canBeNull = canBeNull; + + //ranges of macs; two macs joined by '-' forms range, multiple ranges can be joined using ','. + //String mac = "[a-fA-F0-9][02468aAcCeE](:[a-fA-F0-9]{2}){5}$"; + //String macRange = mac2 + "-" + mac2; + //String macRanges = macRange + "(," + macRange + ")*"; + setExpression("^[a-fA-F0-9][02468aAcCeE]" + //$NON-NLS-1$ + "(:[a-fA-F0-9]{2}){5}-[a-fA-F0-9][02468aAcCeE](:[a-fA-F0-9]{2}){5}" +//$NON-NLS-1$ + "(,[a-fA-F0-9][02468aAcCeE](:[a-fA-F0-9]{2}){5}-" +//$NON-NLS-1$ + "[a-fA-F0-9][02468aAcCeE](:[a-fA-F0-9]{2}){5})*$"); //$NON-NLS-1$ + setMessage(ConstantsManager.getInstance().getConstants().invalidMacRangesDefinitionMsg()); + } + + + + @Override + public ValidationResult validate(Object value) { + if (canBeNull && value == null) { + return new ValidationResult(); + } else { + return super.validate(value); + } + + } +} diff --git a/frontend/webadmin/modules/uicompat/src/main/java/org/ovirt/engine/ui/uicompat/UIConstants.java b/frontend/webadmin/modules/uicompat/src/main/java/org/ovirt/engine/ui/uicompat/UIConstants.java index 10e02e6..7faa11c 100644 --- a/frontend/webadmin/modules/uicompat/src/main/java/org/ovirt/engine/ui/uicompat/UIConstants.java +++ b/frontend/webadmin/modules/uicompat/src/main/java/org/ovirt/engine/ui/uicompat/UIConstants.java @@ -865,6 +865,9 @@ @DefaultStringValue("Invalid MAC address") String invalidMacAddressMsg(); + @DefaultStringValue("Invalid MAC ranges definition") + String invalidMacRangesDefinitionMsg(); + @DefaultStringValue("Note: Local Storage is already configured for this Host. The Host belongs to") String noteLocalStorageAlreadyConfiguredForThisHostMsg(); diff --git a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/ApplicationConstants.java b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/ApplicationConstants.java index 87a3e6f..9450f04 100644 --- a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/ApplicationConstants.java +++ b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/ApplicationConstants.java @@ -218,6 +218,10 @@ @DefaultStringValue("Comment") String commentLabel(); + @Override + @DefaultStringValue("Mac Pool Ranges") + String macPoolRanges(); + @DefaultStringValue("VM network") String vmNetworkLabel(); diff --git a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/datacenter/DataCenterPopupView.java b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/datacenter/DataCenterPopupView.java index 01463bc..52cbb22 100644 --- a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/datacenter/DataCenterPopupView.java +++ b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/datacenter/DataCenterPopupView.java @@ -52,6 +52,11 @@ @WithElementId StringEntityModelTextBoxEditor commentEditor; + @UiField + @Path(value = "macPoolRanges.entity") + @WithElementId + StringEntityModelTextBoxEditor macRangesEditor; + @UiField(provided = true) @Path(value = "storagePoolType.selectedItem") @WithElementId @@ -100,6 +105,7 @@ nameEditor.setLabel(constants.nameLabel()); descriptionEditor.setLabel(constants.descriptionLabel()); commentEditor.setLabel(constants.commentLabel()); + macRangesEditor.setLabel(constants.macPoolRanges()); storagePoolTypeEditor.setLabel(constants.dataCenterPopupStorageTypeLabel()); versionEditor.setLabel(constants.dataCenterPopupVersionLabel()); quotaEnforceTypeEditor.setLabel(constants.dataCenterPopupQuotaEnforceTypeLabel()); diff --git a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/datacenter/DataCenterPopupView.ui.xml b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/datacenter/DataCenterPopupView.ui.xml index 0754ee1..7b2e63e 100644 --- a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/datacenter/DataCenterPopupView.ui.xml +++ b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/datacenter/DataCenterPopupView.ui.xml @@ -18,6 +18,7 @@ <e:ListModelListBoxEditor ui:field="versionEditor" /> <e:ListModelListBoxEditor ui:field="quotaEnforceTypeEditor" /> <ge:StringEntityModelTextBoxEditor ui:field="commentEditor" /> + <ge:StringEntityModelTextBoxEditor ui:field="macRangesEditor" /> </g:FlowPanel> </d:content> </d:SimpleDialogPanel> -- To view, visit http://gerrit.ovirt.org/26796 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Id36188ef4b51d9b255c2adf230ca20bcf5979513 Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Martin Mucha <mmu...@redhat.com> _______________________________________________ Engine-patches mailing list Engine-patches@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-patches