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

1 line
9.9 KiB
JavaScript
Raw Normal View History

2024-12-05 07:03:33 +00:00
"use strict";exports.id=9621,exports.ids=[9621],exports.modules={59621:(e,a,s)=>{s.a(e,async(e,l)=>{try{s.d(a,{A:()=>o,p:()=>m});var t=s(8732),i=s(82015),n=s.n(i),r=s(48241),c=s(86571),d=e([r]);function o({database:e,tables:a,setTargetTable:s,confirmedDelegetedUser:l,query:i,user:d}){return l?.delegated,l?.priviledges?.match(/Edit Tables/i),l?.priviledges?.match(/Delete Tables/i),l?.priviledges?.match(/Create Tables/i),(0,t.jsxs)(n().Fragment,{children:[e.active_clone&&d?(0,t.jsx)(c.A,{database:e,user:d}):(0,t.jsx)(t.Fragment,{}),e.remote_connected?(0,t.jsx)(m,{database:e}):(0,t.jsx)(t.Fragment,{}),(0,t.jsxs)("section",{className:"paper gray",children:[a&&a[0]?(0,t.jsxs)("div",{className:"flex-wrap gap-4 justify-between w-full",children:[(0,t.jsx)("h2",{className:"text-xl m-0",children:"Tables"}),(0,t.jsx)("a",{href:`/admin/${d?.id}/databases/${e.db_slug}/tables`,className:"button outlined gray small-text",children:"See All Tables"})]}):(0,t.jsx)("h2",{className:"text-xl m-0",children:"This Database is empty"}),(0,t.jsx)("hr",{}),d?(0,t.jsx)(r.A,{database:e,tables:a,setTargetTable:s,confirmedDelegetedUser:l,query:i,user:d}):null]})]})}function m({database:e}){return(0,t.jsx)("div",{className:"info green",children:(0,t.jsxs)("span",{className:"text font-normal",children:["This database is an active clone of"," ",(0,t.jsx)("b",{children:e.remote_db_full_name?.replace(/datasquirel_user_\d+_/,"")})," ","on"," ",(0,t.jsx)("a",{className:"font-bold text-inherit",href:e.remote_connection_host,target:"_blank",children:e.remote_connection_host})," ","Host"]})})}r=(d.then?(await d)():d)[0],l()}catch(e){l(e)}})},6258:(e,a,s)=>{s.d(a,{A:()=>o});var l=s(8732),t=s(82015),i=s.n(t),n=s(68253),r=s(63715),c=s(83147),d=s(32415);function o({database:e}){let a=i().useRef(),[s,t]=i().useState(!1);return(0,l.jsxs)(i().Fragment,{children:[(0,l.jsx)("input",{type:"file",name:"sql-file-input",id:"sql-file-input",accept:".sql",className:"hidden",ref:a}),(0,l.jsxs)("button",{className:"flex-col normal-weight outlined gray dashed w-full p-8 relative",onClick:s=>{a.current?.addEventListener("change",a=>{let s=a.target;if(!s.files?.[0]){window.alert("No FIles selected");return}c.A({inputFile:s.files[0]}).then(a=>{window.confirm(`Use this file '${a.fileName}' as your import file?`)&&(t(!0),r.A("/api/importDatabase",{method:"post",body:{database:e,fileBase64:a.fileBase64}},!0).then(e=>{e.success?window.location.reload():window.alert("Import Failed!"),setTimeout(()=>{t(!1)},1e3)}))})}),a.current?.click()},children:[s&&(0,l.jsx)(d.A,{}),(0,l.jsx)("span",{className:"text-slate-400",children:"Do you have an SQL file already?"}),(0,l.jsx)(n.A,{sx:{fontSize:80},className:"opacity-20"}),(0,l.jsx)("span",{className:"",children:"Import Database"})]})]})}},39615:(e,a,s)=>{s.d(a,{A:()=>o});var l=s(8732),t=s(82015),i=s.n(t),n=s(63715),r=s(83147),c=s(32415),d=s(42125);function o({database:e}){let a=i().useRef(),[s,t]=i().useState(!1);return(0,l.jsxs)(i().Fragment,{children:[(0,l.jsx)("input",{type:"file",name:"json_file_input",id:"json_file_input",accept:".json",className:"hidden",ref:a}),(0,l.jsxs)("button",{className:"flex-col normal-weight outlined gray dashed w-full p-8 relative",onClick:s=>{a.current?.addEventListener("change",a=>{let s=a.target;if(!s.files?.[0]){window.alert("No FIles selected");return}r.A({inputFile:s.files[0]}).then(a=>{window.confirm(`Use this file '${a.fileName}' as your import file?`)&&(t(!0),n.A("/api/importDatabaseSchema",{method:"post",body:{database:e,fileBase64:a.fileBase64}},!0).then(e=>{e.success?window.location.reload():window.alert("Import Failed!"),setTimeout(()=>{t(!1)},1e3)}))})}),a.current?.click()},children:[s&&(0,l.jsx)(c.A,{}),(0,l.jsx)("span",{className:"text-slate-400",children:"Do you have a JSON schema?"}),(0,l.jsx)(d.A,{sx:{fontSize:80},className:"opacity-20"}),(0,l.jsx)("span",{className:"",children:"Import JSON schema"})]})]})}},15510:(e,a,s)=>{s.a(e,async(e,l)=>{try{s.d(a,{A:()=>h});var t=s(8732),i=s(82015),n=s.n(i),r=s(94010),c=s(55158),d=s(62506),o=s(8740),m=s(6070),u=e([r]);function h({table:e,setTargetTable:a,