diff --git a/backend/internal/web/public/assets/index.css b/backend/internal/web/public/assets/index.css new file mode 100644 index 0000000..356ac8c --- /dev/null +++ b/backend/internal/web/public/assets/index.css @@ -0,0 +1 @@ +.my-btn{height:100%;background-color:#0000;color:var(--bs-primary);text-align:center}.my-btn:hover{background-color:#0000001a} diff --git a/backend/internal/web/public/assets/index.js b/backend/internal/web/public/assets/index.js new file mode 100644 index 0000000..9bfe348 --- /dev/null +++ b/backend/internal/web/public/assets/index.js @@ -0,0 +1 @@ +(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const n of document.querySelectorAll('link[rel="modulepreload"]'))i(n);new MutationObserver(n=>{for(const s of n)if(s.type==="childList")for(const o of s.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&i(o)}).observe(document,{childList:!0,subtree:!0});function l(n){const s={};return n.integrity&&(s.integrity=n.integrity),n.referrerPolicy&&(s.referrerPolicy=n.referrerPolicy),n.crossOrigin==="use-credentials"?s.credentials="include":n.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function i(n){if(n.ep)return;n.ep=!0;const s=l(n);fetch(n.href,s)}})();const pe=!1,$e=(e,t)=>e===t,we=Symbol("solid-track"),B={equals:$e};let te=re;const E=1,M=2,le={owned:null,cleanups:null,context:null,owner:null};var d=null;let F=null,ye=null,h=null,g=null,A=null,R=0;function P(e,t){const l=h,i=d,n=e.length===0,s=t===void 0?i:t,o=n?le:{owned:null,cleanups:null,context:s?s.context:null,owner:s},r=n?e:()=>e(()=>T(()=>N(o)));d=o,h=null;try{return O(r,!0)}finally{h=l,d=i}}function ie(e,t){t=t?Object.assign({},B,t):B;const l={value:e,observers:null,observerSlots:null,comparator:t.equals||void 0},i=n=>(typeof n=="function"&&(n=n(l.value)),se(l,n));return[ne.bind(l),i]}function V(e,t,l){const i=q(e,t,!1,E);D(i)}function me(e,t,l){te=ve;const i=q(e,t,!1,E);i.user=!0,A?A.push(i):D(i)}function Se(e,t,l){l=l?Object.assign({},B,l):B;const i=q(e,t,!0,0);return i.observers=null,i.observerSlots=null,i.comparator=l.equals||void 0,D(i),ne.bind(i)}function T(e){if(h===null)return e();const t=h;h=null;try{return e()}finally{h=t}}function _e(e){me(()=>T(e))}function xe(e){return d===null||(d.cleanups===null?d.cleanups=[e]:d.cleanups.push(e)),e}function ne(){if(this.sources&&this.state)if(this.state===E)D(this);else{const e=g;g=null,O(()=>U(this),!1),g=e}if(h){const e=this.observers?this.observers.length:0;h.sources?(h.sources.push(this),h.sourceSlots.push(e)):(h.sources=[this],h.sourceSlots=[e]),this.observers?(this.observers.push(h),this.observerSlots.push(h.sources.length-1)):(this.observers=[h],this.observerSlots=[h.sources.length-1])}return this.value}function se(e,t,l){let i=e.value;return(!e.comparator||!e.comparator(i,t))&&(e.value=t,e.observers&&e.observers.length&&O(()=>{for(let n=0;n1e6)throw g=[],new Error},!1)),t}function D(e){if(!e.fn)return;N(e);const t=R;Ce(e,e.value,t)}function Ce(e,t,l){let i;const n=d,s=h;h=d=e;try{i=e.fn(t)}catch(o){return e.pure&&(e.state=E,e.owned&&e.owned.forEach(N),e.owned=null),e.updatedAt=l+1,ce(o)}finally{h=s,d=n}(!e.updatedAt||e.updatedAt<=l)&&(e.updatedAt!=null&&"observers"in e?se(e,i):e.value=i,e.updatedAt=l)}function q(e,t,l,i=E,n){const s={fn:e,state:i,updatedAt:null,owned:null,sources:null,sourceSlots:null,cleanups:null,value:t,owner:d,context:d?d.context:null,pure:l};return d===null||d!==le&&(d.owned?d.owned.push(s):d.owned=[s]),s}function H(e){if(e.state===0)return;if(e.state===M)return U(e);if(e.suspense&&T(e.suspense.inFallback))return e.suspense.effects.push(e);const t=[e];for(;(e=e.owner)&&(!e.updatedAt||e.updatedAt=0;l--)if(e=t[l],e.state===E)D(e);else if(e.state===M){const i=g;g=null,O(()=>U(e,t[0]),!1),g=i}}function O(e,t){if(g)return e();let l=!1;t||(g=[]),A?l=!0:A=[],R++;try{const i=e();return Ae(l),i}catch(i){l||(A=null),g=null,ce(i)}}function Ae(e){if(g&&(re(g),g=null),e)return;const t=A;A=null,t.length&&O(()=>te(t),!1)}function re(e){for(let t=0;t=0;t--)N(e.tOwned[t]);delete e.tOwned}if(e.owned){for(t=e.owned.length-1;t>=0;t--)N(e.owned[t]);e.owned=null}if(e.cleanups){for(t=e.cleanups.length-1;t>=0;t--)e.cleanups[t]();e.cleanups=null}e.state=0}function Ee(e){return e instanceof Error?e:new Error(typeof e=="string"?e:"Unknown error",{cause:e})}function ce(e,t=d){throw Ee(e)}const ke=Symbol("fallback");function Z(e){for(let t=0;t1?[]:null;return xe(()=>Z(s)),()=>{let f=e()||[],a=f.length,u,c;return f[we],T(()=>{let b,p,S,x,C,w,$,y,v;if(a===0)o!==0&&(Z(s),s=[],i=[],n=[],o=0,r&&(r=[])),l.fallback&&(i=[ke],n[0]=P(L=>(s[0]=L,l.fallback())),o=1);else if(o===0){for(n=new Array(a),c=0;c=w&&y>=w&&i[$]===f[y];$--,y--)S[y]=n[$],x[y]=s[$],r&&(C[y]=r[$]);for(b=new Map,p=new Array(y+1),c=y;c>=w;c--)v=f[c],u=b.get(v),p[c]=u===void 0?-1:u,b.set(v,c);for(u=w;u<=$;u++)v=i[u],c=b.get(v),c!==void 0&&c!==-1?(S[c]=n[u],x[c]=s[u],r&&(C[c]=r[u]),c=p[c],b.set(v,c)):s[u]();for(c=w;ce(t||{}))}function Te(e){const t="fallback"in e&&{fallback:()=>e.fallback};return Se(Ne(()=>e.each,e.children,t||void 0))}function De(e,t,l){let i=l.length,n=t.length,s=i,o=0,r=0,f=t[n-1].nextSibling,a=null;for(;ou-r){const p=t[o];for(;r{n=s,t===document?e():_(t,e(),t.firstChild?null:void 0,l)},i.owner),()=>{n(),t.textContent=""}}function I(e,t,l,i){let n;const s=()=>{const r=document.createElement("template");return r.innerHTML=e,r.content.firstChild},o=()=>(n||(n=s())).cloneNode(!0);return o.cloneNode=o,o}function Ie(e,t=window.document){const l=t[z]||(t[z]=new Set);for(let i=0,n=e.length;iK(e,t(),n,l),i)}function Pe(e){let t=e.target;const l=`$$${e.type}`,i=e.target,n=e.currentTarget,s=f=>Object.defineProperty(e,"target",{configurable:!0,value:f}),o=()=>{const f=t[l];if(f&&!t.disabled){const a=t[`${l}Data`];if(a!==void 0?f.call(t,a,e):f.call(t,e),e.cancelBubble)return}return t.host&&typeof t.host!="string"&&!t.host._$host&&t.contains(e.target)&&s(t.host),!0},r=()=>{for(;o()&&(t=t._$host||t.parentNode||t.host););};if(Object.defineProperty(e,"currentTarget",{configurable:!0,get(){return t||document}}),e.composedPath){const f=e.composedPath();s(f[0]);for(let a=0;a{let r=t();for(;typeof r=="function";)r=r();l=K(e,r,l,i)}),()=>l;if(Array.isArray(t)){const r=[],f=l&&Array.isArray(l);if(G(r,t,l,n))return V(()=>l=K(e,r,l,i,!0)),()=>l;if(r.length===0){if(l=k(e,l,i),o)return l}else f?l.length===0?ee(e,r,i):De(e,l,r):(l&&k(e),ee(e,r));l=r}else if(t.nodeType){if(Array.isArray(l)){if(o)return l=k(e,l,i,t);k(e,l,null,t)}else l==null||l===""||!e.firstChild?e.appendChild(t):e.replaceChild(t,e.firstChild);l=t}}return l}function G(e,t,l,i){let n=!1;for(let s=0,o=t.length;s=0;o--){const r=t[o];if(n!==r){const f=r.parentNode===e;!s&&!o?f?e.replaceChild(n,r):e.insertBefore(n,l):f&&r.remove()}else s=!0}}else e.insertBefore(n,l);return[n]}const[Be,Me]=ie([]),He="",Ue=async()=>{const e=He+"/api/all";return await(await fetch(e)).json()};var je=I(''),Ke=I(''),Re=I('.
');function Fe(e){const t="http://"+e.host.IP;let l=je();e.host.Now==1&&(l=Ke());let i=!1;return e.host.Known==1&&(i=!0),(()=>{var n=Re(),s=n.firstChild,o=s.firstChild,r=s.nextSibling,f=r.nextSibling,a=f.nextSibling,u=a.firstChild,c=a.nextSibling,m=c.nextSibling,b=m.nextSibling,p=b.nextSibling,S=p.firstChild,x=S.firstChild,C=p.nextSibling;return _(s,()=>e.index,o),_(r,()=>e.host.Name),_(f,()=>e.host.Iface),Le(u,"href",t),_(u,()=>e.host.IP),_(c,()=>e.host.Mac),_(m,()=>e.host.Hw),_(b,()=>e.host.Date),x.checked=i,_(C,l),n})()}var Ve=I('
Header
');function Ge(){const e=t=>{console.log("SORT BY",t)};return _e(async()=>{Me(await Ue())}),(()=>{var t=Ve(),l=t.firstChild,i=l.nextSibling,n=i.firstChild,s=n.firstChild,o=s.firstChild,r=o.firstChild,f=r.nextSibling,a=f.firstChild,u=a.nextSibling,c=f.nextSibling,m=c.firstChild,b=m.nextSibling,p=c.nextSibling,S=p.firstChild,x=S.nextSibling,C=p.nextSibling,w=C.firstChild,$=w.nextSibling,y=C.nextSibling,v=y.firstChild,L=v.nextSibling,Q=y.nextSibling,fe=Q.firstChild,W=fe.nextSibling,X=Q.nextSibling,ae=X.firstChild,Y=ae.nextSibling,ue=X.nextSibling,he=ue.firstChild,J=he.nextSibling,de=s.nextSibling;return u.$$click=e,u.$$clickData="Name",b.$$click=e,b.$$clickData="Iface",x.$$click=e,x.$$clickData="IP",$.$$click=e,$.$$clickData="Mac",L.$$click=e,L.$$clickData="Hw",W.$$click=e,W.$$clickData="Date",Y.$$click=e,Y.$$clickData="Known",J.$$click=e,J.$$clickData="Now",_(de,j(Te,{get each(){return Be()},children:(be,ge)=>j(Fe,{host:be,index:ge})})),t})()}Ie(["click"]);var qe=I('
');function Qe(){return(()=>{var e=qe(),t=e.firstChild,l=t.firstChild;return _(l,j(Ge,{})),e})()}const We=document.getElementById("root");Oe(()=>j(Qe,{}),We); diff --git a/backend/internal/web/templates/header.html b/backend/internal/web/templates/header.html index 5008d2d..1d2cd2a 100644 --- a/backend/internal/web/templates/header.html +++ b/backend/internal/web/templates/header.html @@ -20,8 +20,6 @@ {{ end }} - -
Name Iface IP MAC Hardware Date Known Online
- - - - - - - - - - - - - -
Name Iface IP MAC Hardware Date Known Online
-
-
- - - - - - - + + + + + +
{{ template "footer.html" }} {{ end }} \ No newline at end of file diff --git a/backend/internal/web/templates/old_index.html b/backend/internal/web/templates/old_index.html new file mode 100644 index 0000000..440c56f --- /dev/null +++ b/backend/internal/web/templates/old_index.html @@ -0,0 +1,73 @@ +{{ define "oldindex.html" }} + + +
+
+
+
+ + +
+
+
+
+
+
+
+
+
+ + + + + + + + +
+
+
+ + +
+
+
+
+
+ + + + + + + + + + + + + + +
Name Iface IP MAC Hardware Date Known Online
+
+
+
+
+
+ + + + + +{{ template "footer.html" }} +{{ end }} \ No newline at end of file diff --git a/frontend/src/App.css b/frontend/src/App.css index e69de29..8707468 100644 --- a/frontend/src/App.css +++ b/frontend/src/App.css @@ -0,0 +1,10 @@ +/* Sort button */ +.my-btn { + height: 100%; + background-color: #00000000; + color: var(--bs-primary); + text-align: center; +} +.my-btn:hover { + background-color: #0000001a; +} \ No newline at end of file diff --git a/frontend/src/components/TableRow.tsx b/frontend/src/components/TableRow.tsx new file mode 100644 index 0000000..ad0c9a6 --- /dev/null +++ b/frontend/src/components/TableRow.tsx @@ -0,0 +1,38 @@ + + + +function TableRow(_props: any) { + + const link = "http://" + _props.host.IP; + + let now = ; + if (_props.host.Now == 1) { + now = ; + }; + + let known = false; + if (_props.host.Known == 1) { + known = true; + } + + return ( + + {_props.index}. + {_props.host.Name} + {_props.host.Iface} + {_props.host.IP} + {_props.host.Mac} + {_props.host.Hw} + {_props.host.Date} + +
+ +
+ + {now} + + + ) +} + +export default TableRow diff --git a/frontend/src/pages/Body.tsx b/frontend/src/pages/Body.tsx index 7b8e2e1..261053b 100644 --- a/frontend/src/pages/Body.tsx +++ b/frontend/src/pages/Body.tsx @@ -2,6 +2,7 @@ import { onMount } from "solid-js"; import { allHosts, setAllHosts } from "../functions/exports"; import { getAllHosts } from "../functions/api"; import { For } from "solid-js"; +import TableRow from "../components/TableRow"; function Body() { @@ -33,21 +34,12 @@ function Body() { Date Known Online + {(host, index) => - - {index()+1}. - {host.Name} - {host.Iface} - {host.IP} - {host.Mac} - {host.Hw} - {host.Date} - {host.Known} - {host.Now} - + }