Kanagaraj M has uploaded a new change for review. Change subject: webadmin: Adding force option to remove host ......................................................................
webadmin: Adding force option to remove host 'Remove Forcefully' checkbox will be shown while removing a host from a gluster only cluster. This is supported for mutiple hosts removals as well, but all the selected hosts should belong to a single gluster cluster. If the user selects force, it internally passes 'force' option to 'gluster peer detach' command. Change-Id: I9fe3814815acff8a5f230c1a3d6ebcb6e3bbc633 Bug-Url: https://bugzilla.redhat.com/882807 Signed-off-by: Kanagaraj M <[email protected]> --- M frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/CommonApplicationConstants.java M frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/view/popup/RemoveConfirmationPopupView.java M frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/view/popup/RemoveConfirmationPopupView.ui.xml M frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/ConfirmationModel.java M frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/hosts/HostListModel.java 5 files changed, 51 insertions(+), 2 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/80/10180/1 diff --git a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/CommonApplicationConstants.java b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/CommonApplicationConstants.java index 4b841b4..874b33c 100644 --- a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/CommonApplicationConstants.java +++ b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/CommonApplicationConstants.java @@ -199,6 +199,9 @@ @DefaultStringValue("Approve operation") String approveOperation(); + @DefaultStringValue("Remove Forcefully") + String removeForcefully(); + // General @DefaultStringValue("Yes") String yes(); diff --git a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/view/popup/RemoveConfirmationPopupView.java b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/view/popup/RemoveConfirmationPopupView.java index 5d4d920..8a6248d 100644 --- a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/view/popup/RemoveConfirmationPopupView.java +++ b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/view/popup/RemoveConfirmationPopupView.java @@ -53,6 +53,11 @@ @WithElementId protected EntityModelCheckBoxEditor latch; + @UiField(provided = true) + @Path(value = "force.entity") + @WithElementId + protected EntityModelCheckBoxEditor force; + @UiField @Ignore protected HTML noteHTML; @@ -66,6 +71,8 @@ super(eventBus, resources); latch = new EntityModelCheckBoxEditor(Align.RIGHT); latch.setLabel(constants.approveOperation()); + force = new EntityModelCheckBoxEditor(Align.RIGHT); + force.setLabel(constants.removeForcefully()); this.constants= constants; this.messages = messages; initWidget(ViewUiBinder.uiBinder.createAndBindUi(this)); diff --git a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/view/popup/RemoveConfirmationPopupView.ui.xml b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/view/popup/RemoveConfirmationPopupView.ui.xml index 12b73df..9cae2ac 100644 --- a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/view/popup/RemoveConfirmationPopupView.ui.xml +++ b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/view/popup/RemoveConfirmationPopupView.ui.xml @@ -27,6 +27,7 @@ <g:HTML ui:field="messageHTML" /> <g:FlowPanel ui:field="itemPanel" addStyleNames="{style.items}" /> <e:EntityModelCheckBoxEditor ui:field="latch" visible="false" /> + <e:EntityModelCheckBoxEditor ui:field="force" visible="false" /> <g:HTML ui:field="noteHTML" addStyleNames="{style.noteHTML}"/> </g:FlowPanel> </d:content> diff --git a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/ConfirmationModel.java b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/ConfirmationModel.java index f8d7bd0..ede47f0 100644 --- a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/ConfirmationModel.java +++ b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/ConfirmationModel.java @@ -20,6 +20,18 @@ privateLatch = value; } + private EntityModel force; + + public EntityModel getForce() + { + return force; + } + + public void setForce(EntityModel value) + { + force = value; + } + private String note; public String getNote() @@ -41,6 +53,10 @@ setLatch(new EntityModel()); getLatch().setEntity(false); getLatch().setIsAvailable(false); + + setForce(new EntityModel()); + getForce().setEntity(false); + getForce().setIsAvailable(false); } public boolean Validate() diff --git a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/hosts/HostListModel.java b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/hosts/HostListModel.java index b3b0587..a238d0f 100644 --- a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/hosts/HostListModel.java +++ b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/hosts/HostListModel.java @@ -3,7 +3,9 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; +import java.util.HashSet; import java.util.Map; +import java.util.Set; import org.ovirt.engine.core.common.VdcActionUtils; import org.ovirt.engine.core.common.VdcObjectType; @@ -899,18 +901,37 @@ return; } - ConfirmationModel model = new ConfirmationModel(); + final ConfirmationModel model = new ConfirmationModel(); setWindow(model); model.setTitle(ConstantsManager.getInstance().getConstants().removeHostsTitle()); model.setHashName("remove_host"); //$NON-NLS-1$ model.setMessage(ConstantsManager.getInstance().getConstants().hostsMsg()); + Set<Guid> clusters = new HashSet<Guid>(); ArrayList<String> list = new ArrayList<String>(); for (VDS item : Linq.<VDS> Cast(getSelectedItems())) { list.add(item.getvds_name()); + clusters.add(item.getvds_group_id()); } model.setItems(list); + + // Remove Force option will be shown only if + // - All the selected hosts belongs to same cluster + // - the cluster should be a gluster only cluster + if (clusters.size() == 1) { + model.StartProgress(null); + AsyncDataProvider.GetClusterById(new AsyncQuery(this, new INewAsyncCallback() { + @Override + public void OnSuccess(Object target, Object returnValue) { + VDSGroup cluster = (VDSGroup) returnValue; + if (cluster != null && cluster.supportsGlusterService() && !cluster.supportsVirtService()) { + model.getForce().setIsAvailable(true); + } + model.StopProgress(); + } + }), clusters.iterator().next()); + } UICommand tempVar = new UICommand("OnRemove", this); //$NON-NLS-1$ tempVar.setTitle(ConstantsManager.getInstance().getConstants().ok()); @@ -931,11 +952,12 @@ return; } + boolean force = (Boolean) model.getForce().getEntity(); ArrayList<VdcActionParametersBase> list = new ArrayList<VdcActionParametersBase>(); for (Object item : getSelectedItems()) { VDS vds = (VDS) item; - list.add(new RemoveVdsParameters(vds.getId())); + list.add(new RemoveVdsParameters(vds.getId(), force)); } model.StartProgress(null); -- To view, visit http://gerrit.ovirt.org/10180 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I9fe3814815acff8a5f230c1a3d6ebcb6e3bbc633 Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Kanagaraj M <[email protected]> _______________________________________________ Engine-patches mailing list [email protected] http://lists.ovirt.org/mailman/listinfo/engine-patches
