Tomas Jelinek has uploaded a new change for review.

Change subject: frontend: incorrect DC/Cluster handling on new pool
......................................................................

frontend: incorrect DC/Cluster handling on new pool

Have one DC with two clusters. Make a template on the first cluster.
Go to the new pool dialog and select the second cluster - it gets
automatically reset to the first one.

The problem was that the logic of selecting the DC/Cluster was
implemented in the common place for new and edit dialog. For edit
dialog it selected the DC/Cluster according to the selected pool.
For new pool according to the selected template.

While for edit pool it made sense to select the DC/Cluster according
to edited pool it made no sense for new pool to select the DC/Cluster
according to the selected template.

Fixed by moving the logic specific for edit pool to the
ExistingPoolModelBehavior from PoolModelBehaviorBase.

Change-Id: I38e771d88fc300304942f750b6628862279a02ad
Bug-Url: https://bugzilla.redhat.com/1002902
Signed-off-by: Tomas Jelinek <tjeli...@redhat.com>
---
M 
frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/ExistingPoolModelBehavior.java
M 
frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/NewPoolModelBehavior.java
M 
frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/PoolModelBehaviorBase.java
3 files changed, 12 insertions(+), 12 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/13/18713/1

diff --git 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/ExistingPoolModelBehavior.java
 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/ExistingPoolModelBehavior.java
index 8a813ee..af8fcd7 100644
--- 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/ExistingPoolModelBehavior.java
+++ 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/ExistingPoolModelBehavior.java
@@ -51,8 +51,17 @@
 
     @Override
     protected void postInitTemplate() {
-        setupWindowModelFrom(pool.getStaticData(), pool.getStoragePoolId());
+        setupWindowModelFrom(pool.getStaticData());
         getModel().setIsDisksAvailable(true);
+
+        List<DataCenterWithCluster> dataCenterWithClusters = 
(List<DataCenterWithCluster>) 
getModel().getDataCenterWithClustersList().getItems();
+        DataCenterWithCluster selectDataCenterWithCluster =
+                Linq.firstOrDefault(dataCenterWithClusters,
+                        new 
Linq.DataCenterWithClusterPredicate(pool.getStoragePoolId(), 
pool.getVdsGroupId()));
+
+        getModel().getDataCenterWithClustersList()
+                .setSelectedItem((selectDataCenterWithCluster != null) ? 
selectDataCenterWithCluster
+                        : Linq.firstOrDefault(dataCenterWithClusters));
     }
 
     @Override
diff --git 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/NewPoolModelBehavior.java
 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/NewPoolModelBehavior.java
index 43dcbe9..ac30fbf8 100644
--- 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/NewPoolModelBehavior.java
+++ 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/NewPoolModelBehavior.java
@@ -34,7 +34,7 @@
             return;
         }
 
-        setupWindowModelFrom(template, template.getStoragePoolId());
+        setupWindowModelFrom(template);
         updateHostPinning(template.getMigrationSupport());
         doChangeDefautlHost(template.getDedicatedVmForVds());
     }
diff --git 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/PoolModelBehaviorBase.java
 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/PoolModelBehaviorBase.java
index 5e5cd32..c400317 100644
--- 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/PoolModelBehaviorBase.java
+++ 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/PoolModelBehaviorBase.java
@@ -78,7 +78,7 @@
         }, getModel().getHash()), true, false);
     }
 
-    protected void setupWindowModelFrom(VmBase vmBase, Guid dataCenterId) {
+    protected void setupWindowModelFrom(VmBase vmBase) {
         if (vmBase != null) {
             updateQuotaByCluster(vmBase.getQuotaId(), vmBase.getQuotaName());
             // Copy VM parameters from template.
@@ -107,15 +107,6 @@
 
             // Update domain list
             updateDomain();
-
-            List<DataCenterWithCluster> dataCenterWithClusters = 
(List<DataCenterWithCluster>) 
getModel().getDataCenterWithClustersList().getItems();
-            DataCenterWithCluster selectDataCenterWithCluster =
-                    Linq.firstOrDefault(dataCenterWithClusters,
-                            new 
Linq.DataCenterWithClusterPredicate(dataCenterId, vmBase.getVdsGroupId()));
-
-            getModel().getDataCenterWithClustersList()
-                    .setSelectedItem((selectDataCenterWithCluster != null) ? 
selectDataCenterWithCluster
-                            : Linq.firstOrDefault(dataCenterWithClusters));
 
             // Update display protocol selected item
             EntityModel displayProtocol = null;


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I38e771d88fc300304942f750b6628862279a02ad
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Tomas Jelinek <tjeli...@redhat.com>
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to