From 64bc95cb473e348c15add5bd6a36b2be087c2a56 Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Sat, 15 Oct 2011 03:13:49 +0000 Subject: modules/admin-full: make software page tabbed, show available list broken down by letters; greatly speeds up loading time --- .../luasrc/view/admin_system/packages.htm | 147 +++++++++++++-------- 1 file changed, 90 insertions(+), 57 deletions(-) (limited to 'modules/admin-full/luasrc/view/admin_system') diff --git a/modules/admin-full/luasrc/view/admin_system/packages.htm b/modules/admin-full/luasrc/view/admin_system/packages.htm index 51a1211712..e78f1c2ca7 100644 --- a/modules/admin-full/luasrc/view/admin_system/packages.htm +++ b/modules/admin-full/luasrc/view/admin_system/packages.htm @@ -34,6 +34,19 @@ local free_byte = space_free * fstat.frsize local filter = { } + +local querypat +if query and #query > 0 then + querypat = "*%s*" % query +end + +local letterpat +if letter == 35 then + letterpat = "[^a-zA-Z]*" +else + letterpat = string.char(91, letter, letter + 32, 93, 42) -- '[' 'A' 'a' ']' '*' +end + -%> <%+header%>

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

@@ -55,9 +68,10 @@ local filter = { } -
+
+
@@ -73,6 +87,12 @@ local filter = { }
 
+ <% if querypat then %> +


+ <%:Displaying only packages containing%> "<%=pcdata(query)%>" + + <% end %> + <% if (install and next(install)) or (remove and next(remove)) or update or upgrade then %>


<% if #stdout > 0 then %>
<%=pcdata(stdout)%>
<% end %> @@ -81,62 +101,75 @@ local filter = { }
-

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

- -
- - - - - - - <% local empty = true; luci.model.ipkg.list_installed(query, function(n, v, d) empty = false; filter[n] = true %> - - - - - - <% end) %> - <% if empty then %> - - - - - - <% end %> -
 <%:Package name%><%:Version%>
<%:Remove%><%=luci.util.pcdata(n)%><%=luci.util.pcdata(v)%>
 <%:none%><%:none%>
-
-
- - -

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

- -
- - - - - - - - <% local empty = true; luci.model.ipkg.list_all(query, function(n, v, d) if filter[n] then return end; 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%>
-
+ + + <% if display ~= "available" then %> +
+ + + + + + + <% local empty = true; luci.model.ipkg.list_installed(querypat, function(n, v, d) empty = false; filter[n] = true %> + + + + + + <% end) %> + <% if empty then %> + + + + + + <% end %> +
 <%:Package name%><%:Version%>
<%:Remove%><%=luci.util.pcdata(n)%><%=luci.util.pcdata(v)%>
 <%:none%><%:none%>
+
+ <% else %> +
+ <% if not querypat then %> + +
+ <% end %> + + + + + + + + <% local empty = true; luci.model.ipkg.list_all(querypat or letterpat, function(n, v, d) if filter[n] then return end; 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%>
+ <% if not querypat then %> +
+ <% end %> +
+ <% end %>
<%+footer%> -- cgit v1.2.3