1 line
8.9 KiB
JavaScript
1 line
8.9 KiB
JavaScript
|
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7538],{99928:(e,a,s)=>{s.d(a,{A:()=>u});var t=s(74848),l=s(96540),i=s(70910),n=s(45165),d=s(23698),c=s(620),r=s(60557),o=s(18453);function u(e){var a;let{database:s,setTargetDatabase:u,delegated:x,icons:m,user:p}=e,h="/admin/".concat(null==p?void 0:p.id,"/databases/").concat(s.db_slug)+(x?"?delegated=true&dbUserId=".concat(s.user_id):""),{active_clone:j,active_clone_parent_db:g}=s,[f,b]=l.useState(!1);return(0,t.jsxs)("a",{href:h,className:"card",onClick:e=>{(e.target.closest(".db-list-item-actions-block")||e.target.closest(".cancel-link"))&&e.preventDefault(),x&&(e.preventDefault(),b(!0),(0,d.A)("/api/getDelegatedDatabaseToken",{method:"post",body:{rootUserId:s.user_id,priviledges:s.user_priviledge,database:s.db_slug}},!0).then(e=>{e.success&&(window.location.href=h)}),setTimeout(()=>{b(!1)},1e3))},children:[f&&(0,t.jsx)(c.A,{width:"20px"}),(0,t.jsx)("img",{src:s.db_image?s.db_image:"/images/folder.svg",alt:"Folder Image",width:20,className:s.db_image?"avatar":"avatar opacity-50"}),(0,t.jsxs)("div",{className:"flex-col items-start grow",children:[(0,t.jsx)("span",{className:"title",children:s.db_name}),g&&(0,t.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,t.jsx)("b",{children:g.replace(/datasquirel_user_\d+_/,"")})]}),(0,t.jsx)("div",{className:"-mt-2",children:(0,t.jsx)(i.A,{slugText:s.db_slug,smaller:!0})}),(0,t.jsx)("div",{className:"-mt-1 gap-1",children:(0,t.jsx)(i.A,{slugText:s.db_full_name,smaller:!0,full:!0})}),!x&&(0,t.jsxs)("span",{className:"text-sm text-slate-400",children:["Created: ",null===(a=s.date_created)||void 0===a?void 0:a.substring(0,21)]}),x&&(0,t.jsxs)("div",{className:"flex items-center mt-2",children:[(0,t.jsx)("img",{src:s.image_thumbnail,alt:"",className:"w-8 h-8 rounded-full object-cover"}),(0,t.jsxs)("div",{className:"flex-col items-start gap-0",children:[(0,t.jsxs)("span",{className:"text-xs text-slate-600",children:[s.first_name," ",s.last_name]}),(0,t.jsx)("span",{className:"text-xs text-slate-400",children:s.email})]})]}),(0,t.jsxs)("div",{className:"w-full justify-between flex-wrap",children:[(0,t.jsx)("div",{className:"db-list-item-actions-block flex-wrap",children:(0,t.jsxs)(r.A,{children:[!x&&(0,t.jsx)("button",{className:"outlined light-gray small-text",onClick:e=>{window.location.pathname="/admin/".concat(null==p?void 0:p.id,"/databases/").concat(s.db_slug,"/edit-database")},children:(0,t.jsx)("span",{children:"Edit"})}),!x&&!j&&(0,t.jsx)("button",{className:"outlined light-gray small-text",onClick:e=>{window.location.href="/admin/".concat(null==p?void 0:p.id,"/databases/add-database?duplicate=").concat(s.db_full_name)},children:(0,t.jsx)("span",{children:"Duplicate"})}),!x&&(0,t.jsx)("button",{className:"outlined light-gray small-text",onClick:e=>{u&&u(s),(0,n.PB)("delete-database-confirmation")},children:(0,t.jsx)("span",{children:"Delete"})})]})}),(0,t.jsx)(o.A,{className:"text-slate-600",size:20})]})]})]})}},67720:(e,a,s)=>{s.d(a,{A:()=>o});var t=s(74848),l=s(96540),i=s(98471),n=s(4709),d=s(55624),c=s(82171),r=s(56417);function o(e){var a;let{databases:s,setTargetDatabase:o,user:u}=l.useContext(i.DatabasesContext);return(0,t.jsxs)(l.Fragment,{children:[(0,t.jsxs)("div",{className:"flex-col items-start gap-0 w-full",children:[(0,t.jsxs)("div",{className:"w-full justify-between flex-wrap",children:[(0,t.jsx)("h1",{className:"text-3xl m-0",children:"Databases"}),(0,t.jsxs)("a",{href:"/admin/".concat(null==u?void 0:u.id,"/databases/add-database"),className:"button flex items-center gap-2",children:[(0,t.jsx)("span",{className:"symbol",children:"+"}),(0,t.jsx)("span",{children:"Add Database"})]})]}),(0,t.jsx)(n.A,{user:u})]}),(null==u?void 0:null===(a=u.verification_status)||void 0===a?void 0:a.toString().match(/1/))?(0,t.jsxs)(l.Fragment,{children:[(0,t.jsx)(c.A,{databases:s,setTargetDatabase:o,user:u}),(0,t.jsx)(r.A,{user:u})]}):(0,t.jsx)(d.A,{})]})}},82171:(e,a,
|