1 line
21 KiB
JavaScript
1 line
21 KiB
JavaScript
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4916],{50027:function(e,t,s){"use strict";var a=s(64836);t.Z=void 0;var n=a(s(64938)),r=s(85893),l=(0,n.default)([(0,r.jsx)("path",{d:"m19.21 12.04-1.53-.11-.3-1.5C16.88 7.86 14.62 6 12 6 9.94 6 8.08 7.14 7.12 8.96l-.5.95-1.07.11C3.53 10.24 2 11.95 2 14c0 2.21 1.79 4 4 4h13c1.65 0 3-1.35 3-3 0-1.55-1.22-2.86-2.79-2.96zm-5.76.96v3h-2.91v-3H8l4-4 4 4h-2.55z",opacity:".3"},"0"),(0,r.jsx)("path",{d:"M19.35 10.04C18.67 6.59 15.64 4 12 4 9.11 4 6.6 5.64 5.35 8.04 2.34 8.36 0 10.91 0 14c0 3.31 2.69 6 6 6h13c2.76 0 5-2.24 5-5 0-2.64-2.05-4.78-4.65-4.96zM19 18H6c-2.21 0-4-1.79-4-4 0-2.05 1.53-3.76 3.56-3.97l1.07-.11.5-.95C8.08 7.14 9.94 6 12 6c2.62 0 4.88 1.86 5.39 4.43l.3 1.5 1.53.11c1.56.1 2.78 1.41 2.78 2.96 0 1.65-1.35 3-3 3zM8 13h2.55v3h2.9v-3H16l-4-4z"},"1")],"BackupTwoTone");t.Z=l},64689:function(e,t,s){"use strict";var a=s(64836);t.Z=void 0;var n=a(s(64938)),r=s(85893),l=(0,n.default)([(0,r.jsx)("path",{d:"M18 19h-5v-4h-2v4H6v-8.9l6-4.58 6 4.58z",opacity:".3"},"0"),(0,r.jsx)("path",{d:"M12 3 6 7.58V6H4v3.11L1 11.4l1.21 1.59L4 11.62V21h16v-9.38l1.79 1.36L23 11.4 12 3zm6 16h-5v-4h-2v4H6v-8.9l6-4.58 6 4.58V19zM10 1c0 1.66-1.34 3-3 3-.55 0-1 .45-1 1H4c0-1.66 1.34-3 3-3 .55 0 1-.45 1-1h2z"},"1")],"CottageTwoTone");t.Z=l},39269:function(e,t,s){"use strict";var a=s(64836);t.Z=void 0;var n=a(s(64938)),r=s(85893),l=(0,n.default)([(0,r.jsx)("path",{d:"M12 4c-4.42 0-8 3.58-8 8s3.58 8 8 8 8-3.58 8-8-3.58-8-8-8zm1 13h-2v-2h2v2zm0-4h-2V7h2v6z",opacity:".3"},"0"),(0,r.jsx)("path",{d:"M11.99 2C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2zM12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8zm-1-5h2v2h-2zm0-8h2v6h-2z"},"1")],"ErrorTwoTone");t.Z=l},30212:function(e,t,s){"use strict";var a=s(64836);t.Z=void 0;var n=a(s(64938)),r=s(85893),l=(0,n.default)([(0,r.jsx)("path",{d:"M11.17 4H7v11h14V6h-7.83z",opacity:".3"},"0"),(0,r.jsx)("path",{d:"M21 4h-7l-2-2H7c-1.1 0-1.99.9-1.99 2L5 15c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm0 11H7V4h4.17l2 2H21v9z"},"1"),(0,r.jsx)("path",{d:"M3 6H1v13c0 1.1.9 2 2 2h17v-2H3V6z"},"2")],"FolderCopyTwoTone");t.Z=l},57835:function(e,t,s){"use strict";var a=s(64836);t.Z=void 0;var n=a(s(64938)),r=s(85893),l=(0,n.default)([(0,r.jsx)("path",{d:"M13 4H6v16h12V9h-5z",opacity:".3"},"0"),(0,r.jsx)("path",{d:"m20 8-6-6H6c-1.1 0-1.99.9-1.99 2L4 20c0 1.1.89 2 1.99 2H18c1.1 0 2-.9 2-2V8zm-2 12H6V4h7v5h5v11z"},"1")],"InsertDriveFileTwoTone");t.Z=l},71496:function(e,t,s){"use strict";var a=s(64836);t.Z=void 0;var n=a(s(64938)),r=s(85893),l=(0,n.default)((0,r.jsx)("path",{d:"M8.12 9.29 12 13.17l3.88-3.88c.39-.39 1.02-.39 1.41 0 .39.39.39 1.02 0 1.41l-4.59 4.59c-.39.39-1.02.39-1.41 0L6.7 10.7a.9959.9959 0 0 1 0-1.41c.39-.38 1.03-.39 1.42 0z"}),"KeyboardArrowDownRounded");t.Z=l},28466:function(e,t,s){"use strict";var a=s(64836);t.Z=void 0;var n=a(s(64938)),r=s(85893),l=(0,n.default)([(0,r.jsx)("path",{d:"M6 10v10h5.29c-.19-.63-.29-1.3-.29-2 0-3.87 3.13-7 7-7v-1H6z",opacity:".3"},"0"),(0,r.jsx)("path",{d:"M6 20V10h12v1c.7 0 1.37.1 2 .29V10c0-1.1-.9-2-2-2h-1V6c0-2.76-2.24-5-5-5S7 3.24 7 6v2H6c-1.1 0-2 .9-2 2v10c0 1.1.9 2 2 2h6.26c-.42-.6-.75-1.28-.97-2H6zM9 6c0-1.66 1.34-3 3-3s3 1.34 3 3v2H9V6z"},"1"),(0,r.jsx)("path",{d:"M18 13c-2.76 0-5 2.24-5 5s2.24 5 5 5 5-2.24 5-5-2.24-5-5-5zm0 2c.83 0 1.5.67 1.5 1.5S18.83 18 18 18s-1.5-.67-1.5-1.5.67-1.5 1.5-1.5zm0 6c-1.03 0-1.94-.52-2.48-1.32.73-.42 1.57-.68 2.48-.68s1.75.26 2.48.68c-.54.8-1.45 1.32-2.48 1.32z"},"2")],"LockPersonTwoTone");t.Z=l},38544:function(e,t,s){"use strict";var a=s(64836);t.Z=void 0;var n=a(s(64938)),r=s(85893),l=(0,n.default)([(0,r.jsx)("circle",{cx:"9",cy:"8",r:"2",opacity:".3"},"0"),(0,r.jsx)("path",{d:"M9 15c-2.7 0-5.8 1.29-6 2.01V18h12v-1c-.2-.71-3.3-2-6-2z",opacity:".3"},"1"),(0,r.jsx)("path",{d:"M16.67 13.13C18.04 14.06 19 15.32 19 17v3h4v-3c0-2.18-3.57-3.47-6.33-3.87zM15 12c2.21 0 4-1.79 4-4s-1.79-4-4-4c-.47 0-.91.1-1.33.24C14.5 5.27 15 6.58 15 8s-.5 2.73-1.33 3.76c.42.14.86.24 1.33.24zm-6 0c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm0-6c1.1 0 2 .9 2 2s-.9 2-2 2-2-.9-2-2 .9-2 2-2zm0 7c-2.67 0-8 1.34-8 4v3h16v-3c0-2.66-5.33-4-8-4zm6 5H3v-.99C3.2 16.29 6.3 15 9 15s5.8 1.29 6 2v1z"},"2")],"PeopleAltTwoTone");t.Z=l},34999:function(e,t,s){"use strict";var a=s(64836);t.Z=void 0;var n=a(s(64938)),r=s(85893),l=(0,n.default)([(0,r.jsx)("path",{d:"M15.22 4.75 7.87 7.79l4.96 11.96 7.35-3.05-4.96-11.95zM11 10c-.55 0-1-.45-1-1s.45-1 1-1 1 .45 1 1-.45 1-1 1z",opacity:".3"},"0"),(0,r.jsx)("path",{d:"m3.87 11.18-2.43 5.86c-.41 1.02.08 2.19 1.09 2.61l1.34.56v-9.03zm18.16 4.77L17.07 3.98c-.31-.75-1.04-1.21-1.81-1.23-.26 0-.53.04-.79.15L7.1 5.95c-.75.31-1.21 1.03-1.23 1.8-.01.27.04.54.15.8l4.96 11.97c.31.76 1.05 1.22 1.83 1.23.26 0 .52-.05.77-.15l7.36-3.05c1.02-.42 1.51-1.59 1.09-2.6zm-9.2 3.8L7.87 7.79l7.35-3.04h.01l4.95 11.95-7.35 3.05z"},"1"),(0,r.jsx)("circle",{cx:"11",cy:"9",r:"1"},"2"),(0,r.jsx)("path",{d:"m9.33 21.75-3.45-8.34v6.34c0 1.1.9 2 2 2h1.45z"},"3")],"StyleTwoTone");t.Z=l},51903:function(e,t,s){"use strict";var a=s(64836);t.Z=void 0;var n=a(s(64938)),r=s(85893),l=(0,n.default)([(0,r.jsx)("path",{d:"M4 18h16V8H4v10zm8-3h6v2h-6v-2zm-5.91-4.59L7.5 9l4 4-4 4-1.41-1.41L8.67 13l-2.58-2.59z",opacity:".3"},"0"),(0,r.jsx)("path",{d:"M12 15h6v2h-6z"},"1"),(0,r.jsx)("path",{d:"M20 4H4c-1.11 0-2 .9-2 2v12c0 1.1.89 2 2 2h16c1.1 0 2-.9 2-2V6c0-1.1-.89-2-2-2zm0 14H4V8h16v10z"},"2"),(0,r.jsx)("path",{d:"m7.5 17 4-4-4-4-1.41 1.41L8.67 13l-2.58 2.59z"},"3")],"TerminalTwoTone");t.Z=l},7208:function(e,t,s){(window.__NEXT_P=window.__NEXT_P||[]).push(["/su/users/[single]",function(){return s(89499)}])},44114:function(e,t,s){"use strict";s.d(t,{Z:function(){return r}});var a=s(85893),n=s(8971);s(67294);function r(e){var t=e.selectOptions,s=e.name,r=e.onChangeHandler,l=e.required,i=e.setAlert,c=e.title,o=e.defaultValue,d=e.info,u=e.id;try{var h=function(e){if(!(e.type.match(/enter/i)&&window.innerWidth<1200)){var t=e.target.closest(".info-wrapper"),s=t.querySelector(".info-dropdown");!e.type.match(/leave/i)||s.classList.contains("hidden")?e.type.match(/leave/i)&&s.classList.contains("hidden")||(t&&s.classList.contains("hidden")?s.classList.remove("hidden"):s.classList.add("hidden")):s.classList.add("hidden")}};return(0,a.jsxs)("div",{className:"form-select-block flex items-start flex-col gap-0.5 w-full relative"+(d?" pr-8":""),children:[c&&(0,a.jsxs)("label",{htmlFor:s,children:[c,l?"":" (optional)"]}),(0,a.jsxs)("div",{className:"flex items-center w-full relative",children:[(0,a.jsx)("select",{name:s,id:u||s,className:"w-full bg-white",required:l,onChange:function(e){i&&i(null),e.target.classList.remove("warning"),r&&r(e)},defaultValue:o||void 0,children:t.map((function(e,t){var s=e.payload,n=e.title;return(0,a.jsx)("option",{value:s,selected:!!e.default,children:n},t+1)}))}),(0,a.jsx)(n.Z,{className:"absolute right-2 text-base text-slate-500 pointer-events-none",size:20}),d&&(0,a.jsxs)("div",{className:"info-wrapper absolute -right-10 w-8 h-8 rounded-full bg-white flex items-center justify-center z-10",style:{top:"50%",transform:"translate(0,-50%)"},onMouseEnter:h,onMouseLeave:h,onClick:h,children:[(0,a.jsx)("img",{src:"/images/info-outlined-black.png",alt:"",className:"w-6 h-6 object-contain opacity-60 pointer-events-none"}),(0,a.jsx)("div",{className:"info-dropdown absolute top-9 right-0 bg-white w-52 md:w-96 p-2 sm:p-6 shadow-xl rounded hidden text-center border border-slate-300 border-solid",children:(0,a.jsx)("span",{children:d})}),(0,a.jsx)("div",{className:"absolute -top-2 w-12",style:{height:"45px"}})]})]})]})}catch(m){return console.log("ERROR in FormSelect =>",m),(0,a.jsx)("div",{children:"Form Select Error"})}}},61781:function(e,t,s){"use strict";s.d(t,{Z:function(){return r}});var a=s(85893),n=(s(67294),s(42065));function r(){return(0,a.jsx)("button",{className:"outlined gray p-2 w-9 h-9 flex items-center justify-center rounded-full",onClick:function(e){window.history.back()},children:(0,a.jsx)(n.Z,{color:"inherit",className:"opacity-50 text-black",fontSize:"small"})})}},424:function(e,t,s){"use strict";s.d(t,{Z:function(){return l}});var a=s(828),n=s(85893),r=s(67294);function l(e){var t,s,l,i=e.confirmedDelegetedUser,c=e.linksArray,o=e.user,d=(null===i||void 0===i||i.delegated,null===i||void 0===i||null===(t=i.priviledges)||void 0===t||t.match(/Edit Tables/i),null===i||void 0===i||null===(s=i.priviledges)||void 0===s||s.match(/Delete Tables/i),null===i||void 0===i||null===(l=i.priviledges)||void 0===l||l.match(/Create Tables/i),r.useState(c||null)),u=(0,a.Z)(d,2),h=u[0],m=u[1];return r.useEffect((function(){var e;if(!c){var t=window.location.pathname,s=t.split("/"),a=[];a.push({title:"Home",path:t.match(/admin/)?"/admin":"/"});null===(e=window.location.search)||void 0===e||e.match(/delegated=true/);s.forEach((function(e,t,s){(null===e||void 0===e?void 0:e.match(/./))&&1!=t&&(e.match(/^\d+$/)&&o||a.push({title:e,path:function(){for(var e="",a=0;a<s.length;a++){var n=s[a];a>t||!n.match(/./)||(e+="/".concat(n))}return e}()}))})),m(a)}}),[]),h&&h[1]?(0,n.jsx)("div",{className:"text-sm mt-2 flex-wrap",children:h.map((function(e,t,s){return t===h.length-1?(0,n.jsx)("a",{href:e.path,className:"text-slate-400 dark:text-slate-500 pointer-events-none",children:e.title},t):(0,n.jsxs)(r.Fragment,{children:[(0,n.jsx)("a",{href:e.path,className:"query-url",children:e.title}),(0,n.jsx)("span",{className:"opacity-20",children:"|"})]},t)}))}):(0,n.jsx)(r.Fragment,{})}},22434:function(e,t,s){"use strict";s.d(t,{Z:function(){return c}});var a=s(828),n=s(85893),r=s(67294),l=s(41899),i=s(35922);function c(e){var t=e.content,s=e.language,c=e.style,o=(0,a.Z)(r.useState(!1),2),d=o[0],u=o[1],h=function(e,t){"clickaway"!==t&&u(!1)},m=(0,n.jsx)(r.Fragment,{children:(0,n.jsx)("button",{className:"outlined gray",style:{border:"none",padding:"2px",width:"20px",height:"20px",color:"white"},onClick:h,children:"\u2716"})});return(0,n.jsxs)("pre",{className:"language-".concat(s||"javascript"," w-full overflow-hidden code-block relative max-w-4xl"),style:c||{},children:[(0,n.jsx)("code",{className:"w-full",style:{wordBreak:"break-all"},children:t}),(0,n.jsx)("button",{className:"outlined absolute top-2 right-2 z-20 copy-code hover:opacity-50",style:{padding:"2px",border:"none"},onClick:function(e){navigator.clipboard.writeText(t).then((function(){u(!0)}))},children:(0,n.jsx)(l.Z,{fontSize:"small",color:"action"})}),(0,n.jsx)(i.Z,{open:d,autoHideDuration:2e3,onClose:h,children:(0,n.jsxs)("div",{className:"h-full text-white px-4 py-2 justify-between rounded",style:{maxWidth:"250px",width:"250px",backgroundColor:"#0b8862"},children:[(0,n.jsx)("span",{children:"Code Copied!"}),m]})})]})}},61336:function(e,t,s){"use strict";s.d(t,{Z:function(){return l}});var a=s(828),n=s(85893),r=s(67294);function l(e){var t=e.userObject,s=e.userPage,l=Object.keys(t),i=(0,a.Z)(r.useState(!1),2),c=(i[0],i[1],(0,a.Z)(r.useState(0),2)),o=(c[0],c[1],(0,a.Z)(r.useState(!s),2)),d=o[0],u=o[1];return(0,n.jsxs)("div",{className:"card col green w-full overflow-hidden"+(d?s?" h-[100px]":" h-[85px]":" "),children:[(0,n.jsxs)("div",{className:"items-center w-full",children:[(0,n.jsx)("img",{src:t.image_thumbnail,alt:"",className:"rounded-full object-cover"+(s?" w-16 h-16":" w-12 h-12")}),!s&&(0,n.jsxs)("h3",{className:"m-0 text-xl",children:[t.first_name," ",t.last_name," "]}),(0,n.jsxs)("div",{className:"ml-auto",children:[(0,n.jsx)("button",{className:"outlined gray small-text",onClick:function(e){u(!d)},children:d?"More Details":"Collapse"}),!s&&(0,n.jsx)("a",{href:"/su/users/".concat(t.id),className:"button outlined gray small-text",children:"View User"})]})]}),(0,n.jsx)("div",{className:"card no-hover col w-full light-gray-bg",children:l.map((function(e,s){return(0,n.jsxs)(r.Fragment,{children:[(0,n.jsx)("div",{children:(0,n.jsxs)("span",{style:{wordBreak:"break-all"},children:[e,":"," ",(0,n.jsx)("b",{children:t[e]})]})}),s<l.length-1&&(0,n.jsx)("hr",{})]},s+1)}))}),(0,n.jsx)("button",{className:"outlined gray small-text w-full",onClick:function(e){u(!0)},children:"Collapse"})]})}},89499:function(e,t,s){"use strict";s.r(t),s.d(t,{__N_SSP:function(){return E},default:function(){return O}});var a=s(85893),n=s(67294),r=s(85313),l=s(828),i=s(61336),c=s(61781),o=s(95264),d=s(86729),u=s(34999);function h(e){var t=e.user,s=e.refresh,r=(e.setRefresh,(0,l.Z)(n.useState(!1),2)),i=(r[0],r[1],(0,l.Z)(n.useState([]),2)),c=i[0],h=i[1];return n.useEffect((function(){(0,d.Z)("/api/admin/getUserBackups",{method:"post",body:{user:t}}).then((function(e){h(e.backups)}))}),[s]),(0,a.jsxs)("section",{className:"paper",children:[(0,a.jsx)("h2",{className:"text-xl m-0",children:"User Backups"}),!c&&(0,a.jsx)(o.Z,{width:"20px",position:"relative"}),c&&!c[0]&&(0,a.jsx)("div",{children:"This user has no backups"}),c&&c[0]&&c.sort((function(e,t){return parseInt(e)>parseInt(t)?-1:1})).map((function(e,s){var n=new Date(parseInt(e));return(0,a.jsxs)("a",{href:"/su/users/".concat(t.id,"/").concat(e),className:"card w-full items-center",children:[(0,a.jsx)(u.Z,{color:"inherit",className:"opacity-40 text-slate-500"}),(0,a.jsx)("b",{children:"Backup:"}),(0,a.jsx)("span",{children:n.toString()})]},e)}))]})}var m=s(22434),v=s(30212),x=s(71496),f=s(57835);function p(e){var t=e.user,s=e.file,n=e.activeFile,r=e.setActiveFile;return(0,a.jsxs)("button",{className:"justify-start gap-4"+((null===n||void 0===n?void 0:n.path)==="".concat(s.root,"/").concat(s.name)?" dark":" light-gray"),onClick:function(e){(0,d.Z)("/api/admin/grabFile",{method:"post",body:{user:t,type:"file",path:"".concat(s.root,"/").concat(s.name)}}).then((function(e){if(e.success)try{r({title:s.name,path:"".concat(s.root,"/").concat(s.name),data:JSON.stringify(JSON.parse(e.data),null,4)})}catch(t){r({title:s.name,path:"".concat(s.root,"/").concat(s.name),data:e.data})}}))},children:[(0,a.jsx)(f.Z,{fontSize:"small",className:"text-slate-400"}),s.name]})}function j(e){var t=e.user,s=e.file,r=e.activeFile,i=e.setActiveFile,c=(0,l.Z)(n.useState(null),2),o=(c[0],c[1],(0,l.Z)(n.useState(!1),2));o[0],o[1];return(0,a.jsxs)("div",{className:"flex-col w-full items-start relative",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(v.Z,{fontSize:"small",className:"text-slate-400"}),s.name,(0,a.jsx)(x.Z,{className:"ml-auto absolute right-2"})]}),s.content&&(0,a.jsx)("div",{className:"flex-col w-full pl-4 items-start ml-2",style:{borderLeft:"1px solid var(--slate-200)"},children:s.content.map((function(e,s){var n;return(null===e||void 0===e||null===(n=e.type)||void 0===n?void 0:n.match(/file/i))?(0,a.jsx)(p,{user:t,file:e,activeFile:r,setActiveFile:i},s):(0,a.jsx)(j,{user:t,file:e,activeFile:r,setActiveFile:i},s)}))})]})}function g(e){var t=e.user,s=e.rootFilesArray,r=(0,l.Z)(n.useState(null),2),i=r[0],c=r[1];return(0,a.jsxs)("section",{className:"paper",children:[(0,a.jsx)("h3",{className:"text-lg m-0",children:"User Files"}),(0,a.jsxs)("div",{className:"w-full items-start max-w-7xl",children:[(0,a.jsx)("div",{className:"flex-col items-stretch w-[40%]",children:s.map((function(e,s){var n;return(null===e||void 0===e||null===(n=e.type)||void 0===n?void 0:n.match(/file/))?(0,a.jsx)(p,{user:t,file:e,activeFile:i,setActiveFile:c},s):(0,a.jsx)(j,{user:t,file:e,activeFile:i,setActiveFile:c},s)}))}),(0,a.jsx)("div",{className:"grow flex-col items-start justify-start w-[60%] h-full -mt-4",children:i&&(0,a.jsx)(m.Z,{content:i.data||"",language:"javascript"})})]})]})}s(424);var w=s(14924),b=s(2641),y=s(7906),Z=s(295),N=s(98102),z=s(89755),C=s(72882),S=s(53184),k=s(53816),T=s(90629),F=(0,b.ZP)(N.Z)((function(e){var t;e.theme;return t={},(0,w.Z)(t,"&.".concat(z.Z.head),{backgroundColor:"var(--slate-800)",color:"white"}),(0,w.Z)(t,"&.".concat(z.Z.body),{}),t}));function H(e){var t=e.data;e.user;try{var s=Object.keys(t[0]);return(0,a.jsx)(n.Fragment,{children:(0,a.jsx)("div",{className:"p-4 bg-slate-200 rounded-md overflow-hidden w-full max-w-6xl",children:(0,a.jsx)(C.Z,{component:T.Z,sx:{width:"100%"},children:(0,a.jsxs)(y.Z,{sx:{minWidth:650},"aria-label":"simple table",children:[(0,a.jsx)(S.Z,{children:(0,a.jsx)(k.Z,{children:s&&s[0]&&s.map((function(e,t){return(0,a.jsx)(F,{align:"left",children:e},t+1)}))})}),(0,a.jsx)(Z.Z,{children:t&&t[0]&&t.map((function(e,t){return(0,a.jsx)(k.Z,{sx:{"&:last-child td, &:last-child th":{border:0}},children:s.map((function(t,s){return(0,a.jsx)(F,{align:"left",children:e[t]},s+1)}))},t+1)}))})]})})})})}catch(r){return(0,a.jsx)(n.Fragment,{children:(0,a.jsx)("span",{children:"No results"})})}}var M=s(44114);function L(e){var t=e.user,s=e.databases;try{var r=function(){v(!0);var e=c.current?c.current.getValue():null;if(null===e||void 0===e?void 0:e.match(/./)){var t=e.replace(/^--.*/gm,"").replace(/\n|\r|\n\r/gm,"").replace(/ {2,}/g," ");(0,d.Z)("/api/admin/runUserDbQuery",{method:"post",body:{database:u.current,query:t}},!0).then((function(e){e.success?p(e.result):e.msg&&window.alert(e.msg),setTimeout((function(){v(!1)}),500)}))}},i=n.useRef(),c=n.useRef(),u=n.useRef(s[0]),h=(0,l.Z)(n.useState(!1),2),m=h[0],v=h[1],x=(0,l.Z)(n.useState(!1),2),f=x[0],p=x[1],j=(0,l.Z)(n.useState(0),2),g=j[0],w=j[1],b=(0,l.Z)(n.useState(s[0]),2),y=b[0],Z=b[1];n.useEffect((function(){if(null===ace||void 0===ace?void 0:ace.edit){var e=ace.edit("ace-editor-wrapper");e.setOptions({mode:"ace/mode/mysql",theme:"ace/theme/twilight",value:"SELECT * FROM table_name",placeholder:"Type an SQL query",enableBasicAutocompletion:!0,enableLiveAutocompletion:!0}),e.commands.addCommand({name:"myCommand",bindKey:{win:"Ctrl-Enter",mac:"Command-Enter"},exec:function(e){r()},readOnly:!0}),c.current=e}else setTimeout((function(){w((function(e){return e+1}))}),1e3)}),[g]);var N=(0,l.Z)(n.useState([]),2),z=N[0],C=N[1];return n.useEffect((function(){(0,d.Z)("/api/admin/getTablesForUserDatabase?database=".concat(y)).then((function(e){e.success&&C(e.tables)}))}),[y,g]),(0,a.jsxs)("div",{className:"paper w-full",children:[(0,a.jsx)("h3",{className:"text-lg m-0",children:(0,a.jsx)("span",{children:"Database Shell"})}),(0,a.jsxs)("div",{children:[(0,a.jsx)(M.Z,{selectOptions:s.map((function(e){return{payload:e,title:null===e||void 0===e?void 0:e.replace(new RegExp("datasquirel_user_".concat(t.id,"_")),"")}})),name:"select-database",onChangeHandler:function(e){Z(e.target.value),u.current=e.target.value},title:"Databases"}),y&&z&&(0,a.jsx)(M.Z,{selectOptions:z.map((function(e){return{payload:e,title:e}})),name:"select-database-table",title:"Tables"})]}),(0,a.jsxs)("div",{className:"w-full flex-col relative",children:[(0,a.jsx)("div",{ref:i,id:"ace-editor-wrapper",style:{height:"100px"}}),(0,a.jsxs)("button",{className:"absolute right-4 bottom-4"+(m?" pointer-events-none opacity-70":""),onClick:function(e){r()},children:[m&&(0,a.jsx)(o.Z,{position:"relative",width:"15px",borderWidth:"3px",style:{backgroundColor:"transparent"}}),m?"Running Query ...":"Run Query"]})]}),f&&!m&&(0,a.jsx)(H,{data:f,user:t})]})}catch(S){return console.log(S),(0,a.jsx)(n.Fragment,{children:(0,a.jsx)("section",{className:"card",children:(0,a.jsx)("h2",{className:"text-xl m-0",children:"Shell not available at this time"})})})}}function V(e){var t=e.user,s=e.refresh,r=(e.setRefresh,(0,l.Z)(n.useState(!1),2)),i=(r[0],r[1],(0,l.Z)(n.useState(null),2)),c=i[0],o=i[1],u=(0,l.Z)(n.useState(null),2),h=u[0],m=u[1];return n.useEffect((function(){(0,d.Z)("/api/admin/getUserData",{method:"post",body:{user:t}}).then((function(e){console.log(e),e.success&&(o(e.data),m(e.databases))}))}),[s]),(0,a.jsxs)("div",{className:"paper w-full",children:[(0,a.jsx)("h2",{className:"text-xl m-0",children:"User Data"}),c&&(0,a.jsx)(g,{user:t,rootFilesArray:c}),h&&(0,a.jsx)(L,{user:t,databases:h})]})}function _(e){var t=e.data.user,s=(0,l.Z)(n.useState(0),2),r=s[0],u=s[1],m=(0,l.Z)(n.useState(!1),2),v=m[0],x=m[1];return(0,a.jsxs)(n.Fragment,{children:[(0,a.jsxs)("div",{className:"w-full justify-between",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(c.Z,{}),(0,a.jsxs)("h1",{className:"text-3xl m-0",children:[t.first_name," ",t.last_name]}),(0,a.jsx)("span",{className:"info w-auto gray font-normal",children:t.email})]}),(0,a.jsx)("div",{children:(0,a.jsxs)("button",{onClick:function(e){window.confirm("Create a new backup for ".concat(t.first_name,"?"))&&(x(!0),(0,d.Z)("/api/admin/addUserBackup",{method:"post",body:{user:t}}).then((function(e){console.log(e),e.success&&u((function(e){return e+1})),setTimeout((function(){x(!1)}),1e3)})))},className:"relative",children:[v&&(0,a.jsx)(o.Z,{width:"20px"}),"Backup User"]})})]}),(0,a.jsx)(i.Z,{userObject:t,userPage:!0}),(0,a.jsx)(h,{user:t,refresh:r,setRefresh:u}),(0,a.jsx)(V,{user:t,refresh:r,setRefresh:u})]})}var E=!0;function O(e){var t=e.user,s=e.data,l=(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("title",{children:"User Dashboard | Datasquirel"}),(0,a.jsx)("meta",{name:"description",content:"Welcome to your data app"}),(0,a.jsxs)(n.Fragment,{children:[(0,a.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,a.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"})]})]});return(0,a.jsx)(r.Z,{head:l,user:t,children:(0,a.jsx)(_,{data:s})})}}},function(e){e.O(0,[4185,8473,3795,5313,9774,2888,179],(function(){return t=7208,e(e.s=t);var t}));var t=e.O();_N_E=t}]); |