Clients UI: show several sessions of one user
- API: /api/v1/stats returns sessions_count and sessions per client - UI: badge "xN", "N devices", expandable session list, Active Sessions KPI - deploy/ui-dist rebuilt, docs: plan, summary, API reference, UI architecture Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
4815821f17
commit
1bbf9b7cc1
24 files changed
+229
-19
No files matched your search
@@ -0,0 +1 @@
|
||||
import{C as p,r as v}from"./vendor-charts-Bcjh2pZL.js";import{u as T}from"./useFormatters-CKGG-YVI.js";import{c as k}from"./index-CH6sppUl.js";p.register(...v);const L="#1652B8",M="#EC7C31",_=1024*1024,S=()=>{const e=document.documentElement.getAttribute("data-theme")==="dark";return{isDark:e,gridColor:e?"rgba(240, 246, 252, 0.1)":"rgba(0,0,0,0.05)",textColor:e?"#8b949e":"#6c757d"}},A=(e,o)=>{if(!e||e.length===0)return[];if(e.length<=o)return e;const u=Math.ceil(e.length/o),n=[];for(let a=0;a<e.length;a+=u){const l=e.slice(a,a+u);if(l.length===0)continue;let m=0,c=0,s=0,t=0;l.forEach(r=>{m+=r.bytes_received||0,c+=r.bytes_sent||0,s=Math.max(s,r.rx_rate_mbps||0),t=Math.max(t,r.tx_rate_mbps||0)}),n.push({timestamp:l[0].timestamp,bytes_received:m,bytes_sent:c,rx_rate_mbps:s,tx_rate_mbps:t})}return n},B=e=>{const o=/^(\d+)([hd])$/.exec(e||"");return o?Number(o[1])*(o[2]==="d"?24:1)>24:!1};function D(e,{maxPoints:o}){const{parseServerDate:u}=T();let n=null;const a=()=>{n&&(n.destroy(),n=null)},l=(c,s)=>{const t=u(c),r=t.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"});return s.includes("h")||s==="1d"?r:t.toLocaleDateString([],{month:"short",day:"numeric"})+" "+r},m=(c,{range:s,speedMode:t})=>{if(!e.value)return;a();const r=[],d=[],b=[];A(c,o).forEach(i=>{r.push(l(i.timestamp,s)),t?(d.push(i.rx_rate_mbps||0),b.push(i.tx_rate_mbps||0)):(d.push(i.bytes_received/_),b.push(i.bytes_sent/_))});const{gridColor:h,textColor:g}=S(),x=B(s)?" (avg)":"",f=(i,C,R,y)=>({label:i,data:C,borderColor:R,backgroundColor:y,borderWidth:2,fill:!0,tension:.3,pointRadius:3,pointHoverRadius:4});n=new p(e.value.getContext("2d"),{type:"line",data:{labels:r,datasets:[f(t?`RX Mbps${x}`:"Received (MB)",d,L,"rgba(22, 82, 184, 0.15)"),f(t?`TX Mbps${x}`:"Sent (MB)",b,M,"rgba(236, 124, 49, 0.15)")]},options:{responsive:!0,maintainAspectRatio:!1,interaction:{mode:"index",intersect:!1},plugins:{legend:{labels:{color:g}}},scales:{x:{ticks:{color:g,maxTicksLimit:8},grid:{color:h}},y:{beginAtZero:!0,ticks:{color:g},grid:{color:h}}}}})};return k(a),{render:m,destroy:a}}export{L as C,M as a,S as g,D as u};
|
||||
Reference in new issue
Block a user