Tomas Jelinek has uploaded a new change for review.

Change subject: webadmin: changeing vm_type did reset the dialog
......................................................................

webadmin: changeing vm_type did reset the dialog

The problem was that the change of the vm_type in the vm dialog triggered the
InstanceTypeManager.updateFields().

It was not correct since this caused the whole dialog to be re-inited from the
selected instance type/template (depending on the actual selection) and that
should happen only after "big" changes like cluster change which changes
availability of some fields.

Since the vm type only provides some defaults for the fields and not the
availability of the fields, there is no need to go through the instance type
manager - just simply set the fields up.

Change-Id: I5859ca02ddcbeb60583a0e79b94f7b9f2647596a
Bug-Url: https://bugzilla.redhat.com/1125344
Signed-off-by: Tomas Jelinek <[email protected]>
---
M 
frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/NewVmModelBehavior.java
M 
frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/UnitVmModel.java
M 
frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/VmModelBehaviorBase.java
3 files changed, 6 insertions(+), 9 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/92/31892/1

diff --git 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/NewVmModelBehavior.java
 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/NewVmModelBehavior.java
index e6ff61d..700f8f3 100644
--- 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/NewVmModelBehavior.java
+++ 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/NewVmModelBehavior.java
@@ -336,8 +336,6 @@
 
     @Override
     public void vmTypeChanged(VmType vmType) {
-        deactivateInstanceTypeManager();
-
         // provisioning thin -> false
         // provisioning clone -> true
         if (getModel().getProvisioning().getIsAvailable()) {
@@ -345,7 +343,6 @@
         }
 
         super.vmTypeChanged(vmType);
-        activateInstanceTypeManager();
     }
 
     @Override
diff --git 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/UnitVmModel.java
 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/UnitVmModel.java
index 91798ce..5dd6790 100644
--- 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/UnitVmModel.java
+++ 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/UnitVmModel.java
@@ -1734,12 +1734,7 @@
         else if 
(ev.matchesDefinition(ListModel.selectedItemChangedEventDefinition))
         {
             if (sender == getVmType()) {
-                deactivateInstanceTypeManagerAndUpdateFields();
-
                 vmTypeChanged();
-
-                getBehavior().activateInstanceTypeManager();
-
             } else if (sender == getDataCenterWithClustersList())
             {
                 dataCenterWithClusterSelectedItemChanged(sender, args);
diff --git 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/VmModelBehaviorBase.java
 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/VmModelBehaviorBase.java
index ee4c30b..3bcfd58 100644
--- 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/VmModelBehaviorBase.java
+++ 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/VmModelBehaviorBase.java
@@ -1114,7 +1114,12 @@
     }
 
     public void vmTypeChanged(VmType vmType) {
-        getModel().getIsSoundcardEnabled().setEntity(vmType == VmType.Desktop);
+        if (getModel().getInstanceTypes().getSelectedItem() instanceof 
CustomInstanceType) {
+            // this field is normally taken from instance type. If the 
"custom" is selected, than it is supposed to use the default
+            // determined by vm type
+            getModel().getIsSoundcardEnabled().setEntity(vmType == 
VmType.Desktop);
+        }
+
         getModel().getAllowConsoleReconnect().setEntity(vmType == 
VmType.Server);
     }
 


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

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

Reply via email to