1 line
9.3 KiB
JavaScript
1 line
9.3 KiB
JavaScript
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7391],{3647:(e,s,a)=>{a.d(s,{A:()=>n});var t=a(4848),l=a(6540);function n(e){let{confirmedDelegetedUser:s,linksArray:a,user:n}=e,[i,r]=l.useState(a||null);return(l.useEffect(()=>{var e;if(a)return;let s=window.location.pathname,t=s.split("/"),l=[];l.push({title:"Home",path:s.match(/admin/)?"/admin":"/"}),null===(e=window.location.search)||void 0===e||e.match(/delegated=true/),t.forEach((e,s,a)=>{!(null==e?void 0:e.match(/./))||1==s||e.match(/^\d+$/)&&n&&!l.find(e=>!!e.title.match(/^entries$|^users$/))||l.push({title:e,path:(()=>{let e="";for(let t=0;t<a.length;t++){let l=a[t];!(t>s)&&l.match(/./)&&(e+="/".concat(l))}return e})()})}),r(l)},[]),i&&i[1])?(0,t.jsx)("div",{className:"text-sm mt-2 flex-wrap",children:i.map((e,s,a)=>s===i.length-1?(0,t.jsx)("a",{href:e.path,className:"text-slate-400 dark:text-slate-500 pointer-events-none",children:e.title},s):(0,t.jsxs)(l.Fragment,{children:[(0,t.jsx)("a",{href:e.path,className:"query-url",children:e.title}),(0,t.jsx)("span",{className:"opacity-20",children:"|"})]},s))}):(0,t.jsx)(l.Fragment,{})}},4839:(e,s,a)=>{a.d(s,{A:()=>x});var t=a(4848),l=a(6540),n=a(9020),i=a(65),r=a(1710),c=a(9753),d=a(7273),o=a(7216);function x(){let[e,s]=l.useState(!0),[a,x]=l.useState(0),[h,m]=l.useState(0);return(l.useEffect(()=>{a||(0,n.A)("/api/getDiskUsage").then(e=>{(null==e?void 0:e.total)&&(x(e.total),localStorage.setItem("disk_usage",e.total)),s(!1)})},[]),e)?(0,t.jsx)("div",{className:"button ghost small-text",style:{height:"30px"},children:(0,t.jsx)(r.A,{width:"15px",position:"relative"})}):(0,t.jsx)(l.Fragment,{children:a?(0,t.jsxs)("div",{className:"button ghost small-text normal-weight p-0",style:{height:"30px",padding:0},onClick:e=>{s(!0),(0,i.A)().then(()=>{m(e=>e+1),s(!1)})},children:[e&&(0,t.jsx)(r.A,{width:"15px"}),(0,t.jsx)(c.A,{size:20,className:"text-slate-400 mr-[3px]"}),(0,t.jsx)("span",{className:"font-bold text-slate-700 dark:text-white",children:a&&a.toFixed(2)}),(0,t.jsx)("span",{className:"text-slate-500",children:"mb"}),(0,t.jsx)(d.A,{size:17,className:"text-slate-400",strokeWidth:2})]}):(0,t.jsxs)("span",{className:"text-sm info gray font-normal w-auto",children:[(0,t.jsx)(o.A,{}),(0,t.jsx)("span",{children:"No Disk Usage Data Available Yet"})]})})}},65:(e,s,a)=>{a.d(s,{A:()=>l});var t=a(9020);async function l(){let e=await (0,t.A)("/api/getDiskUsage");localStorage.setItem("disk_usage",e.total)}},8181:(e,s,a)=>{a.d(s,{A:()=>k});var t=a(4848),l=a(6540),n=a(3368),i=a.n(n),r=a(6232),c=a(8631),d=a(9140),o=a(1915),x=a(4909),h=a(5014),m=a(2894),u=a(9508),j=a(5922);function p(e){let{user:s}=e,[a,n]=l.useState(!0);return(0,t.jsxs)("aside",{className:"aside"+(a?" mobile-collapsed":" mobile-expanded"),children:[(0,t.jsx)(r.A,{adminAside:!0,collapseAsideMobile:a,setCollapseAsideMobile:n}),(0,t.jsx)("hr",{className:"opacity-0 mt-4"}),(0,t.jsxs)("div",{className:"main-links"+(a?" hidden lg:flex":" "),children:[(0,t.jsxs)("a",{href:"/admin","data-currentlink":"/admin","data-strictlink":"true",children:[(0,t.jsx)(c.A,{size:20}),(0,t.jsx)("span",{children:"Dashboard"})]}),(0,t.jsxs)("a",{href:"/admin/".concat(null==s?void 0:s.id,"/databases"),"data-currentlink":"/admin/".concat(null==s?void 0:s.id,"/databases"),children:[(0,t.jsx)(d.A,{size:20}),(0,t.jsx)("span",{children:"Databases"})]}),(0,t.jsxs)("a",{href:"/admin/".concat(null==s?void 0:s.id,"/media"),"data-currentlink":"/admin/".concat(null==s?void 0:s.id,"/media"),children:[(0,t.jsx)(o.A,{size:20}),(0,t.jsx)("span",{children:"Media"})]}),(0,t.jsxs)("a",{href:"/admin/".concat(null==s?void 0:s.id,"/users"),"data-currentlink":"/admin/".concat(null==s?void 0:s.id,"/users"),children:[(0,t.jsx)(x.A,{size:20}),(0,t.jsx)("span",{children:"Users"})]}),(0,t.jsxs)("a",{href:"/admin/".concat(null==s?void 0:s.id,"/schema"),"data-currentlink":"/admin/".concat(null==s?void 0:s.id,"/schema"),children:[(0,t.jsx)(h.A,{size:20}),(0,t.jsx)("span",{children:"Schema"})]}),(0,t.jsxs)("a",{href:"/admin/".concat(null==s?void 0:s.id,"/api-keys"),"data-currentlink":"/admin/".concat(null==s?void 0:s.id,"/api-keys"),children:[(0,t.jsx)(m.A,{size:20}),(0,t.jsx)("span",{children:"API Keys"})]}),(0,t.jsxs)("a",{href:"/admin/".concat(null==s?void 0:s.id,"/connect"),"data-currentlink":"/admin/".concat(null==s?void 0:s.id,"/connect"),children:[(0,t.jsx)(u.A,{size:20}),(0,t.jsx)("span",{children:"Connect"})]}),!!((null==s?void 0:s.id)&&"1"==String(null==s?void 0:s.id))&&(0,t.jsx)(l.Fragment,{children:(0,t.jsxs)("a",{href:"/su","data-currentlink":"/su",children:[(0,t.jsx)(j.A,{size:20}),(0,t.jsx)("span",{children:"Super Admin User"})]})}),(0,t.jsx)("hr",{className:"opacity-80"}),(0,t.jsxs)("div",{className:"flex-col gap-0 items-start w-full",children:[(0,t.jsx)("a",{href:"/admin/".concat(null==s?void 0:s.id,"/settings"),"data-currentlink":"/admin/".concat(null==s?void 0:s.id,"/settings"),children:(0,t.jsx)("span",{children:"Settings"})}),(0,t.jsx)("a",{href:"/docs","data-currentlink":"/docs",target:"_blank",children:(0,t.jsx)("span",{children:"Documentation"})}),(0,t.jsx)("a",{href:"/logout","data-currentlink":"/logout",children:(0,t.jsx)("span",{children:"Logout"})})]})]})]})}a(7836);var f=a(2683);function g(e){let{user:s,extraHeaderContent:a}=e,[n,i]=l.useState(s||null);return l.useEffect(()=>{(null==s?void 0:s.logged_in_status)&&i(s||null)},[s]),(0,t.jsx)("section",{className:"overflow-visible w-full px-0 md:px-8 py-0 flex justify-center bg-white dark:bg-slate-800 shadow-lg gap-4 dark:shadow-black/10 shadow-slate-900/5 relative z-[100]",style:{zIndex:700,border:"none"},children:(0,t.jsxs)("div",{className:"w-full items-center justify-between gap-4 md:gap-8",children:[(0,t.jsxs)("div",{className:"hidden xl:flex flex-col items-stretch grow fixed xl:static top-0 right-0 px-4 xl:px-0 shadow-xl xl:shadow-none h-screen xl:h-auto overflow-auto xl:overflow-visible w-screen sl:w-auto bg-white xl:bg-transparent pb-10 xl:pb-0",id:"main-nav-content-wrapper",children:[(0,t.jsxs)("div",{className:"items-center mb-2 flex xl:hidden",children:[(0,t.jsx)("a",{href:"/",className:"hidden xl:flex",children:(0,t.jsx)("img",{src:"/images/logo-icon-alt-2.png",alt:"Logo Icon",width:37})}),(0,t.jsx)("button",{className:"outlined gray ml-auto",onClick:e=>{let s=document.getElementById("main-nav-content-wrapper");null==s||s.classList.toggle("hidden")},style:{border:"none"},children:(0,t.jsx)("span",{className:"font-semibold text-4xl",children:"✕"})})]}),(0,t.jsxs)("div",{className:"flex items-center w-full gap-6 grow flex-col xl:flex-row justify-start xl:justify-between",children:[(0,t.jsx)("div",{className:"gap-6",children:a}),(0,t.jsx)(f.A,{activeUser:n})]})]}),(0,t.jsxs)("button",{className:"bg-transparent w-16 p-4 gap-1.5 flex xl:hidden flex-col hover:bg-transparent transition-all ml-auto",onClick:e=>{let s=document.getElementById("main-nav-content-wrapper");null==s||s.classList.toggle("hidden")},style:{minWidth:"50px",backgroundColor:"transparent"},id:"main-header-hamburger-button","aria-label":"Mobile Hambutget Button",children:[(0,t.jsx)("div",{className:"w-full h-1 bg-slate-600 dark:bg-slate-400 rounded-full"}),(0,t.jsx)("div",{className:"w-full h-1 bg-slate-600 dark:bg-slate-400 rounded-full"}),(0,t.jsx)("div",{className:"w-full h-1 bg-slate-600 dark:bg-slate-400 rounded-full"})]})]})})}var v=a(2567),w=a(4839),b=a(9020);function k(e){let{children:s,head:a,user:n,productionEnvironment:c,extraHeaderContent:d,aceEditor:o}=e;return d||(d=(0,t.jsx)(w.A,{})),l.useEffect(()=>{let e=document.querySelectorAll("aside .main-links a");(0,v.A)({links:e}),document.cookie.match(/user_refresh=1/)&&(0,b.A)("/api/reAuthenticateUser",{method:"post",body:{}},!0).then(e=>{e.status&&e.user&&(document.cookie="user_refresh=0;max-age=0",localStorage.setItem("csrf",e.user.csrf_k),localStorage.setItem("user",JSON.stringify(e.user)),window.location.reload())})},[]),(0,t.jsxs)(l.Fragment,{children:[(0,t.jsxs)(i(),{children:[a,(0,t.jsxs)(l.Fragment,{children:[(0,t.jsx)("script",{src:"https://cdnjs.cloudflare.com/ajax/libs/ace/1.22.0/ace.min.js",integrity:"sha512-q6CTB0jS+VuJnSct82rVcWlI06LGzNjaG3CWenHWVUncRvc4UQMFkA3a5Ip880xr+lBx38FcHDclOxPdSg+sBw==",crossOrigin:"anonymous",referrerPolicy:"no-referrer"}),(0,t.jsx)("script",{src:"https://cdnjs.cloudflare.com/ajax/libs/ace/1.22.0/ext-language_tools.min.js",integrity:"sha512-6g6cvocV7eT/J8L44lL8gJKqq9onqQeYGgJO0DmrsYFcCfRl6wYkYA/KHS768r4QVTB4JxsCcMQ9gIezxpTCZw==",crossOrigin:"anonymous",referrerPolicy:"no-referrer"})]})]}),(0,t.jsxs)("div",{className:"admin w-full flex items-start gap-0",children:[(0,t.jsx)(p,{user:n}),(0,t.jsxs)("main",{className:"relative",children:[(0,t.jsx)(g,{user:n,extraHeaderContent:d}),(0,t.jsx)("div",{className:"admin-content relative z-10",children:s}),(0,t.jsx)("footer",{className:"flex justify-center w-full items-center p-4",children:(0,t.jsxs)("div",{className:"max-w-6xl w-full justify-center flex-wrap",children:[(0,t.jsx)("div",{className:"flex items-center gap-2 scale-75",children:(0,t.jsx)(r.A,{})}),(0,t.jsx)("span",{className:"opacity-25",children:"|"}),(0,t.jsxs)("span",{className:"text-sm text-slate-400 dark:text-slate-600 text-center",children:[new Date().getFullYear()," \xa9 Datasquirel. All rights reserved."]}),(0,t.jsx)("span",{className:"opacity-25",children:"|"}),(0,t.jsx)("a",{href:"/docs",children:"Docs"}),(0,t.jsx)("span",{className:"opacity-25",children:"|"}),(0,t.jsx)("a",{href:"/terms",children:"Terms"})]})})]})]})]})}}}]); |