Changeset 5738

Show
Ignore:
Timestamp:
03/08/10 01:13:43 (3 years ago)
Author:
jow
Message:

luci-0.9: various improvements in package management ui

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • luci/branches/luci-0.9/modules/admin-full/luasrc/view/admin_system/packages.htm

    r5700 r5738  
    22LuCI - Lua Configuration Interface 
    33Copyright 2008 Steven Barth <steven@midlink.org> 
    4 Copyright 2008 Jo-Philipp Wich <xm@leipzig.freifunk.net> 
     4Copyright 2008-2010 Jo-Philipp Wich <xm@subsignal.org> 
    55 
    66Licensed under the Apache License, Version 2.0 (the "License"); 
     
    1515<%- 
    1616local bit = require "bit" 
     17local opkg = require "luci.model.ipkg" 
     18local fs = require "nixio.fs" 
     19local wa = require "luci.tools.webadmin" 
    1720local rowcnt = 1 
    1821 
     
    2932    ) 
    3033end 
     34 
     35local fstat = fs.statvfs(opkg.overlay_root()) 
     36local space_total = fstat and fstat.blocks or 0 
     37local space_free  = fstat and fstat.bfree  or 0 
     38local space_used  = space_total - space_free 
     39 
     40local used_perc = math.floor(0.5 + ((space_total > 0) and ((100 / space_total) * space_used) or 100)) 
     41local free_byte = space_free * fstat.frsize 
     42 
    3143-%> 
    3244<%+header%> 
     
    4254            <br /> 
    4355            <fieldset class="cbi-section-node"> 
    44             <div class="cbi-value"> 
    45                 <label class="cbi-value-title"><%:a_s_packages_installurl%>:</label> 
    46                 <div class="cbi-value-field"> 
    47                     <input type="text" name="url" size="30" value="" /> 
    48                     <input class="cbi-input-save" type="submit" name="submit" value="<%:ok%>" /> 
     56                <div class="cbi-value"> 
     57                    <label class="cbi-value-title"><%:a_s_packages_installurl%>:</label> 
     58                    <div class="cbi-value-field"> 
     59                        <input type="text" name="url" size="30" value="" /> 
     60                        <input class="cbi-input-save" type="submit" name="submit" value="<%:ok%>" /> 
     61                    </div> 
    4962                </div> 
     63 
     64                <div class="cbi-value"> 
     65                    <label class="cbi-value-title"><%:filter%>:</label> 
     66                    <div class="cbi-value-field"> 
     67                        <input type="text" name="query" size="20" value="<%=query%>" /> 
     68                        <input type="submit" class="cbi-input-find" name="search" value="<%:a_s_packages_search%>" /> 
     69                    </div> 
     70                </div> 
     71            </fieldset> 
     72        </fieldset> 
     73        <br /> 
     74 
     75        <h3><%:status%></h3> 
     76        <fieldset class="cbi-section"> 
     77            <%:a_s_packages_freespace Free space%>: <strong><%=(100-used_perc)%>%</strong> (<strong><%=wa.byte_format(free_byte)%></strong>) 
     78            <div style="margin:3px 0; width:300px; height:10px; border:1px solid #000000; background-color:#80C080"> 
     79                <div style="background-color:#F08080; border-right:1px solid #000000; height:100%; width:<%=used_perc%>%">&nbsp;</div> 
    5080            </div> 
    5181 
    52             <div class="cbi-value"> 
    53                 <label class="cbi-value-title"><%:filter%>:</label> 
    54                 <div class="cbi-value-field"> 
    55                     <input type="text" name="query" size="20" value="<%=query%>" /> 
    56                     <input type="submit" class="cbi-input-find" name="search" value="<%:a_s_packages_search%>" /> 
    57                 </div> 
    58             </div> 
    59             </fieldset> 
    60         </fieldset> 
    61  
    62         <% if (install and next(install)) or (remove and next(remove)) or update or upgrade then %> 
    63         <h2><%:status%></h2> 
    64         <fieldset class="cbi-section"> 
    65             <% if update then %> 
    66                 <%:a_s_packages_update%>: <% if update == 0 then %><span class="ok"><%:ok%></span><% else %><span class="error"><%:error%> (<%=opkg_error(update)%>)</span><% end %><br /> 
     82            <% if (install and next(install)) or (remove and next(remove)) or update or upgrade then %> 
     83                <br /><hr /><br /> 
     84                <% if update then %> 
     85                    <%:a_s_packages_update%>: <% if update == 0 then %><span class="ok"><%:ok%></span><% else %><span class="error"><%:error%> (<%=opkg_error(update)%>)</span><% end %><br /> 
     86                <% end %> 
     87                <% if upgrade then%> 
     88                    <%:a_s_packages_upgrade%>: <% if upgrade == 0 then %><span class="ok"><%:ok%></span><% else %><span class="error"><%:error%> (<%=opkg_error(upgrade)%>)</span><% end %><br /> 
     89                <% end %> 
     90                <% if install then for k,v in pairs(install) do %> 
     91                    <%:a_s_packages_install%> '<%=k%>': <% if v == 0 then %><span class="ok"><%:ok%></span><% else %><span class="error"><%:error%> (<%=opkg_error(v)%>)</span><% end %><br /> 
     92                <% end end %> 
     93                <% if remove then for k,v in pairs(remove) do %> 
     94                    <%:a_s_packages_remove%> '<%=k%>': <% if v == 0 then %><span class="ok"><%:ok%></span><% else %><span class="error"><%:error%> (<%=opkg_error(v)%>)</span><% end %><br /> 
     95                <% end end %> 
    6796            <% end %> 
    68             <% if upgrade then%> 
    69                 <%:a_s_packages_upgrade%>: <% if upgrade == 0 then %><span class="ok"><%:ok%></span><% else %><span class="error"><%:error%> (<%=opkg_error(upgrade)%>)</span><% end %><br /> 
    70             <% end %> 
    71             <% if install then for k,v in pairs(install) do %> 
    72                 <%:a_s_packages_install%> '<%=k%>': <% if v == 0 then %><span class="ok"><%:ok%></span><% else %><span class="error"><%:error%> (<%=opkg_error(v)%>)</span><% end %><br /> 
    73             <% end end %> 
    74             <% if remove then for k,v in pairs(remove) do %> 
    75                 <%:a_s_packages_remove%> '<%=k%>': <% if v == 0 then %><span class="ok"><%:ok%></span><% else %><span class="error"><%:error%> (<%=opkg_error(v)%>)</span><% end %><br /> 
    76             <% end end %> 
    7797        </fieldset> 
    7898        <br /> 
    79         <% end %> 
    8099 
    81         <h2><%:a_s_packages_installed Installed packages%><% if query then %> (<%=luci.util.pcdata(query)%>)<% end %></h2> 
     100        <h3><%:a_s_packages_installed Installed packages%><% if query then %> (<%=luci.util.pcdata(query)%>)<% end %></h3> 
    82101 
    83102        <fieldset class="cbi-section"> 
     
    90109                <% local empty = true; luci.model.ipkg.list_installed(query, function(n, v, d) empty = false %> 
    91110                <tr class="cbi-section-table-row cbi-rowstyle-<%=rowstyle()%>"> 
    92                     <td style="text-align:left; width:10%"><a href="<%=REQUEST_URI%>?submit=1&amp;remove=<%=luci.util.pcdata(n)%>"><%:delete%></a></td> 
     111                    <td style="text-align:left; width:10%"><a onclick="return window.confirm('<%:delete%> &quot;<%=luci.util.pcdata(n)%>&quot; ?')" href="<%=REQUEST_URI%>?submit=1&amp;remove=<%=luci.util.pcdata(n)%>"><%:delete%></a></td> 
    93112                    <td style="text-align:left"><%=luci.util.pcdata(n)%></td> 
    94113                    <td style="text-align:left"><%=luci.util.pcdata(v)%></td> 
     
    104123            </table> 
    105124        </fieldset> 
     125        <br /> 
    106126 
    107127 
    108         <h2><%:a_s_packages_available Available packages%><% if query then %> (<%=luci.util.pcdata(query)%>)<% end %></h2> 
     128        <h3><%:a_s_packages_available Available packages%><% if query then %> (<%=luci.util.pcdata(query)%>)<% end %></h3> 
    109129 
    110130        <fieldset class="cbi-section"> 
     
    118138                <% local empty = true; luci.model.ipkg.list_all(query, function(n, v, d) empty = false %> 
    119139                <tr class="cbi-section-table-row cbi-rowstyle-<%=rowstyle()%>"> 
    120                     <td style="text-align:left; width:10%"><a href="<%=REQUEST_URI%>?submit=1&amp;install=<%=luci.util.pcdata(n)%>"><%:install%></a></td> 
     140                    <td style="text-align:left; width:10%"><a onclick="return window.confirm('<%:install%> &quot;<%=luci.util.pcdata(n)%>&quot; ?')" href="<%=REQUEST_URI%>?submit=1&amp;install=<%=luci.util.pcdata(n)%>"><%:install%></a></td> 
    121141                    <td style="text-align:left"><%=luci.util.pcdata(n)%></td> 
    122142                    <td style="text-align:left"><%=luci.util.pcdata(v)%></td>