Gilad Chaplik has uploaded a new change for review.

Change subject: webadmin: set default quota in quota drop down (#838454)
......................................................................

webadmin: set default quota in quota drop down (#838454)

https://bugzilla.redhat.com/838454

"Move Disk resets quota to default":
in case a quota is already given to a disk, choose the same
quota (if exists in the list) in move/copy the quota.

Change-Id: Ib7238cb1112a66d9f34ec7845c0c66d06356e077
Signed-off-by: Gilad Chaplik <gchap...@redhat.com>
---
M 
frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/storage/DisksAllocationModel.java
1 file changed, 19 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/82/7182/1

diff --git 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/storage/DisksAllocationModel.java
 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/storage/DisksAllocationModel.java
index 7d21682..098fc1e 100644
--- 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/storage/DisksAllocationModel.java
+++ 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/storage/DisksAllocationModel.java
@@ -233,9 +233,28 @@
                                             
diskAllocationModel.getQuota().setItems(list);
                                             for (DiskModel diskModel : 
diskAllocationModel.getDisks()) {
                                                 
diskModel.getQuota().setItems(list);
+                                                for (Quota quota : list) {
+                                                    if (diskModel.getDisk() 
instanceof DiskImage
+                                                            &&
+                                                            quota.getId()
+                                                                    
.equals(((DiskImage) diskModel.getDisk()).getQuotaId())) {
+                                                        
diskModel.getQuota().setSelectedItem(quota);
+                                                    }
+                                                }
                                             }
                                         } else {
+                                            Quota selectedQuota = null;
+                                            if (isItem.getSelectedItem() != 
null) {
+                                                selectedQuota = (Quota) 
isItem.getSelectedItem();
+                                            }
                                             isItem.setItems(list);
+                                            if (selectedQuota != null && 
list.size() > 1) {
+                                                for (Quota quota : list) {
+                                                    if 
(quota.getId().equals(selectedQuota.getId())) {
+                                                        
isItem.setSelectedItem(quota);
+                                                    }
+                                                }
+                                            }
                                         }
                                     }
                                 }


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib7238cb1112a66d9f34ec7845c0c66d06356e077
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
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