Kanagaraj M has uploaded a new change for review.

Change subject: webadmin: Disabling Add Bricks if Empty Cluster Selected
......................................................................

webadmin: Disabling Add Bricks if Empty Cluster Selected

In Create Volume dialog, the Add Bricks button will be
disabled if the selected Cluster is Empty or does not
have any hosts in UP state..

Change-Id: I1cdbdddd52fe29b8f652e7bf264bc70aa82b198e
Bug-Url: https://bugzilla.redhat.com/883774
Signed-off-by: Kanagaraj M <[email protected]>
---
M 
frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/gluster/VolumeModel.java
M 
frontend/webadmin/modules/uicompat/src/main/java/org/ovirt/engine/ui/uicompat/Constants.java
M 
frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/gluster/VolumePopupView.ui.xml
3 files changed, 21 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/13/10513/1

diff --git 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/gluster/VolumeModel.java
 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/gluster/VolumeModel.java
index 3052c5a..3f95635 100644
--- 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/gluster/VolumeModel.java
+++ 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/gluster/VolumeModel.java
@@ -3,6 +3,7 @@
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Iterator;
+import java.util.List;
 
 import org.ovirt.engine.core.common.businessentities.VDS;
 import org.ovirt.engine.core.common.businessentities.VDSGroup;
@@ -419,7 +420,21 @@
     {
         if (getCluster().getSelectedItem() != null)
         {
-            getAddBricksCommand().setIsExecutionAllowed(true);
+            VDSGroup cluster = (VDSGroup) getCluster().getSelectedItem();
+            AsyncDataProvider.GetHostListByCluster(new AsyncQuery(this, new 
INewAsyncCallback() {
+                @Override
+                public void OnSuccess(Object model, Object returnValue) {
+                    List<VDS> hostList = (List<VDS>) returnValue;
+                    for (VDS host : hostList) {
+                        if (host.getstatus() == VDSStatus.Up) {
+                            getAddBricksCommand().setIsExecutionAllowed(true);
+                            return;
+                        }
+                    }
+                    getAddBricksCommand().setIsExecutionAllowed(false);
+                    
setMessage(ConstantsManager.getInstance().getConstants().volumeEmptyClusterValidationMsg());
+                }
+            }), cluster.getname());
         }
         else
         {
diff --git 
a/frontend/webadmin/modules/uicompat/src/main/java/org/ovirt/engine/ui/uicompat/Constants.java
 
b/frontend/webadmin/modules/uicompat/src/main/java/org/ovirt/engine/ui/uicompat/Constants.java
index 6a55433..6134bec 100644
--- 
a/frontend/webadmin/modules/uicompat/src/main/java/org/ovirt/engine/ui/uicompat/Constants.java
+++ 
b/frontend/webadmin/modules/uicompat/src/main/java/org/ovirt/engine/ui/uicompat/Constants.java
@@ -1484,6 +1484,9 @@
     @DefaultStringValue("At least one transport type should be selected.")
     String volumeTransportTypesValidationMsg();
 
+    @DefaultStringValue("No host found in 'UP' state in the cluster, please 
select another cluster.")
+    String volumeEmptyClusterValidationMsg();
+
     @DefaultStringValue("USB")
     String usb();
 
diff --git 
a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/gluster/VolumePopupView.ui.xml
 
b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/gluster/VolumePopupView.ui.xml
index 29ef277..b7b544d 100644
--- 
a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/gluster/VolumePopupView.ui.xml
+++ 
b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/gluster/VolumePopupView.ui.xml
@@ -53,13 +53,13 @@
                .messageLabel {
                        color: #FF0000;
                        left: 10px;
-                       padding-top: 5px;
+                       padding-top: 15px;
                        padding-left: 5px;
                }
 
        </ui:style>
 
-       <d:SimpleDialogPanel width="450px" height="500px">
+       <d:SimpleDialogPanel width="450px" height="510px">
                <d:content>
                        <g:VerticalPanel>
                                <g:FlowPanel 
addStyleNames="{style.generalTabTopDecorator}">


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

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

Reply via email to