Shubhendu Tripathi has uploaded a new change for review. Change subject: gluster: Confirmation dialog fole removing a volume snapshot ......................................................................
gluster: Confirmation dialog fole removing a volume snapshot Introduced a confirmation dialog while removing a gluster volume snapshot as its a disruptive action. Change-Id: If269bba8f3952cf72936c5ed27f9b198fd90220a Bug-Url: https://bugzilla.redhat.com/1226129 Signed-off-by: Shubhendu Tripathi <shtri...@redhat.com> --- 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/GlusterVolumeSnapshotListModel.java M frontend/webadmin/modules/uicompat/src/main/java/org/ovirt/engine/ui/uicompat/UIConstants.java 3 files changed, 40 insertions(+), 3 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/51/41851/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 12f3f0f..5a745ca 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 @@ -350,6 +350,8 @@ configure_volume_snapshot_confirmation("configure_volume_snapshot_confirmation", HelpTagType.WEBADMIN, "Configure volume snapshot: confirmation dialog that appears when changing the volume snapshot configuration parameters."), //$NON-NLS-1$ //$NON-NLS-2$ + remove_volume_snapshot_schedule_confirmation("remove_volume_snapshot_schedule_confirmation", HelpTagType.WEBADMIN, "Remove volume snapshot schedule: confirmation dialog that appears when None option selected while editing the gluster volume snapshot schedule."), //$NON-NLS-1$ //$NON-NLS-2$ + new_volume_snapshot("new_volume_snapshot", HelpTagType.WEBADMIN, "[gluster] Volumes main tab -> Snapshot -> New"), //$NON-NLS-1$ //$NON-NLS-2$ edit_volume_snapshot_schedule("edit_volume_snapshot_schedule", HelpTagType.WEBADMIN, "[gluster] Volumes main tab -> Snapshot -> Edit Schedule"), //$NON-NLS-1$ //$NON-NLS-2$ diff --git a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/gluster/GlusterVolumeSnapshotListModel.java b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/gluster/GlusterVolumeSnapshotListModel.java index 09fb6dd..e167231 100644 --- a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/gluster/GlusterVolumeSnapshotListModel.java +++ b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/gluster/GlusterVolumeSnapshotListModel.java @@ -237,6 +237,8 @@ setWindow(null); } else if (command.equals(getEditSnapshotScheduleCommand())) { editSnapshotSchedule(); + } else if (command.getName().equalsIgnoreCase("onEditSnapshotScheduleWithoutConfirmation")) {//$NON-NLS-1$ + onEditSnapshotScheduleWithoutConfirmation(); } else if (command.getName().equalsIgnoreCase("onEditSnapshotSchedule")) {//$NON-NLS-1$ onEditSnapshotSchedule(); } @@ -677,20 +679,48 @@ snapshotModel.getClusterName().setEntity(getEntity().getVdsGroupName()); snapshotModel.getVolumeName().setEntity(getEntity().getName()); - UICommand okCommand = UICommand.createDefaultOkUiCommand("onEditSnapshotSchedule", this); //$NON-NLS-1$ + UICommand okCommand = UICommand.createDefaultOkUiCommand("onEditSnapshotScheduleWithoutConfirmation", this); //$NON-NLS-1$ snapshotModel.getCommands().add(okCommand); UICommand cancelCommand = UICommand.createCancelUiCommand("cancel", this); //$NON-NLS-1$ snapshotModel.getCommands().add(cancelCommand); } - public void onEditSnapshotSchedule() { + private void confirmDeleteVolumeSnapshotSchedule() { + ConfirmationModel model = new ConfirmationModel(); + setConfirmWindow(model); + model.setTitle(ConstantsManager.getInstance() + .getConstants() + .removeGlusterVolumeSnapshotScheduleConfirmationTitle()); + model.setHelpTag(HelpTag.remove_volume_snapshot_schedule_confirmation); + model.setHashName("remove_volume_snapshot_schedule_confirmation"); //$NON-NLS-1$ + model.setMessage(ConstantsManager.getInstance().getConstants().youAreAboutToRemoveSnapshotScheduleMsg()); + + UICommand okCommand = UICommand.createDefaultOkUiCommand("onEditSnapshotSchedule", this); //$NON-NLS-1$ + model.getCommands().add(okCommand); + UICommand cancelCommand = UICommand.createCancelUiCommand("cancelConfirmation", this); //$NON-NLS-1$ + model.getCommands().add(cancelCommand); + } + + public void onEditSnapshotScheduleWithoutConfirmation() { + final GlusterVolumeSnapshotModel snapshotModel = (GlusterVolumeSnapshotModel) getWindow(); + + if (snapshotModel.getRecurrence().getSelectedItem() == GlusterVolumeSnapshotScheduleRecurrence.UNKNOWN) { + confirmDeleteVolumeSnapshotSchedule(); + } else { + onEditSnapshotSchedule(); + } + } + + private void onEditSnapshotSchedule() { final GlusterVolumeSnapshotModel snapshotModel = (GlusterVolumeSnapshotModel) getWindow(); if (!snapshotModel.validate(false)) { return; } + setConfirmWindow(null); + scheduleSnapshot(snapshotModel, true); } } 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 dce3725..b163c75 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 @@ -1,6 +1,5 @@ package org.ovirt.engine.ui.uicompat; -import com.google.gwt.i18n.client.Constants; import org.ovirt.engine.core.common.businessentities.VmPool; import com.google.gwt.i18n.client.Constants; @@ -2676,11 +2675,17 @@ @DefaultStringValue("Update snapshot configuration options") String updateSnapshotConfigurationConfirmationTitle(); + @DefaultStringValue("Remove Gluster Volume snapshot schedule") + String removeGlusterVolumeSnapshotScheduleConfirmationTitle(); + @DefaultStringValue("Configuring volume snapshot options\n\n" + "Changing configuration parameters will limit the creation of new snapshots if they exceed the new limit.\n\n" + "Do you want to continue?") String youAreAboutChangeSnapshotConfigurationMsg(); + @DefaultStringValue("The snapshot schedule would be deleted. Do you want to continue?") + String youAreAboutToRemoveSnapshotScheduleMsg(); + @DefaultStringValue("existing") String existingDisk(); -- To view, visit https://gerrit.ovirt.org/41851 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: If269bba8f3952cf72936c5ed27f9b198fd90220a Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Shubhendu Tripathi <shtri...@redhat.com> _______________________________________________ Engine-patches mailing list Engine-patches@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-patches