Tomer Saban has uploaded a new change for review.

Change subject: webadmin: Changed the new storage popup
......................................................................

webadmin: Changed the new storage popup

The new storage qos popup is now more intutive and explains
better how to use the ui(Total and read/write can't be put together).

Change-Id: Ia294f95e13440456798600c34eca392c0213d3e7
Bug-Url: https://bugzilla.redhat.com/1168558
Signed-off-by: Tomer Saban <[email protected]>
---
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, 183 insertions(+), 47 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/15/36115/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 806a589..6c416ed 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
@@ -15,6 +15,10 @@
     private EntityModel<Integer> read;
     private EntityModel<Integer> write;
     private EntityModel<Boolean> enabled;
+    private EntityModel<Boolean> choiceGroupNone;
+    private EntityModel<Boolean> choiceGroupTotal;
+    private EntityModel<Boolean> choiceGroupReadWrite;
+
     private final ConfigurationValues maxTotal;
     private final ConfigurationValues maxRead;
     private final ConfigurationValues maxWrite;
@@ -29,8 +33,18 @@
         setRead(new EntityModel<Integer>());
         setWrite(new EntityModel<Integer>());
         setEnabled(new EntityModel<Boolean>());
+        setChoiceGroupNone(new EntityModel<Boolean>());
+        setChoiceGroupTotal(new EntityModel<Boolean>());
+        setChoiceGroupReadWrite(new EntityModel<Boolean>());
+
         getEnabled().getPropertyChangedEvent().addListener(this);
+
+        getChoiceGroupNone().getEntityChangedEvent().addListener(this);
+        getChoiceGroupTotal().getEntityChangedEvent().addListener(this);
+        getChoiceGroupReadWrite().getEntityChangedEvent().addListener(this);
+
         getPropertyChangedEvent().addListener(this);
+
     }
 
     public EntityModel<Integer> getTotal() {
@@ -61,12 +75,29 @@
         return enabled;
     }
 
+    public EntityModel<Boolean> getChoiceGroupNone() {
+        return choiceGroupNone;
+    }
+
+    public EntityModel<Boolean> getChoiceGroupTotal() {
+        return choiceGroupTotal;
+    }
+
+    public EntityModel<Boolean> getChoiceGroupReadWrite() {
+        return choiceGroupReadWrite;
+    }
+
+
+    public void setChoiceGroupNone(EntityModel<Boolean> choice_group_none) { 
this.choiceGroupNone = choice_group_none; }
+    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 boolean validate() {
-        if (!getEnabled().getEntity()) {
+        if(getChoiceGroupNone().getEntity() && 
!getChoiceGroupTotal().getEntity() && !getChoiceGroupReadWrite().getEntity() ) {
             return true;
         }
 
@@ -102,17 +133,50 @@
     public void eventRaised(Event<? extends EventArgs> ev, Object sender, 
EventArgs args) {
         super.eventRaised(ev, sender, args);
 
-        if (getEnabled().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(false);
+            }
+
+            if (!getChoiceGroupTotal().equals(sender))
+            {
+                getChoiceGroupTotal().setEntity(false);
+            }
+
+            if (!getChoiceGroupReadWrite().equals(sender))
+            {
+                getChoiceGroupReadWrite().setEntity(false);
+            }
         }
     }
 
-    private void updateChangeability() {
+    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;
+        }
+
         boolean enabled = getIsChangable() && getEnabled().getEntity();
-        getTotal().setIsChangable(enabled);
-        getRead().setIsChangable(enabled);
-        getWrite().setIsChangable(enabled);
+
+        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 2d5230f..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
@@ -38,42 +38,66 @@
                 && qos.getMaxReadThroughput() == null
                 && qos.getMaxWriteThroughput() == null) {
             getThroughput().getEnabled().setEntity(false);
+            getThroughput().getChoiceGroupNone().setEntity(true);
+            getThroughput().getChoiceGroupTotal().setEntity(false);
+            getThroughput().getChoiceGroupReadWrite().setEntity(false);
         } else {
             getThroughput().getTotal().setEntity(qos.getMaxThroughput());
             getThroughput().getRead().setEntity(qos.getMaxReadThroughput());
             getThroughput().getWrite().setEntity(qos.getMaxWriteThroughput());
             getThroughput().getEnabled().setEntity(true);
+            getThroughput().getChoiceGroupNone().setEntity(true);
+            getThroughput().getChoiceGroupTotal().setEntity(false);
+            getThroughput().getChoiceGroupReadWrite().setEntity(false);
         }
 
         if (qos.getMaxIops() == null
                 && qos.getMaxReadIops() == null
                 && qos.getMaxWriteIops() == null) {
             getIops().getEnabled().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().getChoiceGroupNone().setEntity(true);
+            getIops().getChoiceGroupTotal().setEntity(false);
+            getIops().getChoiceGroupReadWrite().setEntity(false);
         }
     }
 
     @Override
     public void flush(StorageQos storageQos) {
-        if (getThroughput().getEnabled().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()) {
+        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);
@@ -109,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 6e9f3a7..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
@@ -5,6 +5,7 @@
 import org.ovirt.engine.ui.common.idhandler.WithElementId;
 import org.ovirt.engine.ui.common.widget.Align;
 import 
org.ovirt.engine.ui.common.widget.editor.generic.EntityModelCheckBoxEditor;
+import 
org.ovirt.engine.ui.common.widget.editor.generic.EntityModelRadioButtonEditor;
 import 
org.ovirt.engine.ui.common.widget.editor.generic.IntegerEntityModelTextBoxOnlyEditor;
 import 
org.ovirt.engine.ui.uicommonweb.models.datacenters.qos.StorageQosParametersModel;
 import org.ovirt.engine.ui.webadmin.ApplicationConstants;
@@ -46,6 +47,37 @@
     @WithElementId
     EntityModelCheckBoxEditor iopsEnabled;
 
+    @UiField(provided = true)
+    @Path(value = "throughput.choiceGroupTotal.entity")
+    @WithElementId
+    EntityModelRadioButtonEditor throughputTotalRadioButton;
+
+    @UiField(provided = true)
+    @Path(value = "throughput.choiceGroupNone.entity")
+    @WithElementId
+    EntityModelRadioButtonEditor throughputNoneRadioButton;
+
+    @UiField(provided = true)
+    @Path(value = "throughput.choiceGroupReadWrite.entity")
+    @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
@@ -79,6 +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 67b574e..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
@@ -32,51 +32,57 @@
        <g:FlowPanel ui:field="mainPanel" >
                <e:EntityModelCheckBoxEditor addStyleNames="{style.labelStyle}" 
ui:field="throughputEnabled"/>
                <g:HorizontalPanel>
+            <g:VerticalPanel addStyleNames="{style.valuePanelStyle}">
+                <e:EntityModelRadioButtonEditor label="None" 
ui:field="throughputNoneRadioButton" />
+            </g:VerticalPanel>
                        <g:VerticalPanel 
addStyleNames="{style.valuePanelStyle}">
-                               <g:Label 
addStyleNames="{style.textBoxLabelStyle}" 
text="{constants.totalStorageQosPopup}"/>
-                               <g:VerticalPanel>
+                <g:VerticalPanel>
+                    <e:EntityModelRadioButtonEditor label="Total" 
ui:field="throughputTotalRadioButton" />
                                        <e:IntegerEntityModelTextBoxOnlyEditor 
ui:field="throughputTotalEditor" />
                                        <g:Label 
addStyleNames="{style.mbpsLabel}" text="{constants.mbpsLabelStorageQosPopup}"/>
                                </g:VerticalPanel>
                        </g:VerticalPanel>
                        <g:VerticalPanel 
addStyleNames="{style.valuePanelStyle}">
-                               <g:Label 
addStyleNames="{style.textBoxLabelStyle}" 
text="{constants.readStorageQosPopup}"/>
-                               <g:VerticalPanel>
-                                       <e:IntegerEntityModelTextBoxOnlyEditor 
ui:field="throughputReadEditor" />
-                                       <g:Label 
addStyleNames="{style.mbpsLabel}" text="{constants.mbpsLabelStorageQosPopup}"/>
-                               </g:VerticalPanel>
-                       </g:VerticalPanel>
-                       <g:VerticalPanel 
addStyleNames="{style.valuePanelStyle}">
-                               <g:Label 
addStyleNames="{style.textBoxLabelStyle}" 
text="{constants.writeStorageQosPopup}"/>
-                               <g:VerticalPanel>
-                                       <e:IntegerEntityModelTextBoxOnlyEditor 
ui:field="throughputWriteEditor" />
-                                       <g:Label 
addStyleNames="{style.mbpsLabel}" text="{constants.mbpsLabelStorageQosPopup}"/>
-                               </g:VerticalPanel>
+                <e:EntityModelRadioButtonEditor label="Read / Write" 
ui:field="throughputReadWriteRadioButton" />
+                <g:HorizontalPanel>
+                    <g:VerticalPanel>
+                        <e:IntegerEntityModelTextBoxOnlyEditor 
ui:field="throughputReadEditor" />
+                        <g:Label addStyleNames="{style.mbpsLabel}" 
text="{constants.mbpsLabelStorageQosPopup}"/>
+                    </g:VerticalPanel>
+                    <g:Label addStyleNames="{style.textBoxLabelStyle}" 
text="/"/>
+                    <g:VerticalPanel>
+                        <e:IntegerEntityModelTextBoxOnlyEditor 
ui:field="throughputWriteEditor" />
+                        <g:Label addStyleNames="{style.mbpsLabel}" 
text="{constants.mbpsLabelStorageQosPopup}"/>
+                    </g:VerticalPanel>
+                </g:HorizontalPanel>
                        </g:VerticalPanel>
                </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/36115
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia294f95e13440456798600c34eca392c0213d3e7
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Tomer Saban <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to