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

1 line
12 KiB
JavaScript
Raw Normal View History

2025-01-13 08:00:21 +00:00
"use strict";exports.id=6160,exports.ids=[6160],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}}})},74153:(e,a,t)=>{t.d(a,{A:()=>p});var s=t(8732),l=t(82015),d=t.n(l),n=t(88791),i=t(91140),r=t(46169),c=t(16757),o=t(55904),h=t(6070);function p({database:e,setTargetDatabase:a,delegated:t,user:l}){let p=`/admin/${l?.id}/databases/${e.db_slug}`+(t?`?delegated=true&dbUserId=${e.user_id}`:""),{active_clone:x,active_clone_parent_db:m}=e,[u,y]=d().useState(!1);return(0,s.jsxs)("a",{href:p,className:"card",onClick:a=>{let s=a.target;(s.closest(".db-list-item-actions-block")||s.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=p)}),setTimeout(()=>{y(!1)},1e3))},children:[u&&(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}),m&&(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:m.replace(/datasquirel_user_\d+_/,"")})]}),(0,s.jsx)("div",{className:"-mt-2",children:(0,s.jsx)(n.A,{slugText:e.db_slug,smaller:!0})}),(0,s.jsx)("div",{className:"-mt-1 gap-1",children:(0,s.jsx)(n.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&&!x&&(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})]})]})]})}},56331:(e,a,t)=>{t.d(a,{A:()=>r});var s=t(8732),l=t(82015),d=t.n(l),n=t(74153);let i=(0,t(82544).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 r({databases:e,setTargetDatabase:a,title:t,more:l,user:r}){return(0,s.jsx)(d().Fragment,{children:(0,s.jsxs)("section",{className:"paper",children:[(0,s.jsx)("h2",{className:"text-xl m-0",children:t||"Database List"}),r&&e&&e[0]&&a&&(0,s.jsx)("div",{className:"w-full grid grid-cols-1 sl:grid-cols-2 xl:grid-cols-3 items-stretch gap-6",children:e.map(e=>(0,s.jsx)(n.A,{database:e,setTargetDatabase:a,