1 line
13 KiB
JavaScript
1 line
13 KiB
JavaScript
|
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9950],{5330:(e,a,t)=>{t.d(a,{A:()=>h});var s=t(4848),l=t(6540),d=t(7516),i=t(5655),n=t(9020),r=t(1710),c=t(900),o=t(8453);function h(e){var a;let{database:t,setTargetDatabase:h,delegated:p,user:u}=e,m="/admin/".concat(null==u?void 0:u.id,"/databases/").concat(t.db_slug)+(p?"?delegated=true&dbUserId=".concat(t.user_id):""),{active_clone:x,active_clone_parent_db:y}=t,[b,f]=l.useState(!1);return(0,s.jsxs)("a",{href:m,className:"card",onClick:e=>{let a=e.target;(a.closest(".db-list-item-actions-block")||a.closest(".cancel-link"))&&e.preventDefault(),p&&(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})}),!p&&(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)]}),p&&(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:[!p&&(0,s.jsx)("button",{className:"outlined light-gray small-text",onClick:e=>{window.location.pathname="/admin/".concat(null==u?void 0:u.id,"/databases/").concat(t.db_slug,"/edit-database")},children:(0,s.jsx)("span",{children:"Edit"})}),!p&&!x&&(0,s.jsx)("button",{className:"outlined light-gray small-text",onClick:e=>{window.location.href="/admin/".concat(null==u?void 0:u.id,"/databases/add-database?duplicate=").concat(t.db_full_name)},children:(0,s.jsx)("span",{children:"Duplicate"})}),!p&&(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})]})]})]})}},2992:(e,a,t)=>{t.d(a,{A:()=>n});var s=t(4848),l=t(6540),d=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 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")
|