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

1 line
22 KiB
JavaScript
Raw Normal View History

2024-12-05 07:03:33 +00:00
"use strict";(()=>{var e={};e.id=2504,e.ids=[636,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}}})},88297:(e,s,t)=>{t.r(s),t.d(s,{config:()=>z,default:()=>H,getServerSideProps:()=>G,getStaticPaths:()=>O,getStaticProps:()=>U,reportWebVitals:()=>F,routeModule:()=>Y,unstable_getServerProps:()=>Q,unstable_getServerSideProps:()=>X,unstable_getStaticParams:()=>W,unstable_getStaticPaths:()=>B,unstable_getStaticProps:()=>D});var r={};t.r(r),t.d(r,{ConnectContext:()=>I,default:()=>T,getServerSideProps:()=>V});var a=t(63865),l=t(9455),i=t(30671),n=t(49407),d=t(68268),c=t(8732),o=t(82015),u=t.n(o),p=t(95222),x=t(20048),m=t.n(x),h=t(67216),j=t.n(h),f=t(58548),y=t(72412),b=t(54827);function v(e){let{user:s,query:t,mariadbUserCred:r}=u().useContext(I);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:r.mariadb_user})]}),(0,c.jsxs)("li",{children:["Host: ",(0,c.jsx)("b",{children:r.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(r.mariadb_pass||"").then(()=>{window.alert("Copied Password!")})},children:(0,c.jsx)(y.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)(b.A,{className:"-mt-[3px]"}),"Download"]})})})]})})]})]})})}var g=t(56062),A=t(55158),E=t(32415),S=t(77627),N=t(63715);function w({mariadbUser:e}){let{setTargetMariadbUser:s}=u().useContext(I),t=!!String(e.primary)?.match(/1/),[r,a]=u().useState(!1);return(0,c.jsxs)("div",{className:"card w-full col"+(t?" green":""),children:[r&&(0,c.jsx)(E.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,A.PB)("edit-mariadb-user-popup")},children:(0,c.jsx)(g.A,{})}),!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?")&&(a(!0),(0,N.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(()=>{a(!1)},1e3)}))},children:(0,c.jsx)(S.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)(y.A,{className:"text-[15px] -ml-2"})})]})]})]})}function P(e){let{mariadbUsers:s}=u().useContext(I);return(0,c.jsxs)("section",{className:"paper",children:[(0,c.jsxs)("div",{className:"w-full justify-between",children:[(0,c.jsx)("h2",{clas