anmolbabu has uploaded a new change for review. Change subject: webadmin : Show confirmation for geo-rep actions ......................................................................
webadmin : Show confirmation for geo-rep actions This patch adds confirmation dialogs for stop, pause and remove geo-rep sessions. Change-Id: I319072213021cfd130b4521c0b77e5e4ab9cb1fe Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1224893 Signed-off-by: Anmol Babu <[email protected]> --- M frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/gluster/GlusterVolumeGeoRepActionConfirmationModel.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/UIMessages.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 6 files changed, 78 insertions(+), 15 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/01/41901/1 diff --git a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/gluster/GlusterVolumeGeoRepActionConfirmationModel.java b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/gluster/GlusterVolumeGeoRepActionConfirmationModel.java index 2a40ea9..cccb8fd 100644 --- a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/gluster/GlusterVolumeGeoRepActionConfirmationModel.java +++ b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/gluster/GlusterVolumeGeoRepActionConfirmationModel.java @@ -12,6 +12,7 @@ private EntityModel<Boolean> force; private String forceLabel; private String forceHelp; + private String message; public GlusterVolumeGeoRepActionConfirmationModel() { init(); @@ -23,6 +24,7 @@ setSlaveHost(new EntityModel<String>()); setForce(new EntityModel<Boolean>()); + force.setIsAvailable(false); } protected void initWindow(String masterVolume, String slaveVolume, String slaveHost) { @@ -74,11 +76,22 @@ public void setForceHelp(String forceHelp) { this.forceHelp = forceHelp; + force.setIsAvailable(true); onPropertyChanged(new PropertyChangedEventArgs("forceHelp"));//$NON-NLS-1$ + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + onPropertyChanged(new PropertyChangedEventArgs("messageSet"));//$NON-NLS-1$ } public void setForceLabel(String forceLabel) { this.forceLabel = forceLabel; + force.setIsAvailable(true); onPropertyChanged(new PropertyChangedEventArgs("forceLabel"));//$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 f38f93e..19e72b5 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 @@ -1,6 +1,7 @@ package org.ovirt.engine.ui.uicommonweb.models.gluster; import java.util.ArrayList; +import java.util.Arrays; import java.util.Collections; import java.util.LinkedHashMap; import java.util.List; @@ -227,13 +228,13 @@ if (command.equals(getNewSessionCommand())) { createGeoRepSession(); } else if (command.equals(getRemoveSessionCommand())) { - removeGeoRepSession(); + confirmGeoRepAction(constants.geoReplicationRemoveTitle(), HelpTag.volume_geo_rep_remove_confirmation, "volume_geo_rep_remove_confirmation", "removeGeoRepSession", constants.removeGeoRep());//$NON-NLS-1$//$NON-NLS-2$ } else if(command.equals(getStartSessionCommand())) { startGeoRepSession(); } else if(command.equals(getStopSessionCommand())) { - stopGeoRepSession(); + confirmGeoRepAction(constants.geoReplicationStopTitle(), HelpTag.volume_geo_rep_stop_confirmation, "volume_geo_rep_stop_confirmation", "stopGeoRepSesssion", constants.stopGeoRep());//$NON-NLS-1$//$NON-NLS-2$ } else if(command.equals(getPauseSessionCommand())) { - pauseGeoRepSession(); + confirmGeoRepAction(constants.geoReplicationPauseTitle(), HelpTag.volume_geo_rep_pause_confirmation, "volume_geo_rep_pause_confirmation", "pauseGeoRepSession", constants.pauseGeoRep());//$NON-NLS-1$//$NON-NLS-2$ } else if(command.equals(getResumeSessionCommand())) { resumeGeoRepSession(); } else if(command.equals(getSessionOptionsCommand())) { @@ -258,6 +259,12 @@ updateConfig(); } else if (command.getName().equalsIgnoreCase("closeWindow")) {//$NON-NLS-1$ closeWindow(); + } else if(command.getName().equalsIgnoreCase("stopGeoRepSesssion")) {//$NON-NLS-1$ + stopGeoRepSession(); + } else if(command.getName().equalsIgnoreCase("removeGeoRepSession")) {//$NON-NLS-1$ + removeGeoRepSession(); + } else if(command.getName().equalsIgnoreCase("pauseGeoRepSession")) {//$NON-NLS-1$ + pauseGeoRepSession(); } else if (command.getName().equalsIgnoreCase("closeConfirmWindow")) {//$NON-NLS-1$ closeConfirmWindow(); } @@ -467,6 +474,25 @@ 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 confirmGeoRepAction(String title, HelpTag helpTag, String hashName, String commandName, String action) { + GlusterGeoRepSession selectedSession = getSelectedItem(); + if (selectedSession == null) { + return; + } + + GlusterVolumeGeoRepActionConfirmationModel cModel = new GlusterVolumeGeoRepActionConfirmationModel(); + cModel.setTitle(title); + cModel.setHelpTag(helpTag); + cModel.setHashName(hashName); + cModel.setMessage(messages.geoRepActionConfirmationMessage(action)); + + setWindow(cModel); + + cModel.initWindow(selectedSession.getMasterVolumeName(), selectedSession.getSlaveVolumeName(), selectedSession.getSlaveHostName()); + cModel.getCommands().add(UICommand.createDefaultOkUiCommand(commandName, this)); + cModel.getCommands().add(UICommand.createCancelUiCommand("closeWindow", this));//$NON-NLS-1$ + } + 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$ } @@ -496,8 +522,13 @@ } private void initializeGeoRepActionConfirmation(String title, HelpTag helpTag, String hashName, String forceHelp, String forceLabelText, String commandName, String masterVolumeName, String slaveVolumeName, String slaveHostName) { - GlusterVolumeGeoRepActionConfirmationModel cModel = new GlusterVolumeGeoRepActionConfirmationModel(); - cModel.setTitle(title); + GlusterVolumeGeoRepActionConfirmationModel cModel; + if(getWindow() != null) { + cModel = (GlusterVolumeGeoRepActionConfirmationModel) getWindow(); + } else { + cModel = new GlusterVolumeGeoRepActionConfirmationModel(); + cModel.setTitle(title); + } cModel.setHelpTag(helpTag); cModel.setHashName(hashName); @@ -508,15 +539,11 @@ cModel.setForceHelp(forceHelp); cModel.setForceLabel(forceLabelText); - UICommand okCommand = new UICommand(commandName, this); - okCommand.setTitle(constants.ok()); - okCommand.setIsDefault(true); - cModel.getCommands().add(okCommand); + List<UICommand> geoRepActionCommands = Arrays.asList(UICommand.createDefaultOkUiCommand(commandName, this), UICommand.createCancelUiCommand("closeWindow", this));//$NON-NLS-1$ - UICommand cancelCommand = new UICommand("closeWindow", this);//$NON-NLS-1$ - cancelCommand.setTitle(constants.cancel()); - cancelCommand.setIsCancel(true); - cModel.getCommands().add(cancelCommand); + if(cModel.getCommands() != null) { + cModel.setCommands(geoRepActionCommands); + } } private void refreshSessions() { 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 ba70ae7..cc0ffa6 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 @@ -431,6 +431,9 @@ @DefaultMessage("Force {0} session") String geoRepForceTitle(String action); + @DefaultMessage("Are you sure you want to {0} geo-rep session") + String geoRepActionConfirmationMessage(String action); + @DefaultMessage("Icon dimensions are too large: {0}x{1}, maximum allowed: {2}x{3}") String iconDimensionsTooLarge(int width, int height, int maxWidht, int maxHeight); 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 a701610..a65a754 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 @@ -31,6 +31,8 @@ getView().setForceHelp(model.getForceHelp()); } else if (args.propertyName.equalsIgnoreCase("Message")) {//$NON-NLS-1$ getView().setErrorMessage(model.getMessage()); + } else if(args.propertyName.equalsIgnoreCase("messageSet")) {//$NON-NLS-1$ + getView().setMessage(model.getMessage()); } } }); @@ -40,6 +42,7 @@ public void setForceLabelMessage(String forceLabelMessage); public void setForceHelp(String forceHelpText); public void setErrorMessage(String errorMessage); + public void setMessage(String message); } } 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 4c22d03..4765a45 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 @@ -10,7 +10,6 @@ import org.ovirt.engine.ui.common.widget.editor.generic.StringEntityModelLabelEditor; import org.ovirt.engine.ui.uicommonweb.models.gluster.GlusterVolumeGeoRepActionConfirmationModel; import org.ovirt.engine.ui.webadmin.ApplicationConstants; -import org.ovirt.engine.ui.webadmin.ApplicationResources; import org.ovirt.engine.ui.webadmin.ApplicationTemplates; import org.ovirt.engine.ui.webadmin.gin.AssetProvider; import org.ovirt.engine.ui.webadmin.section.main.presenter.popup.gluster.GlusterVolumeGeoRepActionConfirmPopUpViewPresenterWidget; @@ -39,6 +38,11 @@ @UiField WidgetStyle style; + + @UiField + @Ignore + @WithElementId + Label messageLabel; @UiField @Path("masterVolume.entity") @@ -72,7 +76,6 @@ private final Driver driver = GWT.create(Driver.class); private final static ApplicationTemplates templates = AssetProvider.getTemplates(); - private final static ApplicationResources resources = AssetProvider.getResources(); private final static ApplicationConstants constants = AssetProvider.getConstants(); @Inject @@ -84,7 +87,13 @@ localize(); addStyles(); driver.initialize(this); + initVisibilities(); + } + + private void initVisibilities() { errorMsg.setVisible(false); + messageLabel.setVisible(false); + geoRepForceHelpIcon.setVisible(false); } private void addStyles() { @@ -116,6 +125,7 @@ @Override public void setForceHelp(String forceHelpText) { geoRepForceHelpIcon.setText(templates.italicText(forceHelpText)); + geoRepForceHelpIcon.setVisible(!forceHelpText.isEmpty()); } @Override @@ -124,6 +134,12 @@ } @Override + public void setMessage(String message) { + messageLabel.setText(message); + messageLabel.setVisible(message != null); + } + + @Override public void setErrorMessage(String errorMessage) { errorMsg.setText(errorMessage); errorMsg.setVisible(errorMessage != null); 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 acffff6..21d3399 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 @@ -28,6 +28,7 @@ <d:SimpleDialogPanel width="480px" height="300px"> <d:content> <g:FlowPanel> + <g:Label ui:field="messageLabel" addStyleNames="{style.messageLabel}"/> <ge:StringEntityModelLabelEditor ui:field="masterVolumeEditor" /> <ge:StringEntityModelLabelEditor ui:field="slaveVolumeEditor" /> <ge:StringEntityModelLabelEditor ui:field="slaveHostEditor" /> -- To view, visit https://gerrit.ovirt.org/41901 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I319072213021cfd130b4521c0b77e5e4ab9cb1fe Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: anmolbabu <[email protected]> _______________________________________________ Engine-patches mailing list [email protected] http://lists.ovirt.org/mailman/listinfo/engine-patches
