luci-base: cbi.js: use IEC 80000-13 units to format base 2 byte values
authorJo-Philipp Wich <jo@mein.io>
Fri, 8 Oct 2021 18:52:52 +0000 (20:52 +0200)
committerJo-Philipp Wich <jo@mein.io>
Fri, 8 Oct 2021 18:53:45 +0000 (20:53 +0200)
Fixes: #5354
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
modules/luci-base/htdocs/luci-static/resources/cbi.js

index 9728e03e120fdcef153a1103065c14f3610fd3bd..aef64d577eb49b2749549f0075a39f2b04c755db 100644 (file)
@@ -657,7 +657,11 @@ String.prototype.format = function()
                                                for (i = 0; (i < units.length) && (val > mf); i++)
                                                        val /= mf;
 
-                                               subst = (i ? val.toFixed(pr) : val) + units[i];
+                                               if (i)
+                                                       subst = val.toFixed(pr) + units[i] + (mf == 1024 ? 'i' : '');
+                                               else
+                                                       subst = val + ' ';
+
                                                pMinLength = null;
                                                break;
                                }