1 line
14 KiB
JavaScript
1 line
14 KiB
JavaScript
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3616],{9928:(e,a,t)=>{t.d(a,{A:()=>h});var s=t(4848),l=t(6540),d=t(910),i=t(5165),n=t(3698),r=t(620),c=t(557),o=t(8453);function h(e){var a;let{database:t,setTargetDatabase:h,delegated:u,user:x}=e,m="/admin/".concat(null==x?void 0:x.id,"/databases/").concat(t.db_slug)+(u?"?delegated=true&dbUserId=".concat(t.user_id):""),{active_clone:p,active_clone_parent_db:y}=t,[b,f]=l.useState(!1);return(0,s.jsxs)("a",{href:m,className:"card",onClick:e=>{(e.target.closest(".db-list-item-actions-block")||e.target.closest(".cancel-link"))&&e.preventDefault(),u&&(e.preventDefault(),f(!0),(0,n.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=m)}),setTimeout(()=>{f(!1)},1e3))},children:[b&&(0,s.jsx)(r.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}),y&&(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:y.replace(/datasquirel_user_\d+_/,"")})]}),(0,s.jsx)("div",{className:"-mt-2",children:(0,s.jsx)(d.A,{slugText:t.db_slug,smaller:!0})}),(0,s.jsx)("div",{className:"-mt-1 gap-1",children:(0,s.jsx)(d.A,{slugText:t.db_full_name,smaller:!0,full:!0})}),!u&&(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)]}),u&&(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:[!u&&(0,s.jsx)("button",{className:"outlined light-gray small-text",onClick:e=>{window.location.pathname="/admin/".concat(null==x?void 0:x.id,"/databases/").concat(t.db_slug,"/edit-database")},children:(0,s.jsx)("span",{children:"Edit"})}),!u&&!p&&(0,s.jsx)("button",{className:"outlined light-gray small-text",onClick:e=>{window.location.href="/admin/".concat(null==x?void 0:x.id,"/databases/add-database?duplicate=").concat(t.db_full_name)},children:(0,s.jsx)("span",{children:"Duplicate"})}),!u&&(0,s.jsx)("button",{className:"outlined light-gray small-text",onClick:e=>{h&&h(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})]})]})]})}},7720:(e,a,t)=>{t.d(a,{A:()=>o});var s=t(4848),l=t(6540),d=t(8471),i=t(4709),n=t(5624),r=t(462),c=t(6417);function o(e){var a;let{databases:t,setTargetDatabase:o,user:h}=l.useContext(d.DatabasesContext);return(0,s.jsxs)(l.Fragment,{children:[(0,s.jsxs)("div",{className:"flex-col items-start gap-0 w-full",children:[(0,s.jsxs)("div",{className:"w-full justify-between flex-wrap",children:[(0,s.jsx)("h1",{className:"text-3xl m-0",children:"Databases"}),(0,s.jsxs)("a",{href:"/admin/".concat(null==h?void 0:h.id,"/databases/add-database"),className:"button flex items-center gap-2",children:[(0,s.jsx)("span",{className:"symbol",children:"+"}),(0,s.jsx)("span",{children:"Add Database"})]})]}),(0,s.jsx)(i.A,{user:h})]}),(null==h?void 0:null===(a=h.verification_status)||void 0===a?void 0:a.toString().match(/1/))?(0,s.jsxs)(l.Fragment,{children:[(0,s.jsx)(r.A,{databases:t,setTargetDatabase:o,user:h}),(0,s.jsx)(c.A,{user:h})]}):(0,s.jsx)(n.A,{})]})}},462:(e,a,t)=>{t.d(a,{A:()=>n});var s=t(4848),l=t(6540),d=t(9928);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 n(e){let{databases:a,setTargetDatabase:t,title:n,more:r,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:n||"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)(d.A,{database:e,setTargetDatabase:t,user:c},e.id))}),r&&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"})]})]})})}},6417:(e,a,t)=>{t.d(a,{A:()=>r});var s=t(4848),l=t(6540),d=t(620),i=t(3698),n=t(9928);function r(e){let{user:a}=e,[t,r]=l.useState(null),[c,o]=l.useState(!1);return l.useEffect(()=>{(0,i.A)("/api/getDelegatedDatabases").then(e=>{e.success&&(r(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)(d.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)(n.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)(d.A,{position:"relative",width:"20px"})})})]})}},7652:(e,a,t)=>{t.d(a,{A:()=>r});var s=t(4848),l=t(6540),d=t(3698),i=t(5165),n=t(620);function r(e){let{targetDatabase:a}=e,[t,r]=l.useState(!1);return(0,s.jsxs)(i.Ay,{title:"delete-database-confirmation",children:[t&&(0,s.jsx)(n.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}r(!0),window.confirm("Note that you will loose all data in this database. Continue?")?(0,d.A)("/api/deleteUserDatabase",{method:"post",body:a},!0).then(e=>{e.success&&window.location.reload()}):r(!1)},children:(0,s.jsx)("span",{children:"Yes"})}),(0,s.jsx)("button",{onClick:e=>{(0,i.fs)()},children:(0,s.jsx)("span",{children:"Cancel"})})]})]})}},910:(e,a,t)=>{t.d(a,{A:()=>d});var s=t(4848),l=t(7220);function d(e){let{slugText:a,smaller:t,outlined:d,full:i}=e;return(0,s.jsxs)("span",{className:"button break-words text-wrap cancel-link "+(d?" 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)},5165:(e,a,t)=>{t.d(a,{Ay:()=>i,PB:()=>n,fs:()=>r});var s=t(4848),l=t(6897),d=t(6540);function i(e){let{children:a,title:t,data:i,fullPage:n,wrapperClasses:c,closePopupDispatch:o,wrapperStyle:h,noContainer:u}=e;return n?(0,s.jsxs)("div",{className:"popup-bg overflow-hidden "+(c||""),"data-popupid":t||null,style:h,children:[u?(0,s.jsx)(d.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=>{r(),o&&o()},children:(0,s.jsx)(l.A,{color:"white",size:20})}),(0,s.jsx)("div",{className:"popup-canceller",onClick:e=>{r(),o&&o()}})]}):(0,s.jsxs)("div",{className:"popup-bg","data-popupid":t||null,children:[u?(0,s.jsx)(d.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=>{r(),o&&o()},children:(0,s.jsx)("span",{className:"font-normal",children:"✖"})})]}),u&&(0,s.jsx)("button",{className:"gray popup-cancel-button",onClick:e=>{r(),o&&o()},children:(0,s.jsx)("span",{className:"font-normal",children:"✖"})}),(0,s.jsx)("div",{className:"popup-canceller",onClick:e=>{r(),o&&o()}})]})}function n(e,a){let t=document.querySelector("[data-popupid='".concat(e,"']"));t&&(t.style.display="flex",a&&a(t))}function r(e){document.querySelectorAll("[data-popupid]").forEach(e=>{e.style.display="none"}),e&&e()}},5624:(e,a,t)=>{t.d(a,{A:()=>l});var s=t(4848);function l(e){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)},557:(e,a,t)=>{t.d(a,{A:()=>d});var s=t(4848),l=t(6540);function d(e){let{children:a,column:t,className:d}=e,i=l.useRef();return l.useEffect(()=>{try{let e=i.current.childNodes,a=Array.from(e);if((null==a?void 0:a.length)===1)return;a.forEach((e,s)=>{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])}s<a.length-1&&(l.style[t?"borderBottomRightRadius":"borderTopRightRadius"]=0,l.style[t?"borderBottomLeftRadius":"borderBottomRightRadius"]=0),s>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")+(d?" "+d:""),ref:i,children:a})}},7216:(e,a,t)=>{t.d(a,{A:()=>s});let s=(0,t(5737).A)("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]])},5014:(e,a,t)=>{t.d(a,{A:()=>s});let s=(0,t(5737).A)("BookText",[["path",{d:"M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H20v20H6.5a2.5 2.5 0 0 1 0-5H20",key:"t4utmx"}],["path",{d:"M8 7h6",key:"1f0q6e"}],["path",{d:"M8 11h8",key:"vwpz6n"}]])},8453:(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"}]])},9140:(e,a,t)=>{t.d(a,{A:()=>s});let s=(0,t(5737).A)("Database",[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]])},2894:(e,a,t)=>{t.d(a,{A:()=>s});let s=(0,t(5737).A)("FileKey2",[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v6",key:"rc0qvx"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["circle",{cx:"4",cy:"16",r:"2",key:"1ehqvc"}],["path",{d:"m10 10-4.5 4.5",key:"7fwrp6"}],["path",{d:"m9 11 1 1",key:"wa6s5q"}]])},9508:(e,a,t)=>{t.d(a,{A:()=>s});let s=(0,t(5737).A)("Globe",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]])},9753:(e,a,t)=>{t.d(a,{A:()=>s});let s=(0,t(5737).A)("HardDrive",[["line",{x1:"22",x2:"2",y1:"12",y2:"12",key:"1y58io"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"oot6mr"}],["line",{x1:"6",x2:"6.01",y1:"16",y2:"16",key:"sgf278"}],["line",{x1:"10",x2:"10.01",y1:"16",y2:"16",key:"1l4acy"}]])},1915:(e,a,t)=>{t.d(a,{A:()=>s});let s=(0,t(5737).A)("Images",[["path",{d:"M18 22H4a2 2 0 0 1-2-2V6",key:"pblm9e"}],["path",{d:"m22 13-1.296-1.296a2.41 2.41 0 0 0-3.408 0L11 18",key:"nf6bnh"}],["circle",{cx:"12",cy:"8",r:"2",key:"1822b1"}],["rect",{width:"16",height:"16",x:"6",y:"2",rx:"2",key:"12espp"}]])},7273:(e,a,t)=>{t.d(a,{A:()=>s});let s=(0,t(5737).A)("RotateCw",[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]])},5922:(e,a,t)=>{t.d(a,{A:()=>s});let s=(0,t(5737).A)("ShieldEllipsis",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"M8 12h.01",key:"czm47f"}],["path",{d:"M12 12h.01",key:"1mp3jc"}],["path",{d:"M16 12h.01",key:"1l6xoz"}]])},4909:(e,a,t)=>{t.d(a,{A:()=>s});let s=(0,t(5737).A)("Users",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["path",{d:"M16 3.13a4 4 0 0 1 0 7.75",key:"1da9ce"}]])},6897:(e,a,t)=>{t.d(a,{A:()=>s});let s=(0,t(5737).A)("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]])},8471:(e,a,t)=>{t.r(a),t.d(a,{DatabasesContext:()=>c,__N_SSP:()=>r,default:()=>o});var s=t(4848),l=t(6540),d=t(1187),i=t(7720),n=t(7652),r=!0;let c=l.createContext({});function o(e){let{user:a,databases:t}=e,r=(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("title",{children:"Databases | Datasquirel"}),(0,s.jsx)("meta",{name:"description",content:"Welcome to your data app"})]}),[o,h]=l.useState(0);return(0,s.jsx)(c.Provider,{value:{user:a,databases:t,targetDatabase:o,setTargetDatabase:h},children:(0,s.jsxs)(l.Fragment,{children:[(0,s.jsx)(d.A,{head:r,user:a,children:(0,s.jsx)(i.A,{})}),(0,s.jsx)(n.A,{targetDatabase:o})]})})}}}]); |