Kanagaraj M has uploaded a new change for review.

Change subject: webadmin: Gluster Hooks - conflict resolution popup
......................................................................

webadmin: Gluster Hooks - conflict resolution popup

New Action 'Resolve Conflicts' is added to gluster hooks tab.
This action will be enabled if the hook is not in sync in the
hosts of the cluster and engine. Engine copy of the hook will
be considered as a Master copy.

On clicking 'Resolve Conflicts', a popup will be shown explaining
the reason for the conflict. The conflict could be any one/mutiple of
the following

1.MISMATCH IN CONTENT - hook content is different across hosts
2.MISMATCH IN STATUS - hook status is different across hosts
3.NEW HOOK - hook is present only in some hosts but not in all
4.MISSING HOOK - hook is present in Engine but not in hosts

The user will be able to view the content and status of the hook from different
sources (hosts and Engine).

Finally the user can select the resole step which will resolve the conflicts.

Change-Id: I10bc9c7dba7cb1be320bb0e12f3b7bf7a8beb485
Signed-off-by: Kanagaraj M <[email protected]>
---
M 
frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/clusters/ClusterGlusterHookListModel.java
A 
frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/clusters/GlusterHookConflictType.java
M 
frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/clusters/GlusterHookContentModel.java
A 
frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/clusters/GlusterHookResolveConflictsModel.java
M 
frontend/webadmin/modules/uicompat/src/main/java/org/ovirt/engine/ui/uicompat/Constants.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/gin/PresenterModule.java
M 
frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/gin/uicommon/ClusterModule.java
A 
frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/presenter/popup/cluster/GlusterHookResolveConflictsPopupPresenterWidget.java
A 
frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/cluster/GlusterHookResolveConflictsPopupView.java
A 
frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/cluster/GlusterHookResolveConflictsPopupView.ui.xml
M 
frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/tab/cluster/SubTabClusterGlusterHookView.java
12 files changed, 567 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/39/11839/1

diff --git 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/clusters/ClusterGlusterHookListModel.java
 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/clusters/ClusterGlusterHookListModel.java
index 72b103c..6898627 100644
--- 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/clusters/ClusterGlusterHookListModel.java
+++ 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/clusters/ClusterGlusterHookListModel.java
@@ -26,6 +26,7 @@
     private UICommand enableHookCommand;
     private UICommand disableHookCommand;
     private UICommand viewHookCommand;
+    private UICommand resolveConflictsCommand;
 
     public UICommand getEnableHookCommand() {
         return enableHookCommand;
@@ -51,6 +52,14 @@
         this.viewHookCommand = viewHookCommand;
     }
 
+    public UICommand getResolveConflictsCommand() {
+        return resolveConflictsCommand;
+    }
+
+    public void setResolveConflictsCommand(UICommand resolveConflictsCommand) {
+        this.resolveConflictsCommand = resolveConflictsCommand;
+    }
+
     @Override
     public VDSGroup getEntity() {
         return (VDSGroup) super.getEntity();
@@ -64,10 +73,12 @@
         setEnableHookCommand(new UICommand("EnableHook", this)); //$NON-NLS-1$
         setDisableHookCommand(new UICommand("DisableHook", this)); 
//$NON-NLS-1$
         setViewHookCommand(new UICommand("ViewHook", this)); //$NON-NLS-1$
+        setResolveConflictsCommand(new UICommand("ResolveConflicts", this)); 
//$NON-NLS-1$
 
         getEnableHookCommand().setIsExecutionAllowed(false);
         getDisableHookCommand().setIsExecutionAllowed(false);
         getViewHookCommand().setIsExecutionAllowed(false);
+        getResolveConflictsCommand().setIsExecutionAllowed(false);
     }
 
     private void enableHook() {
@@ -155,6 +166,10 @@
         setConfirmWindow(null);
     }
 
+    private void cancel() {
+        setWindow(null);
+    }
+
     private void viewHook() {
         if (getWindow() != null)
         {
@@ -179,6 +194,36 @@
         contentModel.getCommands().add(command);
     }
 
+    private void resolveConflicts() {
+        if (getWindow() != null)
+        {
+            return;
+        }
+
+        GlusterHookEntity hookEntity = (GlusterHookEntity) getSelectedItem();
+
+        if (hookEntity == null)
+        {
+            return;
+        }
+
+        GlusterHookResolveConflictsModel conflictsModel = new 
GlusterHookResolveConflictsModel();
+        
conflictsModel.setTitle(ConstantsManager.getInstance().getConstants().resolveConflictsGlusterHookTitle());
+        conflictsModel.setHashName("view_gluster_hook"); //$NON-NLS-1$
+        conflictsModel.setConflictType(GlusterHookConflictType.CONTENT_STATUS);
+        setWindow(conflictsModel);
+
+        UICommand command = new UICommand("OnResolveConflicts", this); 
//$NON-NLS-1$
+        command.setTitle(ConstantsManager.getInstance().getConstants().ok());
+        command.setIsCancel(true);
+        conflictsModel.getCommands().add(command);
+
+        command = new UICommand("Cancel", this); //$NON-NLS-1$
+        
command.setTitle(ConstantsManager.getInstance().getConstants().close());
+        command.setIsCancel(true);
+        conflictsModel.getCommands().add(command);
+    }
+
     @Override
     protected void SelectedItemsChanged() {
         super.SelectedItemsChanged();
@@ -194,6 +239,8 @@
         }
 
         getViewHookCommand().setIsExecutionAllowed(getSelectedItems().size() 
== 1);
+        
getResolveConflictsCommand().setIsExecutionAllowed(getSelectedItems().size() == 
1
+                && ((GlusterHookEntity) getSelectedItems().get(0)) != null);
 
         getEnableHookCommand().setIsExecutionAllowed(true);
         getDisableHookCommand().setIsExecutionAllowed(true);
@@ -271,5 +318,11 @@
         else if (command.equals(getViewHookCommand())) {
             viewHook();
         }
+        else if (command.equals(getResolveConflictsCommand())) {
+            resolveConflicts();
+        }
+        else if (command.getName().equals("Cancel")) { //$NON-NLS-1$
+            cancel();
+        }
     }
 }
diff --git 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/clusters/GlusterHookConflictType.java
 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/clusters/GlusterHookConflictType.java
new file mode 100644
index 0000000..142ec10
--- /dev/null
+++ 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/clusters/GlusterHookConflictType.java
@@ -0,0 +1,10 @@
+package org.ovirt.engine.ui.uicommonweb.models.clusters;
+
+public enum GlusterHookConflictType {
+
+    CONTENT,
+    STATUS,
+    CONTENT_STATUS,
+    NEW,
+    MISSING;
+}
diff --git 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/clusters/GlusterHookContentModel.java
 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/clusters/GlusterHookContentModel.java
index 4be87a9..9da0f08 100644
--- 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/clusters/GlusterHookContentModel.java
+++ 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/clusters/GlusterHookContentModel.java
@@ -7,6 +7,10 @@
 
     EntityModel content;
 
+    EntityModel md5Checksum;
+
+    EntityModel status;
+
     public EntityModel getContent() {
         return content;
     }
@@ -15,7 +19,25 @@
         this.content = content;
     }
 
+    public EntityModel getMd5Checksum() {
+        return md5Checksum;
+    }
+
+    public void setMd5Checksum(EntityModel md5Checksum) {
+        this.md5Checksum = md5Checksum;
+    }
+
+    public EntityModel getStatus() {
+        return status;
+    }
+
+    public void setStatus(EntityModel status) {
+        this.status = status;
+    }
+
     public GlusterHookContentModel() {
-        setContent(new EntityModel());
+        setContent(new EntityModel("")); //$NON-NLS-1$
+        setMd5Checksum(new EntityModel("")); //$NON-NLS-1$
+        setStatus(new EntityModel("")); //$NON-NLS-1$
     }
 }
diff --git 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/clusters/GlusterHookResolveConflictsModel.java
 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/clusters/GlusterHookResolveConflictsModel.java
new file mode 100644
index 0000000..68a6a0a
--- /dev/null
+++ 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/clusters/GlusterHookResolveConflictsModel.java
@@ -0,0 +1,42 @@
+package org.ovirt.engine.ui.uicommonweb.models.clusters;
+
+import org.ovirt.engine.ui.uicommonweb.models.ListModel;
+import org.ovirt.engine.ui.uicommonweb.models.Model;
+
+public class GlusterHookResolveConflictsModel extends Model {
+
+    GlusterHookConflictType conflictType;
+
+    ListModel hookSources;
+
+    GlusterHookContentModel contentModel;
+
+    public GlusterHookConflictType getConflictType() {
+        return conflictType;
+    }
+
+    public void setConflictType(GlusterHookConflictType conflictType) {
+        this.conflictType = conflictType;
+    }
+
+    public ListModel getHookSources() {
+        return hookSources;
+    }
+
+    public void setHookSources(ListModel hookSources) {
+        this.hookSources = hookSources;
+    }
+
+    public GlusterHookContentModel getContentModel() {
+        return contentModel;
+    }
+
+    public void setContentModel(GlusterHookContentModel contentModel) {
+        this.contentModel = contentModel;
+    }
+
+    public GlusterHookResolveConflictsModel() {
+        setHookSources(new ListModel());
+        setContentModel(new GlusterHookContentModel());
+    }
+}
diff --git 
a/frontend/webadmin/modules/uicompat/src/main/java/org/ovirt/engine/ui/uicompat/Constants.java
 
b/frontend/webadmin/modules/uicompat/src/main/java/org/ovirt/engine/ui/uicompat/Constants.java
index d44eb7e..86413b3 100644
--- 
a/frontend/webadmin/modules/uicompat/src/main/java/org/ovirt/engine/ui/uicompat/Constants.java
+++ 
b/frontend/webadmin/modules/uicompat/src/main/java/org/ovirt/engine/ui/uicompat/Constants.java
@@ -1487,6 +1487,9 @@
     @DefaultStringValue("Hook Content")
     String viewContentGlusterHookTitle();
 
+    @DefaultStringValue("Resolve Conflicts")
+    String resolveConflictsGlusterHookTitle();
+
     @DefaultStringValue("VMs already exist")
     String vmAlreadyExistsMsg();
 
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 ab853f4..d6a3bec 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
@@ -1686,6 +1686,9 @@
     @DefaultStringValue("View Content")
     String viewHookContent();
 
+    @DefaultStringValue("Resolve Conflicts")
+    String resolveConflictsGlusterHook();
+
     // Interface
     @DefaultStringValue("Empty")
     String emptyInterface();
diff --git 
a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/gin/PresenterModule.java
 
b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/gin/PresenterModule.java
index 2536d35..d393f95 100644
--- 
a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/gin/PresenterModule.java
+++ 
b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/gin/PresenterModule.java
@@ -19,6 +19,7 @@
 import 
org.ovirt.engine.ui.webadmin.section.main.presenter.popup.cluster.ClusterManageNetworkPopupPresenterWidget;
 import 
org.ovirt.engine.ui.webadmin.section.main.presenter.popup.cluster.ClusterPopupPresenterWidget;
 import 
org.ovirt.engine.ui.webadmin.section.main.presenter.popup.cluster.GlusterHookContentPopupPresenterWidget;
+import 
org.ovirt.engine.ui.webadmin.section.main.presenter.popup.cluster.GlusterHookResolveConflictsPopupPresenterWidget;
 import 
org.ovirt.engine.ui.webadmin.section.main.presenter.popup.cluster.NewClusterNetworkPopupPresenterWidget;
 import 
org.ovirt.engine.ui.webadmin.section.main.presenter.popup.configure.ConfigurePopupPresenterWidget;
 import 
org.ovirt.engine.ui.webadmin.section.main.presenter.popup.configure.RolePopupPresenterWidget;
@@ -202,6 +203,7 @@
 import 
org.ovirt.engine.ui.webadmin.section.main.view.popup.cluster.ClusterManageNetworkPopupView;
 import 
org.ovirt.engine.ui.webadmin.section.main.view.popup.cluster.ClusterPopupView;
 import 
org.ovirt.engine.ui.webadmin.section.main.view.popup.cluster.GlusterHookContentPopupView;
+import 
org.ovirt.engine.ui.webadmin.section.main.view.popup.cluster.GlusterHookResolveConflictsPopupView;
 import 
org.ovirt.engine.ui.webadmin.section.main.view.popup.cluster.NewClusterNetworkPopupView;
 import 
org.ovirt.engine.ui.webadmin.section.main.view.popup.configure.ConfigurePopupView;
 import 
org.ovirt.engine.ui.webadmin.section.main.view.popup.configure.RolePopupView;
@@ -914,6 +916,10 @@
                 GlusterHookContentPopupPresenterWidget.ViewDef.class,
                 GlusterHookContentPopupView.class);
 
+        
bindPresenterWidget(GlusterHookResolveConflictsPopupPresenterWidget.class,
+                GlusterHookResolveConflictsPopupPresenterWidget.ViewDef.class,
+                GlusterHookResolveConflictsPopupView.class);
+
         // Host
         bindPresenterWidget(HostPopupPresenterWidget.class,
                 HostPopupPresenterWidget.ViewDef.class,
diff --git 
a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/gin/uicommon/ClusterModule.java
 
b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/gin/uicommon/ClusterModule.java
index 90a918a..ebd6114 100644
--- 
a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/gin/uicommon/ClusterModule.java
+++ 
b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/gin/uicommon/ClusterModule.java
@@ -34,6 +34,7 @@
 import 
org.ovirt.engine.ui.webadmin.section.main.presenter.popup.cluster.ClusterManageNetworkPopupPresenterWidget;
 import 
org.ovirt.engine.ui.webadmin.section.main.presenter.popup.cluster.ClusterPopupPresenterWidget;
 import 
org.ovirt.engine.ui.webadmin.section.main.presenter.popup.cluster.GlusterHookContentPopupPresenterWidget;
+import 
org.ovirt.engine.ui.webadmin.section.main.presenter.popup.cluster.GlusterHookResolveConflictsPopupPresenterWidget;
 import 
org.ovirt.engine.ui.webadmin.section.main.presenter.popup.cluster.NewClusterNetworkPopupPresenterWidget;
 import 
org.ovirt.engine.ui.webadmin.section.main.presenter.popup.gluster.DetachGlusterHostsPopupPresenterWidget;
 import 
org.ovirt.engine.ui.webadmin.section.main.presenter.popup.guide.GuidePopupPresenterWidget;
@@ -172,7 +173,8 @@
     @Singleton
     public SearchableDetailModelProvider<GlusterHookEntity, ClusterListModel, 
ClusterGlusterHookListModel> getClusterGlusterHookListProvider(ClientGinjector 
ginjector,
             final Provider<DefaultConfirmationPopupPresenterWidget> 
confirmPopupProvider,
-            final Provider<GlusterHookContentPopupPresenterWidget> 
contentPopupProvider) {
+            final Provider<GlusterHookContentPopupPresenterWidget> 
contentPopupProvider,
+            final Provider<GlusterHookResolveConflictsPopupPresenterWidget> 
resolveConflictsPopupProvider) {
         return new SearchableDetailTabModelProvider<GlusterHookEntity, 
ClusterListModel, ClusterGlusterHookListModel>(ginjector,
                 ClusterListModel.class,
                 ClusterGlusterHookListModel.class) {
@@ -182,6 +184,9 @@
                 if (lastExecutedCommand == getModel().getViewHookCommand()) {
                     return contentPopupProvider.get();
                 }
+                else if (lastExecutedCommand == 
getModel().getResolveConflictsCommand()) {
+                    return resolveConflictsPopupProvider.get();
+                }
                 else {
                     return super.getModelPopup(source, lastExecutedCommand, 
windowModel);
                 }
diff --git 
a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/presenter/popup/cluster/GlusterHookResolveConflictsPopupPresenterWidget.java
 
b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/presenter/popup/cluster/GlusterHookResolveConflictsPopupPresenterWidget.java
new file mode 100644
index 0000000..fcd7b4f
--- /dev/null
+++ 
b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/presenter/popup/cluster/GlusterHookResolveConflictsPopupPresenterWidget.java
@@ -0,0 +1,24 @@
+package org.ovirt.engine.ui.webadmin.section.main.presenter.popup.cluster;
+
+import 
org.ovirt.engine.ui.common.presenter.AbstractModelBoundPopupPresenterWidget;
+import 
org.ovirt.engine.ui.uicommonweb.models.clusters.GlusterHookResolveConflictsModel;
+
+import com.google.gwt.event.shared.EventBus;
+import com.google.inject.Inject;
+
+public class GlusterHookResolveConflictsPopupPresenterWidget extends 
AbstractModelBoundPopupPresenterWidget<GlusterHookResolveConflictsModel, 
GlusterHookResolveConflictsPopupPresenterWidget.ViewDef> {
+
+    public interface ViewDef extends 
AbstractModelBoundPopupPresenterWidget.ViewDef<GlusterHookResolveConflictsModel>
 {
+    }
+
+    @Inject
+    public GlusterHookResolveConflictsPopupPresenterWidget(EventBus eventBus, 
ViewDef view) {
+        super(eventBus, view);
+    }
+
+    @Override
+    public void init(GlusterHookResolveConflictsModel model) {
+        super.init(model);
+    }
+
+}
diff --git 
a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/cluster/GlusterHookResolveConflictsPopupView.java
 
b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/cluster/GlusterHookResolveConflictsPopupView.java
new file mode 100644
index 0000000..fe5ea98
--- /dev/null
+++ 
b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/cluster/GlusterHookResolveConflictsPopupView.java
@@ -0,0 +1,259 @@
+package org.ovirt.engine.ui.webadmin.section.main.view.popup.cluster;
+
+import org.ovirt.engine.core.common.businessentities.VDS;
+import org.ovirt.engine.ui.common.idhandler.ElementIdHandler;
+import org.ovirt.engine.ui.common.idhandler.WithElementId;
+import org.ovirt.engine.ui.common.view.popup.AbstractModelBoundPopupView;
+import org.ovirt.engine.ui.common.widget.Align;
+import org.ovirt.engine.ui.common.widget.dialog.SimpleDialogPanel;
+import org.ovirt.engine.ui.common.widget.editor.EntityModelCellTable;
+import org.ovirt.engine.ui.common.widget.editor.EntityModelCheckBoxEditor;
+import org.ovirt.engine.ui.common.widget.editor.EntityModelLabelEditor;
+import org.ovirt.engine.ui.common.widget.editor.EntityModelRadioButtonEditor;
+import org.ovirt.engine.ui.common.widget.editor.EntityModelTextAreaLabelEditor;
+import org.ovirt.engine.ui.common.widget.editor.ListModelListBoxEditor;
+import org.ovirt.engine.ui.common.widget.table.column.EntityModelTextColumn;
+import org.ovirt.engine.ui.uicommonweb.models.ListModel;
+import org.ovirt.engine.ui.uicommonweb.models.clusters.GlusterHookConflictType;
+import 
org.ovirt.engine.ui.uicommonweb.models.clusters.GlusterHookResolveConflictsModel;
+import org.ovirt.engine.ui.webadmin.ApplicationConstants;
+import org.ovirt.engine.ui.webadmin.ApplicationResources;
+import 
org.ovirt.engine.ui.webadmin.section.main.presenter.popup.cluster.GlusterHookResolveConflictsPopupPresenterWidget;
+
+import com.google.gwt.core.client.GWT;
+import com.google.gwt.editor.client.SimpleBeanEditorDriver;
+import com.google.gwt.event.shared.EventBus;
+import com.google.gwt.resources.client.CssResource;
+import com.google.gwt.uibinder.client.UiBinder;
+import com.google.gwt.uibinder.client.UiField;
+import com.google.gwt.user.client.ui.HorizontalPanel;
+import com.google.gwt.user.client.ui.Label;
+import com.google.inject.Inject;
+
+public class GlusterHookResolveConflictsPopupView extends 
AbstractModelBoundPopupView<GlusterHookResolveConflictsModel> implements 
GlusterHookResolveConflictsPopupPresenterWidget.ViewDef {
+
+    interface Driver extends 
SimpleBeanEditorDriver<GlusterHookResolveConflictsModel, 
GlusterHookResolveConflictsPopupView> {
+        Driver driver = GWT.create(Driver.class);
+    }
+
+    interface ViewUiBinder extends UiBinder<SimpleDialogPanel, 
GlusterHookResolveConflictsPopupView> {
+        ViewUiBinder uiBinder = GWT.create(ViewUiBinder.class);
+    }
+
+    interface ViewIdHandler extends 
ElementIdHandler<GlusterHookResolveConflictsPopupView> {
+        ViewIdHandler idHandler = GWT.create(ViewIdHandler.class);
+    }
+
+    @UiField
+    WidgetStyle style;
+
+    @UiField
+    @Ignore
+    @WithElementId
+    Label conflictReasonsLabel;
+
+    @UiField
+    @Ignore
+    @WithElementId
+    Label conflictReasonsContentDiffLabel;
+
+    @UiField
+    @Ignore
+    @WithElementId
+    Label conflictReasonsStatusDiffLabel;
+
+    @UiField
+    @Ignore
+    @WithElementId
+    Label conflictReasonsNewHookLabel;
+
+    @UiField
+    @Ignore
+    @WithElementId
+    Label conflictReasonsMissingHookLabel;
+
+    @UiField
+    @Ignore
+    @WithElementId
+    Label contentSourcesLabel;
+
+    @UiField(provided = true)
+    @Ignore
+    @WithElementId
+    EntityModelCellTable<ListModel> contentSourcesTable;
+
+    @UiField
+    @Path(value = "contentModel.content.entity")
+    @WithElementId
+    EntityModelTextAreaLabelEditor contentEditor;
+
+    @UiField
+    @Path(value = "contentModel.md5Checksum.entity")
+    @WithElementId
+    EntityModelLabelEditor checksumEditor;
+
+    @UiField
+    @Path(value = "contentModel.status.entity")
+    @WithElementId
+    EntityModelLabelEditor statusEditor;
+
+    @UiField
+    @Ignore
+    Label resolveHeaderLabel;
+
+    @UiField
+    @Ignore
+    HorizontalPanel useContentSourcePanel;
+
+    @UiField
+    @Ignore
+    @WithElementId
+    ListModelListBoxEditor<Object> useContentSourceEditor;
+
+    @UiField
+    @Ignore
+    Label useContentSourceWarning;
+
+    @UiField
+    @Ignore
+    HorizontalPanel hookStatusPanel;
+
+    @UiField
+    @Ignore
+    Label hookStatusLabel;
+
+    @UiField(provided = true)
+    @Ignore
+    EntityModelRadioButtonEditor hookStausEnable;
+
+    @UiField(provided = true)
+    @Ignore
+    EntityModelRadioButtonEditor hookStausDisable;
+
+    @UiField(provided = true)
+    @Ignore
+    EntityModelCheckBoxEditor copyHookToAllEditor;
+
+    @UiField
+    @Ignore
+    HorizontalPanel removeMissingHookPanel;
+
+    @UiField(provided = true)
+    @Ignore
+    EntityModelCheckBoxEditor removeMissingHookEditor;
+
+    @UiField
+    @Ignore
+    Label removeMissingHookWarning;
+
+    @UiField
+    @Ignore
+    Label messageLabel;
+
+    @Inject
+    public GlusterHookResolveConflictsPopupView(EventBus eventBus, 
ApplicationResources resources, ApplicationConstants constants) {
+        super(eventBus, resources);
+        initEditors();
+        initWidget(ViewUiBinder.uiBinder.createAndBindUi(this));
+        ViewIdHandler.idHandler.generateAndSetIds(this);
+        addStyles();
+        localize(constants);
+        initTableColumns(constants);
+        Driver.driver.initialize(this);
+    }
+
+    private void initEditors() {
+        contentSourcesTable = new EntityModelCellTable<ListModel>(false);
+
+        hookStausEnable = new EntityModelRadioButtonEditor("status", 
Align.RIGHT); //$NON-NLS-1$
+        hookStausDisable = new EntityModelRadioButtonEditor("status", 
Align.RIGHT); //$NON-NLS-1$
+
+        copyHookToAllEditor = new EntityModelCheckBoxEditor(Align.RIGHT);
+        removeMissingHookEditor = new EntityModelCheckBoxEditor(Align.RIGHT);
+    }
+
+    private void addStyles() {
+        contentEditor.addContentWidgetStyleName(style.contentViewWidget());
+        checksumEditor.addContentWidgetStyleName(style.contentViewWidget());
+        statusEditor.addContentWidgetStyleName(style.contentViewWidget());
+    }
+
+    private void localize(ApplicationConstants constants) {
+        conflictReasonsLabel.setText("Conflict Reasons"); //$NON-NLS-1$
+        conflictReasonsContentDiffLabel.setText("Hook content is different in 
some servers compared to Master copy(Engine)"); //$NON-NLS-1$
+        conflictReasonsStatusDiffLabel.setText("Hook status is inconsistent 
(Enabled/Disabled) across servers"); //$NON-NLS-1$
+        conflictReasonsNewHookLabel.setText("Hook is present only in some 
server(s) not in all"); //$NON-NLS-1$
+        conflictReasonsMissingHookLabel.setText("Hook is missing from all 
servers but present in Engine"); //$NON-NLS-1$
+
+        contentSourcesLabel.setText("Select the source to view the content"); 
//$NON-NLS-1$
+        contentEditor.setLabel("Content"); //$NON-NLS-1$
+        checksumEditor.setLabel("MD5 Checksum"); //$NON-NLS-1$
+        statusEditor.setLabel("Status"); //$NON-NLS-1$
+
+        resolveHeaderLabel.setText("Resolve"); //$NON-NLS-1$
+        useContentSourceEditor.setLabel("Use content from"); //$NON-NLS-1$
+        useContentSourceWarning.setText("NOTE: The hook content will be 
overwritten in all the servers and in Engine"); //$NON-NLS-1$
+        hookStatusLabel.setText("Hook Staus"); //$NON-NLS-1$
+        hookStausEnable.setLabel("Enable"); //$NON-NLS-1$
+        hookStausDisable.setLabel("Disable"); //$NON-NLS-1$
+        copyHookToAllEditor.setLabel("Copy the hook to all the servers"); 
//$NON-NLS-1$
+        removeMissingHookEditor.setLabel("Remove the missing hook"); 
//$NON-NLS-1$
+        removeMissingHookWarning.setText("NOTE: Master copy of the hook will 
be removed from Engine, this cannot be restored later"); //$NON-NLS-1$
+    }
+
+    private void initTableColumns(ApplicationConstants constants) {
+        contentSourcesTable.addEntityModelColumn(new 
EntityModelTextColumn<VDS>() {
+            @Override
+            public String getText(VDS entity) {
+                return entity.getName();
+            }
+        }, "Source"); //$NON-NLS-1$
+
+        contentSourcesTable.addEntityModelColumn(new 
EntityModelTextColumn<VDS>() {
+            @Override
+            public String getText(VDS entity) {
+                return entity.getName();
+            }
+        }, "Status"); //$NON-NLS-1$
+    }
+
+    @Override
+    public void edit(GlusterHookResolveConflictsModel object) {
+        Driver.driver.edit(object);
+
+        contentSourcesTable.edit(object.getHookSources());
+
+        conflictReasonsContentDiffLabel.setVisible(object.getConflictType() == 
GlusterHookConflictType.CONTENT
+                || object.getConflictType() == 
GlusterHookConflictType.CONTENT_STATUS);
+        conflictReasonsStatusDiffLabel.setVisible(object.getConflictType() == 
GlusterHookConflictType.STATUS
+                || object.getConflictType() == 
GlusterHookConflictType.CONTENT_STATUS);
+        conflictReasonsNewHookLabel.setVisible(object.getConflictType() == 
GlusterHookConflictType.NEW);
+        conflictReasonsMissingHookLabel.setVisible(object.getConflictType() == 
GlusterHookConflictType.MISSING);
+
+        useContentSourcePanel.setVisible(object.getConflictType() == 
GlusterHookConflictType.CONTENT
+                || object.getConflictType() == 
GlusterHookConflictType.CONTENT_STATUS);
+        useContentSourceWarning.setVisible(object.getConflictType() == 
GlusterHookConflictType.CONTENT
+                || object.getConflictType() == 
GlusterHookConflictType.CONTENT_STATUS);
+        hookStatusPanel.setVisible(object.getConflictType() == 
GlusterHookConflictType.STATUS
+                || object.getConflictType() == 
GlusterHookConflictType.CONTENT_STATUS);
+        copyHookToAllEditor.setVisible(object.getConflictType() == 
GlusterHookConflictType.NEW);
+        removeMissingHookEditor.setVisible(object.getConflictType() == 
GlusterHookConflictType.MISSING);
+        removeMissingHookWarning.setVisible(object.getConflictType() == 
GlusterHookConflictType.MISSING);
+    }
+
+    @Override
+    public GlusterHookResolveConflictsModel flush() {
+        return Driver.driver.flush();
+    }
+
+    @Override
+    public void setMessage(String message) {
+        super.setMessage(message);
+        messageLabel.setText(message);
+    }
+
+    interface WidgetStyle extends CssResource {
+        String contentViewWidget();
+    }
+
+}
diff --git 
a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/cluster/GlusterHookResolveConflictsPopupView.ui.xml
 
b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/cluster/GlusterHookResolveConflictsPopupView.ui.xml
new file mode 100644
index 0000000..05204c4
--- /dev/null
+++ 
b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/cluster/GlusterHookResolveConflictsPopupView.ui.xml
@@ -0,0 +1,132 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent";>
+<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
+       xmlns:g="urn:import:com.google.gwt.user.client.ui" 
xmlns:d="urn:import:org.ovirt.engine.ui.common.widget.dialog"
+       xmlns:e="urn:import:org.ovirt.engine.ui.common.widget.editor"
+       xmlns:w="urn:import:org.ovirt.engine.ui.common.widget">
+
+       <ui:style 
type="org.ovirt.engine.ui.webadmin.section.main.view.popup.cluster.GlusterHookResolveConflictsPopupView.WidgetStyle">
+               .conflictsLabel {
+                       padding: 5px;
+               }
+
+               .conflictReasonLabel {
+                       padding-top: 5px;
+                       padding-left: 50px;
+               }
+
+               .contentPanel {
+                       height: 270px;
+                       padding-top: 20px;
+                       padding-left: 10px;
+               }
+
+               .contentListPanel {
+                       width: 300px;
+                       padding-right: 20px;
+               }
+
+               .contentSourcesLabel {
+                       padding: 5px;
+               }
+
+               .tablePanel {
+                       height: 200px;
+                       width: 300px;
+                       border: 1px solid #CED8DF;
+               }
+
+               .contentViewPanel {
+                       width: 530px;
+                       height: 340px;
+                       background-color: grey;
+               }
+
+               .contentViewWidget{
+                       width: 400px;
+                       border-width: 0px;
+                       background-color: grey;
+               }
+
+               .contentEditor textarea {
+                       height: 270px;
+               }
+
+               .resolveHeaderLabel {
+                       font-weight: bold;
+                       padding-left: 5px;
+               }
+
+               .useContentSourceEditor {
+                       width: 375px;
+               }
+
+               .hookStatusLabel {
+                       padding-top: 5px;
+                       padding-left: 5px;
+                       padding-right: 60px;
+               }
+
+               .hookStatusEditor {
+                       width: 150px;
+               }
+
+               .messageLabel {
+                       color: #FF0000;
+                       left: 10px;
+                       padding-top: 5px;
+                       padding-left: 5px;
+               }
+       </ui:style>
+
+       <d:SimpleDialogPanel width="900px" height="600px">
+               <d:content>
+                       <g:VerticalPanel>
+                               <g:HorizontalPanel>
+                                       <g:Label 
ui:field="conflictReasonsLabel" addStyleNames="{style.conflictsLabel}"/>
+                                       <g:VerticalPanel>
+                                               <g:Label 
ui:field="conflictReasonsContentDiffLabel" 
addStyleNames="{style.conflictReasonLabel}"/>
+                                               <g:Label 
ui:field="conflictReasonsStatusDiffLabel" 
addStyleNames="{style.conflictReasonLabel}"/>
+                                               <g:Label 
ui:field="conflictReasonsNewHookLabel" 
addStyleNames="{style.conflictReasonLabel}"/>
+                                               <g:Label 
ui:field="conflictReasonsMissingHookLabel" 
addStyleNames="{style.conflictReasonLabel}"/>
+                                       </g:VerticalPanel>
+                               </g:HorizontalPanel>
+                               
+                               <g:HorizontalPanel spacing="5" 
addStyleNames="{style.contentPanel}">
+                                       <g:VerticalPanel 
addStyleNames="{style.contentListPanel}">
+                                               <g:Label 
ui:field="contentSourcesLabel" addStyleNames="{style.contentSourcesLabel}"/> 
+                                               <g:ScrollPanel 
addStyleNames="{style.tablePanel}">
+                                                       <e:EntityModelCellTable 
ui:field="contentSourcesTable"/>
+                                               </g:ScrollPanel>
+                                       </g:VerticalPanel>
+                                       <g:VerticalPanel 
addStyleNames="{style.contentViewPanel}">
+                                               
<e:EntityModelTextAreaLabelEditor ui:field="contentEditor" 
addStyleNames="{style.contentEditor}"/>
+                                               <e:EntityModelLabelEditor 
ui:field="checksumEditor"/>
+                                               <e:EntityModelLabelEditor 
ui:field="statusEditor"/>
+                                       </g:VerticalPanel>
+                               </g:HorizontalPanel>
+
+                               <g:VerticalPanel ui:field="resolvePanel">
+                                       <g:Label ui:field="resolveHeaderLabel" 
addStyleNames="{style.resolveHeaderLabel}"/>
+                                       <g:HorizontalPanel 
ui:field="useContentSourcePanel">
+                                               <e:ListModelListBoxEditor 
ui:field="useContentSourceEditor" 
addStyleNames="{style.useContentSourceEditor}"/>
+                                               <g:Label 
ui:field="useContentSourceWarning" addStyleNames="{style.messageLabel}"/>
+                                       </g:HorizontalPanel>
+                                       <g:HorizontalPanel 
ui:field="hookStatusPanel">
+                                               <g:Label 
ui:field="hookStatusLabel" addStyleNames="{style.hookStatusLabel}"/>
+                                               <e:EntityModelRadioButtonEditor 
ui:field="hookStausEnable" addStyleNames="{style.hookStatusEditor}"/>
+                                               <e:EntityModelRadioButtonEditor 
ui:field="hookStausDisable" addStyleNames="{style.hookStatusEditor}"/> 
+                                       </g:HorizontalPanel>
+                                       <e:EntityModelCheckBoxEditor 
ui:field="copyHookToAllEditor"/>
+                                       <g:HorizontalPanel 
ui:field="removeMissingHookPanel">
+                                               <e:EntityModelCheckBoxEditor 
ui:field="removeMissingHookEditor"/>
+                                               <g:Label 
ui:field="removeMissingHookWarning" addStyleNames="{style.messageLabel}"/>
+                                       </g:HorizontalPanel>                    
                
+                               </g:VerticalPanel>
+                               
+                               <g:Label ui:field="messageLabel" 
addStyleNames="{style.messageLabel}" />
+                       </g:VerticalPanel>
+               </d:content>
+       </d:SimpleDialogPanel>
+
+</ui:UiBinder>
\ No newline at end of file
diff --git 
a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/tab/cluster/SubTabClusterGlusterHookView.java
 
b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/tab/cluster/SubTabClusterGlusterHookView.java
index 09d32fb..b087837 100644
--- 
a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/tab/cluster/SubTabClusterGlusterHookView.java
+++ 
b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/tab/cluster/SubTabClusterGlusterHookView.java
@@ -82,5 +82,11 @@
                 return getDetailModel().getViewHookCommand();
             }
         });
+        getTable().addActionButton(new 
WebAdminButtonDefinition<GlusterHookEntity>(constants.resolveConflictsGlusterHook())
 {
+            @Override
+            protected UICommand resolveCommand() {
+                return getDetailModel().getResolveConflictsCommand();
+            }
+        });
     }
 }


--
To view, visit http://gerrit.ovirt.org/11839
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I10bc9c7dba7cb1be320bb0e12f3b7bf7a8beb485
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

Reply via email to