dsql-admin/dsql-app/.local_dist/static/chunks/1840-834878b1eb82685d.js
Benjamin Toby e95f4d1087 Updates
2025-02-16 17:12:40 +01:00

1 line
11 KiB
JavaScript

"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1840],{5330:(e,a,t)=>{t.d(a,{A:()=>u});var s=t(4848),l=t(6540),n=t(7516),i=t(5655),r=t(9020),d=t(1710),c=t(900),o=t(834);function u(e){var a;let{database:t,setTargetDatabase:u,delegated:h,user:m}=e,p="/admin/".concat(null==m?void 0:m.id,"/databases/").concat(t.db_slug)+(h?"?delegated=true&dbUserId=".concat(t.user_id):""),{active_clone:x,active_clone_parent_db:f}=t,[b,g]=l.useState(!1);return(0,s.jsxs)("a",{href:p,className:"card",onClick:e=>{let a=e.target;(a.closest(".db-list-item-actions-block")||a.closest(".cancel-link"))&&e.preventDefault(),h&&(e.preventDefault(),g(!0),(0,r.A)("/api/getDelegatedDatabaseToken",{method:"post",body:{rootUserId:t.user_id,priviledges:t.user_priviledge,database:t.db_slug}},!0).then(e=>{e.success&&(window.location.href=p)}),setTimeout(()=>{g(!1)},1e3))},children:[b&&(0,s.jsx)(d.A,{width:"20px"}),(0,s.jsx)("img",{src:t.db_image?t.db_image:"/images/folder.svg",alt:"Folder Image",width:20,className:t.db_image?"avatar":"avatar opacity-50"}),(0,s.jsxs)("div",{className:"flex-col items-start grow",children:[(0,s.jsx)("span",{className:"title",children:t.db_name}),f&&(0,s.jsxs)("span",{className:"text-xs bg-emerald-100 dark:bg-emerald-100/10 text-emerald-700 dark:text-emerald-200 px-2 py-0.5 rounded-full mb-1",children:["This Database is an active Clone of"," ",(0,s.jsx)("b",{children:f.replace(/datasquirel_user_\d+_/,"")})]}),(0,s.jsx)("div",{className:"-mt-2",children:(0,s.jsx)(n.A,{slugText:t.db_slug,smaller:!0})}),(0,s.jsx)("div",{className:"-mt-1 gap-1",children:(0,s.jsx)(n.A,{slugText:t.db_full_name,smaller:!0,full:!0})}),!h&&(0,s.jsxs)("span",{className:"text-sm text-slate-400",children:["Created: ",null===(a=t.date_created)||void 0===a?void 0:a.substring(0,21)]}),h&&(0,s.jsxs)("div",{className:"flex items-center mt-2",children:[(0,s.jsx)("img",{src:t.image_thumbnail,alt:"",className:"w-8 h-8 rounded-full object-cover"}),(0,s.jsxs)("div",{className:"flex-col items-start gap-0",children:[(0,s.jsxs)("span",{className:"text-xs text-slate-600",children:[t.first_name," ",t.last_name]}),(0,s.jsx)("span",{className:"text-xs text-slate-400",children:t.email})]})]}),(0,s.jsxs)("div",{className:"w-full justify-between flex-wrap",children:[(0,s.jsx)("div",{className:"db-list-item-actions-block flex-wrap",children:(0,s.jsxs)(c.A,{children:[!h&&(0,s.jsx)("button",{className:"outlined light-gray small-text",onClick:e=>{window.location.pathname="/admin/".concat(null==m?void 0:m.id,"/databases/").concat(t.db_slug,"/edit-database")},children:(0,s.jsx)("span",{children:"Edit"})}),!h&&!x&&(0,s.jsx)("button",{className:"outlined light-gray small-text",onClick:e=>{window.location.href="/admin/".concat(null==m?void 0:m.id,"/databases/add-database?duplicate=").concat(t.db_full_name)},children:(0,s.jsx)("span",{children:"Duplicate"})}),!h&&(0,s.jsx)("button",{className:"outlined light-gray small-text",onClick:e=>{u&&u(t),(0,i.PB)("delete-database-confirmation")},children:(0,s.jsx)("span",{children:"Delete"})})]})}),(0,s.jsx)(o.A,{className:"text-slate-600",size:20})]})]})]})}},2992:(e,a,t)=>{t.d(a,{A:()=>r});var s=t(4848),l=t(6540),n=t(5330);let i=(0,t(5737).A)("PackagePlus",[["path",{d:"M16 16h6",key:"100bgy"}],["path",{d:"M19 13v6",key:"85cyf1"}],["path",{d:"M21 10V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l2-1.14",key:"e7tb2h"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["line",{x1:"12",x2:"12",y1:"22",y2:"12",key:"a4e8g8"}]]);function r(e){let{databases:a,setTargetDatabase:t,title:r,more:d,user:c}=e;return(0,s.jsx)(l.Fragment,{children:(0,s.jsxs)("section",{className:"paper",children:[(0,s.jsx)("h2",{className:"text-xl m-0",children:r||"Database List"}),c&&a&&a[0]&&t&&(0,s.jsx)("div",{className:"w-full grid grid-cols-1 sl:grid-cols-2 xl:grid-cols-3 items-stretch gap-6",children:a.map(e=>(0,s.jsx)(n.A,{database:e,setTargetDatabase:t,user:c},e.id))}),d&&a&&a[0]&&(0,s.jsx)("a",{href:"/admin/".concat(null==c?void 0:c.id,"/databases"),className:"button w-full more-padding",children:"See All Databases"}),!a||!a[0]&&(0,s.jsxs)("a",{href:"/admin/".concat(null==c?void 0:c.id,"/databases/add-database"),className:"button outlined gray dashed w-full p-10 flex-col",children:[(0,s.jsx)("span",{className:"text-slate-400",children:"No Databases Created."}),(0,s.jsx)(i,{}),(0,s.jsx)("span",{className:"",children:"Add Database"})]})]})})}},4435:(e,a,t)=>{t.d(a,{A:()=>d});var s=t(4848),l=t(6540),n=t(1710),i=t(9020),r=t(5330);function d(e){let{user:a}=e,[t,d]=l.useState(null),[c,o]=l.useState(!1);return l.useEffect(()=>{(0,i.A)("/api/getDelegatedDatabases").then(e=>{e.success&&(d(e.databases),o(!1))})},[]),(0,s.jsxs)("section",{className:"paper",children:[(0,s.jsx)("h2",{className:"text-xl m-0 text-left w-full",children:"Delegated Databases"}),c&&(0,s.jsx)(n.A,{}),a&&t?t[0]?(0,s.jsx)(l.Fragment,{children:(0,s.jsx)("div",{className:"w-full grid grid-cols-1 sl:grid-cols-2 xl:grid-cols-3 items-stretch gap-6",children:t.map(e=>(0,s.jsx)(r.A,{database:e,delegated:!0,user:a},e.id))})}):(0,s.jsx)(l.Fragment,{children:(0,s.jsx)("span",{className:"info gray w-full font-normal justify-center",children:"No Delegated Databases Yet"})}):(0,s.jsx)(l.Fragment,{children:(0,s.jsx)("div",{className:"w-full justify-center",children:(0,s.jsx)(n.A,{position:"relative",width:"20px"})})})]})}},1670:(e,a,t)=>{t.d(a,{A:()=>d});var s=t(4848),l=t(6540),n=t(9020),i=t(5655),r=t(1710);function d(e){let{targetDatabase:a}=e,[t,d]=l.useState(!1);return(0,s.jsxs)(i.Ay,{title:"delete-database-confirmation",children:[t&&(0,s.jsx)(r.A,{width:"20px"}),(0,s.jsxs)("h4",{className:"m-0",children:["Delete '",(null==a?void 0:a.db_name)?a.db_name:"This Database","' database?"]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("button",{className:"outlined"+(t?" pointer-events-none opacity-40":""),onClick:e=>{if(!a){alert("No Target Database Selected!");return}d(!0),window.confirm("Note that you will loose all data in this database. Continue?")?(0,n.A)("/api/deleteUserDatabase",{method:"post",body:a},!0).then(e=>{e.success&&window.location.reload()}):d(!1)},children:(0,s.jsx)("span",{children:"Yes"})}),(0,s.jsx)("button",{onClick:e=>{(0,i.fs)()},children:(0,s.jsx)("span",{children:"Cancel"})})]})]})}},3647:(e,a,t)=>{t.d(a,{A:()=>n});var s=t(4848),l=t(6540);function n(e){let{confirmedDelegetedUser:a,linksArray:t,user:n}=e,[i,r]=l.useState(t||null);return(l.useEffect(()=>{var e;if(t)return;let a=window.location.pathname,s=a.split("/"),l=[];l.push({title:"Home",path:a.match(/admin/)?"/admin":"/"}),null===(e=window.location.search)||void 0===e||e.match(/delegated=true/),s.forEach((e,a,t)=>{!(null==e?void 0:e.match(/./))||1==a||e.match(/^\d+$/)&&n&&!l.find(e=>!!e.title.match(/^entries$|^users$/))||l.push({title:e,path:(()=>{let e="";for(let s=0;s<t.length;s++){let l=t[s];!(s>a)&&l.match(/./)&&(e+="/".concat(l))}return e})()})}),r(l)},[]),i&&i[1])?(0,s.jsx)("div",{className:"text-sm mt-2 flex-wrap",children:i.map((e,a,t)=>a===i.length-1?(0,s.jsx)("a",{href:e.path,className:"text-slate-400 dark:text-slate-500 pointer-events-none",children:e.title},a):(0,s.jsxs)(l.Fragment,{children:[(0,s.jsx)("a",{href:e.path,className:"query-url",children:e.title}),(0,s.jsx)("span",{className:"opacity-20",children:"|"})]},a))}):(0,s.jsx)(l.Fragment,{})}},7516:(e,a,t)=>{t.d(a,{A:()=>n});var s=t(4848),l=t(7220);function n(e){let{slugText:a,smaller:t,outlined:n,full:i}=e;return(0,s.jsxs)("span",{className:"button break-words text-wrap cancel-link "+(n?" outlined gray":"light-gray")+(t?" small-text":""),onClick:e=>{navigator.clipboard.writeText(a).then(()=>{alert("".concat(i?"Database Full name":"Database Slug",' "').concat(a,'" Copied to Clipboard. Use this as the database name when querying data'))})},style:{wordWrap:"break-word",wordBreak:"break-all"},children:[(0,s.jsx)(l.A,{}),(0,s.jsx)("span",{children:a})]})}t(6540)},5655:(e,a,t)=>{t.d(a,{Ay:()=>i,PB:()=>r,fs:()=>d});var s=t(4848),l=t(6897),n=t(6540);function i(e){let{children:a,title:t,data:i,fullPage:r,wrapperClasses:c,closePopupDispatch:o,wrapperStyle:u,noContainer:h}=e;return r?(0,s.jsxs)("div",{className:"popup-bg overflow-hidden "+(c||""),"data-popupid":t||null,style:u,children:[h?(0,s.jsx)(n.Fragment,{children:a}):(0,s.jsx)("div",{className:"relative w-full h-full z-50","data-data":i?JSON.stringify(i):"",children:a}),(0,s.jsx)("button",{className:"popup-cancel-button fixed outlined gray",onClick:e=>{d(),o&&o()},children:(0,s.jsx)(l.A,{color:"white",size:20})}),(0,s.jsx)("div",{className:"popup-canceller",onClick:e=>{d(),o&&o()}})]}):(0,s.jsxs)("div",{className:"popup-bg","data-popupid":t||null,children:[h?(0,s.jsx)(n.Fragment,{children:a}):(0,s.jsxs)("div",{className:"popup-content-container minimal-scrollbars","data-data":i?JSON.stringify(i):"",children:[a,(0,s.jsx)("button",{className:"outlined gray popup-cancel-button",onClick:e=>{d(),o&&o()},children:(0,s.jsx)("span",{className:"font-normal",children:"✖"})})]}),h&&(0,s.jsx)("button",{className:"gray popup-cancel-button",onClick:e=>{d(),o&&o()},children:(0,s.jsx)("span",{className:"font-normal",children:"✖"})}),(0,s.jsx)("div",{className:"popup-canceller",onClick:e=>{d(),o&&o()}})]})}function r(e,a){let t=document.querySelector("[data-popupid='".concat(e,"']"));t&&(t.style.display="flex",null==a||a(t))}function d(e){document.querySelectorAll("[data-popupid]").forEach(e=>{e.style.display="none"}),null==e||e()}},18:(e,a,t)=>{t.d(a,{A:()=>l});var s=t(4848);function l(){return(0,s.jsxs)("a",{href:"/email-verification",className:"card w-full items-center justify-center py-4 gap-2",children:[(0,s.jsx)("img",{src:"/images/warning.png",alt:"Down Arrow",width:25,className:""}),(0,s.jsx)("span",{children:"Your Account is not verified. Please verify your account."})]})}t(6540)},900:(e,a,t)=>{t.d(a,{A:()=>n});var s=t(4848),l=t(6540);function n(e){let{children:a,column:t,className:n}=e,i=l.useRef();return l.useEffect(()=>{try{let e=i.current;if(!e)throw Error("No Button Group Wrapper!");let a=e.childNodes,s=Array.from(a);if((null==s?void 0:s.length)===1)return;s.forEach((e,a)=>{let l=e;if(l.classList.contains("dropdown-wrapper")){let a=Array.from(e.childNodes).filter(e=>{var a;return(null==e?void 0:null===(a=e.nodeName)||void 0===a?void 0:a.match(/button/i))||e.classList.contains("button")});a&&a[0]&&(l=a[0])}a<s.length-1&&(l.style[t?"borderBottomRightRadius":"borderTopRightRadius"]=0,l.style[t?"borderBottomLeftRadius":"borderBottomRightRadius"]=0),a>0&&(l.style[t?"borderTop":"borderLeft"]="none",l.style[t?"borderTopRightRadius":"borderTopLeftRadius"]=0,l.style[t?"borderTopLeftRadius":"borderBottomLeftRadius"]=0)})}catch(e){console.log(e.message)}},[]),(0,s.jsx)("div",{className:"items-stretch gap-0"+(t?" flex-col":" flex-wrap xl:flex-nowrap")+(n?" "+n:""),ref:i,children:a})}},834:(e,a,t)=>{t.d(a,{A:()=>s});let s=(0,t(5737).A)("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]])},7220:(e,a,t)=>{t.d(a,{A:()=>s});let s=(0,t(5737).A)("Copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]])}}]);