anmolbabu has uploaded a new change for review.

Change subject: webadmin : Geo-rep Actions UI
......................................................................

webadmin : Geo-rep Actions UI

This patch adds the following actions to Geo-rep sub-tab :

1. Start : It allows the user to start the selected geo-rep session.

2. Stop : It allows the user to stop the selected geo-rep session.

3. Pause : It allows the user to pause the selected geo-rep session.

4. Resume : It allows the user to resume the selected geo-rep session.

Change-Id: I46fbd79f714175e3ad3ce76d858714c6fec3fdde
Signed-off-by: Anmol Babu <[email protected]>
---
M 
frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/help/HelpTag.java
M 
frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/gluster/VolumeGeoRepListModel.java
M 
frontend/webadmin/modules/uicompat/src/main/java/org/ovirt/engine/ui/uicompat/UIConstants.java
M 
frontend/webadmin/modules/uicompat/src/main/java/org/ovirt/engine/ui/uicompat/UIMessages.java
M 
frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/ApplicationConstants.java
M 
frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/gin/uicommon/VolumeModule.java
M 
frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/presenter/popup/gluster/GlusterVolumeGeoRepActionConfirmPopUpViewPresenterWidget.java
M 
frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/gluster/GeoRepActionConfirmPopUpView.java
M 
frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/gluster/GeoRepActionConfirmPopUpView.ui.xml
M 
frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/tab/gluster/SubTabVolumeGeoRepView.java
10 files changed, 273 insertions(+), 34 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/66/39666/1

diff --git 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/help/HelpTag.java
 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/help/HelpTag.java
index d40ad67..8c249ae 100644
--- 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/help/HelpTag.java
+++ 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/help/HelpTag.java
@@ -478,6 +478,14 @@
 
     volume_snapshots("volume_snapshots", HelpTagType.WEBADMIN), //$NON-NLS-1$
 
+    volume_geo_rep_start_confirmation("volume_geo_rep_start_confirmation", 
HelpTagType.WEBADMIN, "[gluster] Volumes main tab -> Geo-Replication sub-tab -> 
'Start' dialog"), //$NON-NLS-1$ //$NON-NLS-2$
+
+    volume_geo_rep_stop_confirmation("volume_geo_rep_stop_confirmation", 
HelpTagType.WEBADMIN, "[gluster] Volumes main tab -> Geo-Replication sub-tab -> 
'Stop' dialog"), //$NON-NLS-1$ //$NON-NLS-2$
+
+    volume_geo_rep_pause_confirmation("volume_geo_rep_pause_confirmation", 
HelpTagType.WEBADMIN, "[gluster] Volumes main tab -> Geo-Replication sub-tab -> 
'Pause' dialog"), //$NON-NLS-1$ //$NON-NLS-2$
+
+    volume_geo_rep_resume_confirmation("volume_geo_rep_resume_confirmation", 
HelpTagType.WEBADMIN, "[gluster] Volumes main tab -> Geo-Replication sub-tab -> 
'Resume' dialog"), //$NON-NLS-1$ //$NON-NLS-2$
+
     new_role("new_role", HelpTagType.WEBADMIN), //$NON-NLS-1$
 
     edit_role("edit_role", HelpTagType.WEBADMIN), //$NON-NLS-1$
diff --git 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/gluster/VolumeGeoRepListModel.java
 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/gluster/VolumeGeoRepListModel.java
index d184e93..67e318d 100644
--- 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/gluster/VolumeGeoRepListModel.java
+++ 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/gluster/VolumeGeoRepListModel.java
@@ -5,7 +5,9 @@
 import java.util.List;
 
 import org.ovirt.engine.core.common.action.VdcActionType;
+import 
org.ovirt.engine.core.common.action.gluster.GlusterVolumeGeoRepSessionParameters;
 import org.ovirt.engine.core.common.action.gluster.GlusterVolumeParameters;
+import 
org.ovirt.engine.core.common.businessentities.gluster.GeoRepSessionStatus;
 import 
org.ovirt.engine.core.common.businessentities.gluster.GlusterGeoRepSession;
 import 
org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity;
 import org.ovirt.engine.ui.frontend.AsyncQuery;
@@ -17,10 +19,16 @@
 import org.ovirt.engine.ui.uicommonweb.help.HelpTag;
 import org.ovirt.engine.ui.uicommonweb.models.SearchableListModel;
 import org.ovirt.engine.ui.uicompat.ConstantsManager;
+import org.ovirt.engine.ui.uicompat.FrontendActionAsyncResult;
+import org.ovirt.engine.ui.uicompat.IFrontendActionAsyncCallback;
 import org.ovirt.engine.ui.uicompat.PropertyChangedEventArgs;
+import org.ovirt.engine.ui.uicompat.UIConstants;
+import org.ovirt.engine.ui.uicompat.UIMessages;
 
 public class VolumeGeoRepListModel extends SearchableListModel{
 
+    private static final UIConstants constants = 
ConstantsManager.getInstance().getConstants();
+    private static final UIMessages messages = 
ConstantsManager.getInstance().getMessages();
     private UICommand newSessionCommand;
     private UICommand removeSessionCommand;
     private UICommand startSessionCommand;
@@ -28,7 +36,8 @@
     private UICommand sessionOptionsCommand;
     private UICommand viewSessionDetailsCommand;
     private UICommand refreshSessionsCommand;
-
+    private UICommand pauseSessionCommand;
+    private UICommand resumeSessionCommand;
 
     @Override
     protected String getListName() {
@@ -36,7 +45,7 @@
     }
 
     public VolumeGeoRepListModel() {
-        
setTitle(ConstantsManager.getInstance().getConstants().geoReplicationTitle());
+        setTitle(constants.geoReplicationTitle());
         setHelpTag(HelpTag.geo_replication);
         setHashName("geo_replication");//$NON-NLS-1$
         setNewSessionCommand(new UICommand("createNewSession", 
this));//$NON-NLS-1$
@@ -46,6 +55,8 @@
         setSessionOptionsCommand(new UICommand("sessionOptions", 
this));//$NON-NLS-1$
         setViewSessionDetailsCommand(new UICommand("viewSessionDetails", 
this));//$NON-NLS-1$
         setRefreshSessionsCommand(new UICommand("refreshSessions", 
this));//$NON-NLS-1$
+        setPauseSessionCommand(new UICommand("pauseSession", 
this));//$NON-NLS-1$
+        setResumeSessionCommand(new UICommand("resumeSession", 
this));//$NON-NLS-1$
     }
 
     public UICommand getViewSessionDetailsCommand() {
@@ -104,6 +115,22 @@
         this.refreshSessionsCommand = optionsCommand;
     }
 
+    public UICommand getPauseSessionCommand() {
+        return pauseSessionCommand;
+    }
+
+    public void setPauseSessionCommand(UICommand pauseSessionCommand) {
+        this.pauseSessionCommand = pauseSessionCommand;
+    }
+
+    public UICommand getResumeSessionCommand() {
+        return resumeSessionCommand;
+    }
+
+    public void setResumeSessionCommand(UICommand resumeSessionCommand) {
+        this.resumeSessionCommand = resumeSessionCommand;
+    }
+
     @Override
     protected void onEntityChanged() {
         super.onEntityChanged();
@@ -127,16 +154,14 @@
     @Override
     public void search()
     {
-        if (getEntity() != null)
-        {
+        if (getEntity() != null) {
             super.search();
         }
     }
 
     @Override
     protected void syncSearch() {
-        if (getEntity() == null)
-        {
+        if (getEntity() == null) {
             return;
         }
 
@@ -152,14 +177,30 @@
     }
 
     private void updateActionAvailability(GlusterVolumeEntity volumeEntity) {
+        boolean allowStartSessionCommand = false;
+        boolean allowStopSessionCommand = false;
+        boolean allowResumeSessionCommand = false;
+        boolean allowPauseSessionCommand = false;
         if(volumeEntity == null) {
             return;
         }
+        if (getSelectedItems() != null && getSelectedItems().size() == 1) {
+            GlusterGeoRepSession selectedSession = 
(GlusterGeoRepSession)getSelectedItem();
+            GeoRepSessionStatus sessionStatus = selectedSession.getStatus();
+            allowStartSessionCommand =
+                    sessionStatus == GeoRepSessionStatus.NOTSTARTED || 
sessionStatus == GeoRepSessionStatus.STOPPED;
+            allowStopSessionCommand = !allowStartSessionCommand;
+            allowResumeSessionCommand = sessionStatus == 
GeoRepSessionStatus.PAUSED;
+            allowPauseSessionCommand =
+                    sessionStatus == GeoRepSessionStatus.ACTIVE || 
sessionStatus == GeoRepSessionStatus.INITIALIZING;
+        }
         getNewSessionCommand().setIsAvailable(true);
         getRemoveSessionCommand().setIsAvailable(false);
-        getStartSessionCommand().setIsAvailable(false);
-        getStopSessionCommand().setIsAvailable(false);
-        getSessionOptionsCommand().setIsAvailable(false);
+        
getStartSessionCommand().setIsExecutionAllowed(allowStartSessionCommand);
+        getStopSessionCommand().setIsExecutionAllowed(allowStopSessionCommand);
+        
getPauseSessionCommand().setIsExecutionAllowed(allowPauseSessionCommand);
+        
getResumeSessionCommand().setIsExecutionAllowed(allowResumeSessionCommand);
+        getSessionOptionsCommand().setIsExecutionAllowed(true);
         getViewSessionDetailsCommand().setIsAvailable(false);
         getRefreshSessionsCommand().setIsAvailable(true);
     }
@@ -167,25 +208,94 @@
     @Override
     public void executeCommand(UICommand command) {
         super.executeCommand(command);
-        if(command.equals(getNewSessionCommand())) {
-            createNewGeoRepSession();
-        } else if(command.equals(getRemoveSessionCommand())) {
+        if (command.equals(getRemoveSessionCommand())) {
 
         } else if(command.equals(getStartSessionCommand())) {
-
+            startGeoRepSession();
         } else if(command.equals(getStopSessionCommand())) {
-
+            stopGeoRepSession();
+        }  else if(command.equals(getPauseSessionCommand())) {
+            pauseGeoRepSession();
+        } else if(command.equals(getResumeSessionCommand())) {
+            resumeGeoRepSession();
         } else if(command.equals(getSessionOptionsCommand())) {
 
         } else if(command.equals(getViewSessionDetailsCommand())) {
 
         } else if (command.equals(getRefreshSessionsCommand())) {
             refreshSessions();
+        } else if (command.getName().equalsIgnoreCase("onStartGeoRepSession")) 
{//$NON-NLS-1$
+            onGeoRepSessionAction(VdcActionType.StartGlusterVolumeGeoRep);
+        } else if (command.getName().equalsIgnoreCase("onStopGeoRepSession")) 
{//$NON-NLS-1$
+            onGeoRepSessionAction(VdcActionType.StopGeoRepSession);
+        } else if (command.getName().equalsIgnoreCase("onPauseGeoRepSession")) 
{//$NON-NLS-1$
+            
onGeoRepSessionAction(VdcActionType.PauseGlusterVolumeGeoRepSession);
+        } else if 
(command.getName().equalsIgnoreCase("onResumeGeoRepSession")) {//$NON-NLS-1$
+            onGeoRepSessionAction(VdcActionType.ResumeGeoRepSession);
+        } else if (command.getName().equalsIgnoreCase("closeWindow")) 
{//$NON-NLS-1$
+            closeWindow();
         }
     }
 
-    private void createNewGeoRepSession() {
+    private void closeWindow() {
+        setWindow(null);
+    }
 
+    private void startGeoRepSession() {
+        performGeoRepAction("onStartGeoRepSession", 
constants.geoReplicationStartTitle(), 
HelpTag.volume_geo_rep_start_confirmation, "volume_geo_rep_start_confirmation", 
constants.startGeoRep(), VdcActionType.StartGlusterVolumeGeoRep, 
constants.startGeoRepProgressText());//$NON-NLS-1$//$NON-NLS-2$
+    }
+
+    private void stopGeoRepSession() {
+        performGeoRepAction("onStopGeoRepSession", 
constants.geoReplicationStopTitle(), HelpTag.volume_geo_rep_stop_confirmation, 
"volume_geo_rep_stop_confirmation", constants.stopGeoRep(), 
VdcActionType.StopGeoRepSession, 
constants.stopGeoRepProgressText());//$NON-NLS-1$//$NON-NLS-2$
+    }
+
+    private void pauseGeoRepSession() {
+        performGeoRepAction("onPauseGeoRepSession", 
constants.geoReplicationPauseTitle(), 
HelpTag.volume_geo_rep_pause_confirmation, "volume_geo_rep_pause_confirmation", 
constants.pauseGeoRep(), VdcActionType.PauseGlusterVolumeGeoRepSession, 
constants.pauseGeoRepProgressText());//$NON-NLS-1$//$NON-NLS-2$
+    }
+
+    private void resumeGeoRepSession() {
+        performGeoRepAction("onResumeGeoRepSession", 
constants.geoReplicationResumeTitle(), 
HelpTag.volume_geo_rep_resume_confirmation, 
"volume_geo_rep_resume_confirmation", constants.resumeGeoRep(), 
VdcActionType.ResumeGeoRepSession, 
constants.resumeGeoRepProgressText());//$NON-NLS-1$//$NON-NLS-2$
+    }
+
+    private void performGeoRepAction(String commandName,
+            String confirmTitle,
+            HelpTag helpTag,
+            String hashName,
+            String action,
+            VdcActionType actionType,
+            String actionProgressText) {
+        GlusterGeoRepSession selectedSession = (GlusterGeoRepSession) 
getSelectedItem();
+        if (selectedSession == null) {
+            return;
+        }
+
+        initializeGeoRepActionConfirmation(confirmTitle, helpTag, hashName, 
constants.geoRepForceHelp(), messages.geoRepForceTitle(action), commandName);
+        onGeoRepSessionAction(actionType);
+    }
+
+    private void initializeGeoRepActionConfirmation(String title, HelpTag 
helpTag, String hashName, String forceHelp, String forceLabelText, String 
commandName) {
+        GlusterGeoRepSession selectedSession = (GlusterGeoRepSession) 
getSelectedItem();
+        GlusterVolumeGeoRepActionConfirmationModel cModel = new 
GlusterVolumeGeoRepActionConfirmationModel();
+        cModel.setTitle(title);
+        cModel.setHelpTag(helpTag);
+        cModel.setHashName(hashName);
+
+        setWindow(cModel);
+
+        cModel.initWindow(selectedSession);
+
+        cModel.setForceHelp(forceHelp);
+        cModel.setForceLabel(forceLabelText);
+
+        UICommand okCommand = new UICommand(commandName, this);
+        okCommand.setTitle(constants.ok());
+        okCommand.setIsDefault(true);
+        cModel.getCommands().add(okCommand);
+
+        UICommand cancelCommand = new UICommand("closeWindow", 
this);//$NON-NLS-1$
+        cancelCommand.setTitle(constants.cancel());
+        cancelCommand.setIsCancel(true);
+        cModel.getCommands().add(cancelCommand);
     }
 
     private void refreshSessions() {
@@ -202,6 +312,33 @@
     public void setEntity(GlusterVolumeEntity value)
     {
         super.setEntity(value);
+        updateActionAvailability(value);
     }
 
+    private void onGeoRepSessionAction(VdcActionType actionType) {
+        final GlusterVolumeGeoRepActionConfirmationModel cModel = 
(GlusterVolumeGeoRepActionConfirmationModel) getWindow();
+        cModel.startProgress(null);
+        boolean force = cModel.getForce().getEntity();
+        GlusterGeoRepSession selectedSession = 
(GlusterGeoRepSession)getSelectedItem();
+        GlusterVolumeGeoRepSessionParameters sessionParamters = new 
GlusterVolumeGeoRepSessionParameters(selectedSession.getMasterVolumeId(), 
selectedSession.getId());
+        sessionParamters.setForce(force);
+        Frontend.getInstance().runAction(actionType, sessionParamters, new 
IFrontendActionAsyncCallback() {
+            @Override
+            public void executed(FrontendActionAsyncResult result) {
+                if (cModel == null) {
+                    return;
+                }
+                else {
+                    cModel.stopProgress();
+                    if (!result.getReturnValue().getSucceeded()) {
+                        
cModel.setMessage(result.getReturnValue().getFault().getMessage());
+                    } else {
+                        setWindow(null);
+                    }
+                }
+            }
+        },
+        this,
+        false);
+    }
 }
diff --git 
a/frontend/webadmin/modules/uicompat/src/main/java/org/ovirt/engine/ui/uicompat/UIConstants.java
 
b/frontend/webadmin/modules/uicompat/src/main/java/org/ovirt/engine/ui/uicompat/UIConstants.java
index ff6715c..f8eeeda 100644
--- 
a/frontend/webadmin/modules/uicompat/src/main/java/org/ovirt/engine/ui/uicompat/UIConstants.java
+++ 
b/frontend/webadmin/modules/uicompat/src/main/java/org/ovirt/engine/ui/uicompat/UIConstants.java
@@ -282,6 +282,42 @@
     @DefaultStringValue("Geo-Replication")
     String geoReplicationTitle();
 
+    @DefaultStringValue("Start Geo-Replication")
+    String geoReplicationStartTitle();
+
+    @DefaultStringValue("Stop Geo-Replication")
+    String geoReplicationStopTitle();
+
+    @DefaultStringValue("Pause Geo-Replication")
+    String geoReplicationPauseTitle();
+
+    @DefaultStringValue("Resume Geo-Replication")
+    String geoReplicationResumeTitle();
+
+    @DefaultStringValue("Start")
+    String startGeoRepProgressText();
+
+    @DefaultStringValue("Stop")
+    String stopGeoRepProgressText();
+
+    @DefaultStringValue("Pause")
+    String pauseGeoRepProgressText();
+
+    @DefaultStringValue("Resume")
+    String resumeGeoRepProgressText();
+
+    @DefaultStringValue("start")
+    String startGeoRep();
+
+    @DefaultStringValue("stop")
+    String stopGeoRep();
+
+    @DefaultStringValue("pause")
+    String pauseGeoRep();
+
+    @DefaultStringValue("resume")
+    String resumeGeoRep();
+
     @DefaultStringValue("Rebalance Status")
     String volumeRebalanceStatusTitle();
 
@@ -2446,5 +2482,14 @@
 
     @DefaultStringValue("No")
     String doNotOptimiseForVirtStore();
+
+    @DefaultStringValue("This field is not a valid Guid (use 0-9,A-F format: 
00000000-0000-0000-0000-000000000000)")
+    String invalidGuidMsg();
+
+    @DefaultStringValue("This will force the operation on geo-replication 
sessions on the nodes that are part of the master volume \n."
+            + "If it is unable to successfully perform the operation on any 
node which is online and part of the master volume,\n "
+            + "the command will still perform the operation on as many nodes 
as it can.\n"
+            + "This command can also be used to re-perform the operation on 
the nodes where the session has died, or the operation has not be executed.")
+    String geoRepForceHelp();
 }
 
diff --git 
a/frontend/webadmin/modules/uicompat/src/main/java/org/ovirt/engine/ui/uicompat/UIMessages.java
 
b/frontend/webadmin/modules/uicompat/src/main/java/org/ovirt/engine/ui/uicompat/UIMessages.java
index 4cfd1c7..9fb4c39 100644
--- 
a/frontend/webadmin/modules/uicompat/src/main/java/org/ovirt/engine/ui/uicompat/UIMessages.java
+++ 
b/frontend/webadmin/modules/uicompat/src/main/java/org/ovirt/engine/ui/uicompat/UIMessages.java
@@ -1,6 +1,5 @@
 package org.ovirt.engine.ui.uicompat;
 
-import java.util.Date;
 import java.util.List;
 
 public interface UIMessages extends com.google.gwt.i18n.client.Messages {
@@ -412,4 +411,8 @@
 
     @DefaultMessage("Do you approve trusting self signed certificate subject 
{0}, SHA-1 fingerprint {1}?")
     String approveRootCertificateTrust(String subject, String sha1Fingerprint);
+
+    @DefaultMessage("Force {0} session")
+    String geoRepForceTitle(String action);
+
 }
diff --git 
a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/ApplicationConstants.java
 
b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/ApplicationConstants.java
index 07146ec..202301f 100644
--- 
a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/ApplicationConstants.java
+++ 
b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/ApplicationConstants.java
@@ -130,6 +130,12 @@
     @DefaultStringValue("Stop")
     String stopGeoRepSession();
 
+    @DefaultStringValue("Pause")
+    String pauseGeoRepSession();
+
+    @DefaultStringValue("Resume")
+    String resumeGeoRepSession();
+
     @DefaultStringValue("Options")
     String geoRepSessionsOptions();
 
diff --git 
a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/gin/uicommon/VolumeModule.java
 
b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/gin/uicommon/VolumeModule.java
index 2d30c97..30d42d3 100644
--- 
a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/gin/uicommon/VolumeModule.java
+++ 
b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/gin/uicommon/VolumeModule.java
@@ -32,6 +32,7 @@
 import 
org.ovirt.engine.ui.webadmin.section.main.presenter.popup.event.EventPopupPresenterWidget;
 import 
org.ovirt.engine.ui.webadmin.section.main.presenter.popup.gluster.AddBrickPopupPresenterWidget;
 import 
org.ovirt.engine.ui.webadmin.section.main.presenter.popup.gluster.BrickAdvancedDetailsPopupPresenterWidget;
+import 
org.ovirt.engine.ui.webadmin.section.main.presenter.popup.gluster.GlusterVolumeGeoRepActionConfirmPopUpViewPresenterWidget;
 import 
org.ovirt.engine.ui.webadmin.section.main.presenter.popup.gluster.RemoveBrickPopupPresenterWidget;
 import 
org.ovirt.engine.ui.webadmin.section.main.presenter.popup.gluster.RemoveBrickStatusPopupPresenterWidget;
 import 
org.ovirt.engine.ui.webadmin.section.main.presenter.popup.gluster.ReplaceBrickPopupPresenterWidget;
@@ -149,11 +150,15 @@
 
     @Provides
     @Singleton
-    public SearchableDetailModelProvider<GlusterGeoRepSession, 
VolumeListModel, VolumeGeoRepListModel> getVolumeGeoRepListProvider(EventBus 
eventBus, Provider<DefaultConfirmationPopupPresenterWidget> 
defaultConfirmPopupProvider) {
+    public SearchableDetailModelProvider<GlusterGeoRepSession, 
VolumeListModel, VolumeGeoRepListModel> getVolumeGeoRepListProvider(EventBus 
eventBus, final Provider<DefaultConfirmationPopupPresenterWidget> 
defaultConfirmPopupProvider, final 
Provider<GlusterVolumeGeoRepActionConfirmPopUpViewPresenterWidget> 
geoRepActionConfirmationPopupProvider) {
         return new SearchableDetailTabModelProvider<GlusterGeoRepSession, 
VolumeListModel, VolumeGeoRepListModel>(eventBus, defaultConfirmPopupProvider, 
VolumeListModel.class, VolumeGeoRepListModel.class) {
             @Override
             public AbstractModelBoundPopupPresenterWidget<? extends Model, ?> 
getModelPopup(VolumeGeoRepListModel source, UICommand lastExecutedCommand, 
Model windowModel) {
-                return null;
+                if(lastExecutedCommand == getModel().getStartSessionCommand() 
|| lastExecutedCommand == getModel().getStopSessionCommand() || 
lastExecutedCommand == getModel().getPauseSessionCommand() || 
lastExecutedCommand == getModel().getResumeSessionCommand()) {
+                    return geoRepActionConfirmationPopupProvider.get();
+                } else {
+                    return defaultConfirmPopupProvider.get();
+                }
             }
         };
     }
diff --git 
a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/presenter/popup/gluster/GlusterVolumeGeoRepActionConfirmPopUpViewPresenterWidget.java
 
b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/presenter/popup/gluster/GlusterVolumeGeoRepActionConfirmPopUpViewPresenterWidget.java
index a2205ac..fe752e4 100644
--- 
a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/presenter/popup/gluster/GlusterVolumeGeoRepActionConfirmPopUpViewPresenterWidget.java
+++ 
b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/presenter/popup/gluster/GlusterVolumeGeoRepActionConfirmPopUpViewPresenterWidget.java
@@ -26,18 +26,21 @@
             public void eventRaised(Event ev, Object sender, EventArgs args) {
                 
if(((PropertyChangedEventArgs)args).propertyName.equalsIgnoreCase("forceLabel"))
 {//$NON-NLS-1$
                     if(model.getForceLabel() != null) {
-                        getView().setForceLabelMessage(model);
+                        getView().setForceLabelMessage(model.getForceLabel());
                     }
                 } else 
if(((PropertyChangedEventArgs)args).propertyName.equalsIgnoreCase("forceHelp")) 
{//$NON-NLS-1$
-                    getView().setForceHelp(model);
+                    getView().setForceHelp(model.getForceHelp());
+                } else if 
(((PropertyChangedEventArgs)args).propertyName.equalsIgnoreCase("Message")) 
{//$NON-NLS-1$
+                    getView().setErrorMessage(model.getMessage());
                 }
             }
         });
     }
 
     public interface ViewDef extends 
AbstractModelBoundPopupPresenterWidget.ViewDef<GlusterVolumeGeoRepActionConfirmationModel>
 {
-        public void 
setForceLabelMessage(GlusterVolumeGeoRepActionConfirmationModel object);
-        public void setForceHelp(GlusterVolumeGeoRepActionConfirmationModel 
object);
+        public void setForceLabelMessage(String forceLabelMessage);
+        public void setForceHelp(String forceHelpText);
+        public void setErrorMessage(String errorMessage);
     }
 
 }
diff --git 
a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/gluster/GeoRepActionConfirmPopUpView.java
 
b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/gluster/GeoRepActionConfirmPopUpView.java
index f980688..50595a3 100644
--- 
a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/gluster/GeoRepActionConfirmPopUpView.java
+++ 
b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/gluster/GeoRepActionConfirmPopUpView.java
@@ -16,11 +16,11 @@
 
 import com.google.gwt.core.client.GWT;
 import com.google.gwt.editor.client.SimpleBeanEditorDriver;
-import com.google.gwt.editor.client.Editor.Ignore;
 import com.google.gwt.event.shared.EventBus;
 import com.google.gwt.resources.client.CssResource;
 import com.google.gwt.uibinder.client.UiBinder;
 import com.google.gwt.uibinder.client.UiField;
+import com.google.gwt.user.client.ui.Label;
 import com.google.inject.Inject;
 
 public class GeoRepActionConfirmPopUpView extends 
AbstractModelBoundPopupView<GlusterVolumeGeoRepActionConfirmationModel> 
implements GlusterVolumeGeoRepActionConfirmPopUpViewPresenterWidget.ViewDef {
@@ -63,6 +63,11 @@
     @Ignore
     InfoIcon geoRepForceHelpIcon;
 
+    @UiField
+    @Ignore
+    @WithElementId
+    Label errorMsg;
+
     private ApplicationConstants constants;
     private ApplicationResources resources;
     private CommonApplicationTemplates templates;
@@ -81,6 +86,7 @@
         localize();
         addStyles();
         driver.initialize(this);
+        errorMsg.setVisible(false);
     }
 
     private void addStyles() {
@@ -94,9 +100,9 @@
     }
 
     @Override
-    public void 
setForceLabelMessage(GlusterVolumeGeoRepActionConfirmationModel object) {
-        forceEditor.setLabel(object.getForceLabel() == null ? 
constants.notAvailableLabel() : object.getForceLabel());
-        forceEditor.setVisible(object.getForceLabel() != null);
+    public void setForceLabelMessage(String forceLabelMessage) {
+        forceEditor.setLabel(forceLabelMessage == null ? 
constants.notAvailableLabel() : forceLabelMessage);
+        forceEditor.setVisible(forceLabelMessage != null);
     }
 
     private void initEditors() {
@@ -110,8 +116,8 @@
     }
 
     @Override
-    public void setForceHelp(GlusterVolumeGeoRepActionConfirmationModel 
object) {
-        
geoRepForceHelpIcon.setText(templates.italicText(object.getForceHelp()));
+    public void setForceHelp(String forceHelpText) {
+        geoRepForceHelpIcon.setText(templates.italicText(forceHelpText));
     }
 
     @Override
@@ -119,6 +125,12 @@
         return driver.flush();
     }
 
+    @Override
+    public void setErrorMessage(String errorMessage) {
+        errorMsg.setText(errorMessage);
+        errorMsg.setVisible(errorMessage != null);
+    }
+
     interface WidgetStyle extends CssResource {
         String checkBoxEditorWidget();
     }
diff --git 
a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/gluster/GeoRepActionConfirmPopUpView.ui.xml
 
b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/gluster/GeoRepActionConfirmPopUpView.ui.xml
index 673c2f1..acffff6 100644
--- 
a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/gluster/GeoRepActionConfirmPopUpView.ui.xml
+++ 
b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/gluster/GeoRepActionConfirmPopUpView.ui.xml
@@ -11,13 +11,18 @@
                }
 
                .checkBoxEditorWidget {
-               width: 150px;
+               width: 185px;
                }
 
         .geoRepForceHelpIcon {
         display: inline-block;
         }
 
+               .messageLabel {
+                       color: #FF0000;
+                       left: 10px;
+                       padding-left: 5px;
+               }
        </ui:style>
 
        <d:SimpleDialogPanel width="480px" height="300px">
@@ -30,6 +35,7 @@
                                        <ge:EntityModelCheckBoxEditor 
ui:field="forceEditor" />
                                        <d:InfoIcon 
ui:field="geoRepForceHelpIcon" />
                                </g:HorizontalPanel>
+                               <g:Label ui:field="errorMsg" 
addStyleNames="{style.messageLabel}"/>
                        </g:FlowPanel>
                </d:content>
        </d:SimpleDialogPanel>
diff --git 
a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/tab/gluster/SubTabVolumeGeoRepView.java
 
b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/tab/gluster/SubTabVolumeGeoRepView.java
index 5844408..bb73c0f 100644
--- 
a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/tab/gluster/SubTabVolumeGeoRepView.java
+++ 
b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/tab/gluster/SubTabVolumeGeoRepView.java
@@ -17,9 +17,9 @@
 import com.google.inject.Inject;
 
 public class SubTabVolumeGeoRepView
-            extends
-            AbstractSubTabTableView<GlusterVolumeEntity, GlusterGeoRepSession, 
VolumeListModel, VolumeGeoRepListModel>
-            implements SubTabVolumeGeoRepPresenter.ViewDef {
+extends
+AbstractSubTabTableView<GlusterVolumeEntity, GlusterGeoRepSession, 
VolumeListModel, VolumeGeoRepListModel>
+implements SubTabVolumeGeoRepPresenter.ViewDef {
 
     interface ViewIdHandler extends ElementIdHandler<SubTabVolumeGeoRepView> {
         ViewIdHandler idHandler = GWT.create(ViewIdHandler.class);
@@ -74,14 +74,28 @@
         getTable().addActionButton(new 
WebAdminButtonDefinition<GlusterGeoRepSession>(constants.startGeoRepSession()) {
             @Override
             protected UICommand resolveCommand() {
-                return null;
+                return getDetailModel().getStartSessionCommand();
             }
         });
 
         getTable().addActionButton(new 
WebAdminButtonDefinition<GlusterGeoRepSession>(constants.stopGeoRepSession()) {
             @Override
             protected UICommand resolveCommand() {
-                return null;
+                return getDetailModel().getStopSessionCommand();
+            }
+        });
+
+        getTable().addActionButton(new 
WebAdminButtonDefinition<GlusterGeoRepSession>(constants.pauseGeoRepSession()) {
+            @Override
+            protected UICommand resolveCommand() {
+                return getDetailModel().getPauseSessionCommand();
+            }
+        });
+
+        getTable().addActionButton(new 
WebAdminButtonDefinition<GlusterGeoRepSession>(constants.resumeGeoRepSession()) 
{
+            @Override
+            protected UICommand resolveCommand() {
+                return getDetailModel().getResumeSessionCommand();
             }
         });
 


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

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

Reply via email to