anmolbabu has uploaded a new change for review.

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, 7 insertions(+), 6 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/47/38747/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 5fb570a..1e28dc4 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
@@ -13,6 +13,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;
 
@@ -37,17 +38,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 69a3aca..77601c4 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
@@ -341,7 +341,7 @@
         };
         Frontend.getInstance().runMultipleActions(actionTypes,
                 parameters,
-                Arrays.asList(callbacks),
+                new ArrayList<>(Arrays.asList(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/38747
To unsubscribe, visit https://gerrit.ovirt.org/settings

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

Reply via email to