Liron Aravot has uploaded a new change for review.

Change subject: webadmin: isRemoveCommandAvailable() - removal of unneeded 
booleans
......................................................................

webadmin: isRemoveCommandAvailable() - removal of unneeded booleans

isRemoveCommandAvailable() is storing the checks results into booleans
and checks them all at each iteration.
The booleans can be replaced with comments and we can return immediately
when the result is known.

Change-Id: I808275fb826e2d4fd154e87aa9730f4c57b53002
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1131845
Signed-off-by: Liron Aravot <[email protected]>
---
M 
frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/disks/DiskListModel.java
1 file changed, 7 insertions(+), 5 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/53/31953/1

diff --git 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/disks/DiskListModel.java
 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/disks/DiskListModel.java
index fde26fe..cd2f6a6 100644
--- 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/disks/DiskListModel.java
+++ 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/disks/DiskListModel.java
@@ -580,12 +580,14 @@
 
         for (Disk disk : disks)
         {
-            boolean isTemplateDisk = disk.getVmEntityType() != null && 
disk.getVmEntityType().isTemplateType();
-            boolean isImageLocked = disk.getDiskStorageType() == 
DiskStorageType.IMAGE
-                    && ((DiskImage) disk).getImageStatus() == 
ImageStatus.LOCKED;
+            // check if the disk is template disk
+            if (disk.getVmEntityType() != null && 
disk.getVmEntityType().isTemplateType()) {
+                return false;
+            }
 
-            if (isTemplateDisk || isImageLocked)
-            {
+            // check if the disk is locked (if it's a DiskImage)
+            if (disk.getDiskStorageType() == DiskStorageType.IMAGE
+                    && ((DiskImage) disk).getImageStatus() == 
ImageStatus.LOCKED) {
                 return false;
             }
         }


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

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

Reply via email to