Tomer Saban has uploaded a new change for review. Change subject: Managed to fix the UI. Now the radio button have to be pushed twice in order to work ......................................................................
Managed to fix the UI. Now the radio button have to be pushed twice in order to work Change-Id: I9f6baf3f311a7a13a7e00373cecfac3cf4804d8b Signed-off-by: Tomer Saban <tsa...@redhat.com> --- M frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/datacenters/qos/StorageQosMetricParametersModel.java M frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/datacenters/qos/StorageQosParametersModel.java M frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/qos/StorageQosWidget.java M frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/qos/StorageQosWidget.ui.xml 4 files changed, 127 insertions(+), 54 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/13/36113/1 diff --git a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/datacenters/qos/StorageQosMetricParametersModel.java b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/datacenters/qos/StorageQosMetricParametersModel.java index f624ad8..3e7c1be 100644 --- a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/datacenters/qos/StorageQosMetricParametersModel.java +++ b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/datacenters/qos/StorageQosMetricParametersModel.java @@ -38,10 +38,13 @@ setChoiceGroupReadWrite(new EntityModel<Boolean>()); getEnabled().getPropertyChangedEvent().addListener(this); - getChoiceGroupNone().getPropertyChangedEvent().addListener(this); - getChoiceGroupTotal().getPropertyChangedEvent().addListener(this); - getChoiceGroupReadWrite().getPropertyChangedEvent().addListener(this); + + getChoiceGroupNone().getEntityChangedEvent().addListener(this); + getChoiceGroupTotal().getEntityChangedEvent().addListener(this); + getChoiceGroupReadWrite().getEntityChangedEvent().addListener(this); + getPropertyChangedEvent().addListener(this); + } public EntityModel<Integer> getTotal() { @@ -89,13 +92,12 @@ public void setChoiceGroupTotal(EntityModel<Boolean> choice_group_total) { this.choiceGroupTotal = choice_group_total; } public void setChoiceGroupReadWrite(EntityModel<Boolean> choice_group_read_write) { this.choiceGroupReadWrite = choice_group_read_write; } - public void setEnabled(EntityModel<Boolean> enabled) { this.enabled = enabled; } + public void setEnabled(EntityModel<Boolean> enabled) { + this.enabled = enabled; + } public boolean validate() { - if (!getEnabled().getEntity() && - !getChoiceGroupNone().getEntity() && - !getChoiceGroupTotal().getEntity() && - !getChoiceGroupReadWrite().getEntity()) { + if(getChoiceGroupNone().getEntity() && !getChoiceGroupTotal().getEntity() && !getChoiceGroupReadWrite().getEntity() ) { return true; } @@ -131,28 +133,62 @@ public void eventRaised(Event<? extends EventArgs> ev, Object sender, EventArgs args) { super.eventRaised(ev, sender, args); - if (getEnabled().equals(sender) || - getChoiceGroupNone().equals(sender) || - getChoiceGroupTotal().equals(sender) || - getChoiceGroupReadWrite().equals(sender)) { - updateChangeability(); - - } else if (this.equals(sender)) { + if (this.equals(sender)) { getEnabled().setIsChangable(getIsChangable()); getChoiceGroupNone().setIsChangable(getIsChangable()); getChoiceGroupTotal().setIsChangable(getIsChangable()); getChoiceGroupReadWrite().setIsChangable(getIsChangable()); } + else + { + updateChangeability(); + + if (getChoiceGroupNone().equals(sender)) + { + getChoiceGroupNone().setEntity(true); + } + else + { + getChoiceGroupNone().setEntity(false); + } + + if (getChoiceGroupTotal().equals(sender)) + { + getChoiceGroupTotal().setEntity(true); + } + else + { + getChoiceGroupTotal().setEntity(false); + } + + if (getChoiceGroupReadWrite().equals(sender)) + { + getChoiceGroupReadWrite().setEntity(true); + } + else + { + getChoiceGroupReadWrite().setEntity(false); + } + } } - private void updateChangeability() { - boolean enabled = getIsChangable() && getEnabled().getEntity(); - boolean choiceGroupNone = getIsChangable() && getChoiceGroupNone().getEntity() != null; - boolean choiceGroupTotal = getIsChangable() && getChoiceGroupTotal().getEntity() != null; - boolean choiceGroupReadWrite = getIsChangable() && getChoiceGroupReadWrite().getEntity() != null; + private void updateChangeability() + { + //Suppress update of changeability when entities weren't constructed yet. + if(getChoiceGroupNone() == null || getChoiceGroupNone().getEntity() == null || + getChoiceGroupTotal() == null || getChoiceGroupTotal().getEntity() == null || + getChoiceGroupReadWrite() == null || getChoiceGroupReadWrite().getEntity() == null) + { + return; + } - getTotal().setIsChangable(enabled && choiceGroupTotal); - getRead().setIsChangable(enabled && (choiceGroupTotal || choiceGroupReadWrite)); - getWrite().setIsChangable(enabled && (choiceGroupTotal || choiceGroupReadWrite)); + boolean enabled = getIsChangable() && getEnabled().getEntity(); + + boolean total_available = getIsChangable() && getChoiceGroupTotal().getEntity(); + boolean read_write_available = getIsChangable() && getChoiceGroupReadWrite().getEntity(); + + getTotal().setIsChangable(total_available); + getRead().setIsChangable(read_write_available); + getWrite().setIsChangable(read_write_available); } } diff --git a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/datacenters/qos/StorageQosParametersModel.java b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/datacenters/qos/StorageQosParametersModel.java index db7db8d..e415b13 100644 --- a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/datacenters/qos/StorageQosParametersModel.java +++ b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/datacenters/qos/StorageQosParametersModel.java @@ -55,37 +55,49 @@ && qos.getMaxReadIops() == null && qos.getMaxWriteIops() == null) { getIops().getEnabled().setEntity(false); -// getIops().getChoiceGroupTotal().setEntity(false); + getIops().getChoiceGroupNone().setEntity(true); + getIops().getChoiceGroupTotal().setEntity(false); + getIops().getChoiceGroupReadWrite().setEntity(false); } else { getIops().getTotal().setEntity(qos.getMaxIops()); getIops().getRead().setEntity(qos.getMaxReadIops()); getIops().getWrite().setEntity(qos.getMaxWriteIops()); getIops().getEnabled().setEntity(true); -// getIops().getChoiceGroupTotal().setEntity(true); + getIops().getChoiceGroupNone().setEntity(true); + getIops().getChoiceGroupTotal().setEntity(false); + getIops().getChoiceGroupReadWrite().setEntity(false); } } @Override public void flush(StorageQos storageQos) { - if (getThroughput().getEnabled().getEntity() && - getThroughput().getChoiceGroupTotal().getEntity()) { - + if(getThroughput().getChoiceGroupTotal().getEntity()) + { storageQos.setMaxThroughput(getThroughput().getTotal().getEntity()); + } + else if(getThroughput().getChoiceGroupReadWrite().getEntity()) + { storageQos.setMaxReadThroughput(getThroughput().getRead().getEntity()); storageQos.setMaxWriteThroughput(getThroughput().getWrite().getEntity()); - } else { + } + else + { storageQos.setMaxThroughput(null); storageQos.setMaxReadThroughput(null); storageQos.setMaxWriteThroughput(null); } - if (getIops().getEnabled().getEntity() && - getIops().getChoiceGroupTotal().getEntity()) { - + if(getIops().getChoiceGroupTotal().getEntity()) + { storageQos.setMaxIops(getIops().getTotal().getEntity()); + } + else if(getIops().getChoiceGroupReadWrite().getEntity()) + { storageQos.setMaxReadIops(getIops().getRead().getEntity()); storageQos.setMaxWriteIops(getIops().getWrite().getEntity()); - } else { + } + else + { storageQos.setMaxIops(null); storageQos.setMaxReadIops(null); storageQos.setMaxWriteIops(null); @@ -121,3 +133,4 @@ this.iops = iops; } } + diff --git a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/qos/StorageQosWidget.java b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/qos/StorageQosWidget.java index 84a0208..f61e2ba 100644 --- a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/qos/StorageQosWidget.java +++ b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/qos/StorageQosWidget.java @@ -62,6 +62,22 @@ @WithElementId EntityModelRadioButtonEditor throughputReadWriteRadioButton; + @UiField(provided = true) + @Path(value = "iops.choiceGroupTotal.entity") + @WithElementId + EntityModelRadioButtonEditor iopsTotalRadioButton; + + @UiField(provided = true) + @Path(value = "iops.choiceGroupNone.entity") + @WithElementId + EntityModelRadioButtonEditor iopsNoneRadioButton; + + @UiField(provided = true) + @Path(value = "iops.choiceGroupReadWrite.entity") + @WithElementId + EntityModelRadioButtonEditor iopsReadWriteRadioButton; + + @UiField @Path(value = "throughput.total.entity") @WithElementId @@ -95,10 +111,15 @@ public StorageQosWidget(ApplicationConstants constants) { throughputEnabled = new EntityModelCheckBoxEditor(Align.RIGHT); iopsEnabled = new EntityModelCheckBoxEditor(Align.RIGHT); + throughputTotalRadioButton = new EntityModelRadioButtonEditor("1"); //$NON-NLS-1$ throughputNoneRadioButton = new EntityModelRadioButtonEditor("1"); //$NON-NLS-1$ throughputReadWriteRadioButton = new EntityModelRadioButtonEditor("1"); //$NON-NLS-1$ + iopsTotalRadioButton = new EntityModelRadioButtonEditor("2"); //$NON-NLS-1$ + iopsNoneRadioButton = new EntityModelRadioButtonEditor("2"); //$NON-NLS-1$ + iopsReadWriteRadioButton = new EntityModelRadioButtonEditor("2"); //$NON-NLS-1$ + initWidget(ViewUiBinder.uiBinder.createAndBindUi(this)); ViewIdHandler.idHandler.generateAndSetIds(this); diff --git a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/qos/StorageQosWidget.ui.xml b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/qos/StorageQosWidget.ui.xml index 5fc6f2f..92cad9b 100644 --- a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/qos/StorageQosWidget.ui.xml +++ b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/qos/StorageQosWidget.ui.xml @@ -59,27 +59,30 @@ </g:HorizontalPanel> <e:EntityModelCheckBoxEditor addStyleNames="{style.labelStyle}" ui:field="iopsEnabled"/> <g:HorizontalPanel> - <g:VerticalPanel addStyleNames="{style.valuePanelStyle}"> - <g:Label addStyleNames="{style.textBoxLabelStyle}" text="{constants.totalStorageQosPopup}"/> - <g:VerticalPanel> - <e:IntegerEntityModelTextBoxOnlyEditor ui:field="iopsTotalEditor" /> - <g:Label addStyleNames="{style.mbpsLabel}" text="{constants.iopsCountLabelQosPopup}"/> - </g:VerticalPanel> - </g:VerticalPanel> - <g:VerticalPanel addStyleNames="{style.valuePanelStyle}"> - <g:Label addStyleNames="{style.textBoxLabelStyle}" text="{constants.readStorageQosPopup}"/> - <g:VerticalPanel> - <e:IntegerEntityModelTextBoxOnlyEditor ui:field="iopsReadEditor" /> - <g:Label addStyleNames="{style.mbpsLabel}" text="{constants.iopsCountLabelQosPopup}"/> - </g:VerticalPanel> - </g:VerticalPanel> - <g:VerticalPanel addStyleNames="{style.valuePanelStyle}"> - <g:Label addStyleNames="{style.textBoxLabelStyle}" text="{constants.writeStorageQosPopup}"/> - <g:VerticalPanel> - <e:IntegerEntityModelTextBoxOnlyEditor ui:field="iopsWriteEditor" /> - <g:Label addStyleNames="{style.mbpsLabel}" text="{constants.iopsCountLabelQosPopup}"/> - </g:VerticalPanel> - </g:VerticalPanel> + <g:VerticalPanel addStyleNames="{style.valuePanelStyle}"> + <e:EntityModelRadioButtonEditor label="None" ui:field="iopsNoneRadioButton" /> + </g:VerticalPanel> + <g:VerticalPanel addStyleNames="{style.valuePanelStyle}"> + <g:VerticalPanel> + <e:EntityModelRadioButtonEditor label="Total" ui:field="iopsTotalRadioButton" /> + <e:IntegerEntityModelTextBoxOnlyEditor ui:field="iopsTotalEditor" /> + <g:Label addStyleNames="{style.mbpsLabel}" text="{constants.mbpsLabelStorageQosPopup}"/> + </g:VerticalPanel> + </g:VerticalPanel> + <g:VerticalPanel addStyleNames="{style.valuePanelStyle}"> + <e:EntityModelRadioButtonEditor label="Read / Write" ui:field="iopsReadWriteRadioButton" /> + <g:HorizontalPanel> + <g:VerticalPanel> + <e:IntegerEntityModelTextBoxOnlyEditor ui:field="iopsReadEditor" /> + <g:Label addStyleNames="{style.mbpsLabel}" text="{constants.mbpsLabelStorageQosPopup}"/> + </g:VerticalPanel> + <g:Label addStyleNames="{style.textBoxLabelStyle}" text="/"/> + <g:VerticalPanel> + <e:IntegerEntityModelTextBoxOnlyEditor ui:field="iopsWriteEditor" /> + <g:Label addStyleNames="{style.mbpsLabel}" text="{constants.mbpsLabelStorageQosPopup}"/> + </g:VerticalPanel> + </g:HorizontalPanel> + </g:VerticalPanel> </g:HorizontalPanel> </g:FlowPanel> -- To view, visit http://gerrit.ovirt.org/36113 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I9f6baf3f311a7a13a7e00373cecfac3cf4804d8b Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Tomer Saban <tsa...@redhat.com> _______________________________________________ Engine-patches mailing list Engine-patches@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-patches