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

1 line
13 KiB
JavaScript
Raw Normal View History

2025-01-14 15:27:08 +00:00
"use strict";exports.id=5771,exports.ids=[5771],exports.modules={30671:(e,a)=>{Object.defineProperty(a,"M",{enumerable:!0,get:function(){return function e(a,s){return s in a?a[s]:"then"in a&&"function"==typeof a.then?a.then(a=>e(a,s)):"function"==typeof a&&"default"===s?a:void 0}}})},74153:(e,a,s)=>{s.d(a,{A:()=>h});var t=s(8732),l=s(82015),n=s.n(l),r=s(88791),d=s(91140),i=s(46169),c=s(16757),o=s(55904),p=s(6070);function h({database:e,setTargetDatabase:a,delegated:s,user:l}){let h=`/admin/${l?.id}/databases/${e.db_slug}`+(s?`?delegated=true&dbUserId=${e.user_id}`:""),{active_clone:u,active_clone_parent_db:m}=e,[x,y]=n().useState(!1);return(0,t.jsxs)("a",{href:h,className:"card",onClick:a=>{let t=a.target;(t.closest(".db-list-item-actions-block")||t.closest(".cancel-link"))&&a.preventDefault(),s&&(a.preventDefault(),y(!0),(0,i.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=h)}),setTimeout(()=>{y(!1)},1e3))},children:[x&&(0,t.jsx)(c.A,{width:"20px"}),(0,t.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,t.jsxs)("div",{className:"flex-col items-start grow",children:[(0,t.jsx)("span",{className:"title",children:e.db_name}),m&&(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:m.replace(/datasquirel_user_\d+_/,"")})]}),(0,t.jsx)("div",{className:"-mt-2",children:(0,t.jsx)(r.A,{slugText:e.db_slug,smaller:!0})}),(0,t.jsx)("div",{className:"-mt-1 gap-1",children:(0,t.jsx)(r.A,{slugText:e.db_full_name,smaller:!0,full:!0})}),!s&&(0,t.jsxs)("span",{className:"text-sm text-slate-400",children:["Created: ",e.date_created?.substring(0,21)]}),s&&(0,t.jsxs)("div",{className:"flex items-center mt-2",children:[(0,t.jsx)("img",{src:e.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:[e.first_name," ",e.last_name]}),(0,t.jsx)("span",{className:"text-xs text-slate-400",children:e.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)(o.A,{children:[!s&&(0,t.jsx)("button",{className:"outlined light-gray small-text",onClick:a=>{window.location.pathname=`/admin/${l?.id}/databases/${e.db_slug}/edit-database`},children:(0,t.jsx)("span",{children:"Edit"})}),!s&&!u&&(0,t.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,t.jsx)("span",{children:"Duplicate"})}),!s&&(0,t.jsx)("button",{className:"outlined light-gray small-text",onClick:s=>{a&&a(e),(0,d.PB)("delete-database-confirmation")},children:(0,t.jsx)("span",{children:"Delete"})})]})}),(0,t.jsx)(p.A,{className:"text-slate-600",size:20})]})]})]})}},56331:(e,a,s)=>{s.d(a,{A:()=>i});var t=s(8732),l=s(82015),n=s.n(l),r=s(74153);let d=(0,s(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 i({databases:e,setTargetDatabase:a,title:s,more:l,user:i}){return(0,t.jsx)(n().Fragment,{children:(0,t.jsxs)("section",{className:"paper",children:[(0,t.jsx)("h2",{className:"text-xl m-0",children:s||"Database List"}),i&&e&&e[0]&&a&&(0,t.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,t.jsx)(r.A,{database:e,setTargetDatabase:a,