Shubhendu Tripathi has uploaded a new change for review. Change subject: webadmin: UI for gluster volume snapshot actions ......................................................................
webadmin: UI for gluster volume snapshot actions Added UI changes for gluster volume snapshot actions - Restore - Delete - Delete All - Activate - Deactivate Change-Id: I3d5b6162c6c6931cd0366db5ba600566ab8ac7c9 Signed-off-by: Shubhendu Tripathi <[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/GlusterVolumeSnapshotListModel.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/SubTabGlusterVolumeSnapshotView.java 6 files changed, 472 insertions(+), 1 deletion(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/51/38151/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 c1cebad..d67ee69 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 @@ -492,6 +492,21 @@ volume_snapshots("volume_snapshots", HelpTagType.WEBADMIN), //$NON-NLS-1$ + volume_restore_snapshot_confirmation( + "volume_restore_snapshot_confirmation", HelpTagType.WEBADMIN, "[gluster] Volumes main tab -> Snapshots sub-tab -> 'Restore Snapshot' dialog"), //$NON-NLS-1$//$NON-NLS-2$ + + volume_delete_snapshot_confirmation( + "volume_delete_snapshot_confirmation", HelpTagType.WEBADMIN, "[gluster] Volumes main tab -> Snapshots sub-tab -> 'Remove Snapshot' dialog"), //$NON-NLS-1$//$NON-NLS-2$ + + volume_delete_all_snapshot_confirmation( + "volume_delete_all_snapshot_confirmation", HelpTagType.WEBADMIN, "[gluster] Volumes main tab -> Snapshots sub-tab -> 'Remove All Snapshots' dialog"), //$NON-NLS-1$//$NON-NLS-2$ + + volume_activate_snapshot_confirmation( + "volume_activate_snapshot_confirmation", HelpTagType.WEBADMIN, "[gluster] Volumes main tab -> Snapshots sub-tab -> 'Activate Snapshot' dialog"), //$NON-NLS-1$//$NON-NLS-2$ + + volume_deactivate_snapshot_confirmation( + "volume_deactivate_snapshot_confirmation", HelpTagType.WEBADMIN, "[gluster] Volumes main tab -> Snapshots sub-tab -> 'Deactivate Snapshot' dialog"), //$NON-NLS-1$//$NON-NLS-2$ + 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$ 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 7421c4d..f39e42e 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 @@ -4,16 +4,27 @@ 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.GlusterVolumeParameters; +import org.ovirt.engine.core.common.action.gluster.GlusterVolumeSnapshotActionParameters; +import org.ovirt.engine.core.common.businessentities.gluster.GlusterSnapshotStatus; import org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity; import org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeSnapshotEntity; 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.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.FrontendActionAsyncResult; +import org.ovirt.engine.ui.uicompat.FrontendMultipleActionAsyncResult; +import org.ovirt.engine.ui.uicompat.IFrontendActionAsyncCallback; +import org.ovirt.engine.ui.uicompat.IFrontendMultipleActionAsyncCallback; public class GlusterVolumeSnapshotListModel extends SearchableListModel { @Override @@ -25,6 +36,12 @@ setTitle(ConstantsManager.getInstance().getConstants().snapshotsTitle()); setHelpTag(HelpTag.volume_snapshots); setHashName("volume_snapshots");//$NON-NLS-1$ + + setRestoreSnapshotCommand(new UICommand("Restore", this)); //$NON-NLS-1$ + setDeleteSnapshotCommand(new UICommand("Delete", this)); //$NON-NLS-1$ + setDeleteAllSnapshotsCommand(new UICommand("DeleteAll", this)); //$NON-NLS-1$ + setActivateSnapshotCommand(new UICommand("Activate", this)); //$NON-NLS-1$ + setDeactivateSnapshotCommand(new UICommand("Deactivate", this)); //$NON-NLS-1$ } @Override @@ -36,12 +53,89 @@ @Override protected void onSelectedItemChanged() { super.onSelectedItemChanged(); + updateActionAvailability(); } @Override protected void selectedItemsChanged() { super.selectedItemsChanged(); + updateActionAvailability(); + } + + private UICommand restoreSnapshotCommand; + private UICommand deleteSnapshotCommand; + private UICommand deleteAllSnapshotsCommand; + private UICommand activateSnapshotCommand; + private UICommand deactivateSnapshotCommand; + + public UICommand getRestoreSnapshotCommand() { + return restoreSnapshotCommand; + } + + public void setRestoreSnapshotCommand(UICommand restoreSnapshotCommand) { + this.restoreSnapshotCommand = restoreSnapshotCommand; + } + + public UICommand getDeleteSnapshotCommand() { + return deleteSnapshotCommand; + } + + public void setDeleteSnapshotCommand(UICommand deleteSnapshotCommand) { + this.deleteSnapshotCommand = deleteSnapshotCommand; + } + + public UICommand getDeleteAllSnapshotsCommand() { + return deleteAllSnapshotsCommand; + } + + public void setDeleteAllSnapshotsCommand(UICommand deleteAllSnapshotsCommand) { + this.deleteAllSnapshotsCommand = deleteAllSnapshotsCommand; + } + + public UICommand getActivateSnapshotCommand() { + return activateSnapshotCommand; + } + + public void setActivateSnapshotCommand(UICommand activateSnapshotCommand) { + this.activateSnapshotCommand = activateSnapshotCommand; + } + + public UICommand getDeactivateSnapshotCommand() { + return deactivateSnapshotCommand; + } + + public void setDeactivateSnapshotCommand(UICommand deactivateSnapshotCommand) { + this.deactivateSnapshotCommand = deactivateSnapshotCommand; + } + + private void updateActionAvailability() { + boolean allowRestore = true; + boolean allowDelete = true; + boolean allowDeleteAll = true; + boolean allowActivate = true; + boolean allowDeactivate = true; + + if (getSelectedItems() == null || getSelectedItems().size() == 0) { + allowRestore = false; + allowDelete = false; + allowActivate = false; + allowDeactivate = false; + } else { + List<GlusterVolumeSnapshotEntity> snapshots = Linq.<GlusterVolumeSnapshotEntity> cast(getSelectedItems()); + + if (snapshots.size() == 1) { + allowRestore = true; + allowActivate = snapshots.get(0).getStatus() == GlusterSnapshotStatus.STOPPED; + allowDeactivate = snapshots.get(0).getStatus() == GlusterSnapshotStatus.STARTED; + } + } + + getRestoreSnapshotCommand().setIsExecutionAllowed(allowRestore); + getDeleteSnapshotCommand().setIsExecutionAllowed(allowDelete); + getDeleteAllSnapshotsCommand().setIsExecutionAllowed(allowDeleteAll); + getActivateSnapshotCommand().setIsExecutionAllowed(allowActivate); + getDeactivateSnapshotCommand().setIsExecutionAllowed(allowDeactivate); } @Override @@ -66,6 +160,283 @@ @Override public void executeCommand(UICommand command) { super.executeCommand(command); + if (command.equals(getRestoreSnapshotCommand())) { + restoreSnapshot(); + } else if (command.getName().equals("onRestoreSnapshot")) { //$NON-NLS-1$ + onRestoreSnapshot(); + } else if (command.equals(getDeleteSnapshotCommand())) { + deleteSnapshot(); + } else if (command.getName().equals("onDeleteSnapshot")) { //$NON-NLS-1$ + onDeleteSnapshot(); + } else if (command.equals(getDeleteAllSnapshotsCommand())) { + deleteAllSnapshots(); + } else if (command.getName().equals("onDeleteAllSnapshots")) { //$NON-NLS-1$ + onDeleteAllSnapshots(); + } else if (command.equals(getActivateSnapshotCommand())) { + activateSnapshot(); + } else if (command.getName().equals("onActivateSnapshot")) { //$NON-NLS-1$ + onActivateSnapshot(); + } else if (command.equals(getDeactivateSnapshotCommand())) { + deactivateSnapshot(); + } else if (command.getName().equals("onDeactivateSnapshot")) { //$NON-NLS-1$ + onDeactivateSnapshot(); + } else if (command.getName().equals("CancelConfirmation")) { //$NON-NLS-1$ + setConfirmWindow(null); + } + } + + private void restoreSnapshot() { + if (getSelectedItem() == null) { + return; + } + + ConfirmationModel model = new ConfirmationModel(); + GlusterVolumeSnapshotEntity snapshot = (GlusterVolumeSnapshotEntity) getSelectedItem(); + setConfirmWindow(model); + model.setTitle(ConstantsManager.getInstance().getConstants().confirmRestoreSnapshot() + + " - " + getEntity().getName()); //$NON-NLS-1$ + model.setHelpTag(HelpTag.volume_restore_snapshot_confirmation); + model.setHashName("volume_restore_snapshot_confirmation"); //$NON-NLS-1$ + if (snapshot.getStatus() == GlusterSnapshotStatus.STARTED) { + model.setMessage(ConstantsManager.getInstance().getMessages().confirmVolumeSnapshotRestoreWithStop()); + } else { + model.setMessage(ConstantsManager.getInstance().getMessages().confirmVolumeSnapshotRestore()); + } + + UICommand okCommand = UICommand.createDefaultOkUiCommand("onRestoreSnapshot", this); //$NON-NLS-1$ + model.getCommands().add(okCommand); + UICommand cancelCommand = UICommand.createCancelUiCommand("CancelConfirmation", this); //$NON-NLS-1$ + model.getCommands().add(cancelCommand); + } + + private void onRestoreSnapshot() { + if (getConfirmWindow() == null) { + return; + } + + ConfirmationModel model = (ConfirmationModel) getConfirmWindow(); + if (model.getProgress() != null) { + return; + } + + if (getSelectedItems().size() != 1) { + return; + } + + model.startProgress(null); + + Frontend.getInstance().runAction(VdcActionType.RestoreGlusterVolumeSnapshot, + new GlusterVolumeSnapshotActionParameters(getEntity().getId(), + ((GlusterVolumeSnapshotEntity) getSelectedItem()).getSnapshotName(), + true), + new IFrontendActionAsyncCallback() { + @Override + public void executed(FrontendActionAsyncResult result) { + ConfirmationModel localModel = (ConfirmationModel) getConfirmWindow(); + localModel.stopProgress(); + setConfirmWindow(null); + } + }); + } + + private void deleteSnapshot() { + if (getSelectedItems() == null) { + return; + } + + ConfirmationModel model = new ConfirmationModel(); + List<GlusterVolumeSnapshotEntity> snapshots = (List<GlusterVolumeSnapshotEntity>) getSelectedItems(); + StringBuilder snapshotNames = new StringBuilder(); + for (GlusterVolumeSnapshotEntity snapshot : snapshots) { + snapshotNames.append(snapshot.getSnapshotName()); + snapshotNames.append("\n"); //$NON-NLS-1$ + } + + setConfirmWindow(model); + model.setTitle(ConstantsManager.getInstance().getConstants().confirmRemoveSnapshot() + + " - " + getEntity().getName()); //$NON-NLS-1$ + model.setHelpTag(HelpTag.volume_delete_snapshot_confirmation); + model.setHashName("volume_delete_snapshot_confirmation"); //$NON-NLS-1$ + model.setMessage(ConstantsManager.getInstance().getMessages().confirmVolumeSnapshotDelete() + "\n\n" //$NON-NLS-1$ + + snapshotNames); + + UICommand okCommand = UICommand.createDefaultOkUiCommand("onDeleteSnapshot", this); //$NON-NLS-1$ + model.getCommands().add(okCommand); + UICommand cancelCommand = UICommand.createCancelUiCommand("CancelConfirmation", this); //$NON-NLS-1$ + model.getCommands().add(cancelCommand); + } + + private void onDeleteSnapshot() { + if (getConfirmWindow() == null) { + return; + } + + ConfirmationModel model = (ConfirmationModel) getConfirmWindow(); + if (model.getProgress() != null) { + return; + } + + if (getSelectedItems() == null) { + return; + } + + List<VdcActionParametersBase> paramsList = new ArrayList<>(); + for (GlusterVolumeSnapshotEntity snapshot : (List<GlusterVolumeSnapshotEntity>) getSelectedItems()) { + GlusterVolumeSnapshotActionParameters param = + new GlusterVolumeSnapshotActionParameters(getEntity().getId(), snapshot.getSnapshotName(), true); + paramsList.add(param); + } + + model.startProgress(null); + + Frontend.getInstance().runMultipleAction(VdcActionType.DeleteGlusterVolumeSnapshot, + paramsList, + new IFrontendMultipleActionAsyncCallback() { + + @Override + public void executed(FrontendMultipleActionAsyncResult result) { + ConfirmationModel localModel = (ConfirmationModel) getConfirmWindow(); + localModel.stopProgress(); + setConfirmWindow(null); + } + }); + } + + private void deleteAllSnapshots() { + ConfirmationModel model = new ConfirmationModel(); + setConfirmWindow(model); + model.setTitle(ConstantsManager.getInstance().getConstants().confirmRemoveAllSnapshots() + + " - " + getEntity().getName()); //$NON-NLS-1$ + model.setHelpTag(HelpTag.volume_delete_all_snapshot_confirmation); + model.setHashName("volume_delete_all_snapshot_confirmation"); //$NON-NLS-1$ + model.setMessage(ConstantsManager.getInstance().getMessages().confirmVolumeSnapshotDeleteAll()); + + UICommand okCommand = UICommand.createDefaultOkUiCommand("onDeleteAllSnapshots", this); //$NON-NLS-1$ + model.getCommands().add(okCommand); + UICommand cancelCommand = UICommand.createCancelUiCommand("CancelConfirmation", this); //$NON-NLS-1$ + model.getCommands().add(cancelCommand); + } + + private void onDeleteAllSnapshots() { + if (getConfirmWindow() == null) { + return; + } + + ConfirmationModel model = (ConfirmationModel) getConfirmWindow(); + if (model.getProgress() != null) { + return; + } + + model.startProgress(null); + + Frontend.getInstance().runAction(VdcActionType.DeleteAllGlusterVolumeSnapshots, + new GlusterVolumeParameters(getEntity().getId()), + new IFrontendActionAsyncCallback() { + @Override + public void executed(FrontendActionAsyncResult result) { + ConfirmationModel localModel = (ConfirmationModel) getConfirmWindow(); + localModel.stopProgress(); + setConfirmWindow(null); + } + }); + } + + private void activateSnapshot() { + if (getSelectedItem() == null) { + return; + } + + ConfirmationModel model = new ConfirmationModel(); + setConfirmWindow(model); + model.setTitle(ConstantsManager.getInstance().getConstants().confirmActivateSnapshot() + + " - " + getEntity().getName()); //$NON-NLS-1$ + model.setHelpTag(HelpTag.volume_activate_snapshot_confirmation); + model.setHashName("volume_activate_snapshot_confirmation"); //$NON-NLS-1$ + model.setMessage(ConstantsManager.getInstance().getMessages().confirmVolumeSnapshotActivate()); + + UICommand okCommand = UICommand.createDefaultOkUiCommand("onActivateSnapshot", this); //$NON-NLS-1$ + model.getCommands().add(okCommand); + UICommand cancelCommand = UICommand.createCancelUiCommand("CancelConfirmation", this); //$NON-NLS-1$ + model.getCommands().add(cancelCommand); + } + + private void onActivateSnapshot() { + if (getConfirmWindow() == null) { + return; + } + + ConfirmationModel model = (ConfirmationModel) getConfirmWindow(); + if (model.getProgress() != null) { + return; + } + + if (getSelectedItems().size() != 1) { + return; + } + + model.startProgress(null); + + Frontend.getInstance().runAction(VdcActionType.ActivateGlusterVolumeSnapshot, + new GlusterVolumeSnapshotActionParameters(getEntity().getId(), + ((GlusterVolumeSnapshotEntity) getSelectedItem()).getSnapshotName(), + true), + new IFrontendActionAsyncCallback() { + @Override + public void executed(FrontendActionAsyncResult result) { + ConfirmationModel localModel = (ConfirmationModel) getConfirmWindow(); + localModel.stopProgress(); + setConfirmWindow(null); + } + }); + } + + private void deactivateSnapshot() { + if (getSelectedItem() == null) { + return; + } + + ConfirmationModel model = new ConfirmationModel(); + setConfirmWindow(model); + model.setTitle(ConstantsManager.getInstance().getConstants().confirmDeactivateSnapshot() + + " - " + getEntity().getName()); //$NON-NLS-1$ + model.setHelpTag(HelpTag.volume_deactivate_snapshot_confirmation); + model.setHashName("volume_deactivate_snapshot_confirmation"); //$NON-NLS-1$ + model.setMessage(ConstantsManager.getInstance().getMessages().confirmVolumeSnapshotDeactivate()); + + UICommand okCommand = UICommand.createDefaultOkUiCommand("onDeactivateSnapshot", this); //$NON-NLS-1$ + model.getCommands().add(okCommand); + UICommand cancelCommand = UICommand.createCancelUiCommand("CancelConfirmation", this); //$NON-NLS-1$ + model.getCommands().add(cancelCommand); + } + + private void onDeactivateSnapshot() { + if (getConfirmWindow() == null) { + return; + } + + ConfirmationModel model = (ConfirmationModel) getConfirmWindow(); + if (model.getProgress() != null) { + return; + } + + if (getSelectedItems().size() != 1) { + return; + } + + model.startProgress(null); + + Frontend.getInstance().runAction(VdcActionType.DeactivateGlusterVolumeSnapshot, + new GlusterVolumeSnapshotActionParameters(getEntity().getId(), + ((GlusterVolumeSnapshotEntity) getSelectedItem()).getSnapshotName(), + true), + new IFrontendActionAsyncCallback() { + @Override + public void executed(FrontendActionAsyncResult result) { + ConfirmationModel localModel = (ConfirmationModel) getConfirmWindow(); + localModel.stopProgress(); + setConfirmWindow(null); + } + }); } @Override 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 9b7abe2..34a6afe 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 @@ -3,7 +3,6 @@ import org.ovirt.engine.core.common.businessentities.VmPool; import com.google.gwt.i18n.client.Constants; -import com.google.gwt.i18n.client.Messages.DefaultMessage; public interface UIConstants extends com.google.gwt.i18n.client.Constants { @@ -2541,4 +2540,20 @@ + "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(); + + // Gluster Volume Snapshots + @DefaultStringValue("Restore Snapshot") + String confirmRestoreSnapshot(); + + @DefaultStringValue("Remove Snapshot") + String confirmRemoveSnapshot(); + + @DefaultStringValue("Remove All Snapshots") + String confirmRemoveAllSnapshots(); + + @DefaultStringValue("Activate Snapshot") + String confirmActivateSnapshot(); + + @DefaultStringValue("Deactivate Snapshot") + String confirmDeactivateSnapshot(); } 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 5e712b7..4ac2dd2 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 @@ -418,4 +418,22 @@ @DefaultMessage("Force {0} session") String geoRepForceTitle(String action); + // Gluster Volume Snapshots + @DefaultMessage("Volume will be restore to the state of selected snapshot.\nDo you want to continue?") + String confirmVolumeSnapshotRestore(); + + @DefaultMessage("The volume will be brought down and restored to the state of the selected snapshot.\nDo you want to continue?") + String confirmVolumeSnapshotRestoreWithStop(); + + @DefaultMessage("Below snapshots would be removed. Do you want to continue?") + String confirmVolumeSnapshotDelete(); + + @DefaultMessage("All snapshots would be removed. Do you want to continue?") + String confirmVolumeSnapshotDeleteAll(); + + @DefaultMessage("The selected snapshot will be activated. Do you want to continue?") + String confirmVolumeSnapshotActivate(); + + @DefaultMessage("The selected snapshot will be deactivated.\n Do you want to continue?") + String confirmVolumeSnapshotDeactivate(); } 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 0d14808..edaf392 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 @@ -4040,4 +4040,19 @@ @DefaultStringValue("Snapshot Options") String snapshotConfigHeaderLabel(); + + @DefaultStringValue("Restore") + String restoreVolumeSnapshot(); + + @DefaultStringValue("Delete") + String deleteVolumeSnapshot(); + + @DefaultStringValue("Delete All") + String deleteAllVolumeSnapshots(); + + @DefaultStringValue("Activate") + String activateVolumeSnapshot(); + + @DefaultStringValue("Deactivate") + String deactivateVolumeSnapshot(); } diff --git a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/tab/gluster/SubTabGlusterVolumeSnapshotView.java b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/tab/gluster/SubTabGlusterVolumeSnapshotView.java index 4a25bce..8b3aabd 100644 --- a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/tab/gluster/SubTabGlusterVolumeSnapshotView.java +++ b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/tab/gluster/SubTabGlusterVolumeSnapshotView.java @@ -5,11 +5,13 @@ import org.ovirt.engine.ui.common.idhandler.ElementIdHandler; import org.ovirt.engine.ui.common.uicommon.model.SearchableDetailModelProvider; import org.ovirt.engine.ui.common.widget.table.column.AbstractTextColumnWithTooltip; +import org.ovirt.engine.ui.uicommonweb.UICommand; import org.ovirt.engine.ui.uicommonweb.models.gluster.GlusterVolumeSnapshotListModel; import org.ovirt.engine.ui.uicommonweb.models.volumes.VolumeListModel; import org.ovirt.engine.ui.webadmin.ApplicationConstants; import org.ovirt.engine.ui.webadmin.section.main.presenter.tab.gluster.SubTabGlusterVolumeSnapshotPresenter; import org.ovirt.engine.ui.webadmin.section.main.view.AbstractSubTabTableView; +import org.ovirt.engine.ui.webadmin.widget.action.WebAdminButtonDefinition; import org.ovirt.engine.ui.webadmin.widget.table.column.GlusterVolumeSnapshotStatusColumn; import com.google.gwt.core.client.GWT; @@ -72,5 +74,40 @@ }; creationTimeColumn.makeSortable(); getTable().addColumn(creationTimeColumn, constants.volumeSnapshotCreationTime(), "400px"); //$NON-NLS-1$ + + getTable().addActionButton(new WebAdminButtonDefinition<GlusterVolumeSnapshotEntity>(constants.restoreVolumeSnapshot()) { + @Override + protected UICommand resolveCommand() { + return getDetailModel().getRestoreSnapshotCommand(); + } + }); + + getTable().addActionButton(new WebAdminButtonDefinition<GlusterVolumeSnapshotEntity>(constants.deleteVolumeSnapshot()) { + @Override + protected UICommand resolveCommand() { + return getDetailModel().getDeleteSnapshotCommand(); + } + }); + + getTable().addActionButton(new WebAdminButtonDefinition<GlusterVolumeSnapshotEntity>(constants.deleteAllVolumeSnapshots()) { + @Override + protected UICommand resolveCommand() { + return getDetailModel().getDeleteAllSnapshotsCommand(); + } + }); + + getTable().addActionButton(new WebAdminButtonDefinition<GlusterVolumeSnapshotEntity>(constants.activateVolumeSnapshot()) { + @Override + protected UICommand resolveCommand() { + return getDetailModel().getActivateSnapshotCommand(); + } + }); + + getTable().addActionButton(new WebAdminButtonDefinition<GlusterVolumeSnapshotEntity>(constants.deactivateVolumeSnapshot()) { + @Override + protected UICommand resolveCommand() { + return getDetailModel().getDeactivateSnapshotCommand(); + } + }); } } -- To view, visit https://gerrit.ovirt.org/38151 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I3d5b6162c6c6931cd0366db5ba600566ab8ac7c9 Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Shubhendu Tripathi <[email protected]> _______________________________________________ Engine-patches mailing list [email protected] http://lists.ovirt.org/mailman/listinfo/engine-patches
