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

1 line
20 KiB
JavaScript
Raw Normal View History

2025-01-13 08:00:21 +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:()=>O,default:()=>T,getServerSideProps:()=>G,getStaticPaths:()=>U,getStaticProps:()=>q,reportWebVitals:()=>V,routeModule:()=>W,unstable_getServerProps:()=>H,unstable_getServerSideProps:()=>B,unstable_getStaticParams:()=>z,unstable_getStaticPaths:()=>F,unstable_getStaticProps:()=>D});var a={};t.r(a),t.d(a,{ConnectContext:()=>_,default:()=>R,getServerSideProps:()=>I});var r=t(63865),l=t(9455),n=t(30671),i=t(5583),d=t(19796),c=t(8732),o=t(82015),u=t.n(o),h=t(25562),p=t(92702),x=t(71934),m=t(53926),j=t(96089),y=t(25088);function f(){let{user:e,query:s,mariadbUserCred:t}=u().useContext(_);return(0,c.jsx)("section",{className:"paper",children:(0,c.jsxs)("div",{className:"flex-col items-start w-full",children:[(0,c.jsx)("span",{children:"You can connect to your database remotely using any MySQL/Mariadb client. Use these credentials to connect:"}),(0,c.jsx)("hr",{}),(0,c.jsxs)("ul",{className:"m-0",children:[(0,c.jsxs)("li",{children:["Server:"," ",(0,c.jsx)("b",{children:"172.72.0.24"})]}),(0,c.jsxs)("li",{children:["Username: ",(0,c.jsx)("b",{children:t?.mariadb_user})]}),(0,c.jsxs)("li",{children:["Host: ",(0,c.jsx)("b",{children:t?.mariadb_host})]}),(0,c.jsxs)("li",{children:["Password: ",(0,c.jsx)("b",{children:"*****************"}),(0,c.jsx)("button",{className:"ghost inline-block -my-4",onClick:e=>{navigator.clipboard.writeText(t?.mariadb_pass||"").then(()=>{window.alert("Copied Password!")})},children:(0,c.jsx)(j.A,{})})]}),(0,c.jsx)("li",{children:(0,c.jsxs)("div",{className:"flex",children:["SSL Certificate:"," ",(0,c.jsx)("b",{children:(0,c.jsx)("span",{className:"flex items-center gap-2",children:(0,c.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,c.jsx)(y.A,{}),"Download"]})})})]})})]})]})})}var b=t(91140),g=t(16757),v=t(46169),A=t(11717),E=t(96725);function S({mariadbUser:e}){let{setTargetMariadbUser:s}=u().useContext(_),t=!!String(e.primary)?.match(/1/),[a,r]=u().useState(!1);return(0,c.jsxs)("div",{className:"card w-full col"+(t?" green":""),children:[a&&(0,c.jsx)(g.A,{width:"25px"}),(0,c.jsxs)("div",{className:"w-full justify-between h-auto md:h-8 flex-wrap",children:[(0,c.jsxs)("span",{className:"title",children:[e.username,"@",e.host]}),(0,c.jsxs)("div",{children:[t&&(0,c.jsx)("span",{className:"info small w-auto",children:"Primary User"}),(0,c.jsx)("button",{className:"ghost",title:"Edit User",onClick:t=>{s?.(e),(0,b.PB)("edit-mariadb-user-popup")},children:(0,c.jsx)(A.A,{size:20})}),!t&&(0,c.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,v.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,c.jsx)(E.A,{})})]})]}),(0,c.jsx)("hr",{}),(0,c.jsxs)("ul",{className:"m-0",children:[(0,c.jsxs)("li",{children:["Username: ",(0,c.jsx)("b",{children:e.username})]}),(0,c.jsxs)("li",{children:["Host: ",(0,c.jsx)("b",{children:e.host}),(0,c.jsx)("span",{className:"info gray font-normal",children:"% is a wildcard. Example: 192.168.1.%"})]}),(0,c.jsxs)("li",{children:["Password: ",(0,c.jsx)("b",{children:"*****************"}),(0,c.jsx)("button",{className:"ghost inline-block -my-4",onClick:s=>{navigator.clipboard.writeText(e.password||"").then(()=>{window.alert("Copied Password!")})},children:(0,c.jsx)(j.A,{size:20})})]})]})]})}function N(){let{mariadbUsers:e}=u().useContext(_);return(0,c.jsxs)("section",{className:"paper",children:[(0,c.jsxs)("div",{className:"w-full justify-between",children:[(0,c.jsx)("h2",{className:"text-xl m-0",children:"SQL Users"}),(0,c.jsx)("di