Mercurial > code > home > repos > homeauto
comparison service/wifi/src/index.ts @ 1481:b3ef0886d16c
fix glow
Ignore-this: 6f374683408f724d42abf3aaf7570e2b
darcs-hash:28dcc6f183715a865367974607abe390fa83c9db
author | drewp <drewp@bigasterisk.com> |
---|---|
date | Mon, 06 Jan 2020 22:43:48 -0800 |
parents | ae023bba2104 |
children | 1c04c7dfbae6 |
comparison
equal
deleted
inserted
replaced
1480:ae023bba2104 | 1481:b3ef0886d16c |
---|---|
78 `; | 78 `; |
79 } | 79 } |
80 | 80 |
81 renderDevice(dev: Dev) { | 81 renderDevice(dev: Dev) { |
82 let agoReport = ""; | 82 let agoReport = ""; |
83 let glow = 0; | |
83 if (dev.agoMin === undefined) { | 84 if (dev.agoMin === undefined) { |
84 agoReport = "unknown"; | 85 agoReport = "unknown"; |
85 } else { | 86 } else { |
86 const glow = Math.max(0, 1 - dev.agoMin! / 60); | 87 glow = Math.max(0, 1 - dev.agoMin! / 60); |
87 agoReport = | 88 agoReport = |
88 dev.agoMin! < 360 | 89 dev.agoMin! < 360 |
89 ? ` (${Math.ceil(dev.agoMin! * 10) / 10} minutes ago)` | 90 ? ` (${Math.ceil(dev.agoMin! * 10) / 10} minutes ago)` |
90 : ""; | 91 : ""; |
91 } | 92 } |
92 const glow = ""; //todo | 93 const ntopUrl = "https://bigasterisk.com/ntop/lua/host_details.lua"; |
94 const ntopLink = `${ntopUrl}?ifid=17&host=${dev.ipAddress.value}&page=flows`; | |
93 return html` | 95 return html` |
94 <div class="dev" style="background: rgba(185, 5, 138, ${glow});"> | 96 <div class="dev" style="background: rgba(185, 5, 138, ${glow});"> |
95 <span class="mac">${dev.macAddress.value}</span> | 97 <span class="mac">${dev.macAddress.value}</span> |
96 <span class="ip" | 98 <span class="ip" |
97 ><a href="http://${dev.ipAddress.value}/" | 99 ><a href="http://${dev.ipAddress.value}/" |
100 > | 102 > |
101 <span class="packets">${dev.packetsPerSecDisplay}</span> | 103 <span class="packets">${dev.packetsPerSecDisplay}</span> |
102 <span class="bytes">${dev.bytesPerSecDisplay}</span> | 104 <span class="bytes">${dev.bytesPerSecDisplay}</span> |
103 <span class="hostname">${dev.dhcpHostname}</span> | 105 <span class="hostname">${dev.dhcpHostname}</span> |
104 <span class="ago">${agoReport}</span> | 106 <span class="ago">${agoReport}</span> |
105 <span class="links"> | 107 <span class="links"><a href="${ntopLink}">[flows]</a></span> |
106 <a | |
107 href="https://bigasterisk.com/ntop/lua/host_details.lua?ifid=17&host=${dev.ipAddress.value}&page=flows" | |
108 >[flows]</a | |
109 > | |
110 </span> | |
111 </div> | 108 </div> |
112 `; | 109 `; |
113 } | 110 } |
114 | 111 |
115 renderGroup(key: string, group: DevGroup) { | 112 renderGroup(key: string, group: DevGroup) { |