ofri masad has uploaded a new change for review. Change subject: [WIP] webadmin: Add network QoS to Vnic Profile UI ......................................................................
[WIP] webadmin: Add network QoS to Vnic Profile UI Added Network QoS selection in the Vnic Profile UI. Added Network QoS to the Vnic Profile tables in UI. Change-Id: I94ac502681b23e6e2dd138cd5e4de7c6ec482daa Bug-Url: https://bugzilla.redhat.com/?????? Signed-off-by: Ofri Masad <oma...@redhat.com> --- M frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/datacenters/EditNetworkModel.java M frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/datacenters/NewNetworkModel.java M frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/networks/NetworkProfileListModel.java M frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/profiles/EditVnicProfileModel.java M frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/profiles/VnicProfileListModel.java M frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/profiles/VnicProfileModel.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/AbstractNetworkPopupView.ui.xml M frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/profile/VnicProfilePopupView.java M frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/profile/VnicProfilePopupView.ui.xml M frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/tab/MainTabVnicProfileView.java M frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/tab/network/SubTabNetworkProfileView.java M frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/widget/vnicProfile/VnicProfileWidget.java M frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/widget/vnicProfile/VnicProfileWidget.ui.xml M frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/widget/vnicProfile/VnicProfilesEditor.java M frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/widget/vnicProfile/VnicProfilesEditor.ui.xml 16 files changed, 165 insertions(+), 19 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/23/17923/1 diff --git a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/datacenters/EditNetworkModel.java b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/datacenters/EditNetworkModel.java index b5da904..ff1fe2c 100644 --- a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/datacenters/EditNetworkModel.java +++ b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/datacenters/EditNetworkModel.java @@ -86,12 +86,16 @@ VnicProfileModel editModel = new EditVnicProfileModel(getSourceListModel(), getSelectedDc().getcompatibility_version(), profileView, false); + editModel.initNetworkQoSList(getSelectedDc().getId()); +// editModel.setSelectedNetworkQoSId(profileView.getNetworkQoSId());//TODO profilesModels.add(editModel); editModel.getName().setIsChangable(false); } if (profilesModels.isEmpty()){ - profilesModels.add(new NewVnicProfileModel(getSourceListModel(), - getSelectedDc().getcompatibility_version(), false)); + VnicProfileModel newProfileModel = new NewVnicProfileModel(getSourceListModel(), + getSelectedDc().getcompatibility_version(), false); + newProfileModel.initNetworkQoSList(getSelectedDc().getId()); + profilesModels.add(newProfileModel); } getProfiles().setItems(profilesModels); originalProfileModels = profilesModels; diff --git a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/datacenters/NewNetworkModel.java b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/datacenters/NewNetworkModel.java index 9b6f6be..8c3788a 100644 --- a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/datacenters/NewNetworkModel.java +++ b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/datacenters/NewNetworkModel.java @@ -104,7 +104,10 @@ protected void initProfiles() { List<VnicProfileModel> profiles = new LinkedList<VnicProfileModel>(); - profiles.add(new NewVnicProfileModel(getSourceListModel(), getSelectedDc().getcompatibility_version(), false)); + NewVnicProfileModel newModel = + new NewVnicProfileModel(getSourceListModel(), getSelectedDc().getcompatibility_version(), false); + newModel.initNetworkQoSList(getSelectedDc().getId()); + profiles.add(newModel); getProfiles().setItems(profiles); } diff --git a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/networks/NetworkProfileListModel.java b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/networks/NetworkProfileListModel.java index f1b435f..6efee0d 100644 --- a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/networks/NetworkProfileListModel.java +++ b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/networks/NetworkProfileListModel.java @@ -71,6 +71,7 @@ setWindow(model); initProfileNetwork(model); + model.initNetworkQoSList(getEntity().getDataCenterId()); } public void edit() { @@ -85,6 +86,7 @@ setWindow(model); initProfileNetwork(model); + model.initNetworkQoSList(getEntity().getDataCenterId()); } public void remove() { diff --git a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/profiles/EditVnicProfileModel.java b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/profiles/EditVnicProfileModel.java index 9dcee63..ae26e05 100644 --- a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/profiles/EditVnicProfileModel.java +++ b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/profiles/EditVnicProfileModel.java @@ -23,6 +23,7 @@ getDescription().setEntity(profile.getDescription()); getPortMirroring().setEntity(getProfile().isPortMirroring()); +// setSelectedNetworkQoSId(getProfile().getNetworkQoSId());//TODO getPublicUse().setIsAvailable(false); } diff --git a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/profiles/VnicProfileListModel.java b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/profiles/VnicProfileListModel.java index b632781..590c777 100644 --- a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/profiles/VnicProfileListModel.java +++ b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/profiles/VnicProfileListModel.java @@ -64,14 +64,16 @@ return; } - SystemTreeItemModel treeSelectedItem = - (SystemTreeItemModel) CommonModel.getInstance().getSystemTree().getSelectedItem(); - SystemTreeItemModel treeSelectedDc = SystemTreeItemModel.findAncestor(SystemTreeItemType.DataCenter, treeSelectedItem); + StoragePool treeSelectedDc = getSelectedDc(); final VnicProfileModel profileModel = - new NewVnicProfileModel(this, ((StoragePool) treeSelectedDc.getEntity()).getcompatibility_version()); + new NewVnicProfileModel(this, treeSelectedDc.getcompatibility_version()); setWindow(profileModel); initNetworkList(profileModel); + + if (treeSelectedDc != null) { + profileModel.initNetworkQoSList(treeSelectedDc.getId()); + } } public void edit() { @@ -88,6 +90,17 @@ initNetworkList(profileModel); + StoragePool selectedDc = getSelectedDc(); + if (selectedDc != null) { + profileModel.initNetworkQoSList(selectedDc.getId()); + } + } + + private StoragePool getSelectedDc() { + SystemTreeItemModel treeSelectedItem = + (SystemTreeItemModel) CommonModel.getInstance().getSystemTree().getSelectedItem(); + SystemTreeItemModel treeSelectedDc = SystemTreeItemModel.findAncestor(SystemTreeItemType.DataCenter, treeSelectedItem); + return (StoragePool) treeSelectedDc.getEntity(); } public void remove() { 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 620ae5d1..3309575 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 @@ -10,11 +10,14 @@ import org.ovirt.engine.core.common.action.VnicProfileParameters; import org.ovirt.engine.core.common.businessentities.VmDeviceGeneralType; import org.ovirt.engine.core.common.businessentities.network.Network; +import org.ovirt.engine.core.common.businessentities.network.NetworkQoS; import org.ovirt.engine.core.common.businessentities.network.VnicProfile; import org.ovirt.engine.core.common.queries.ConfigurationValues; import org.ovirt.engine.core.common.queries.GetDeviceCustomPropertiesParameters; +import org.ovirt.engine.core.common.queries.IdQueryParameters; import org.ovirt.engine.core.common.queries.VdcQueryReturnValue; import org.ovirt.engine.core.common.queries.VdcQueryType; +import org.ovirt.engine.core.compat.Guid; import org.ovirt.engine.core.compat.StringHelper; import org.ovirt.engine.core.compat.Version; import org.ovirt.engine.ui.frontend.AsyncQuery; @@ -44,6 +47,7 @@ private final Version dcCompatibilityVersion; private final boolean customPropertiesSupported; private ListModel network; + private ListModel networkQoS; private VnicProfile vnicProfile = null; private boolean customPropertiesVisible; @@ -115,6 +119,14 @@ return vnicProfile; } + public ListModel getNetworkQoS() { + return networkQoS; + } + + public void setNetworkQoS(ListModel networkQoS) { + this.networkQoS = networkQoS; + } + public VnicProfileModel(EntityModel sourceModel, Version dcCompatibilityVersion, boolean customPropertiesVisible) { this.sourceModel = sourceModel; this.dcCompatibilityVersion = dcCompatibilityVersion; @@ -126,6 +138,7 @@ setName(new EntityModel()); setNetwork(new ListModel()); + setNetworkQoS(new ListModel()); setPortMirroring(new EntityModel()); setCustomPropertySheet(new KeyValueModel()); EntityModel publicUse = new EntityModel(); @@ -201,6 +214,8 @@ vnicProfile.setName((String) getName().getEntity()); Network network = (Network) getNetwork().getSelectedItem(); vnicProfile.setNetworkId(network != null ? network.getId() : null); + NetworkQoS networkQoS = (NetworkQoS) getNetworkQoS().getSelectedItem(); +// vnicProfile.setNetworkQoSId(networkQoS != null ? networkQoS.getId() : null); //TODO vnicProfile.setPortMirroring((Boolean) getPortMirroring().getEntity()); if (customPropertiesVisible) { @@ -270,6 +285,23 @@ } } + public void initNetworkQoSList(Guid dcId) { + AsyncQuery _asyncQuery = new AsyncQuery(); + _asyncQuery.setModel(this); + _asyncQuery.asyncCallback = new INewAsyncCallback() { + @Override + public void onSuccess(Object model, Object ReturnValue) + { + ArrayList<NetworkQoS> networkQoSes = + (ArrayList<NetworkQoS>) ((VdcQueryReturnValue) ReturnValue).getReturnValue(); + getNetworkQoS().setItems(networkQoSes); + } + }; + + IdQueryParameters queryParams = new IdQueryParameters(dcId); + Frontend.RunQuery(VdcQueryType.GetAllNetworkQosByStoragePoolId, queryParams, _asyncQuery); + } + public boolean validate() { getName().validateEntity(new IValidation[] { new NotEmptyValidation(), new I18NNameValidation() }); @@ -284,4 +316,14 @@ protected VdcActionParametersBase getActionParameters() { return new VnicProfileParameters(vnicProfile); } + + public void setSelectedNetworkQoSId(Guid networkQoSId) { + getNetworkQoS().setSelectedItem(null); + for (Object item : getNetworkQoS().getItems()) { + if (((NetworkQoS)item).getId().equals(networkQoSId)) { + getNetworkQoS().setSelectedItem(item); + break; + } + } + } } 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 7b5c3a1..c1e3dca 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 @@ -1113,6 +1113,9 @@ @DefaultStringValue("Description") String descriptionVnicProfile(); + @DefaultStringValue("QoS Name") + String qosNameVnicProfile(); + @DefaultStringValue("Port Mirroring") String portMirroringVnicProfile(); @@ -2874,6 +2877,9 @@ @DefaultStringValue("Public") String profilePublicUseInstanceTypeLabel(); + @DefaultStringValue("QoS") + String profileQoSInstanceTypeLabel(); + @DefaultStringValue("Some hosts in this cluster have the console address overridden and some not. For details please see the Hosts subtab") String consolePartiallyOverridden(); diff --git a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/AbstractNetworkPopupView.ui.xml b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/AbstractNetworkPopupView.ui.xml index 9cfd64e..b9f09b5 100644 --- a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/AbstractNetworkPopupView.ui.xml +++ b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/AbstractNetworkPopupView.ui.xml @@ -57,7 +57,7 @@ </ui:style> - <d:SimpleDialogPanel ui:field="mainPanel" width="670px" height="550px"> + <d:SimpleDialogPanel ui:field="mainPanel" width="760px" height="550px"> <d:content> <t:DialogTabPanel ui:field="tabPanel" height="100%"> <t:tab> diff --git a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/profile/VnicProfilePopupView.java b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/profile/VnicProfilePopupView.java index 4dbb564..c948162 100644 --- a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/profile/VnicProfilePopupView.java +++ b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/profile/VnicProfilePopupView.java @@ -1,6 +1,7 @@ package org.ovirt.engine.ui.webadmin.section.main.view.popup.profile; import org.ovirt.engine.core.common.businessentities.network.Network; +import org.ovirt.engine.core.common.businessentities.network.NetworkQoS; import org.ovirt.engine.ui.common.idhandler.ElementIdHandler; import org.ovirt.engine.ui.common.idhandler.WithElementId; import org.ovirt.engine.ui.common.view.popup.AbstractModelBoundPopupView; @@ -63,6 +64,11 @@ @WithElementId("description") EntityModelTextBoxEditor descriptionEditor; + @UiField(provided = true) + @Path(value = "networkQoS.selectedItem") + @WithElementId("networkQoS") + public ListModelListBoxEditor<Object> networkQoSEditor; + @UiField @Path("portMirroring.entity") @WithElementId("portMirroring") @@ -92,6 +98,12 @@ return ((Network) object).getName(); } }); + networkQoSEditor = new ListModelListBoxEditor<Object>(new NullSafeRenderer<Object>() { + @Override + public String renderNullSafe(Object object) { + return (((NetworkQoS)object).getName()); + } + }); initWidget(ViewUiBinder.uiBinder.createAndBindUi(this)); localize(constants); applyStyles(); @@ -105,6 +117,7 @@ descriptionEditor.setLabel(constants.descriptionVnicProfile()); portMirroringEditor.setLabel(constants.portMirroringVnicProfile()); publicUseEditor.setLabel(constants.publicUseVnicProfile()); + networkQoSEditor.setLabel(constants.profileQoSInstanceTypeLabel()); } @Override diff --git a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/profile/VnicProfilePopupView.ui.xml b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/profile/VnicProfilePopupView.ui.xml index 52b0cd7..4de0fcd 100644 --- a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/profile/VnicProfilePopupView.ui.xml +++ b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/profile/VnicProfilePopupView.ui.xml @@ -39,6 +39,7 @@ <e:ListModelListBoxEditor ui:field="networkEditor" /> <e:EntityModelTextBoxEditor ui:field="nameEditor" /> <e:EntityModelTextBoxEditor ui:field="descriptionEditor" /> + <e:ListModelListBoxEditor ui:field="networkQoSEditor"/> <g:SimplePanel width="100%"> <e:EntityModelCheckBoxEditor ui:field="portMirroringEditor" /> </g:SimplePanel> diff --git a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/tab/MainTabVnicProfileView.java b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/tab/MainTabVnicProfileView.java index bc3f62b..03ae397 100644 --- a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/tab/MainTabVnicProfileView.java +++ b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/tab/MainTabVnicProfileView.java @@ -71,7 +71,14 @@ } }; getTable().addColumn(compatibilityVersionColumn, constants.compatibilityVersionVnicProfile(), "200px"); //$NON-NLS-1$ - + TextColumnWithTooltip<VnicProfileView> qosColumn = new TextColumnWithTooltip<VnicProfileView>() { + @Override + public String getValue(VnicProfileView object) { +// return object.getNetworkQoSName(); + return null; //TODO + } + }; + getTable().addColumn(qosColumn, constants.qosNameVnicProfile(), "200px"); //$NON-NLS-1$ TextColumnWithTooltip<VnicProfileView> descriptionColumn = new TextColumnWithTooltip<VnicProfileView>() { @Override public String getValue(VnicProfileView object) { diff --git a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/tab/network/SubTabNetworkProfileView.java b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/tab/network/SubTabNetworkProfileView.java index afbf62f..703720a 100644 --- a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/tab/network/SubTabNetworkProfileView.java +++ b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/tab/network/SubTabNetworkProfileView.java @@ -62,6 +62,14 @@ } }; getTable().addColumn(compatibilityVersionColumn, constants.compatibilityVersionVnicProfile(), "200px"); //$NON-NLS-1$ + TextColumnWithTooltip<VnicProfileView> qosColumn = new TextColumnWithTooltip<VnicProfileView>() { + @Override + public String getValue(VnicProfileView object) { +// return object.getNetworkQoSName(); + return null; //TODO + } + }; + getTable().addColumn(qosColumn, constants.qosNameVnicProfile(), "200px"); //$NON-NLS-1$ BooleanColumn<VnicProfileView> portMirroringColumn = new BooleanColumn<VnicProfileView>(constants.portMirroringEnabled()) { diff --git a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/widget/vnicProfile/VnicProfileWidget.java b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/widget/vnicProfile/VnicProfileWidget.java index 51cb666..d598ee1 100644 --- a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/widget/vnicProfile/VnicProfileWidget.java +++ b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/widget/vnicProfile/VnicProfileWidget.java @@ -1,15 +1,15 @@ package org.ovirt.engine.ui.webadmin.widget.vnicProfile; +import org.ovirt.engine.core.common.businessentities.network.NetworkQoS; import org.ovirt.engine.ui.common.idhandler.ElementIdHandler; import org.ovirt.engine.ui.common.idhandler.WithElementId; import org.ovirt.engine.ui.common.widget.editor.EntityModelCheckBoxEditor; import org.ovirt.engine.ui.common.widget.editor.EntityModelTextBoxOnlyEditor; +import org.ovirt.engine.ui.common.widget.editor.ListModelListBoxEditor; +import org.ovirt.engine.ui.common.widget.renderer.NullSafeRenderer; import org.ovirt.engine.ui.common.widget.uicommon.popup.AbstractModelBoundPopupWidget; import org.ovirt.engine.ui.uicommonweb.models.profiles.VnicProfileModel; import org.ovirt.engine.ui.webadmin.ApplicationConstants; -import org.ovirt.engine.ui.webadmin.widget.vnicProfile.VnicProfileWidget.ViewIdHandler; -import org.ovirt.engine.ui.webadmin.widget.vnicProfile.VnicProfilesEditor.WidgetStyle; -import org.ovirt.engine.ui.webadmin.widget.vnicProfile.VnicProfilesEditor.WidgetUiBinder; import org.ovirt.engine.ui.common.widget.Align; import com.google.gwt.core.client.GWT; @@ -41,6 +41,11 @@ @Path(value = "publicUse.entity") public EntityModelCheckBoxEditor publicUseEditor; + @UiField(provided = true) + @Path(value = "networkQoS.selectedItem") + @WithElementId("networkQoS") + public ListModelListBoxEditor<Object> networkQoSEditor; + private VnicProfileModel vnicProfileModel; @UiField @@ -52,11 +57,25 @@ public VnicProfileWidget() { publicUseEditor = new EntityModelCheckBoxEditor(Align.RIGHT); + networkQoSEditor = new ListModelListBoxEditor<Object>(new NullSafeRenderer<Object>() { + @Override + public String renderNullSafe(Object object) { + return (((NetworkQoS)object).getName()); + } + }); initWidget(WidgetUiBinder.uiBinder.createAndBindUi(this)); publicUseEditor.setLabel(constants.profilePublicUseInstanceTypeLabel()); - publicUseEditor.addContentWidgetStyleName(style.publicUse()); + networkQoSEditor.setLabel(constants.profileQoSInstanceTypeLabel()); + + initStyles(); ViewIdHandler.idHandler.generateAndSetIds(this); driver.initialize(this); + } + + private void initStyles() { + nameEditor.addContentWidgetStyleName(style.name()); + publicUseEditor.addContentWidgetStyleName(style.publicUse()); + networkQoSEditor.addContentWidgetStyleName(style.qos()); } @Override @@ -70,7 +89,11 @@ } interface WidgetStyle extends CssResource { + String name(); + String publicUse(); + + String qos(); } } diff --git a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/widget/vnicProfile/VnicProfileWidget.ui.xml b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/widget/vnicProfile/VnicProfileWidget.ui.xml index 8f1cf39..0fa7c95 100644 --- a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/widget/vnicProfile/VnicProfileWidget.ui.xml +++ b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/widget/vnicProfile/VnicProfileWidget.ui.xml @@ -6,11 +6,26 @@ <ui:style type="org.ovirt.engine.ui.webadmin.widget.vnicProfile.VnicProfileWidget.WidgetStyle" > .publicUse { - width: 75px; + width: 90px; + } + + .qos { + width: 135px; + } + + .name { + width: 160px; } .publicUsePanel { width: 75px; + margin-left: 20px; + } + + .qosPanel { + width: 185px; + margin-left: 20px; + } </ui:style> <g:HorizontalPanel> @@ -18,6 +33,9 @@ <g:SimplePanel addStyleNames="{style.publicUsePanel}"> <e:EntityModelCheckBoxEditor ui:field="publicUseEditor"/> </g:SimplePanel> + <g:SimplePanel addStyleNames="{style.qosPanel}"> + <e:ListModelListBoxEditor ui:field="networkQoSEditor"/> + </g:SimplePanel> </g:HorizontalPanel> </ui:UiBinder> diff --git a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/widget/vnicProfile/VnicProfilesEditor.java b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/widget/vnicProfile/VnicProfilesEditor.java index 0cf7ff0..2de83a6 100644 --- a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/widget/vnicProfile/VnicProfilesEditor.java +++ b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/widget/vnicProfile/VnicProfilesEditor.java @@ -5,6 +5,8 @@ import java.util.LinkedList; import java.util.List; +import org.ovirt.engine.core.common.businessentities.network.Network; +import org.ovirt.engine.core.common.businessentities.network.NetworkQoS; import org.ovirt.engine.ui.common.CommonApplicationMessages; import org.ovirt.engine.ui.common.CommonApplicationResources; import org.ovirt.engine.ui.common.widget.editor.TakesConstrainedValueEditor; @@ -100,9 +102,12 @@ public void onClick(ClickEvent event) { List models = (List<VnicProfileModel>) getValue().getItems(); VnicProfileModel existingProfileModel = (VnicProfileModel) value; - models.add(models.indexOf(existingProfileModel) + 1, - new NewVnicProfileModel(existingProfileModel.getSourceModel(), - existingProfileModel.getDcCompatibilityVersion())); + VnicProfileModel newVnicProfileModel = new NewVnicProfileModel(existingProfileModel.getSourceModel(), + existingProfileModel.getDcCompatibilityVersion()); + newVnicProfileModel.initNetworkQoSList(((NetworkQoS)((VnicProfileModel) value).getNetworkQoS() //TODO null safe + .getSelectedItem()).getStoragePoolId()); + models.add(models.indexOf(existingProfileModel) + 1, newVnicProfileModel); + setAcceptableValues(models); } }); diff --git a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/widget/vnicProfile/VnicProfilesEditor.ui.xml b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/widget/vnicProfile/VnicProfilesEditor.ui.xml index 2c2391b..5c8e87a 100644 --- a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/widget/vnicProfile/VnicProfilesEditor.ui.xml +++ b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/widget/vnicProfile/VnicProfilesEditor.ui.xml @@ -20,7 +20,7 @@ height: 10px; padding-left: 2px; padding-top: 2px; - margin-top: 4px; + margin-top: 7px; margin-left: 8px; } @@ -30,7 +30,7 @@ height: 10px; padding-left: 2px; padding-top: 2px; - margin-top: 4px; + margin-top: 7px; } </ui:style> -- To view, visit http://gerrit.ovirt.org/17923 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I94ac502681b23e6e2dd138cd5e4de7c6ec482daa Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: ofri masad <oma...@redhat.com> _______________________________________________ Engine-patches mailing list Engine-patches@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-patches