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

1 line
10 KiB
JavaScript
Raw Normal View History

2024-12-05 07:03:33 +00:00
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6836],{36836:(e,l,a)=>{a.d(l,{A:()=>c,p:()=>d});var s=a(74848),t=a(96540),n=a(98963),i=a(12378);function c(e){var l,a,c;let{database:o,tables:r,setTargetTable:u,confirmedDelegetedUser:m,query:p,user:h}=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===(c=m.priviledges)||void 0===c||c.match(/Create Tables/i),(0,s.jsxs)(t.Fragment,{children:[o.active_clone&&h?(0,s.jsx)(i.A,{database:o,user:h}):(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:[r&&r[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==h?void 0:h.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",{}),h?(0,s.jsx)(n.A,{database:o,tables:r,setTargetTable:u,confirmedDelegetedUser:m,query:p,user:h}):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"]})})}},98963:(e,l,a)=>{a.d(l,{A:()=>w});var s=a(74848),t=a(96540),n=a(77121),i=a(45165),c=a(60557),d=a(74897),o=a(18453);function r(e){var l,a,r,u;let{table:m,setTargetTable:p,database:h,confirmedDelegetedUser:x,query:f,icons:b,user:v}=e,j=null==x?void 0:x.delegated,g=null==x?void 0:null===(l=x.priviledges)||void 0===l?void 0:l.match(/Edit Tables/i),N=null==x?void 0:null===(a=x.priviledges)||void 0===a?void 0:a.match(/Delete Tables/i);null==x||null===(r=x.priviledges)||void 0===r||r.match(/Create Table/i);let{active_clone:y,active_clone_parent_db:w,remote_connected:_}=h;return(0,s.jsxs)("a",{href:"/admin/".concat(null==v?void 0:v.id,"/databases/").concat(h.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,{fontSize:"small",className:"opacity-50",color:"action"}),(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)(c.A,{children:[(0,s.jsx)(n.A,{slugText:m.table_slug||"",outlined:!0}),(!j||j&&g)&&!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(h.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(h.db_slug,"/tables/add-table?clone=true&clone_db=").concat(h.db_slug,"&clone_table=").concat(m.table_slug)},children:(0,s.jsx)("span",{children:"Clone"})}),(!j||j&&N)&&!w&&!_&&(0,s.jsx)("div",{className:"button outlined light-gray small-text",onClick:e=>{p(m),(0,i.PB)("delete-table-confirmation")},children:(0,s.jsx)("span",{children:"Delete"})})]})}),(0,s.jsx)(o.A,{classNam