dsql-admin/dsql-app/.local_dist/server/chunks/3460.js

1 line
14 KiB
JavaScript
Raw Normal View History

2024-12-09 09:39:09 +00:00
"use strict";exports.id=3460,exports.ids=[3460],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),n=t.n(l),d=t(86173),i=t(55158),r=t(63715),c=t(32415),o=t(62506),h=t(6070);function x({database:e,setTargetDatabase:a,delegated:t,user:l}){let x=`/admin/${l?.id}/databases/${e.db_slug}`+(t?`?delegated=true&dbUserId=${e.user_id}`:""),{active_clone:p,active_clone_parent_db:u}=e,[m,y]=n().useState(!1);return(0,s.jsxs)("a",{href:x,className:"card",onClick:a=>{(a.target.closest(".db-list-item-actions-block")||a.target.closest(".cancel-link"))&&a.preventDefault(),t&&(a.preventDefault(),y(!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=x)}),setTimeout(()=>{y(!1)},1e3))},children:[m&&(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)(d.A,{slugText:e.db_slug,smaller:!0})}),(0,s.jsx)("div",{className:"-mt-1 gap-1",children:(0,s.jsx)(d.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/${l?.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/${l?.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,i.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),n=t.n(l),d=t(86176),i=t(58548),r=t(24671),c=t(16291),o=t(92736);function h(e){let{databases:a,setTargetDatabase:t,user:l}=n().useContext(d.DatabasesContext);return(0,s.jsxs)(n().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)(i.A,{user:l})]}),l?.verification_status?.toString().match(/1/)?(0,s.jsxs)(n().Fragment,{children:[(0,s.jsx)(c.A,{databases:a,setTargetDatabase:t,user:l}),(0,s.jsx)(o.A,{user:l})]}):(0,s.jsx)(r.A,{})]})