anmolbabu has uploaded a new change for review. Change subject: webadmin : Resume Geo-Rep Session ......................................................................
webadmin : Resume Geo-Rep Session Resume Geo-Rep Session Change-Id: Ibc1a924d94c27e01f653419b3fa952d6411067a3 Signed-off-by: Anmol Babu <anb...@redhat.com> --- 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/section/main/view/tab/gluster/SubTabVolumeGeoRepView.java 5 files changed, 82 insertions(+), 0 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/62/32962/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 85252d7..e3fc6ad 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 @@ -4,17 +4,25 @@ import java.util.Collections; import java.util.List; +import org.ovirt.engine.core.common.action.VdcActionParametersBase; +import org.ovirt.engine.core.common.action.VdcActionType; +import org.ovirt.engine.core.common.action.gluster.ResumeGeoRepGlusterVolumeParameters; 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; +import org.ovirt.engine.ui.frontend.Frontend; import org.ovirt.engine.ui.frontend.INewAsyncCallback; +import org.ovirt.engine.ui.uicommonweb.ICommandTarget; import org.ovirt.engine.ui.uicommonweb.Linq; import org.ovirt.engine.ui.uicommonweb.UICommand; import org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider; import org.ovirt.engine.ui.uicommonweb.help.HelpTag; +import org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel; import org.ovirt.engine.ui.uicommonweb.models.SearchableListModel; import org.ovirt.engine.ui.uicompat.ConstantsManager; import org.ovirt.engine.ui.uicompat.EventArgs; +import org.ovirt.engine.ui.uicompat.FrontendActionAsyncResult; +import org.ovirt.engine.ui.uicompat.IFrontendActionAsyncCallback; import org.ovirt.engine.ui.uicompat.PropertyChangedEventArgs; public class VolumeGeoRepListModel extends SearchableListModel{ @@ -25,6 +33,7 @@ private UICommand stopSessionCommand; private UICommand sessionOptionsCommand; private UICommand viewSessionDetailsCommand; + private UICommand resumeSessionCommand; private GlusterVolumeEntity volumeEntity; @@ -93,6 +102,14 @@ this.sessionOptionsCommand = optionsCommand; } + public UICommand getResumeSessionCommand() { + return resumeSessionCommand; + } + + public void setResumeSessionCommand(UICommand resumeSessionCommand) { + this.resumeSessionCommand = resumeSessionCommand; + } + @Override protected void onEntityChanged() { super.onEntityChanged(); @@ -153,6 +170,7 @@ boolean isStopSessionCommandAvailable = false; boolean sessionOptionsCommandAvailable = true; boolean isViewSessionDetailsCommandAvailable = false; + boolean isResumeSessionCommandAvailable = true; if (getSelectedItems() != null) { isStopSessionCommandAvailable = true; isViewSessionDetailsCommandAvailable = true; @@ -165,6 +183,7 @@ getStopSessionCommand().setIsAvailable(isStopSessionCommandAvailable); getSessionOptionsCommand().setIsAvailable(sessionOptionsCommandAvailable); getViewSessionDetailsCommand().setIsAvailable(isViewSessionDetailsCommandAvailable); + getResumeSessionCommand().setIsAvailable(isResumeSessionCommandAvailable); } @Override @@ -182,9 +201,56 @@ } else if(command.equals(getViewSessionDetailsCommand())) { + } else if(command.equals(getResumeSessionCommand())) { + resumeSession(); + } else if(command.getName().equals("closeDetailsWarning") || command.getName().equals("close")) {//$NON-NLS-1$//$NON-NLS-2$ + closeConfirmationWindow(); } } + private void closeConfirmationWindow() { + setConfirmWindow(null); + } + + private void resumeSession() { + if(getSelectedItem() == null) { + return; + } + final GlusterGeoRepSession selectedSession = (GlusterGeoRepSession) getSelectedItem(); + Frontend.getInstance().runAction(VdcActionType.ResumeGeoRepGlusterVolume, new ResumeGeoRepGlusterVolumeParameters(selectedSession.getMasterVolumeId(), selectedSession.getSlaveHostName(), selectedSession.getSlaveVolumeName(), false), new IFrontendActionAsyncCallback() { + @Override + public void executed(FrontendActionAsyncResult result) { + if(! result.getReturnValue().getSucceeded()) { + ConfirmationModel cModel = new ConfirmationModel(); + ConstantsManager cManager = ConstantsManager.getInstance(); + cModel.setTitle(cManager.getMessages().geoRepForceWarning("GeoRep Session Resume"));//$NON-NLS-1$ + cModel.setMessage(cManager.getMessages().geoRepForceWarning("GeoRep Session Resume").concat(cManager.getConstants().geoRepForceExecute()));//$NON-NLS-1$ + + UICommand cancel = new UICommand("close", VolumeGeoRepListModel.this);//$NON-NLS-1$ + cancel.setTitle(cManager.getConstants().cancel()); + cancel.setIsCancel(true); + + UICommand ok = new UICommand("forceResume", new ICommandTarget() {//$NON-NLS-1$ + @Override + public void executeCommand(UICommand uiCommand, Object... parameters) { + + } + + @Override + public void executeCommand(UICommand command) { + closeConfirmationWindow(); + Frontend.getInstance().runAction(VdcActionType.ResumeGeoRepGlusterVolume, new ResumeGeoRepGlusterVolumeParameters(selectedSession.getMasterVolumeId(), selectedSession.getSlaveHostName(), selectedSession.getSlaveVolumeName(), true), true); + } + }); + ok.setTitle(cManager.getConstants().ok()); + ok.setIsDefault(true); + + setWindow(cModel); + } + } + }); + } + private void createNewGeoRepSession() { } 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 9b0c6ae..85a28b6 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 @@ -287,6 +287,9 @@ @DefaultStringValue("Geo-Replication") String geoReplicationTitle(); + @DefaultStringValue("Force execute the command") + String geoRepForceExecute(); + @DefaultStringValue("Rebalance Status") String volumeRebalanceStatusTitle(); 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 00911ba..72a4a98 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 @@ -400,4 +400,7 @@ @DefaultMessage("Default ({0})") String defaultMtu(int mtu); + + @DefaultMessage("{0} command execution failed \n") + String geoRepForceWarning(String cName); } 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 858affe..e5b4ab3 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,9 @@ @DefaultStringValue("Stop") String stopGeoRepSession(); + @DefaultStringValue("Resume") + String resumeGeoRepSession(); + @DefaultStringValue("Options") String geoRepSessionsOptions(); 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 167425a..b6b89ec 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 @@ -74,6 +74,13 @@ } }); + getTable().addActionButton(new WebAdminButtonDefinition<GlusterGeoRepSession>(constants.resumeGeoRepSession()) { + @Override + protected UICommand resolveCommand() { + return getDetailModel().getResumeSessionCommand(); + } + }); + getTable().addActionButton(new WebAdminButtonDefinition<GlusterGeoRepSession>(constants.geoRepSessionsOptions()) { @Override protected UICommand resolveCommand() { -- To view, visit http://gerrit.ovirt.org/32962 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ibc1a924d94c27e01f653419b3fa952d6411067a3 Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: anmolbabu <anb...@redhat.com> _______________________________________________ Engine-patches mailing list Engine-patches@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-patches