Sergey Gotliv has posted comments on this change. Change subject: webadmin: Display more accurate size of ISO files ......................................................................
Patch Set 3: (11 comments) .................................................... File frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/renderer/DiskSizeRenderer.java Line 12: GIGABYTE; Line 13: } Line 14: Line 15: public enum Format { Line 16: DEFAULT, Done Line 17: FORMATTED Line 18: } Line 19: Line 20: private final DiskSizeUnit unit; Line 13: } Line 14: Line 15: public enum Format { Line 16: DEFAULT, Line 17: FORMATTED I agree that 'FORMATTED" is not descriptive enough! But 'HUMAN_READABLE' its like saying that others are not "HUMAN_READABLE"! Let's think about something else... Line 18: } Line 19: Line 20: private final DiskSizeUnit unit; Line 21: private final Format format; Line 46: } Line 47: Line 48: double sizeInGB = getSizeInGigabytes(size); Line 49: Line 50: if (format == Format.DEFAULT) { Done Line 51: return (sizeInGB >= 1) ? Double.valueOf(sizeInGB).longValue() + " GB" : "< 1 GB"; //$NON-NLS-1$ //$NON-NLS-2$ Line 52: } else { Line 53: return format(sizeInGB); Line 54: } Line 47: Line 48: double sizeInGB = getSizeInGigabytes(size); Line 49: Line 50: if (format == Format.DEFAULT) { Line 51: return (sizeInGB >= 1) ? Double.valueOf(sizeInGB).longValue() + " GB" : "< 1 GB"; //$NON-NLS-1$ //$NON-NLS-2$ Done Line 52: } else { Line 53: return format(sizeInGB); Line 54: } Line 55: } Line 58: double sizeInGB = -1; Line 59: Line 60: switch (unit) { Line 61: case BYTE: Line 62: sizeInGB = size.doubleValue() / Math.pow(1024, 3); Done Line 63: break; Line 64: case GIGABYTE: Line 65: sizeInGB = size.doubleValue(); Line 66: break; Line 68: Line 69: return sizeInGB; Line 70: } Line 71: Line 72: private String format(double sizeInGB) { Agree with the comment, but I already explained my position about the name. Let's think about something different. Line 73: if (sizeInGB == 0) { Line 74: // sizeInGB = 0 means that Engine is 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 73: if (sizeInGB == 0) { Line 74: // sizeInGB = 0 means that Engine is 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: } Sounds reasonable. I will distinguish between: 0 - real size and -1 - size is not available But meantime will display '<1GB' for both cases, because: 1. I am not sure that the current column width will allow to display long descriptions. 2. Users already familiar with '<1GB' term but I am not sure about 'size is not available' - it may be interpreted as a problem. Anyway, it can be done in additional patch. 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$ Line 77: } 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$ Done Line 82: } Line 83: Line 84: fmt = NumberFormat.getFormat("####.#"); //$NON-NLS-1$ Line 85: double sizeInMB = sizeInGB * 1024; Line 83: Line 84: fmt = NumberFormat.getFormat("####.#"); //$NON-NLS-1$ Line 85: double sizeInMB = sizeInGB * 1024; Line 86: if (sizeInMB >= 1) { Line 87: return fmt.format(sizeInMB) + " MB"; //$NON-NLS-1$ Done Line 88: } Line 89: Line 90: double sizeInKB = sizeInMB * 1024; Line 91: return fmt.format(sizeInKB) + " KB"; //$NON-NLS-1$ Line 87: return fmt.format(sizeInMB) + " MB"; //$NON-NLS-1$ Line 88: } Line 89: Line 90: double sizeInKB = sizeInMB * 1024; Line 91: return fmt.format(sizeInKB) + " KB"; //$NON-NLS-1$ Done Line 92: } Line 88: } Line 89: Line 90: double sizeInKB = sizeInMB * 1024; Line 91: return fmt.format(sizeInKB) + " KB"; //$NON-NLS-1$ Line 92: } Done -- 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: 3 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: Nir Soffer <nsof...@redhat.com> Gerrit-Reviewer: Sergey Gotliv <sgot...@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