Oved Ourfali has uploaded a new change for review.

Change subject: WIP webadmin: enhance warning dialog on host restart
......................................................................

WIP webadmin: enhance warning dialog on host restart

When restarting a host using power management, running VMs will be
ungracefully stopped. This patch adds the number of VMs on each host to
the warning dialog.

Change-Id: If1c09b529d445ce4e6c3131d227ceffb22cd292d
Signed-off-by: Oved Ourfali <oourf...@redhat.com>
---
M 
frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/hosts/HostListModel.java
M 
frontend/webadmin/modules/uicompat/src/main/java/org/ovirt/engine/ui/uicompat/Constants.java
2 files changed, 18 insertions(+), 7 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/01/13801/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 3b8157a..e99f18a 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
@@ -41,6 +41,7 @@
 import org.ovirt.engine.core.common.queries.VdcQueryType;
 import org.ovirt.engine.core.common.users.VdcUser;
 import org.ovirt.engine.core.compat.Guid;
+import org.ovirt.engine.core.compat.StringFormat;
 import org.ovirt.engine.core.compat.StringHelper;
 import org.ovirt.engine.core.compat.Version;
 import org.ovirt.engine.core.searchbackend.SearchObjects;
@@ -63,6 +64,7 @@
 import org.ovirt.engine.ui.uicommonweb.models.events.TaskListModel;
 import org.ovirt.engine.ui.uicommonweb.models.tags.TagListModel;
 import org.ovirt.engine.ui.uicommonweb.models.tags.TagModel;
+import org.ovirt.engine.ui.uicompat.Constants;
 import org.ovirt.engine.ui.uicompat.ConstantsManager;
 import org.ovirt.engine.ui.uicompat.Event;
 import org.ovirt.engine.ui.uicompat.EventArgs;
@@ -1257,26 +1259,32 @@
 
     public void Restart()
     {
+        Constants constants = ConstantsManager.getInstance().getConstants();
         ConfirmationModel model = new ConfirmationModel();
         setConfirmWindow(model);
-        
model.setTitle(ConstantsManager.getInstance().getConstants().restartHostsTitle());
+        model.setTitle(constants.restartHostsTitle());
         model.setHashName("restart_host"); //$NON-NLS-1$
-        
model.setMessage(ConstantsManager.getInstance().getConstants().areYouSureYouWantToRestartTheFollowingHostsMsg());
-        // model.Items = SelectedItems.Cast<VDS>().Select(a => a.vds_name);
+        
model.setMessage(constants.areYouSureYouWantToRestartTheFollowingHostsMsg());
         ArrayList<String> items = new ArrayList<String>();
+        String vdsEntry = "%1$s (%2$d " + constants.runningVms() + ")"; 
//$NON-NLS-1$ //$NON-NLS-2$
         for (Object item : getSelectedItems())
         {
             VDS vds = (VDS) item;
-            items.add(vds.getName());
+            int runningVms = vds.getVmCount();
+            if (runningVms > 0) {
+                items.add(StringFormat.format(vdsEntry, vds.getName(), 
runningVms));
+            } else {
+                items.add(vds.getName());
+            }
         }
         model.setItems(items);
 
         UICommand tempVar = new UICommand("OnRestart", this); //$NON-NLS-1$
-        tempVar.setTitle(ConstantsManager.getInstance().getConstants().ok());
+        tempVar.setTitle(constants.ok());
         tempVar.setIsDefault(true);
         model.getCommands().add(tempVar);
         UICommand tempVar2 = new UICommand("Cancel", this); //$NON-NLS-1$
-        
tempVar2.setTitle(ConstantsManager.getInstance().getConstants().cancel());
+        tempVar2.setTitle(constants.cancel());
         tempVar2.setIsCancel(true);
         model.getCommands().add(tempVar2);
     }
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 a131c92..ae464f9 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
@@ -724,7 +724,7 @@
     @DefaultStringValue("Are you sure you want to place the following host(s) 
into maintenance mode?")
     String areYouSureYouWantToPlaceFollowingHostsIntoMaintenanceModeMsg();
 
-    @DefaultStringValue("Are you sure you want to Restart the following 
Host(s)?")
+    @DefaultStringValue("Are you sure you want to Restart the following 
Host(s), ungracefully stopping running VM(s)?")
     String areYouSureYouWantToRestartTheFollowingHostsMsg();
 
     @DefaultStringValue("Are you sure you want to Stop the following Host(s)?")
@@ -1723,6 +1723,9 @@
     @DefaultStringValue("Running")
     String runningVm();
 
+    @DefaultStringValue("Running VM(s)")
+    String runningVms();
+
     @DefaultStringValue("Not Running")
     String notRunningVm();
 


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: If1c09b529d445ce4e6c3131d227ceffb22cd292d
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Oved Ourfali <oourf...@redhat.com>
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to