Alona Kaplan has uploaded a new change for review.

Change subject: webadmin: displaying reason field on host maintenance 
confirmation dialog
......................................................................

webadmin: displaying reason field on host maintenance confirmation dialog

The field is displayed just if it is required by the cluster policy and
all the selected hosts belong to the same cluster.

Change-Id: I0e5a638121df93333f4087b8d633658e3493013f
Signed-off-by: Alona Kaplan <[email protected]>
---
M 
frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/hosts/HostListModel.java
M 
frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/gin/uicommon/HostModule.java
2 files changed, 37 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/00/38300/1

diff --git 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/hosts/HostListModel.java
 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/hosts/HostListModel.java
index ca71f95..4be9a21 100644
--- 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/hosts/HostListModel.java
+++ 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/hosts/HostListModel.java
@@ -1242,7 +1242,40 @@
                 }, null);
     }
 
-    public void maintenance()
+    private Guid getClusterIdOfSelectedHosts() {
+        Guid clusterId = null;
+        for (Object item : getSelectedItems())
+        {
+            VDS host = (VDS) item;
+            if (clusterId == null) {
+                clusterId = host.getVdsGroupId();
+            } else if (!clusterId.equals(host.getVdsGroupId())) {
+                clusterId = null;
+                break;
+            }
+        }
+        return clusterId;
+    }
+
+    public void maintenance() {
+        Guid clusterId = getClusterIdOfSelectedHosts();
+        if (clusterId == null) {
+            maintenance(false);
+        } else {
+            AsyncDataProvider.getInstance().getClusterById(new AsyncQuery(this,
+                    new INewAsyncCallback() {
+                        @Override
+                        public void onSuccess(Object target, Object 
returnValue) {
+                            VDSGroup cluster = (VDSGroup) returnValue;
+                            if (cluster != null) {
+                                
maintenance(cluster.isVdsMaintenanceReasonRequired());
+                            }
+                        }
+                    }), clusterId);
+        }
+    }
+
+    private void maintenance(boolean isMaintenanceReasonVisible)
     {
         if (getConfirmWindow() != null)
         {
@@ -1257,6 +1290,7 @@
         model.setMessage(ConstantsManager.getInstance()
                 .getConstants()
                 
.areYouSureYouWantToPlaceFollowingHostsIntoMaintenanceModeMsg());
+        model.setReasonVisible(isMaintenanceReasonVisible);
         // model.Items = SelectedItems.Cast<VDS>().Select(a => a.vds_name);
         ArrayList<String> vdss = new ArrayList<String>();
         for (Object item : getSelectedItems())
@@ -1289,7 +1323,7 @@
             VDS vds = (VDS) item;
             vdss.add(vds.getId());
         }
-        list.add(new MaintenanceNumberOfVdssParameters(vdss, false));
+        list.add(new MaintenanceNumberOfVdssParameters(vdss, false, 
model.getReason().getEntity()));
 
         model.startProgress(null);
 
diff --git 
a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/gin/uicommon/HostModule.java
 
b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/gin/uicommon/HostModule.java
index 8343a87..bbb13f0 100644
--- 
a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/gin/uicommon/HostModule.java
+++ 
b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/gin/uicommon/HostModule.java
@@ -113,7 +113,7 @@
                     @Override
                     public AbstractModelBoundPopupPresenterWidget<? extends 
ConfirmationModel, ?> getConfirmModelPopup(HostListModel<Void> source,
                             UICommand lastExecutedCommand) {
-                        if (lastExecutedCommand == 
getModel().getRemoveCommand()) {
+                        if (lastExecutedCommand == 
getModel().getRemoveCommand() || lastExecutedCommand == 
getModel().getMaintenanceCommand()) {
                             return removeConfirmPopupProvider.get();
                         } else if (lastExecutedCommand == 
getModel().getManualFenceCommand()) {
                             return manualFenceConfirmPopupProvider.get();


-- 
To view, visit https://gerrit.ovirt.org/38300
To unsubscribe, visit https://gerrit.ovirt.org/settings

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

Reply via email to