Skip to content

Commit

Permalink
luci-app-usteer: Added tooltip while hovering over connected client s…
Browse files Browse the repository at this point in the history
…howing mac, IP(s), hostname in status page

Signed-off-by: Ramon Van Gorkom <Ramon00c00@gmail.com>
  • Loading branch information
Ramon00 authored and systemcrash committed Dec 28, 2023
1 parent a1f5b60 commit 0f794ac
Showing 1 changed file with 28 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -91,25 +91,46 @@ function collectWlanAPInfoEntries(connectioninfo_table_entries, wlanAPInfos) {
}
};

function tootltip(mac, IP, hostname) {
var body= E([]);
body.appendChild(E('div', mac));
if (typeof IP !== 'undefined') {
for (var IPaddr in IP['ipaddrs']) body.appendChild(E('div', IP['ipaddrs'][IPaddr]));
for (var IPaddr in IP['ip6addrs']) body.appendChild(E('div', IP['ip6addrs'][IPaddr]));;
}
if (hostname !== '') {
body.appendChild(E('div', '%h'.format(hostname)));
}
return body;
}

function collectWlanAPInfos(compactconnectioninfo_table_entries, wlanAPInfos) {
for (var wlan in wlanAPInfos) {
var hostl = '';
var hostl = E([]);
for (var mac in Clients) {
if (typeof Clients[mac] !== 'undefined')
if (typeof Clients[mac][wlan] !== 'undefined')
if (String(Clients[mac][wlan]['connected']).valueOf() == String('true').valueOf()) {
if (String(Clients[mac][wlan]['connected']).valueOf() === 'true') {
var foundname = mac;
var IP = '';
var hostname = '';
var macUp = mac.toUpperCase();
if (typeof Hosts[macUp] !== 'undefined') {
if ((String(Hosts[macUp]['ipaddrs'][0]).length > 0) && (typeof Hosts[macUp]['ipaddrs'][0] !== 'undefined')) {
foundname = Hosts[macUp]['ipaddrs'][0];
if ((typeof Hosts[macUp]['ipaddrs'][0] !== 'undefined') && (String(Hosts[macUp]['ipaddrs'][0]).length > 0)) {
IP = Hosts[macUp]['ipaddrs'][0];
foundname = IP;
}
if ((String(Hosts[macUp]['name']).length > 0) && (typeof Hosts[macUp]['name'] !== 'undefined')) {
foundname = Hosts[macUp]['name'];
if ((typeof Hosts[macUp]['name'] !== 'undefined') && (String(Hosts[macUp]['name']).length > 0)) {
hostname = Hosts[macUp]['name'];
foundname = hostname;
}
}
hostl += '%h\u2003'.format(foundname);
hostl.appendChild(
E('span', { 'class': 'cbi-tooltip-container' }, [
'%h\u2003'.format(foundname),
E('div', { 'class': 'cbi-tooltip' }, tootltip(mac, Hosts[macUp], hostname))
])
);
}
}
compactconnectioninfo_table_entries.push([
Expand Down

0 comments on commit 0f794ac

Please sign in to comment.