dsql-admin/dsql-app/.local_dist/server/pages/admin/[user_id]/connect.js

1 line
22 KiB
JavaScript
Raw Normal View History

2025-01-14 15:27:08 +00:00
"use strict";(()=>{var e={};e.id=2504,e.ids=[2504],e.modules={30671:(e,s)=>{Object.defineProperty(s,"M",{enumerable:!0,get:function(){return function e(s,t){return t in s?s[t]:"then"in s&&"function"==typeof s.then?s.then(s=>e(s,t)):"function"==typeof s&&"default"===t?s:void 0}}})},35987:(e,s,t)=>{t.r(s),t.d(s,{config:()=>q,default:()=>O,getServerSideProps:()=>U,getStaticPaths:()=>I,getStaticProps:()=>M,reportWebVitals:()=>B,routeModule:()=>z,unstable_getServerProps:()=>H,unstable_getServerSideProps:()=>V,unstable_getStaticParams:()=>F,unstable_getStaticPaths:()=>G,unstable_getStaticProps:()=>Q});var a={};t.r(a),t.d(a,{ConnectContext:()=>D,default:()=>R,getServerSideProps:()=>T});var r=t(63865),l=t(9455),n=t(30671),i=t(5583),c=t(19796),d=t(8732),o=t(82015),u=t.n(o),p=t(25562),h=t(92702),x=t(71934),m=t(53926),f=t(96089),y=t(25088);function j(){let{user:e,query:s,mariadbUserCred:t}=u().useContext(D);return(0,d.jsx)("section",{className:"paper",children:(0,d.jsxs)("div",{className:"flex-col items-start w-full",children:[(0,d.jsx)("span",{children:"You can connect to your database remotely using any MySQL/Mariadb client. Use these credentials to connect:"}),(0,d.jsx)("hr",{}),(0,d.jsxs)("ul",{className:"m-0",children:[(0,d.jsxs)("li",{children:["Server:"," ",(0,d.jsx)("b",{children:"172.72.0.24"})]}),(0,d.jsxs)("li",{children:["Username: ",(0,d.jsx)("b",{children:t?.mariadb_user})]}),(0,d.jsxs)("li",{children:["Host: ",(0,d.jsx)("b",{children:t?.mariadb_host})]}),(0,d.jsxs)("li",{children:["Password: ",(0,d.jsx)("b",{children:"*****************"}),(0,d.jsx)("button",{className:"ghost inline-block -my-4",onClick:e=>{navigator.clipboard.writeText(t?.mariadb_pass||"").then(()=>{window.alert("Copied Password!")})},children:(0,d.jsx)(f.A,{})})]}),(0,d.jsx)("li",{children:(0,d.jsxs)("div",{className:"flex",children:["SSL Certificate:"," ",(0,d.jsx)("b",{children:(0,d.jsx)("span",{className:"flex items-center gap-2",children:(0,d.jsxs)("a",{href:"https://datasquirel.com/documents/ssl/ca-cert.pem",className:"flex items-center gap-2 border-none hover:opacity-60",target:"_blank",children:[(0,d.jsx)(y.A,{}),"Download"]})})})]})})]})]})})}var b=t(91140),v=t(16757),g=t(46169),S=t(11717),A=t(96725);function E({mariadbUser:e}){let{setTargetMariadbUser:s}=u().useContext(D),t=!!String(e.primary)?.match(/1/),[a,r]=u().useState(!1);return(0,d.jsxs)("div",{className:"card w-full col"+(t?" green":""),children:[a&&(0,d.jsx)(v.A,{width:"25px"}),(0,d.jsxs)("div",{className:"w-full justify-between h-auto md:h-8 flex-wrap",children:[(0,d.jsxs)("span",{className:"title",children:[e.username,"@",e.host]}),(0,d.jsxs)("div",{children:[t&&(0,d.jsx)("span",{className:"info small w-auto",children:"Primary User"}),(0,d.jsx)("button",{className:"ghost",title:"Edit User",onClick:t=>{s?.(e),(0,b.PB)("edit-mariadb-user-popup")},children:(0,d.jsx)(S.A,{size:20})}),!t&&(0,d.jsx)("button",{className:"ghost -ml-6",title:"Edit User",onClick:s=>{window.confirm("Are you sure you want to delete this User?")&&(r(!0),(0,g.A)("/api/sql-users/delete",{method:"POST",body:{id:e.id}},!0).then(e=>{e.success?window.location.reload():e.msg&&window.alert(e.msg)}).finally(()=>{setTimeout(()=>{r(!1)},1e3)}))},children:(0,d.jsx)(A.A,{})})]})]}),(0,d.jsx)("hr",{}),(0,d.jsxs)("ul",{className:"m-0",children:[(0,d.jsxs)("li",{children:["Username: ",(0,d.jsx)("b",{children:e.username})]}),(0,d.jsxs)("li",{children:["Host: ",(0,d.jsx)("b",{children:e.host}),(0,d.jsx)("span",{className:"info gray font-normal",children:"% is a wildcard. Example: 192.168.1.%"})]}),(0,d.jsxs)("li",{children:["Password: ",(0,d.jsx)("b",{children:"*****************"}),(0,d.jsx)("button",{className:"ghost inline-block -my-4",onClick:s=>{navigator.clipboard.writeText(e.password||"").then(()=>{window.alert("Copied Password!")})},children:(0,d.jsx)(f.A,{size:20})})]})]})]})}function N(){let{mariadbUsers:e}=u().useContext(D);return(0,d.jsxs)("section",{className:"paper",children:[(0,d.jsxs)("div",{className:"w-full justify-between",children:[(0,d.jsx)("h2",{className:"text-xl m-0",children:"SQL Users"}),(0,d.jsx)("di