Merge pull request #6897 from stangri/master-luci-app-opkg
authorStan Grishin <stangri@melmac.ca>
Mon, 12 Feb 2024 17:42:15 +0000 (10:42 -0700)
committerPaul Donald <newtwen@gmail.com>
Wed, 14 Feb 2024 22:05:37 +0000 (23:05 +0100)
luci-app-opkg: show disk space consistent with overview
(cherry picked from commit eb40b0bd576e256a0251279c53490043a070dedf)

applications/luci-app-opkg/htdocs/luci-static/resources/view/opkg.js

index d4d5b8b88b5b4f793c7b2b1f28e3091f4a94baca..f3d0194d97f4077f07fbcc53865c934214bfc5c5 100644 (file)
@@ -1087,11 +1087,11 @@ function updateLists(data)
 
        return (data ? Promise.resolve(data) : downloadLists()).then(function(data) {
                var pg = document.querySelector('.cbi-progressbar'),
-                   mount = L.toArray(data[0].filter(function(m) { return m.mount == '/' || m.mount == '/overlay' }))
-                       .sort(function(a, b) { return a.mount > b.mount })[0] || { size: 0, free: 0 };
+                       mount = L.toArray(data[0].filter(function(m) { return m.mount == '/' || m.mount == '/overlay' }))
+                               .sort(function(a, b) { return a.mount > b.mount })[0] || { size: 0, free: 0 };
 
-               pg.firstElementChild.style.width = Math.floor(mount.size ? ((100 / mount.size) * mount.free) : 100) + '%';
-               pg.setAttribute('title', '%s (%1024mB)'.format(pg.firstElementChild.style.width, mount.free));
+               pg.firstElementChild.style.width = Math.floor(mount.size ? (100 / mount.size) * (mount.size - mount.free) : 100) + '%';
+               pg.setAttribute('title', _('%s used (%1024mB used of %1024mB, %1024mB free)').format(pg.firstElementChild.style.width, mount.size - mount.free, mount.size, mount.free));
 
                parseList(data[1], packages.available);
                parseList(data[2], packages.installed);
@@ -1130,7 +1130,7 @@ return view.extend({
 
                        E('div', { 'class': 'controls' }, [
                                E('div', {}, [
-                                       E('label', {}, _('Free space') + ':'),
+                                       E('label', {}, _('Disk space') + ':'),
                                        E('div', { 'class': 'cbi-progressbar', 'title': _('unknown') }, E('div', {}, [ '\u00a0' ]))
                                ]),