Shubhendu Tripathi has uploaded a new change for review.

Change subject: gluster: Confirmation dialog for removing a volume snapshot 
schedule
......................................................................

gluster: Confirmation dialog for removing a volume snapshot schedule

Introduced a confirmation dialog while removing a gluster
volume snapshot schedule 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, 38 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/11/42211/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 aa70144..a708765 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
@@ -328,6 +328,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 22bbd6d..46deb49 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
@@ -239,6 +239,8 @@
             editSnapshotSchedule();
         } else if 
(command.getName().equalsIgnoreCase("onEditSnapshotSchedule")) {//$NON-NLS-1$
             onEditSnapshotSchedule();
+        } else if 
(command.getName().equalsIgnoreCase("onEditSnapshotScheduleInternal")) 
{//$NON-NLS-1$
+            onEditSnapshotScheduleInternal();
         }
     }
 
@@ -702,13 +704,41 @@
         snapshotModel.getCommands().add(cancelCommand);
     }
 
+    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("onEditSnapshotScheduleInternal", this); 
//$NON-NLS-1$
+        model.getCommands().add(okCommand);
+        UICommand cancelCommand = 
UICommand.createCancelUiCommand("cancelConfirmation", this); //$NON-NLS-1$
+        model.getCommands().add(cancelCommand);
+    }
+
     public void onEditSnapshotSchedule() {
+        final GlusterVolumeSnapshotModel snapshotModel = 
(GlusterVolumeSnapshotModel) getWindow();
+
+        if (snapshotModel.getRecurrence().getSelectedItem() == 
GlusterVolumeSnapshotScheduleRecurrence.UNKNOWN) {
+            confirmDeleteVolumeSnapshotSchedule();
+        } else {
+            onEditSnapshotScheduleInternal();
+        }
+    }
+
+    private void onEditSnapshotScheduleInternal() {
         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 e182272..30497dd 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 org.ovirt.engine.core.common.businessentities.VmPool;
 
 import com.google.gwt.i18n.client.Constants;
@@ -2559,11 +2558,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/42211
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: If269bba8f3952cf72936c5ed27f9b198fd90220a
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: ovirt-engine-3.5-gluster
Gerrit-Owner: Shubhendu Tripathi <shtri...@redhat.com>
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to