Kanagaraj M has uploaded a new change for review. Change subject: webadmin: action to commit brick removal operation ......................................................................
webadmin: action to commit brick removal operation Added a new 'Commit' action to 'Remove' action group in the Bricks subtab. On Clicking, a confirmation will be shown with list of bricks which is being removed. Upon the confirmation the bricks will be removed from the volume. Change-Id: I1048150ca4b994766a09d0a4a1b1d33065051c65 Signed-off-by: Kanagaraj M <kmayi...@redhat.com> --- M frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/gluster/VolumeBrickListModel.java M frontend/webadmin/modules/uicompat/src/main/java/org/ovirt/engine/ui/uicompat/UIConstants.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/SubTabVolumeBrickView.java 4 files changed, 100 insertions(+), 0 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/01/19401/1 diff --git a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/gluster/VolumeBrickListModel.java b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/gluster/VolumeBrickListModel.java index 0c92453..fbf8ec0 100644 --- a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/gluster/VolumeBrickListModel.java +++ b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/gluster/VolumeBrickListModel.java @@ -50,6 +50,7 @@ setAddBricksCommand(new UICommand("Add Bricks", this)); //$NON-NLS-1$ setRemoveBricksCommand(new UICommand("Remove Bricks", this)); //$NON-NLS-1$ setStopRemoveBricksCommand(new UICommand("StopRemoveBricks", this)); //$NON-NLS-1$ + setCommitRemoveBricksCommand(new UICommand("CommitRemoveBricks", this)); //$NON-NLS-1$ setReplaceBrickCommand(new UICommand("Replace Brick", this)); //$NON-NLS-1$ setBrickAdvancedDetailsCommand(new UICommand("Brick Advanced Details", this)); //$NON-NLS-1$ getReplaceBrickCommand().setIsAvailable(false); @@ -89,6 +90,18 @@ private void setStopRemoveBricksCommand(UICommand value) { stopRemoveBricksCommand = value; + } + + private UICommand commitRemoveBricksCommand; + + public UICommand getCommitRemoveBricksCommand() + { + return commitRemoveBricksCommand; + } + + private void setCommitRemoveBricksCommand(UICommand value) + { + commitRemoveBricksCommand = value; } private UICommand replaceBrickCommand; @@ -782,6 +795,73 @@ }, model); } + private void commitRemoveBricks() { + if (getSelectedItems() == null || getSelectedItems().isEmpty()) { + return; + } + + if (getConfirmWindow() != null) { + return; + } + + ConfirmationModel model = new ConfirmationModel(); + setConfirmWindow(model); + model.setTitle(ConstantsManager.getInstance().getConstants().commitRemoveBricksTitle()); + model.setMessage(ConstantsManager.getInstance().getConstants().commitRemoveBricksMessage()); + model.setHashName("volume_remove_bricks_commit"); //$NON-NLS-1$ + + ArrayList<String> list = new ArrayList<String>(); + for (GlusterBrickEntity item : Linq.<GlusterBrickEntity> cast(getSelectedItems())) + { + list.add(item.getQualifiedName()); + } + model.setItems(list); + + UICommand okCommand = new UICommand("OnCommitRemoveBricks", this); //$NON-NLS-1$ + okCommand.setTitle(ConstantsManager.getInstance().getConstants().ok()); + okCommand.setIsDefault(true); + model.getCommands().add(okCommand); + + UICommand cancelCommand = new UICommand("CancelConfirmation", this); //$NON-NLS-1$ + cancelCommand.setTitle(ConstantsManager.getInstance().getConstants().close()); + cancelCommand.setIsCancel(true); + model.getCommands().add(cancelCommand); + } + + private void onCommitRemoveBricks() { + if (getConfirmWindow() == null) { + return; + } + + ConfirmationModel model = (ConfirmationModel) getConfirmWindow(); + + if (model.getProgress() != null) { + return; + } + + if (getSelectedItems() == null || getSelectedItems().isEmpty()) { + return; + } + + GlusterVolumeEntity volumeEntity = (GlusterVolumeEntity) getEntity(); + + GlusterVolumeRemoveBricksParameters parameter = + new GlusterVolumeRemoveBricksParameters(volumeEntity.getId(), getSelectedItems()); + model.startProgress(null); + + Frontend.RunAction(VdcActionType.CommitRemoveGlusterVolumeBricks, + parameter, + new IFrontendActionAsyncCallback() { + @Override + public void executed(FrontendActionAsyncResult result) { + ConfirmationModel localModel = (ConfirmationModel) result.getState(); + localModel.stopProgress(); + setConfirmWindow(null); + } + }, + model); + } + private void replaceBrick() { if (getWindow() != null) @@ -996,6 +1076,10 @@ stopRemoveBricks(); } else if (command.getName().equals("OnStopRemoveBricks")) { //$NON-NLS-1$ onStopRemoveBricks(); + } else if (command.equals(getCommitRemoveBricksCommand())) { + commitRemoveBricks(); + } else if (command.getName().equals("OnCommitRemoveBricks")) { //$NON-NLS-1$ + onCommitRemoveBricks(); } else if (command.equals(getReplaceBrickCommand())) { replaceBrick(); } else if (command.getName().equals("OnReplace")) { //$NON-NLS-1$ 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 1a19a2e..4e43005 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 @@ -1566,6 +1566,12 @@ @DefaultStringValue("Are you sure you want to stop the removal operation of the following bricks?") String stopRemoveBricksMessage(); + @DefaultStringValue("Commit Brick Removal") + String commitRemoveBricksTitle(); + + @DefaultStringValue("Are you sure you want to commit the removal of the following brick(s)?") + String commitRemoveBricksMessage(); + @DefaultStringValue("Brick with the same details already exist") String duplicateBrickMsg(); 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 aea7b5a..cbc69d0 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 @@ -2642,6 +2642,9 @@ @DefaultStringValue("Stop") String removeBricksStop(); + @DefaultStringValue("Commit") + String removeBricksCommit(); + @DefaultStringValue("Replace Brick") String replaceBrickBrick(); diff --git a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/tab/gluster/SubTabVolumeBrickView.java b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/tab/gluster/SubTabVolumeBrickView.java index 33b78f0..4ce0af4 100644 --- a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/tab/gluster/SubTabVolumeBrickView.java +++ b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/tab/gluster/SubTabVolumeBrickView.java @@ -80,6 +80,13 @@ } }); + removeSubActions.add(new WebAdminButtonDefinition<GlusterBrickEntity>(constants.removeBricksCommit()) { + @Override + protected UICommand resolveCommand() { + return getDetailModel().getCommitRemoveBricksCommand(); + } + }); + getTable().addActionButton(new WebAdminMenuBarButtonDefinition<GlusterBrickEntity>(constants.removeBricksBrick(), removeSubActions, CommandLocation.ContextAndToolBar)); -- To view, visit http://gerrit.ovirt.org/19401 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I1048150ca4b994766a09d0a4a1b1d33065051c65 Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Kanagaraj M <kmayi...@redhat.com> _______________________________________________ Engine-patches mailing list Engine-patches@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-patches