diff options
author | Jonny Tischbein <jonny_tischbein@systemli.org> | 2020-04-18 10:18:29 +0200 |
---|---|---|
committer | Jonny Tischbein <jonny_tischbein@systemli.org> | 2020-04-18 10:26:09 +0200 |
commit | f25910a6445304a4639800ac1673531727fe6635 (patch) | |
tree | 1116eef6705234394ffb4609221907ba4e3ab5da /applications/luci-app-dawn/luasrc/model | |
parent | f32978674b5fcf6f7cdaf508ae28b4bac2fff7e5 (diff) |
luci-app-dawn: rewrite dawn hearing map in table form
Signed-off-by: Jonny Tischbein <jonny_tischbein@systemli.org>
Diffstat (limited to 'applications/luci-app-dawn/luasrc/model')
-rw-r--r-- | applications/luci-app-dawn/luasrc/model/cbi/dawn/dawn_hearing_map.lua | 121 |
1 files changed, 71 insertions, 50 deletions
diff --git a/applications/luci-app-dawn/luasrc/model/cbi/dawn/dawn_hearing_map.lua b/applications/luci-app-dawn/luasrc/model/cbi/dawn/dawn_hearing_map.lua index 3e131c520e..e8b0240ea5 100644 --- a/applications/luci-app-dawn/luasrc/model/cbi/dawn/dawn_hearing_map.lua +++ b/applications/luci-app-dawn/luasrc/model/cbi/dawn/dawn_hearing_map.lua @@ -6,59 +6,80 @@ s = m:section(NamedSection, "__hearingmap__") function s.render(self, sid) local tpl = require "luci.template" tpl.render_string([[ - <ul> - <% - local utl = require "luci.util" - local status = require "luci.tools.ieee80211" - local stat = utl.ubus("dawn", "get_hearing_map", { }) - local name, macs - for name, macs in pairs(stat) do - %> - <li> - <strong>SSID is: </strong><%= name %><br /> - </li> - <ul> - <% - local mac, data - for mac, data in pairs(macs) do - %> - <li> - <strong>Client MAC is: </strong><%= mac %><br /> - </li> - <ul> - <% - local mac2, data2 - for mac2, data2 in pairs(data) do - %> - <li> - <strong>AP is: </strong><%= mac2 %><br /> - <strong>Frequency is: </strong><%= "%.3f" %( data2.freq / 1000 ) %> GHz (Channel: <%= "%d" %( status.frequency_to_channel(data2.freq) ) %>)<br /> - <strong>HT support is: </strong><%= (data2.ht_capabilities == true and data2.ht_support == true) and "available" or "not available" %><br /> - <strong>VHT support is: </strong><%= (data2.vht_capabilities == true and data2.vht_support == true) and "available" or "not available" %><br /> - <!-- - <strong>AP HT support is: </strong><%= (data2.ht_support == true) and "available" or "not available" %><br /> - <strong>AP VHT support is: </strong><%= (data2.vht_support == true) and "available" or "not available" %><br /> - <strong>Client HT support is: </strong><%= (data2.ht_capabilities == true) and "available" or "not available" %><br /> - <strong>Client VHT support is: </strong><%= (data2.vht_capabilities == true) and "available" or "not available" %><br /> - --!> - <strong>Signal is: </strong><%= "%d" %data2.signal %><br /> - <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 - %> - </ul> - <% - end - %> - </ul> + <style>.hearing_table tr{ border-bottom: 1px solid grey;} tr:nth-child(even){background-color: lightgrey;}</style> + <% + local utl = require "luci.util" + local status = require "luci.tools.ieee80211" + local stat = utl.ubus("dawn", "get_hearing_map", { }) + local name, macs + + for name, macs in pairs(stat) do + local count = 0 + for a,b in pairs(macs) do for _ in pairs(b) do count = count + 1 end end + %> + <table class="table" style="border: 1px solid grey;"> + <thead style="background-color: grey; color: white;"> + <tr> + <th>SSID</th> + <th>Client MAC</th> + <th>AP MAC</th> + <th>Frequency</th> + <th>HT Sup</th> + <th>VHT Sup</th> + <th>Signal</th> + <th>RCPI</th> + <th>RSNI</th> + <th>Channel<br />Utilization</th> + <th>Station connect<br />to AP</th> + <th>Score</th> + </tr> + </thead> + <tbody> + <tr class="center" style="border: 1px solid grey;"> + <td rowspan="<%= count + 1 %>" style="background-color: white; border-right: 1px solid grey;"><%= name %></td> + <% + local mac, data + for mac, data in pairs(macs) do + local mac2, data2 + local count_macs = 0 + local count_loop = 0 + for _ in pairs(data) do count_macs = count_macs + 1 end + + for mac2, data2 in pairs(data) do + %> + <tr class="center" style="border: 1px solid grey;"> + <% if (count_macs > 1) then %> + <% if (count_loop == 0 ) then %> + <td rowspan="<%= count_macs %>" style="background-color: white; border-right: 1px solid grey;"><%= mac %></td> + <% end %> + <% else %> + <td><%= mac %></td> + <% end %> + <td><%= mac2 %></td> + <td><%= "%.3f" %( data2.freq / 1000 ) %> GHz<br />(Channel: <%= "%d" %( status.frequency_to_channel(data2.freq) ) %>)</td> + <td><%= (data2.ht_capabilities == true and data2.ht_support == true) and "True" or "False" %></td> + <td><%= (data2.vht_capabilities == true and data2.vht_support == true) and "True" or "False" %></td> + <td><%= "%d" %data2.signal %></td> + <td><%= "%d" %data2.rcpi %></td> + <td><%= "%d" %data2.rsni %></td> + <td><%= "%.2f" %(data2.channel_utilization / 2.55) %> %</td> + <td><%= "%d" %data2.num_sta %></td> + <td><%= "%d" %data2.score %></td> + </tr> + <% + count_loop = count_loop + 1 + end + %> + <% + end + %> + </tr> + </tbody> + </table> <% end %> - </ul> - ]]) + ]]) end return m
\ No newline at end of file |