<%# Copyright 2014, CZ.NIC z.s.p.o. (http://www.nic.cz/) This file is part of NUCI configuration server. NUCI is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. NUCI is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with NUCI. If not, see . -%> <%- local wa = require "luci.tools.webadmin" local ERR_MSG_NO_DATA = translate("No data available") local data_seen = false; local titles = { ["monthly"] = translate("Majordomo - monthly statistics"), ["daily"] = translate("Majordomo - daily statistics"), ["hourly"] = translate("Majordomo - hourly statistics") }; local loc_class = { ["monthly"] = translate("monthly"), ["daily"] = translate("daily"), ["hourly"] = translate("hourly") }; local subclass = subclasses[class]; local superclass = superclasses[class]; local up_id = id_of_superlevel(get_variables["id"]); local first = true; -%> <%+header%>

<%=titles[class]%> (<%=pretty_print(get_variables["class"], get_variables["id"])%>)


<% if superclass then %> <% local url_up = build_url("details", superclass, up_id, get_variables["client"], get_variables["sort"]); %> <%:Level up to%>: <%=up_id%> <% else %> <% local url_up = build_url("overview", nil, nil, nil, get_variables["sort"]); %> <%:Go back to%> <%:overview%> <% end %>

<% if subclass_list then %>


<%=translatef("Avalable %s statistics for this client are:", loc_class[subclass])%> <% for _, id in ipairs(subclass_list) do %> <% local url = build_url("details", subclass, id, get_variables["client"], get_variables["sort"]); %> <% if first then first = false else %>| <% end %><%=pretty_print(subclass, id)%> <% end %>

<% end %> <% if data_ok then %> <%- local mac; if make_lookup_mac then mac = macdb:lookup(get_variables["client"]); end -%>

<% if static_names[get_variables["client"]] then %> <%=static_names[get_variables["client"]]%> — <% end %><%=get_variables["client"]%><% if mac then %> (<%= mac %>)<% end %>

<% for _, item in ipairs(stats) do %> <%- data_seen = true; proto, _, dst, port = split_key(item.key); local domain = nil; if item.value.resolved_name and item.value.resolved_name ~= CACHE_EMPTY_NAME then domain = item.value.resolved_name; end -%> <% end %>
<%:Destination address%> <%:Port/Protocol%> <%:Count (download)%> <%:Packet size (download)%> <%:Payload size (download)%> <%:Count (upload)%> <%:Packet size (upload)%> <%:Payload size (upload)%>
<% if domain then %> <%=table.concat(item.value.names:items(), ", ")%> <% else %> <%=dst%> <% end %> <%=port%>/<%=proto%> <%=item.value.d_count%> <%=wa.byte_format(item.value.d_size)%> <%=wa.byte_format(item.value.d_data_size)%> <%=item.value.u_count%> <%=wa.byte_format(item.value.u_size)%> <%=wa.byte_format(item.value.u_data_size)%>
<% end %> <% if not data_ok or not data_seen then %>


<%=ERR_MSG_NO_DATA%>

<% end %> <%+footer%>