X-Git-Url: https://git.archive.openwrt.org/?p=project%2Fluci.git;a=blobdiff_plain;f=modules%2Fadmin-full%2Fluasrc%2Fview%2Fadmin_system%2Fpackages.htm;h=a1a8d698f74cb0246374fd779971f89cfdcb6eb1;hp=b52529ea8922f79e39a458ad47f92874b68e3d0f;hb=cde6e129d4759e7a5089b8779c416b1a85206217;hpb=e4a3fd177c9ff4dc9113af22a72e930f257514ea diff --git a/modules/admin-full/luasrc/view/admin_system/packages.htm b/modules/admin-full/luasrc/view/admin_system/packages.htm index b52529ea8..a1a8d698f 100644 --- a/modules/admin-full/luasrc/view/admin_system/packages.htm +++ b/modules/admin-full/luasrc/view/admin_system/packages.htm @@ -1,7 +1,7 @@ <%# LuCI - Lua Configuration Interface Copyright 2008 Steven Barth -Copyright 2008 Jo-Philipp Wich +Copyright 2008-2010 Jo-Philipp Wich Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -14,6 +14,9 @@ $Id$ -%> <%- local bit = require "bit" +local opkg = require "luci.model.ipkg" +local fs = require "nixio.fs" +local wa = require "luci.tools.webadmin" local rowcnt = 1 function rowstyle() @@ -23,89 +26,130 @@ end function opkg_error(code) code = bit.rshift(tonumber(code), 8) - return translate( - 'a_s_packages_code%i' % code, - translate( - 'a_s_packages_code%i' % code, - '%s %i' % { translate('code'), code } - ) - ) + return translate("OPKG error code %i" % code) end + +local fstat = fs.statvfs(opkg.overlay_root()) +local space_total = fstat and fstat.blocks or 0 +local space_free = fstat and fstat.bfree or 0 +local space_used = space_total - space_free + +local used_perc = math.floor(0.5 + ((space_total > 0) and ((100 / space_total) * space_used) or 100)) +local free_byte = space_free * fstat.frsize + -%> <%+header%> -

<%:system%>

-

<%:a_s_packages%>

- -
- -<% if install or remove or update or upgrade then %> -
<%:status%>:
-<% if update then %> - <%:a_s_packages_update%>: <% if update == 0 then %><%:ok%><% else %><%:error%> (<%=opkg_error(update)%>)<% end %>
-<% end %> -<% if upgrade then%> - <%:a_s_packages_upgrade%>: <% if upgrade == 0 then %><%:ok%><% else %><%:error%> (<%=opkg_error(upgrade)%>)<% end %>
-<% end %> -<% if install then for k,v in pairs(install) do %> - <%:a_s_packages_install%> '<%=k%>': <% if v == 0 then %><%:ok%><% else %><%:error%> (<%=opkg_error(v)%>)<% end %>
-<% end end %> -<% if remove then for k,v in pairs(remove) do %> - <%:a_s_packages_remove%> '<%=k%>': <% if v == 0 then %><%:ok%><% else %><%:error%> (<%=opkg_error(v)%>)<% end %>
-<% end end %> -
-
-<% end %> +

<%:System%> - <%:Software%>


-
- -
- - +
+ +
+ + +
-
-
- -
- - +
+ +
+ + +
+
+
+
+ +

<%:Status%>

+
+ <%:Free space%>: <%=(100-used_perc)%>% (<%=wa.byte_format(free_byte)%>) +
+
 
- + <% if (install and next(install)) or (remove and next(remove)) or update or upgrade then %> +


+ <% if update then %> + <%:Package lists updated%>: <% if update == 0 then %><%:OK%><% else %><%:Error%> (<%=opkg_error(update)%>)<% end %>
+ <% end %> + <% if upgrade then%> + <%:Upgrade installed packages%>: <% if upgrade == 0 then %><%:OK%><% else %><%:Error%> (<%=opkg_error(upgrade)%>)<% end %>
+ <% end %> + <% if install then for k,v in pairs(install) do %> + <%:Install%> '<%=k%>': <% if v == 0 then %><%:OK%><% else %><%:Error%> (<%=opkg_error(v)%>)<% end %>
+ <% end end %> + <% if remove then for k,v in pairs(remove) do %> + <%:Remove%> '<%=k%>': <% if v == 0 then %><%:OK%><% else %><%:Error%> (<%=opkg_error(v)%>)<% end %>
+ <% end end %> + <% end %> + +
+ +

<%:Installed packages%><% if query then %> (<%=luci.util.pcdata(query)%>)<% end %>

+ +
+
- - - - - + + + - <% for k, pkg in pairs(pkgs) do %> + <% local empty = true; luci.model.ipkg.list_installed(query, function(n, v, d) empty = false %> - - - - - + + + + + <% end) %> + <% if empty then %> + + + + <% end %>
<%:a_s_packages_name%><%:version%><%:install%><%:delete%><%:descr%> <%:Package name%><%:Version%>
<%=luci.util.pcdata(pkg.Package)%><%=luci.util.pcdata(pkg.Version)%><% if not pkg.Status or not pkg.Status.installed then %><% else %><%:installed%><% end %><% if pkg.Status and pkg.Status.installed then %><% else %><%:notinstalled%><% end %><%=luci.util.pcdata(pkg.Description)%><%:Remove%><%=luci.util.pcdata(n)%><%=luci.util.pcdata(v)%>
 <%:none%><%:none%>
+
+
-
-
- -
- +

<%:Available packages%><% if query then %> (<%=luci.util.pcdata(query)%>)<% end %>

+ +
+ + + + + + + + <% local empty = true; luci.model.ipkg.list_all(query, function(n, v, d) empty = false %> + + + + + + + <% end) %> + <% if empty then %> + + + + + + + <% end %> +
 <%:Package name%><%:Version%><%:Description%>
<%:Install%><%=luci.util.pcdata(n)%><%=luci.util.pcdata(v)%><%=luci.util.pcdata(d)%>
 <%:none%><%:none%><%:none%>
+
<%+footer%>