Hello anmolbabu,

I'd like you to do a code review.  Please visit

    https://gerrit.ovirt.org/39986

to review the following change.

Change subject: webadmin : Fix geo-rep config issue
......................................................................

webadmin : Fix geo-rep config issue

This patch fixes the following issues:

1. Multiple update actions from geo-rep config list
  Earlier the List of callbacks passed was unmodifiable
  list of 1 non-null callback as returned by the Arrays.asList()
  and hence when the Frontend's recursive implementation
  of runMultipleActions tries to remove the entries on each
  recursive call, it used to fail.
      This patch handles it passing a modifiable list as under
  new ArrayList(Arrays.asList(<collection>))
2. When multiple rows have SelectionCell the previously implemented
   method used to return the value at selectedIndex of
   last added SelectedCell. Hence to overcome this, this patch uses
   the appropriately returned selectedIndex and uses this index to
   get the correct selected value from the allowed values of the
   current row.

Change-Id: If340d6c66bd21248f9d13d67f66e180022cfe6ac
Signed-off-by: Anmol Babu <[email protected]>
---
M 
frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/table/cell/GlusterConfigAwareCell.java
M 
frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/gluster/VolumeGeoRepListModel.java
2 files changed, 11 insertions(+), 11 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/86/39986/1

diff --git 
a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/table/cell/GlusterConfigAwareCell.java
 
b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/table/cell/GlusterConfigAwareCell.java
index 1f39dfe..0f36c7b 100644
--- 
a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/table/cell/GlusterConfigAwareCell.java
+++ 
b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/table/cell/GlusterConfigAwareCell.java
@@ -14,6 +14,7 @@
 import com.google.gwt.dom.client.BrowserEvents;
 import com.google.gwt.dom.client.Element;
 import com.google.gwt.dom.client.NativeEvent;
+import com.google.gwt.dom.client.SelectElement;
 import com.google.gwt.safehtml.shared.SafeHtmlBuilder;
 import com.google.gwt.view.client.CellPreviewEvent;
 
@@ -38,17 +39,17 @@
     }
 
     @Override
-    public void onBrowserEvent(Context context, Element parent, final 
GlusterGeoRepSessionConfiguration configInRow, NativeEvent event, 
ValueUpdater<GlusterGeoRepSessionConfiguration> valueUpdater) {
-        List<String> allowedValuesList = configInRow.getAllowedValues();
+    public void onBrowserEvent(Context context, final Element parent, final 
GlusterGeoRepSessionConfiguration configInRow, NativeEvent event, 
ValueUpdater<GlusterGeoRepSessionConfiguration> valueUpdater) {
+        final List<String> allowedValuesList = configInRow.getAllowedValues();
         boolean isValuesConstrained =
                 isValueConstrained(allowedValuesList);
         if (isValuesConstrained) {
             delegate.onBrowserEvent(context, parent, configInRow.getValue(), 
event, new ValueUpdater<String>() {
                 @Override
                 public void update(String value) {
-                    if (value != null) {
-                        configInRow.setValue(value);
-                    }
+                    SelectElement select = parent.getFirstChild().cast();
+                    int selectedIndex = select.getSelectedIndex();
+                    configInRow.setValue(allowedValuesList.get(selectedIndex));
                 }
             });
         } else {
diff --git 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/gluster/VolumeGeoRepListModel.java
 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/gluster/VolumeGeoRepListModel.java
index d0e65eb..e3541fe 100644
--- 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/gluster/VolumeGeoRepListModel.java
+++ 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/gluster/VolumeGeoRepListModel.java
@@ -1,7 +1,6 @@
 package org.ovirt.engine.ui.uicommonweb.models.gluster;
 
 import java.util.ArrayList;
-import java.util.Arrays;
 import java.util.Collections;
 import java.util.LinkedHashMap;
 import java.util.List;
@@ -303,7 +302,7 @@
     private void updateConfig() {
         ArrayList<VdcActionType> actionTypes = new ArrayList<VdcActionType>();
         ArrayList<VdcActionParametersBase> parameters = new 
ArrayList<VdcActionParametersBase>();
-        IFrontendActionAsyncCallback[] callbacks;
+        List<IFrontendActionAsyncCallback> callbacks;
 
         final GlusterVolumeGeoReplicationSessionConfigModel geoRepConfigModel =
                 (GlusterVolumeGeoReplicationSessionConfigModel) getWindow();
@@ -330,17 +329,17 @@
             closeWindow();
             return;
         }
-        callbacks = new IFrontendActionAsyncCallback[numberOfConfigUpdates];
-        callbacks[numberOfConfigUpdates - 1] = new 
IFrontendActionAsyncCallback() {
+        callbacks = new 
ArrayList<IFrontendActionAsyncCallback>(Collections.nCopies(numberOfConfigUpdates,
 (IFrontendActionAsyncCallback)null));
+        callbacks.set(numberOfConfigUpdates - 1, new 
IFrontendActionAsyncCallback() {
             @Override
             public void executed(FrontendActionAsyncResult result) {
                 geoRepConfigModel.stopProgress();
                 closeWindow();
             }
-        };
+        });
         Frontend.getInstance().runMultipleActions(actionTypes,
                 parameters,
-                Arrays.asList(callbacks),
+                callbacks,
                 new IFrontendActionAsyncCallback() {
             // Failure call back. Update the config list just to reflect any 
new changes and default error msg
             // dialog is thrown.


-- 
To view, visit https://gerrit.ovirt.org/39986
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: If340d6c66bd21248f9d13d67f66e180022cfe6ac
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: ovirt-engine-3.5-gluster
Gerrit-Owner: Sahina Bose <[email protected]>
Gerrit-Reviewer: anmolbabu <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to