Gilad Chaplik has uploaded a new change for review.

Change subject: webadmin: policy: fields reset when changing options
......................................................................

webadmin: policy: fields reset when changing options

Problem: When changing the cluster policy properties (filters/weight/balance)
the custom properties sheet was reset.

Solution: refresh the custom propeties sheet inculding the
values that already set.

Change-Id: Ibb3092953f3ff387625cf00c146f63ea41f58de2
Bug-Url: https://bugzilla.redhat.com/1002171
Signed-off-by: Gilad Chaplik <gchap...@redhat.com>
---
M 
frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/configure/scheduling/NewClusterPolicyModel.java
1 file changed, 13 insertions(+), 9 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/54/19654/1

diff --git 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/configure/scheduling/NewClusterPolicyModel.java
 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/configure/scheduling/NewClusterPolicyModel.java
index 1be60e1..fc5446d 100644
--- 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/configure/scheduling/NewClusterPolicyModel.java
+++ 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/configure/scheduling/NewClusterPolicyModel.java
@@ -74,11 +74,11 @@
             getCustomProperties().putAll(clusterPolicy.getParameterMap());
         }
         customPropertiesInitialized = true;
-        refreshCustomProperties(null);
+        refreshCustomProperties(null, false);
 
     }
 
-    private void refreshCustomProperties(PolicyUnit toRemove) {
+    private void refreshCustomProperties(PolicyUnit toRemove, boolean reset) {
         if (!customPropertiesInitialized) {
             return;
         }
@@ -107,8 +107,12 @@
                 }
             }
         }
+        Map<String, String> defaultMap = new HashMap<String, 
String>(getCustomProperties());
+        if(!reset) {
+            
defaultMap.putAll(KeyValueModel.convertProperties(getCustomPropertySheet().getEntity()));
+        }
         getCustomPropertySheet().setKeyValueString(lines);
-        
getCustomPropertySheet().setEntity(KeyValueModel.convertProperties(getCustomProperties()));
+        
getCustomPropertySheet().setEntity(KeyValueModel.convertProperties(defaultMap));
     }
 
     private void initFilters() {
@@ -168,7 +172,7 @@
 
             @Override
             public void eventRaised(Event ev, Object sender, EventArgs args) {
-                refreshCustomProperties(currentLoadBalance);
+                refreshCustomProperties(currentLoadBalance, false);
                 currentLoadBalance = (PolicyUnit) 
getLoadBalanceList().getSelectedItem();
             }
         });
@@ -444,7 +448,7 @@
                 }
             }
         }
-        refreshCustomProperties(null);
+        refreshCustomProperties(null, false);
         getFiltersChangedEvent().raise(this, EventArgs.Empty);
     }
 
@@ -456,7 +460,7 @@
                 break;
             }
         }
-        refreshCustomProperties(policyUnit);
+        refreshCustomProperties(policyUnit, false);
         getFiltersChangedEvent().raise(this, EventArgs.Empty);
     }
 
@@ -468,7 +472,7 @@
                 break;
             }
         }
-        refreshCustomProperties(null);
+        refreshCustomProperties(null, false);
         getFunctionsChangedEvent().raise(this, EventArgs.Empty);
     }
 
@@ -480,7 +484,7 @@
                 break;
             }
         }
-        refreshCustomProperties(policyUnit);
+        refreshCustomProperties(policyUnit, false);
         getFunctionsChangedEvent().raise(this, EventArgs.Empty);
     }
 
@@ -558,7 +562,7 @@
         if (clusterPolicy.getParameterMap() != null) {
             customProperties.putAll(clusterPolicy.getParameterMap());
         }
-        refreshCustomProperties(null);
+        refreshCustomProperties(null, true);
     }
 
 }


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ibb3092953f3ff387625cf00c146f63ea41f58de2
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: ovirt-engine-3.3
Gerrit-Owner: Gilad Chaplik <gchap...@redhat.com>
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to