hassio-google-drive-backup
hassio-google-drive-backup copied to clipboard
Better Addon details
Hide Addon size if it is "0.0 B". And hide "v" if it is alphabetic like "dev" or "alpha".
I think the UI should till say something if the addon is 0 bytes, if it doesn't say anything users will be confused or assume the size is unknown. Though I agree that "0.0 B" isn't very pretty, I think it might be better to have this method return "0 bytes" just to make it clear. That method is where the size gets formatted for the UI. <sidenote> Its a little misleading because Home Assistant reports the size of an addon in MB to two significant digits, so if an addon is less than 0.01 MB then it reports its size as "0.00" even if its something like 9 kb. Thats always bothered me but there is no getting around it, c'est la vie </sidenote>
I suspect the handling with NaN in your javascript doesn't produce the behavior you're aiming for. size
is always a string like "0.0 B" or "1.7 GB", so isNaN(size) is always false because of the SI identifier at the end. Version is often a multi-decimal point number string like "0.100.3", so isNaN would return true for that as well. It would probably be best just to not include "v" in front of the version string at all. Context should make it clear enough that its the version number/identifier without it. What do you think?