ofri masad has uploaded a new change for review.

Change subject: webadmin: Auto update quota by template
......................................................................

webadmin: Auto update quota by template

In the VM popup - when a template is selected, update the quota to the
quota of the selected template.

Change-Id: Ia1d70b895738218e551128c73415a1cbd33e8915
Bug-Url: https://bugzilla.redhat.com/924928
Signed-off-by: Ofri Masad <oma...@redhat.com>
---
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/VmModelBehaviorBase.java
2 files changed, 6 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/12/14112/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 3357e4f..1c85d1c 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
@@ -179,6 +179,7 @@
             } else {
                 
getModel().getMinAllocatedMemory().setEntity(template.getMinAllocatedMem());
             }
+            updateQuotaByCluster(template.getQuotaId(), 
template.getQuotaName());
         }
     }
 
@@ -189,7 +190,10 @@
         updateCustomPropertySheet();
         UpdateMinAllocatedMemory();
         UpdateNumOfSockets();
-        updateQuotaByCluster(null, "");
+        if ((VmTemplate) getModel().getTemplate().getSelectedItem() != null) {
+            VmTemplate template = (VmTemplate) 
getModel().getTemplate().getSelectedItem();
+            updateQuotaByCluster(template.getQuotaId(), 
template.getQuotaName());
+        }
         updateCpuPinningVisibility();
     }
 
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 39975aa..fa9590d 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
@@ -670,7 +670,7 @@
                                     if (quotaList != null && 
!quotaList.isEmpty()) {
                                         vmModel.getQuota().setItems(quotaList);
                                     }
-                                    if (defaultQuota != null) {
+                                    if (defaultQuota != null && 
!Guid.Empty.equals(defaultQuota)) {
                                         boolean hasQuotaInList = false;
                                         for (Quota quota : quotaList) {
                                             if 
(quota.getId().equals(defaultQuota)) {


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

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

Reply via email to