Tomer Saban has uploaded a new change for review.

Change subject: Just to save changes
......................................................................

Just to save changes

Change-Id: Ib0dd57d27c26701d57a72db3e7282f17201168eb
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, 87 insertions(+), 15 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/10/36110/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..7a3da12 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,7 +33,14 @@
         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().getPropertyChangedEvent().addListener(this);
+        getChoiceGroupTotal().getPropertyChangedEvent().addListener(this);
+        getChoiceGroupReadWrite().getPropertyChangedEvent().addListener(this);
         getPropertyChangedEvent().addListener(this);
     }
 
@@ -61,12 +72,30 @@
         return enabled;
     }
 
-    public void setEnabled(EntityModel<Boolean> enabled) {
-        this.enabled = 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.choiceGroupTotal = 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.choiceGroupTotal = choice_group_read_write; }
+
+    public void setEnabled(EntityModel<Boolean> enabled) { this.enabled = 
enabled; }
+
     public boolean validate() {
-        if (!getEnabled().getEntity()) {
+        if (!getEnabled().getEntity() &&
+            !getChoiceGroupNone().getEntity() &&
+            !getChoiceGroupTotal().getEntity() &&
+            !getChoiceGroupReadWrite().getEntity()) {
             return true;
         }
 
@@ -102,17 +131,28 @@
     public void eventRaised(Event<? extends EventArgs> ev, Object sender, 
EventArgs args) {
         super.eventRaised(ev, sender, args);
 
-        if (getEnabled().equals(sender)) {
+        if (getEnabled().equals(sender) ||
+            getChoiceGroupNone().equals(sender) ||
+            getChoiceGroupTotal().equals(sender) ||
+            getChoiceGroupReadWrite().equals(sender)) {
             updateChangeability();
+
         } else if (this.equals(sender)) {
             getEnabled().setIsChangable(getIsChangable());
+            getChoiceGroupNone().setIsChangable(getIsChangable());
+            getChoiceGroupTotal().setIsChangable(getIsChangable());
+            getChoiceGroupReadWrite().setIsChangable(getIsChangable());
         }
     }
 
     private void updateChangeability() {
         boolean enabled = getIsChangable() && getEnabled().getEntity();
-        getTotal().setIsChangable(enabled);
-        getRead().setIsChangable(enabled);
-        getWrite().setIsChangable(enabled);
+        boolean choiceGroupNone = getIsChangable() && 
getChoiceGroupNone().getEntity() != null;
+        boolean choiceGroupTotal = getIsChangable() && 
getChoiceGroupTotal().getEntity() != null;
+        boolean choiceGroupReadWrite = getIsChangable() && 
getChoiceGroupReadWrite().getEntity() != null;
+
+        getTotal().setIsChangable(enabled && choiceGroupTotal);
+        getRead().setIsChangable(enabled && (choiceGroupTotal || 
choiceGroupReadWrite));
+        getWrite().setIsChangable(enabled && (choiceGroupTotal || 
choiceGroupReadWrite));
     }
 }
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..db7db8d 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,28 +38,38 @@
                 && 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().getChoiceGroupTotal().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);
         }
     }
 
     @Override
     public void flush(StorageQos storageQos) {
-        if (getThroughput().getEnabled().getEntity()) {
+        if (getThroughput().getEnabled().getEntity() &&
+            getThroughput().getChoiceGroupTotal().getEntity()) {
+
             
storageQos.setMaxThroughput(getThroughput().getTotal().getEntity());
             
storageQos.setMaxReadThroughput(getThroughput().getRead().getEntity());
             
storageQos.setMaxWriteThroughput(getThroughput().getWrite().getEntity());
@@ -69,7 +79,9 @@
             storageQos.setMaxWriteThroughput(null);
         }
 
-        if (getIops().getEnabled().getEntity()) {
+        if (getIops().getEnabled().getEntity() &&
+            getIops().getChoiceGroupTotal().getEntity()) {
+
             storageQos.setMaxIops(getIops().getTotal().getEntity());
             storageQos.setMaxReadIops(getIops().getRead().getEntity());
             storageQos.setMaxWriteIops(getIops().getWrite().getEntity());
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..e06ac89 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,21 @@
     @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
     @Path(value = "throughput.total.entity")
     @WithElementId
@@ -79,6 +95,9 @@
     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$
+
         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..ee16796 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,21 +32,22 @@
        <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:EntityModelRadioButtonEditor label="Read / Write" 
ui:field="throughputReadWriteRadioButton" />
+                <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" />


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib0dd57d27c26701d57a72db3e7282f17201168eb
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

Reply via email to