Allon Mureinik has posted comments on this change.

Change subject: webadmin: Display more accurate size of ISO files
......................................................................


Patch Set 2: Code-Review-1

(5 comments)

....................................................
Commit Message
Line 5: CommitDate: 2013-09-29 14:42:58 +0300
Line 6: 
Line 7: webadmin: Display more accurate size of ISO files
Line 8: 
Line 9: Till now DiskSizeRenderer which is used to render all image/disk/file
s/Till/Up until/
Line 10: sizes had 3 limitations:
Line 11: 1. Size appeared only in GB.
Line 12: 2. All numbers were integers.
Line 13: 3. Size smaller than 1GB appeared as '<1GB'


Line 11: 1. Size appeared only in GB.
Line 12: 2. All numbers were integers.
Line 13: 3. Size smaller than 1GB appeared as '<1GB'
Line 14: 
Line 15: From now, it supports MB, KB, and numbers with floating point.
s/now/now on/
Line 16: 
Line 17: Using this new capability when displaing sizes of ISO files and 
floppies
Line 18: under Storage -> Images.
Line 19: 


Line 14: 
Line 15: From now, it supports MB, KB, and numbers with floating point.
Line 16: 
Line 17: Using this new capability when displaing sizes of ISO files and 
floppies
Line 18: under Storage -> Images.
s/Using/This patch uses/
Line 19: 
Line 20: Change-Id: I95961fde2256a44b8474d8f41562bc0e33b0ad4a
Line 21: Bug-Url: https://bugzilla.redhat.com/1005889


....................................................
File 
frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/renderer/DiskSizeRenderer.java
Line 70:     }
Line 71: 
Line 72:     private String format(double sizeInGB) {
Line 73:         if (sizeInGB == 0) {
Line 74:             // sizeInGB = 0 means that Engine working with old VDSM 
which doesn't return the correct size, so it
s/working/is working/
Line 75:             // should display the size as 'less than 1 GB' for 
backward compatibility
Line 76:             return "< 1 GB"; //$NON-NLS-1$
Line 77:         }
Line 78: 


Line 73:         if (sizeInGB == 0) {
Line 74:             // sizeInGB = 0 means that Engine working with old VDSM 
which doesn't return the correct size, so it
Line 75:             // should display the size as 'less than 1 GB' for 
backward compatibility
Line 76:             return "< 1 GB"; //$NON-NLS-1$
Line 77:         }
this logic is doubled - sometimes it's handled in render, and sometimes here, 
depenending on the format.

IMHO, they should be consolidated:

public String render(T size) {
   // snipped

   double sizeInGB = getSizeInGigabytes(size);
   if (sizeInGB >= 1) {
      return format == Format.DEFAULT ? Double.valueOf(sizeInGB).longValue() : 
format(sizeInGB);
   } 

   return "< 1 GB"; //$NON_NLS-1$
Line 78: 
Line 79:         NumberFormat fmt = NumberFormat.getFormat("####.##"); 
//$NON-NLS-1$
Line 80:         if (sizeInGB >= 1) {
Line 81:             return fmt.format(sizeInGB) + " GB"; //$NON-NLS-1$


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

Gerrit-MessageType: comment
Gerrit-Change-Id: I95961fde2256a44b8474d8f41562bc0e33b0ad4a
Gerrit-PatchSet: 2
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Sergey Gotliv <sgot...@redhat.com>
Gerrit-Reviewer: Allon Mureinik <amure...@redhat.com>
Gerrit-Reviewer: Daniel Erez <de...@redhat.com>
Gerrit-Reviewer: Tal Nisan <tni...@redhat.com>
Gerrit-Reviewer: oVirt Jenkins CI Server
Gerrit-HasComments: Yes
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to