dsql-admin/dsql-app/.local_dist/server/pages/su/users/[single].js

1 line
21 KiB
JavaScript
Raw Normal View History

2024-12-08 19:56:57 +00:00
"use strict";(()=>{var e={};e.id=3632,e.ids=[636,3632],e.modules={63709:(e,t,s)=>{s.r(t),s.d(t,{config:()=>er,default:()=>X,getServerSideProps:()=>es,getStaticPaths:()=>et,getStaticProps:()=>ee,reportWebVitals:()=>ea,routeModule:()=>eu,unstable_getServerProps:()=>ec,unstable_getServerSideProps:()=>eo,unstable_getStaticParams:()=>en,unstable_getStaticPaths:()=>el,unstable_getStaticProps:()=>ei});var r={};s.r(r),s.d(r,{default:()=>Y,getServerSideProps:()=>Z});var a=s(63865),i=s(9455),l=s(30671),n=s(49407),c=s(68268),o=s(8732),u=s(82015),d=s.n(u),p=s(93615),x=s.n(p),h=s(64987),m=s(21498),j=s(46437),f=s(32415),y=s(63715),g=s(94081);function v({user:e,refresh:t,setRefresh:s}){let[r,a]=d().useState(!1),[i,l]=d().useState([]);return(0,o.jsxs)("section",{className:"paper",children:[(0,o.jsx)("h2",{className:"text-xl m-0",children:"User Backups"}),!i&&(0,o.jsx)(f.A,{width:"20px",position:"relative"}),i&&!i[0]&&(0,o.jsx)("div",{children:"This user has no backups"}),i&&i[0]&&i.sort((e,t)=>parseInt(e)>parseInt(t)?-1:1).map((t,s)=>{let r=new Date(parseInt(t));return(0,o.jsxs)("a",{href:`/su/users/${e.id}/${t}`,className:"card w-full items-center",children:[(0,o.jsx)(g.A,{color:"inherit",className:"opacity-40 text-slate-500"}),(0,o.jsx)("b",{children:"Backup:"}),(0,o.jsx)("span",{children:r.toString()})]},t)})]})}var b=s(34844),w=s(8203),S=s(48407),q=s(85781);function k({user:e,file:t,activeFile:s,setActiveFile:r}){return(0,o.jsxs)("button",{className:"justify-start gap-4"+(s?.path===`${t.root}/${t.name}`?" dark":" light-gray"),onClick:s=>{(0,y.A)("/api/admin/grabFile",{method:"post",body:{user:e,type:"file",path:`${t.root}/${t.name}`}}).then(e=>{if(e.success)try{r({title:t.name,path:`${t.root}/${t.name}`,data:JSON.stringify(JSON.parse(e.data),null,4)})}catch(s){r({title:t.name,path:`${t.root}/${t.name}`,data:e.data})}})},children:[(0,o.jsx)(q.A,{fontSize:"small",className:"text-slate-400"}),t.name]})}function N({user:e,file:t,activeFile:s,setActiveFile:r}){let[a,i]=d().useState(null),[l,n]=d().useState(!1);return(0,o.jsxs)("div",{className:"flex-col w-full items-start relative",children:[(0,o.jsxs)("div",{children:[(0,o.jsx)(w.A,{fontSize:"small",className:"text-slate-400"}),t.name,(0,o.jsx)(S.A,{className:"ml-auto absolute right-2"})]}),t.content&&(0,o.jsx)("div",{className:"flex-col w-full pl-4 items-start ml-2",style:{borderLeft:"1px solid var(--slate-200)"},children:t.content.map((t,a)=>t?.type?.match(/file/i)?(0,o.jsx)(k,{user:e,file:t,activeFile:s,setActiveFile:r},a):(0,o.jsx)(N,{user:e,file:t,activeFile:s,setActiveFile:r},a))})]})}function A({user:e,rootFilesArray:t}){let[s,r]=d().useState(null);return(0,o.jsxs)("section",{className:"paper",children:[(0,o.jsx)("h3",{className:"text-lg m-0",children:"User Files"}),(0,o.jsxs)("div",{className:"w-full items-start max-w-7xl",children:[(0,o.jsx)("div",{className:"flex-col items-stretch w-[40%]",children:t.map((t,a)=>t?.type?.match(/file/)?(0,o.jsx)(k,{user:e,file:t,activeFile:s,setActiveFile:r},a):(0,o.jsx)(N,{user:e,file:t,activeFile:s,setActiveFile:r},a))}),(0,o.jsx)("div",{className:"grow flex-col items-start justify-start w-[60%] h-full -mt-4",children:s&&(0,o.jsx)(b.A,{content:s.data||"",language:"javascript"})})]})]})}s(58548);var M=s(90627),C=s(34043),F=s.n(C),P=s(7299),_=s.n(P),D=s(61919),L=s.n(D),R=s(34350),T=s.n(R),z=s(71757),E=s.n(z),H=s(79005),$=s.n(H),O=s(45561),V=s.n(O);let B=(0,M.styled)(L())(({theme:e})=>({[`&.${D.tableCellClasses.head}`]:{backgroundColor:"var(--slate-800)",color:"white"},[`&.${D.tableCellClasses.body}`]:{}}));function Q({data:e,user:t}){try{let t=Object.keys(e[0]);return(0,o.jsx)(d().Fragment,{children:(0,o.jsx)("div",{className:"p-4 bg-slate-200 rounded-md overflow-hidden w-full max-w-6xl",children:(0,o.jsx)(T(),{component:V(),sx:{width:"100%"},children:(0,o.jsxs)(F(),{sx:{minWidth:650},"aria-label":"simple table",children:[(0,o.jsx)(E(),{children:(0,o.jsx)($(),{children:t&&t[0]&&t.map((e,t)=>(0,o.jsx)(B,{align:"left",children:e},t+1))})}),(0,o.jsx)(_(),{children:e&&e[0]&&e.map((e,s)=>(0,o.jsx)($(),{sx:{"&:last-child td, &:last-child th":{border: