2024-12-15 11:57:19 +00:00
|
|
|
"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=
|