dsql-admin/dsql-app/.local_dist/static/chunks/9799-16431e3472e19630.js
Benjamin Toby 86f931fb82 Updates
2024-12-08 09:57:48 +01:00

1 line
9.8 KiB
JavaScript

"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9799],{4709:(e,s,a)=>{a.d(s,{A:()=>n});var l=a(74848),t=a(96540);function n(e){var s,a,n;let{confirmedDelegetedUser:i,linksArray:r,user:c}=e;null==i||i.delegated,null==i||null===(s=i.priviledges)||void 0===s||s.match(/Edit Tables/i),null==i||null===(a=i.priviledges)||void 0===a||a.match(/Delete Tables/i),null==i||null===(n=i.priviledges)||void 0===n||n.match(/Create Tables/i);let[d,o]=t.useState(r||null);return(t.useEffect(()=>{var e;if(r)return;let s=window.location.pathname,a=s.split("/"),l=[];l.push({title:"Home",path:s.match(/admin/)?"/admin":"/"}),null===(e=window.location.search)||void 0===e||e.match(/delegated=true/),a.forEach((e,s,a)=>{!(null==e?void 0:e.match(/./))||1==s||e.match(/^\d+$/)&&c&&!l.find(e=>!!e.title.match(/^entries$|^users$/))||l.push({title:e,path:(()=>{let e="";for(let l=0;l<a.length;l++){let t=a[l];!(l>s)&&t.match(/./)&&(e+="/".concat(t))}return e})()})}),o(l)},[]),d&&d[1])?(0,l.jsx)("div",{className:"text-sm mt-2 flex-wrap",children:d.map((e,s,a)=>s===d.length-1?(0,l.jsx)("a",{href:e.path,className:"text-slate-400 dark:text-slate-500 pointer-events-none",children:e.title},s):(0,l.jsxs)(t.Fragment,{children:[(0,l.jsx)("a",{href:e.path,className:"query-url",children:e.title}),(0,l.jsx)("span",{className:"opacity-20",children:"|"})]},s))}):(0,l.jsx)(t.Fragment,{})}},41238:(e,s,a)=>{a.d(s,{A:()=>x});var l=a(74848),t=a(96540),n=a(23698),i=a(17531),r=a(620),c=a(34181),d=a(79753),o=a(87273);function x(e){let[s,a]=t.useState(!0),[x,h]=t.useState(0),[u,m]=t.useState(0);return(t.useEffect(()=>{x||(0,n.A)("/api/getDiskUsage").then(e=>{(null==e?void 0:e.total)&&(h(e.total),localStorage.setItem("disk_usage",e.total)),a(!1)})},[]),s)?(0,l.jsx)("div",{className:"button ghost small-text",style:{height:"30px"},children:(0,l.jsx)(r.A,{width:"15px",position:"relative"})}):(0,l.jsx)(t.Fragment,{children:x?(0,l.jsxs)("div",{className:"button ghost small-text normal-weight p-0",style:{height:"30px",padding:0},onClick:e=>{a(!0),(0,i.A)().then(()=>{m(e=>e+1),a(!1)})},children:[s&&(0,l.jsx)(r.A,{width:"15px"}),(0,l.jsx)(d.A,{size:20,className:"text-slate-400 mr-[3px]"}),(0,l.jsx)("span",{className:"font-bold text-slate-700 dark:text-white",children:x&&x.toFixed(2)}),(0,l.jsx)("span",{className:"text-slate-500",children:"mb"}),(0,l.jsx)(o.A,{size:17,className:"text-slate-400",strokeWidth:2})]}):(0,l.jsxs)("span",{className:"text-sm info gray font-normal w-auto",children:[(0,l.jsx)(c.A,{color:"inherit",className:"opacity-50 text-slate-500",fontSize:"small"}),(0,l.jsx)("span",{children:"No Disk Usage Data Available Yet"})]})})}},17531:(e,s,a)=>{a.d(s,{A:()=>t});var l=a(23698);async function t(){let e=await (0,l.A)("/api/getDiskUsage");localStorage.setItem("disk_usage",e.total)}},56086:(e,s,a)=>{var l=a(77836);e.exports=function(e,s){return s?(null==e?void 0:e.id)&&String(null==e?void 0:e.id)==(l.env.DSQL_SU_USER_ID||"1")&&"true":(null==e?void 0:e.id)&&"1"==String(null==e?void 0:e.id)&&"true"}},51187:(e,s,a)=>{a.d(s,{A:()=>y});var l=a(74848),t=a(96540),n=a(13368),i=a.n(n);a(13980);var r=a(61638),c=a(98631),d=a(59140),o=a(1915),x=a(94909),h=a(45014),u=a(2894),m=a(79508),j=a(5922),p=a(56086),g=a.n(p);function f(e){let{user:s}=e,[a,n]=t.useState(!0);return(0,l.jsxs)("aside",{className:"aside"+(a?" mobile-collapsed":" mobile-expanded"),children:[(0,l.jsx)(r.A,{adminAside:!0,collapseAsideMobile:a,setCollapseAsideMobile:n}),(0,l.jsx)("hr",{className:"opacity-0 mt-4"}),(0,l.jsxs)("div",{className:"main-links"+(a?" hidden lg:flex":" "),children:[(0,l.jsxs)("a",{href:"/admin","data-currentlink":"/admin","data-strictlink":"true",children:[(0,l.jsx)(c.A,{size:20}),(0,l.jsx)("span",{children:"Dashboard"})]}),(0,l.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,l.jsx)(d.A,{size:20}),(0,l.jsx)("span",{children:"Databases"})]}),(0,l.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,l.jsx)(o.A,{size:20}),(0,l.jsx)("span",{children:"Media"})]}),(0,l.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,l.jsx)(x.A,{size:20}),(0,l.jsx)("span",{children:"Users"})]}),(0,l.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,l.jsx)(h.A,{size:20}),(0,l.jsx)("span",{children:"Schema"})]}),(0,l.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,l.jsx)(u.A,{size:20}),(0,l.jsx)("span",{children:"API Keys"})]}),(0,l.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,l.jsx)(m.A,{size:20}),(0,l.jsx)("span",{children:"Connect"})]}),g()(s)&&(0,l.jsx)(t.Fragment,{children:(0,l.jsxs)("a",{href:"/su","data-currentlink":"/su",children:[(0,l.jsx)(j.A,{size:20}),(0,l.jsx)("span",{children:"Super Admin User"})]})}),(0,l.jsx)("hr",{className:"opacity-80"}),(0,l.jsxs)("div",{className:"flex-col gap-0 items-start w-full",children:[(0,l.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,l.jsx)("span",{children:"Settings"})}),(0,l.jsx)("a",{href:"/docs","data-currentlink":"/docs",target:"_blank",children:(0,l.jsx)("span",{children:"Documentation"})}),(0,l.jsx)("a",{href:"/logout","data-currentlink":"/logout",children:(0,l.jsx)("span",{children:"Logout"})})]})]})]})}a(63782);var v=a(37452);function b(e){let{user:s,extraHeaderContent:a}=e,[n,i]=t.useState(s||null);return t.useEffect(()=>{(null==s?void 0:s.logged_in_status)&&i(s||null)},[s]),(0,l.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 z-50 shadow-slate-900/5",style:{zIndex:700,border:"none"},children:(0,l.jsxs)("div",{className:"w-full items-center justify-between gap-4 md:gap-8",children:[(0,l.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,l.jsxs)("div",{className:"items-center mb-2 flex xl:hidden",children:[(0,l.jsx)("a",{href:"/",className:"hidden xl:flex",children:(0,l.jsx)("img",{src:"/images/logo-icon-alt-2.png",alt:"Logo Icon",width:37})}),(0,l.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,l.jsx)("span",{className:"font-semibold text-4xl",children:"✕"})})]}),(0,l.jsxs)("div",{className:"flex items-center w-full gap-6 grow flex-col xl:flex-row justify-start xl:justify-between",children:[(0,l.jsx)("div",{className:"gap-6",children:a}),(0,l.jsx)(v.A,{activeUser:n})]})]}),(0,l.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,l.jsx)("div",{className:"w-full h-1 bg-slate-600 dark:bg-slate-400 rounded-full"}),(0,l.jsx)("div",{className:"w-full h-1 bg-slate-600 dark:bg-slate-400 rounded-full"}),(0,l.jsx)("div",{className:"w-full h-1 bg-slate-600 dark:bg-slate-400 rounded-full"})]})]})})}var w=a(26709),k=a(41238),N=a(23698);function y(e){let{children:s,head:a,user:n,productionEnvironment:c,extraHeaderContent:d,aceEditor:o}=e;return d||(d=(0,l.jsx)(k.A,{})),t.useEffect(()=>{let e=document.querySelectorAll("aside .main-links a");(0,w.A)({links:e}),document.cookie.match(/user_refresh=1/)&&(0,N.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,l.jsxs)(t.Fragment,{children:[(0,l.jsxs)(i(),{children:[a,(0,l.jsxs)(t.Fragment,{children:[(0,l.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,l.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,l.jsxs)("div",{className:"admin w-full flex items-start gap-0",children:[(0,l.jsx)(f,{user:n}),(0,l.jsxs)("main",{className:"relative",children:[(0,l.jsx)(b,{user:n,extraHeaderContent:d}),(0,l.jsx)("div",{className:"admin-content",children:s}),(0,l.jsx)("footer",{className:"flex justify-center w-full items-center p-4",children:(0,l.jsxs)("div",{className:"max-w-6xl w-full justify-center flex-wrap",children:[(0,l.jsx)("div",{className:"flex items-center gap-2 scale-75",children:(0,l.jsx)(r.A,{})}),(0,l.jsx)("span",{className:"opacity-25",children:"|"}),(0,l.jsxs)("span",{className:"text-sm text-slate-400 dark:text-slate-600 text-center",children:[new Date().getFullYear()," \xa9 Datasquirel. All rights reserved."]}),(0,l.jsx)("span",{className:"opacity-25",children:"|"}),(0,l.jsx)("a",{href:"/docs",children:"Docs"}),(0,l.jsx)("span",{className:"opacity-25",children:"|"}),(0,l.jsx)("a",{href:"/terms",children:"Terms"})]})})]})]})]})}a(28133)}}]);