Add loading spinner to front

This commit is contained in:
Herbert Wolverson 2023-08-09 13:11:17 +00:00
parent f0f11d30d0
commit 6c2e6dce4c
9 changed files with 54 additions and 6 deletions

View File

@ -2069,7 +2069,7 @@ ${r.stack}`:o}var Fs=0,A_t=typeof TextEncoder<"u"?new TextEncoder("utf-8"):{enco
</div>
</div>
</div>
`;var e6t=class{constructor(n){this.siteId=n,this.menu=new Mm("sitetreeDash");let i=document.getElementById("mainContent");i&&(i.innerHTML=yxr),this.components=[new wK(n),new _K(n),new $q(n),new xK(n),new SK(n),new T9(n)]}wireup(){this.components.forEach(n=>{n.wireup()})}ontick(){this.menu.ontick(),this.components.forEach(n=>{n.ontick()})}onmessage(n){n.msg&&(this.menu.onmessage(n),this.components.forEach(i=>{i.onmessage(n)}))}};var r6t=class{constructor(){this.curentPage=void 0,this.currentAnchor=""}initialRoute(){if(window.auth.hasCredentials){let n=document.getElementById("main");n&&(n.innerHTML='<i class="fa-solid fa-spinner fa-spin"></i>'),window.setTimeout(()=>{let i=window.location.hash;(i==""||i=="#")&&(i="dashboard"),this.goto(i)},1e3)}else this.goto("login")}ontick(){this.curentPage&&this.curentPage.ontick()}goto(n){n=n.replace("#","");let i=n.split(":");switch(i[0].toLowerCase()){case"login":{this.currentAnchor="login",this.curentPage=new $At;break}case"dashboard":{this.currentAnchor="dashboard",this.curentPage=new WAt;break}case"shapernodes":{this.currentAnchor="shapernodes",this.curentPage=new t6t;break}case"shapernode":{this.currentAnchor="shapernode:"+i[1]+":"+i[2],this.curentPage=new QAt(i[1],i[2]);break}case"sitetree":{this.currentAnchor="sitetree",this.curentPage=new IAt;break}case"site":{this.currentAnchor="site:"+i[1],this.curentPage=new e6t(i[1]);break}case"ap":{this.currentAnchor="ap:"+i[1],this.curentPage=new OAt(i[1]);break}case"circuit":{this.currentAnchor="circuit:"+i[1],this.curentPage=new FAt(i[1]);break}default:{alert("I don't know how to go to: "+i[0].toLowerCase()),this.goto("dashboard");return}}window.location.hash=this.currentAnchor,this.curentPage.wireup()}onMessage(n){this.curentPage&&this.curentPage.onmessage(n)}};var n6t=class{constructor(){let i="ws://"+window.location.href.split("#")[0].replace("https://","").replace("http://","")+"ws";cVe(i)}updateConnected(){let n=document.getElementById("connStatus");n&&uVe()?n.style.color="green":n&&(n.style.color="red")}sendQueue(){fVe()}getToken(){return window.auth.hasCredentials&&window.auth.token?window.auth.token:""}requestThroughputChartCircuit(n){let i={msg:"throughputChartCircuit",period:window.graphPeriod,circuit_id:decodeURI(n)},o=JSON.stringify(i);this.ws.send(o)}requestThroughputChartSite(n){let i={msg:"throughputChartSite",period:window.graphPeriod,site_id:decodeURI(n)},o=JSON.stringify(i);this.ws.send(o)}requestRttChartSite(n){let i={msg:"rttChartSite",period:window.graphPeriod,site_id:decodeURI(n)},o=JSON.stringify(i);this.ws.send(o)}requestRttChartCircuit(n){let i={msg:"rttChartCircuit",period:window.graphPeriod,circuit_id:decodeURI(n)},o=JSON.stringify(i);this.ws.send(o)}requestSiteHeat(n){let i={msg:"siteHeat",period:window.graphPeriod,site_id:decodeURI(n)},o=JSON.stringify(i);this.ws.send(o)}sendSearch(n){let o=JSON.stringify({msg:"search",term:n});this.ws.send(o)}requestSiteInfo(n){let i={msg:"siteInfo",site_id:decodeURI(n)},o=JSON.stringify(i);this.ws.send(o)}requestCircuitInfo(n){let i={msg:"circuitInfo",circuit_id:decodeURI(n)},o=JSON.stringify(i);this.ws.send(o)}requestSiteParents(n){let i={msg:"siteParents",site_id:decodeURI(n)},o=JSON.stringify(i);this.ws.send(o)}};function bxr(){window.auth.hasCredentials=!1,window.login=null,window.auth.token=null,localStorage.removeItem("token"),window.router.goto("login")}function wxr(r,n,i){window.auth.hasCredentials=!0,window.login={msg:"authOk",token:r,name:n,license_key:i},window.auth.token=r}function xxr(r){let n=JSON.parse(r);n.msg=Object.keys(n)[0],window.router.onMessage(n)}var i6t=class{constructor(){let n=localStorage.getItem("token");n?(this.hasCredentials=!0,this.token=n):(this.hasCredentials=!1,this.token=void 0)}};await AVe();console.log("WASM loaded");window.onAuthFail=bxr;window.onAuthOk=wxr;window.onMessage=xxr;window.auth=new i6t;window.bus=new n6t;window.router=new r6t;window.router.initialRoute();var a6t=localStorage.getItem("graphPeriod");a6t||(a6t="5m",localStorage.setItem("graphPeriod",a6t));window.graphPeriod=a6t;window.changeGraphPeriod=r=>_On(r);window.setInterval(()=>{window.bus.updateConnected(),window.router.ontick()},1e4);window.setInterval(()=>{_xr(),window.bus.updateConnected(),window.bus.sendQueue()},500);function _xr(){let r=document.getElementById("graphPeriodBtn");r&&(r.innerText=window.graphPeriod)}function _On(r){window.graphPeriod=r,localStorage.setItem("graphPeriod",r),_xr()}
`;var e6t=class{constructor(n){this.siteId=n,this.menu=new Mm("sitetreeDash");let i=document.getElementById("mainContent");i&&(i.innerHTML=yxr),this.components=[new wK(n),new _K(n),new $q(n),new xK(n,1),new SK(n),new T9(n)]}wireup(){this.components.forEach(n=>{n.wireup()})}ontick(){this.menu.ontick(),this.components.forEach(n=>{n.ontick()})}onmessage(n){n.msg&&(this.menu.onmessage(n),this.components.forEach(i=>{i.onmessage(n)}))}};var r6t=class{constructor(){this.curentPage=void 0,this.currentAnchor=""}initialRoute(){if(window.auth.hasCredentials){let n=document.getElementById("main");n&&(n.innerHTML='<i class="fa-solid fa-spinner fa-spin"></i>'),window.setTimeout(()=>{let i=window.location.hash;(i==""||i=="#")&&(i="dashboard"),this.goto(i)},1e3)}else this.goto("login")}ontick(){this.curentPage&&this.curentPage.ontick()}goto(n){n=n.replace("#","");let i=n.split(":");switch(i[0].toLowerCase()){case"login":{this.currentAnchor="login",this.curentPage=new $At;break}case"dashboard":{this.currentAnchor="dashboard",this.curentPage=new WAt;break}case"shapernodes":{this.currentAnchor="shapernodes",this.curentPage=new t6t;break}case"shapernode":{this.currentAnchor="shapernode:"+i[1]+":"+i[2],this.curentPage=new QAt(i[1],i[2]);break}case"sitetree":{this.currentAnchor="sitetree",this.curentPage=new IAt;break}case"site":{this.currentAnchor="site:"+i[1],this.curentPage=new e6t(i[1]);break}case"ap":{this.currentAnchor="ap:"+i[1],this.curentPage=new OAt(i[1]);break}case"circuit":{this.currentAnchor="circuit:"+i[1],this.curentPage=new FAt(i[1]);break}default:{alert("I don't know how to go to: "+i[0].toLowerCase()),this.goto("dashboard");return}}window.location.hash=this.currentAnchor,this.curentPage.wireup()}onMessage(n){this.curentPage&&this.curentPage.onmessage(n)}};var n6t=class{constructor(){let i="ws://"+window.location.href.split("#")[0].replace("https://","").replace("http://","")+"ws";cVe(i)}updateConnected(){let n=document.getElementById("connStatus");n&&uVe()?n.style.color="green":n&&(n.style.color="red")}sendQueue(){fVe()}getToken(){return window.auth.hasCredentials&&window.auth.token?window.auth.token:""}requestThroughputChartCircuit(n){let i={msg:"throughputChartCircuit",period:window.graphPeriod,circuit_id:decodeURI(n)},o=JSON.stringify(i);this.ws.send(o)}requestThroughputChartSite(n){let i={msg:"throughputChartSite",period:window.graphPeriod,site_id:decodeURI(n)},o=JSON.stringify(i);this.ws.send(o)}requestRttChartSite(n){let i={msg:"rttChartSite",period:window.graphPeriod,site_id:decodeURI(n)},o=JSON.stringify(i);this.ws.send(o)}requestRttChartCircuit(n){let i={msg:"rttChartCircuit",period:window.graphPeriod,circuit_id:decodeURI(n)},o=JSON.stringify(i);this.ws.send(o)}requestSiteHeat(n){let i={msg:"siteHeat",period:window.graphPeriod,site_id:decodeURI(n)},o=JSON.stringify(i);this.ws.send(o)}sendSearch(n){let o=JSON.stringify({msg:"search",term:n});this.ws.send(o)}requestSiteInfo(n){let i={msg:"siteInfo",site_id:decodeURI(n)},o=JSON.stringify(i);this.ws.send(o)}requestCircuitInfo(n){let i={msg:"circuitInfo",circuit_id:decodeURI(n)},o=JSON.stringify(i);this.ws.send(o)}requestSiteParents(n){let i={msg:"siteParents",site_id:decodeURI(n)},o=JSON.stringify(i);this.ws.send(o)}};function bxr(){window.auth.hasCredentials=!1,window.login=null,window.auth.token=null,localStorage.removeItem("token"),window.router.goto("login")}function wxr(r,n,i){window.auth.hasCredentials=!0,window.login={msg:"authOk",token:r,name:n,license_key:i},window.auth.token=r}function xxr(r){let n=JSON.parse(r);n.msg=Object.keys(n)[0],window.router.onMessage(n)}var i6t=class{constructor(){let n=localStorage.getItem("token");n?(this.hasCredentials=!0,this.token=n):(this.hasCredentials=!1,this.token=void 0)}};await AVe();console.log("WASM loaded");window.onAuthFail=bxr;window.onAuthOk=wxr;window.onMessage=xxr;window.auth=new i6t;window.bus=new n6t;window.router=new r6t;window.router.initialRoute();var a6t=localStorage.getItem("graphPeriod");a6t||(a6t="5m",localStorage.setItem("graphPeriod",a6t));window.graphPeriod=a6t;window.changeGraphPeriod=r=>_On(r);window.setInterval(()=>{window.bus.updateConnected(),window.router.ontick()},1e4);window.setInterval(()=>{_xr(),window.bus.updateConnected(),window.bus.sendQueue()},500);function _xr(){let r=document.getElementById("graphPeriodBtn");r&&(r.innerText=window.graphPeriod)}function _On(r){window.graphPeriod=r,localStorage.setItem("graphPeriod",r),_xr()}
/*! Bundled license information:
bootstrap/dist/js/bootstrap.js:

File diff suppressed because one or more lines are too long

View File

@ -12,7 +12,12 @@
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css" />
</head>
<body>
<div id="main"></div>
<div id="main">
<p>
Loading, Please Wait...
<i class="fa-solid fa-spinner fa-spin"></i>
</p>
</div>
<footer>Copyright &copy; 2023 LibreQoS</footer>
</body>
</html>

View File

@ -12,7 +12,12 @@
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css" />
</head>
<body>
<div id="main"></div>
<div id="main">
<p>
Loading, Please Wait...
<i class="fa-solid fa-spinner fa-spin"></i>
</p>
</div>
<footer>Copyright &copy; 2023 LibreQoS</footer>
</body>
</html>

View File

@ -139,6 +139,16 @@ export function request_ext_snr_graph(period: string, device_id: string): void;
* @param {string} device_id
*/
export function request_ext_capacity_graph(period: string, device_id: string): void;
/**
* @param {string} period
* @param {string} site_name
*/
export function request_ext_capacity_ap(period: string, site_name: string): void;
/**
* @param {string} period
* @param {string} site_name
*/
export function request_ext_signal_ap(period: string, site_name: string): void;
export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
@ -175,6 +185,8 @@ export interface InitOutput {
readonly request_ext_device_info: (a: number, b: number) => void;
readonly request_ext_snr_graph: (a: number, b: number, c: number, d: number) => void;
readonly request_ext_capacity_graph: (a: number, b: number, c: number, d: number) => void;
readonly request_ext_capacity_ap: (a: number, b: number, c: number, d: number) => void;
readonly request_ext_signal_ap: (a: number, b: number, c: number, d: number) => void;
readonly __wbindgen_export_0: (a: number) => number;
readonly __wbindgen_export_1: (a: number, b: number, c: number) => number;
readonly __wbindgen_export_2: WebAssembly.Table;

View File

@ -528,6 +528,30 @@ export function request_ext_capacity_graph(period, device_id) {
wasm.request_ext_capacity_graph(ptr0, len0, ptr1, len1);
}
/**
* @param {string} period
* @param {string} site_name
*/
export function request_ext_capacity_ap(period, site_name) {
const ptr0 = passStringToWasm0(period, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
const len0 = WASM_VECTOR_LEN;
const ptr1 = passStringToWasm0(site_name, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
const len1 = WASM_VECTOR_LEN;
wasm.request_ext_capacity_ap(ptr0, len0, ptr1, len1);
}
/**
* @param {string} period
* @param {string} site_name
*/
export function request_ext_signal_ap(period, site_name) {
const ptr0 = passStringToWasm0(period, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
const len0 = WASM_VECTOR_LEN;
const ptr1 = passStringToWasm0(site_name, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
const len1 = WASM_VECTOR_LEN;
wasm.request_ext_signal_ap(ptr0, len0, ptr1, len1);
}
function handleError(f, args) {
try {
return f.apply(this, args);

View File

@ -32,6 +32,8 @@ export function request_circuit_info(a: number, b: number): void;
export function request_ext_device_info(a: number, b: number): void;
export function request_ext_snr_graph(a: number, b: number, c: number, d: number): void;
export function request_ext_capacity_graph(a: number, b: number, c: number, d: number): void;
export function request_ext_capacity_ap(a: number, b: number, c: number, d: number): void;
export function request_ext_signal_ap(a: number, b: number, c: number, d: number): void;
export function __wbindgen_export_0(a: number): number;
export function __wbindgen_export_1(a: number, b: number, c: number): number;
export const __wbindgen_export_2: WebAssembly.Table;