Merge pull request #3927 from JonnyTischbein/master

luci-app-dawn: Rewrite of Dawn Hearing Map in Table Form
This commit is contained in:
Dirk Brenken 2020-04-18 21:13:15 +02:00 committed by GitHub
commit 44ee223571
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -6,59 +6,67 @@ s = m:section(NamedSection, "__hearingmap__")
function s.render(self, sid) function s.render(self, sid)
local tpl = require "luci.template" local tpl = require "luci.template"
tpl.render_string([[ tpl.render_string([[
<ul> <%
<% local utl = require "luci.util"
local utl = require "luci.util" local status = require "luci.tools.ieee80211"
local status = require "luci.tools.ieee80211" local stat = utl.ubus("dawn", "get_hearing_map", { })
local stat = utl.ubus("dawn", "get_hearing_map", { }) local name, macs
local name, macs
for name, macs in pairs(stat) do for name, macs in pairs(stat) do
%> %>
<li> <div class="cbi-section-node">
<strong>SSID is: </strong><%= name %><br /> <h3>SSID: <%= name %></h3>
</li> <div class="table" id="dawn_hearing_map">
<ul> <div class="tr table-titles">
<div class="th">Client MAC</div>
<div class="th">AP MAC</div>
<div class="th">Frequency</div>
<div class="th">HT Sup</div>
<div class="th">VHT Sup</div>
<div class="th">Signal</div>
<div class="th">RCPI</div>
<div class="th">RSNI</div>
<div class="th">Channel Utilization</div>
<div class="th">Station connect to AP</div>
<div class="th">Score</div>
</div>
<% <%
local mac, data local mac, data
for mac, data in pairs(macs) do for mac, data in pairs(macs) do
local mac2, data2
local count_loop = 0
for mac2, data2 in pairs(data) do
%> %>
<li> <div class="tr">
<strong>Client MAC is: </strong><%= mac %><br /> <% if (count_loop == 0) then %>
</li> <div class="td"><%= mac %></div>
<ul> <% else %>
<% <div></div>
local mac2, data2 <% end %>
for mac2, data2 in pairs(data) do <div class="td"><%= mac2 %></div>
%> <div class="td"><%= "%.3f" %( data2.freq / 1000 ) %> GHz Channel: <%= "%d" %( status.frequency_to_channel(data2.freq) ) %></div>
<li> <div class="td"><%= (data2.ht_capabilities == true and data2.ht_support == true) and "True" or "False" %></div>
<strong>AP is: </strong><%= mac2 %><br /> <div class="td"><%= (data2.vht_capabilities == true and data2.vht_support == true) and "True" or "False" %></div>
<strong>Frequency is: </strong><%= "%.3f" %( data2.freq / 1000 ) %> GHz (Channel: <%= "%d" %( status.frequency_to_channel(data2.freq) ) %>)<br /> <div class="td"><%= "%d" %data2.signal %></div>
<strong>HT support is: </strong><%= (data2.ht_capabilities == true and data2.ht_support == true) and "available" or "not available" %><br /> <div class="td"><%= "%d" %data2.rcpi %></div>
<strong>VHT support is: </strong><%= (data2.vht_capabilities == true and data2.vht_support == true) and "available" or "not available" %><br /> <div class="td"><%= "%d" %data2.rsni %></div>
<!-- <div class="td"><%= "%.2f" %(data2.channel_utilization / 2.55) %> %</div>
<strong>AP HT support is: </strong><%= (data2.ht_support == true) and "available" or "not available" %><br /> <div class="td"><%= "%d" %data2.num_sta %></div>
<strong>AP VHT support is: </strong><%= (data2.vht_support == true) and "available" or "not available" %><br /> <div class="td"><%= "%d" %data2.score %></div>
<strong>Client HT support is: </strong><%= (data2.ht_capabilities == true) and "available" or "not available" %><br /> </div>
<strong>Client VHT support is: </strong><%= (data2.vht_capabilities == true) and "available" or "not available" %><br /> <%
--!> count_loop = count_loop + 1
<strong>Signal is: </strong><%= "%d" %data2.signal %><br /> end
<strong>Channel Utilization is: </strong><%= "%d" %data2.channel_utilization %><br />
<strong>Station connected to AP is: </strong><%= "%d" %data2.num_sta %><br />
<strong>Score is: </strong><%= "%d" %data2.score %><br />
</li>
<%
end end
%> %>
</ul> </div>
<% </div>
end
%>
</ul>
<% <%
end end
%> %>
</ul> </div>
]]) ]])
end end
return m return m