dsql-admin/dsql-app/.local_dist/server/chunks/9240.js
Benjamin Toby 81cf010cb5 Updates
2025-01-14 16:27:08 +01:00

1 line
4.9 KiB
JavaScript

"use strict";exports.id=9240,exports.ids=[9240],exports.modules={55904:(e,s,t)=>{t.d(s,{A:()=>o});var a=t(8732),r=t(82015),l=t.n(r);function o({children:e,column:s,className:t}){let r=l().useRef();return(0,a.jsx)("div",{className:"items-stretch gap-0"+(s?" flex-col":" flex-wrap xl:flex-nowrap")+(t?" "+t:""),ref:r,children:e})}},93035:(e,s,t)=>{t.d(s,{A:()=>m});var a=t(8732),r=t(82015),l=t.n(r),o=t(46169),n=t(16757),c=t(82544);let i=(0,c.A)("Newspaper",[["path",{d:"M4 22h16a2 2 0 0 0 2-2V4a2 2 0 0 0-2-2H8a2 2 0 0 0-2 2v16a2 2 0 0 1-2 2Zm0 0a2 2 0 0 1-2-2v-9c0-1.1.9-2 2-2h2",key:"7pis2x"}],["path",{d:"M18 14h-8",key:"sponae"}],["path",{d:"M15 18h-5",key:"95g1m2"}],["path",{d:"M10 6h8v4h-8V6Z",key:"smlsk5"}]]),d=(0,c.A)("Layers",[["path",{d:"m12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83Z",key:"8b97xw"}],["path",{d:"m22 17.65-9.17 4.16a2 2 0 0 1-1.66 0L2 17.65",key:"dd6zsq"}],["path",{d:"m22 12.65-9.17 4.16a2 2 0 0 1-1.66 0L2 12.65",key:"ep9fru"}]]);function p({docPageObject:e}){let[s,t]=l().useState(!1),[r,c]=l().useState([]);return(0,a.jsxs)("div",{className:"card col relative cursor-pointer",onClick:s=>{s.target?.closest(".cancel-link")?s.preventDefault():window.location.pathname=`/su/docs/pages/${e.id}`},children:[s&&(0,a.jsx)(n.A,{width:"20px"}),(0,a.jsxs)("div",{className:"w-full items-start",children:[(0,a.jsx)(i,{}),(0,a.jsxs)("div",{className:"flex-col items-start gap-0 relative z-10",children:[(0,a.jsx)("span",{className:"title",children:e.title}),(0,a.jsx)("span",{className:"-my-3",dangerouslySetInnerHTML:{__html:e.description||""}})]}),(0,a.jsxs)("div",{className:"ml-auto cancel-link",children:[(0,a.jsx)("button",{onClick:()=>{window.location.href=`/su/docs/edit-page?id=${e.id}`},className:"outlined small-text light-gray",children:"Edit Page"}),(0,a.jsx)("button",{onClick:()=>{window.confirm("Delete this page?")&&(t(!0),(0,o.A)("/api/admin/docs/delete-page",{method:"post",body:e}).then(e=>{e.success&&window.location.reload(),setTimeout(()=>{t(!1)},1e3)}))},className:"outlined small-text light-gray",children:"Delete Page"})]})]}),r&&(0,a.jsxs)("div",{className:"-mt-[40px] pt-[40px] ml-[10px] pl-[20px] border-0 border-l border-slate-200 border-solid w-full flex-col items-start cancel-link",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(d,{}),(0,a.jsx)("span",{className:"text-slate-300 font-semibold",children:"Children Pages"})]}),r.map((e,s)=>(0,a.jsxs)("div",{className:"card w-full",onClick:()=>{window.location.pathname=`/su/docs/pages/${e.id}`},children:[(0,a.jsx)(i,{}),(0,a.jsx)("span",{children:e.title})]},s))]})]})}var u=t(55904);function m({data:e}){let{env:s}=e,t=e.docPages,[r,c]=l().useState(!1);function i(e){window.confirm(e?"Update Docs DB from JSON file?":"Update docs json file?")&&(c(!0),(0,o.A)("/api/admin/docs/persist",{method:"post",body:{pull:e}}).then(s=>{s.success?window.alert(e?"Docs database table Updated Sucessfully!":"JSON data written Successfully!"):window.alert("Operation failed!"),setTimeout(()=>{c(!1)},1e3)}).catch(e=>{setTimeout(()=>{c(!1)},1e3)}))}return(0,a.jsxs)(l().Fragment,{children:[r&&(0,a.jsx)(n.A,{}),(0,a.jsxs)("section",{className:"items-start justify-start p-6",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between w-full mb-6",children:[(0,a.jsx)("h2",{className:"text-xl m-0",children:"Documentation Pages"}),(0,a.jsxs)("div",{children:[(0,a.jsx)("a",{href:"/su/docs/create-page",className:"button",children:"Create Page"}),(0,a.jsxs)(u.A,{children:[(0,a.jsx)("button",{className:"outlined gray",onClick:()=>{i(!1)},children:"Push"}),(0,a.jsx)("button",{className:"outlined gray",onClick:()=>{i(!0)},children:"Pull"})]})]})]}),(0,a.jsx)("div",{className:"paper flex-col items-stretch gap-10 w-full",children:t.map((e,s)=>(0,a.jsx)(p,{docPageObject:e},s))})]})]})}},71934:(e,s,t)=>{t.d(s,{A:()=>r});var a=t(51779);async function r(...e){let s=(0,a.A)();try{if(!s)throw Error("No Connection provided to DB_HANDLER function!");let t=await s.query(...e);return JSON.parse(JSON.stringify(t))}catch(e){return console.log("DB Error =>",e),{success:!1,error:e.message}}finally{await s?.end()}}},51779:(e,s,t)=>{t.d(s,{A:()=>l});var a=t(9973),r=t.n(a);function l(e){return e?.ro?DSQL_READ_ONLY_DB_CONN||r()({config:{host:process.env.DSQL_DB_HOST,user:process.env.DSQL_DB_READ_ONLY_USERNAME,password:process.env.DSQL_DB_READ_ONLY_PASSWORD,port:process.env.DSQL_DB_PORT?Number(process.env.DSQL_DB_PORT):void 0,charset:"utf8mb4"}}):e?.fa?global.DSQL_FULL_ACCESS_DB_CONN||r()({config:{host:process.env.DSQL_DB_HOST,user:process.env.DSQL_DB_FULL_ACCESS_USERNAME,password:process.env.DSQL_DB_FULL_ACCESS_PASSWORD,port:process.env.DSQL_DB_PORT?Number(process.env.DSQL_DB_PORT):void 0,charset:"utf8mb4"}}):global.DSQL_DB_CONN||r()({config:{host:process.env.DSQL_DB_HOST,user:process.env.DSQL_DB_USERNAME,password:process.env.DSQL_DB_PASSWORD,database:e?.noDb?void 0:process.env.DSQL_DB_NAME,port:process.env.DSQL_DB_PORT?Number(process.env.DSQL_DB_PORT):void 0,charset:"utf8mb4"}})}}};