dsql-admin/dsql-app/.local_dist/static/chunks/6836-b267904eb7c540d4.js

1 line
11 KiB
JavaScript
Raw Normal View History

2024-12-09 09:39:09 +00:00
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6836],{6836:(e,l,a)=>{a.d(l,{A:()=>r,p:()=>d});var s=a(4848),t=a(6540),n=a(8963),i=a(2378);function r(e){var l,a,r;let{database:o,tables:c,setTargetTable:u,confirmedDelegetedUser:m,query:h,user:p}=e;return null==m||m.delegated,null==m||null===(l=m.priviledges)||void 0===l||l.match(/Edit Tables/i),null==m||null===(a=m.priviledges)||void 0===a||a.match(/Delete Tables/i),null==m||null===(r=m.priviledges)||void 0===r||r.match(/Create Tables/i),(0,s.jsxs)(t.Fragment,{children:[o.active_clone&&p?(0,s.jsx)(i.A,{database:o,user:p}):(0,s.jsx)(s.Fragment,{}),o.remote_connected?(0,s.jsx)(d,{database:o}):(0,s.jsx)(s.Fragment,{}),(0,s.jsxs)("section",{className:"paper gray",children:[c&&c[0]?(0,s.jsxs)("div",{className:"flex-wrap gap-4 justify-between w-full",children:[(0,s.jsx)("h2",{className:"text-xl m-0",children:"Tables"}),(0,s.jsx)("a",{href:"/admin/".concat(null==p?void 0:p.id,"/databases/").concat(o.db_slug,"/tables"),className:"button outlined gray small-text",children:"See All Tables"})]}):(0,s.jsx)("h2",{className:"text-xl m-0",children:"This Database is empty"}),(0,s.jsx)("hr",{}),p?(0,s.jsx)(n.A,{database:o,tables:c,setTargetTable:u,confirmedDelegetedUser:m,query:h,user:p}):null]})]})}function d(e){var l;let{database:a}=e;return(0,s.jsx)("div",{className:"info green",children:(0,s.jsxs)("span",{className:"text font-normal",children:["This database is an active clone of"," ",(0,s.jsx)("b",{children:null===(l=a.remote_db_full_name)||void 0===l?void 0:l.replace(/datasquirel_user_\d+_/,"")})," ","on"," ",(0,s.jsx)("a",{className:"font-bold text-inherit",href:a.remote_connection_host,target:"_blank",children:a.remote_connection_host})," ","Host"]})})}},8963:(e,l,a)=>{a.d(l,{A:()=>w});var s=a(4848),t=a(6540),n=a(7121),i=a(5165),r=a(557),d=a(8190),o=a(8453);function c(e){var l,a,c,u;let{table:m,setTargetTable:h,database:p,confirmedDelegetedUser:f,query:x,icons:b,user:v}=e,g=null==f?void 0:f.delegated,j=null==f?void 0:null===(l=f.priviledges)||void 0===l?void 0:l.match(/Edit Tables/i),N=null==f?void 0:null===(a=f.priviledges)||void 0===a?void 0:a.match(/Delete Tables/i);null==f||null===(c=f.priviledges)||void 0===c||c.match(/Create Table/i);let{active_clone:y,active_clone_parent_db:w,remote_connected:_}=p;return(0,s.jsxs)("a",{href:"/admin/".concat(null==v?void 0:v.id,"/databases/").concat(p.db_slug,"/tables/").concat(m.table_slug),className:"card w-full items-center justify-between py-4"+((null==m?void 0:m.child_table)?" green":""),onClick:e=>{e.target.closest(".db-list-item-actions-block")&&e.preventDefault()},children:[(0,s.jsxs)("div",{className:"flex-wrap items-center flex",children:[(0,s.jsx)(d.A,{size:20,opacity:.3}),(0,s.jsx)("span",{className:"title",style:{fontSize:"16px"},children:m.table_name}),(0,s.jsxs)("span",{className:"text-sm text-slate-400",children:["Created: ",null===(u=m.date_created)||void 0===u?void 0:u.substring(0,21)]})]}),(0,s.jsxs)("div",{className:"flex-wrap",children:[(0,s.jsx)("div",{className:"db-list-item-actions-block flex-wrap",children:(0,s.jsxs)(r.A,{children:[(0,s.jsx)(n.A,{slugText:m.table_slug||"",outlined:!0}),(!g||g&&j)&&!w&&!_&&(0,s.jsx)(t.Fragment,{children:(0,s.jsx)("div",{className:"button outlined light-gray small-text",onClick:e=>{window.location.pathname="/admin/".concat(null==v?void 0:v.id,"/databases/").concat(p.db_slug,"/tables/").concat(m.table_slug,"/edit-table")},children:(0,s.jsx)("span",{children:"Edit"})})}),!w&&!m.child_table&&(0,s.jsx)("div",{className:"button outlined light-gray small-text",onClick:e=>{window.location.href="/admin/".concat(null==v?void 0:v.id,"/databases/").concat(p.db_slug,"/tables/add-table?clone=true&clone_db=").concat(p.db_slug,"&clone_table=").concat(m.table_slug)},children:(0,s.jsx)("span",{children:"Clone"})}),(!g||g&&N)&&!w&&!_&&(0,s.jsx)("div",{className:"button outlined light-gray small-text",onClick:e=>{h(m),(0,i.PB)("delete-table-confirmation")},children:(0,s.jsx)("span",{children:"Delete"})})]})}),(0,s.jsx)(o.A,{className:"text-slate-600",size:20})]})]})}var u=a(3698),m