1 line
16 KiB
JavaScript
1 line
16 KiB
JavaScript
|
"use strict";exports.id=1223,exports.ids=[1223],exports.modules={30671:(e,a)=>{Object.defineProperty(a,"M",{enumerable:!0,get:function(){return function e(a,t){return t in a?a[t]:"then"in a&&"function"==typeof a.then?a.then(a=>e(a,t)):"function"==typeof a&&"default"===t?a:void 0}}})},14587:(e,a,t)=>{t.d(a,{A:()=>x});var s=t(8732),l=t(82015),d=t.n(l),i=t(86173),n=t(55158),r=t(63715),c=t(32415),o=t(62506),h=t(6070);function x({database:e,setTargetDatabase:a,delegated:t,icons:l,user:x}){let m=`/admin/${x?.id}/databases/${e.db_slug}`+(t?`?delegated=true&dbUserId=${e.user_id}`:""),{active_clone:p,active_clone_parent_db:u}=e,[v,j]=d().useState(!1);return(0,s.jsxs)("a",{href:m,className:"card",onClick:a=>{(a.target.closest(".db-list-item-actions-block")||a.target.closest(".cancel-link"))&&a.preventDefault(),t&&(a.preventDefault(),j(!0),(0,r.A)("/api/getDelegatedDatabaseToken",{method:"post",body:{rootUserId:e.user_id,priviledges:e.user_priviledge,database:e.db_slug}},!0).then(e=>{e.success&&(window.location.href=m)}),setTimeout(()=>{j(!1)},1e3))},children:[v&&(0,s.jsx)(c.A,{width:"20px"}),(0,s.jsx)("img",{src:e.db_image?e.db_image:"/images/folder.svg",alt:"Folder Image",width:20,className:e.db_image?"avatar":"avatar opacity-50"}),(0,s.jsxs)("div",{className:"flex-col items-start grow",children:[(0,s.jsx)("span",{className:"title",children:e.db_name}),u&&(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:u.replace(/datasquirel_user_\d+_/,"")})]}),(0,s.jsx)("div",{className:"-mt-2",children:(0,s.jsx)(i.A,{slugText:e.db_slug,smaller:!0})}),(0,s.jsx)("div",{className:"-mt-1 gap-1",children:(0,s.jsx)(i.A,{slugText:e.db_full_name,smaller:!0,full:!0})}),!t&&(0,s.jsxs)("span",{className:"text-sm text-slate-400",children:["Created: ",e.date_created?.substring(0,21)]}),t&&(0,s.jsxs)("div",{className:"flex items-center mt-2",children:[(0,s.jsx)("img",{src:e.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:[e.first_name," ",e.last_name]}),(0,s.jsx)("span",{className:"text-xs text-slate-400",children:e.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)(o.A,{children:[!t&&(0,s.jsx)("button",{className:"outlined light-gray small-text",onClick:a=>{window.location.pathname=`/admin/${x?.id}/databases/${e.db_slug}/edit-database`},children:(0,s.jsx)("span",{children:"Edit"})}),!t&&!p&&(0,s.jsx)("button",{className:"outlined light-gray small-text",onClick:a=>{window.location.href=`/admin/${x?.id}/databases/add-database?duplicate=${e.db_full_name}`},children:(0,s.jsx)("span",{children:"Duplicate"})}),!t&&(0,s.jsx)("button",{className:"outlined light-gray small-text",onClick:t=>{a&&a(e),(0,n.PB)("delete-database-confirmation")},children:(0,s.jsx)("span",{children:"Delete"})})]})}),(0,s.jsx)(h.A,{className:"text-slate-600",size:20})]})]})]})}},37515:(e,a,t)=>{t.d(a,{A:()=>h});var s=t(8732),l=t(82015),d=t.n(l),i=t(86176),n=t(58548),r=t(24671),c=t(42602),o=t(92736);function h(e){let{databases:a,setTargetDatabase:t,user:l}=d().useContext(i.DatabasesContext);return(0,s.jsxs)(d().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/${l?.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)(n.A,{user:l})]}),l?.verification_status?.toString().match(/1/)?(0,s.jsxs)(d().Fragment,{children:[(0,s.jsx)(c.A,{databases:a,setTargetDatabase:t,user:l}),(0,s.jsx)(o.A,{user:l})]}):(0,s.jsx)(r.
|