dsql-admin/dsql-app/.local_dist/static/chunks/5949-b1c68b62cd5dbfee.js
2024-11-05 12:12:42 +01:00

1 line
12 KiB
JavaScript

"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5949],{96224:function(e,t,n){var a=n(64836);t.Z=void 0;var s=a(n(64938)),l=n(85893),c=(0,s.default)([(0,l.jsx)("path",{d:"m16 7.58-5.5-2.4L5 7.58v3.6c0 3.5 2.33 6.74 5.5 7.74.25-.08.49-.2.73-.3-.15-.51-.23-1.06-.23-1.62 0-2.97 2.16-5.43 5-5.91V7.58z",opacity:".3"},"0"),(0,l.jsx)("path",{d:"M17 13c-2.21 0-4 1.79-4 4s1.79 4 4 4 4-1.79 4-4-1.79-4-4-4zm0 1.38c.62 0 1.12.51 1.12 1.12s-.51 1.12-1.12 1.12-1.12-.51-1.12-1.12.5-1.12 1.12-1.12zm0 5.37c-.93 0-1.74-.46-2.24-1.17.05-.72 1.51-1.08 2.24-1.08s2.19.36 2.24 1.08c-.5.71-1.31 1.17-2.24 1.17z",opacity:".3"},"1"),(0,l.jsx)("circle",{cx:"17",cy:"15.5",r:"1.12"},"2"),(0,l.jsx)("path",{d:"M18 11.09V6.27L10.5 3 3 6.27v4.91c0 4.54 3.2 8.79 7.5 9.82.55-.13 1.08-.32 1.6-.55C13.18 21.99 14.97 23 17 23c3.31 0 6-2.69 6-6 0-2.97-2.16-5.43-5-5.91zM11 17c0 .56.08 1.11.23 1.62-.24.11-.48.22-.73.3-3.17-1-5.5-4.24-5.5-7.74v-3.6l5.5-2.4 5.5 2.4v3.51c-2.84.48-5 2.94-5 5.91zm6 4c-2.21 0-4-1.79-4-4s1.79-4 4-4 4 1.79 4 4-1.79 4-4 4z"},"3"),(0,l.jsx)("path",{d:"M17 17.5c-.73 0-2.19.36-2.24 1.08.5.71 1.32 1.17 2.24 1.17s1.74-.46 2.24-1.17c-.05-.72-1.51-1.08-2.24-1.08z"},"4")],"AdminPanelSettingsTwoTone");t.Z=c},88518:function(e,t,n){var a=n(64836);t.Z=void 0;var s=a(n(64938)),l=n(85893),c=(0,s.default)([(0,l.jsx)("path",{d:"M22 15c0-1.66-1.34-3-3-3h-1.5v-.5C17.5 8.46 15.04 6 12 6c-.77 0-1.49.17-2.16.46L20.79 17.4c.73-.55 1.21-1.41 1.21-2.4zM2 14c0 2.21 1.79 4 4 4h9.73l-8-8H6c-2.21 0-4 1.79-4 4z",opacity:".3"},"0"),(0,l.jsx)("path",{d:"M19.35 10.04C18.67 6.59 15.64 4 12 4c-1.33 0-2.57.36-3.65.97l1.49 1.49C10.51 6.17 11.23 6 12 6c3.04 0 5.5 2.46 5.5 5.5v.5H19c1.66 0 3 1.34 3 3 0 .99-.48 1.85-1.21 2.4l1.41 1.41c1.09-.92 1.8-2.27 1.8-3.81 0-2.64-2.05-4.78-4.65-4.96zM3 5.27l2.77 2.77h-.42C2.34 8.36 0 10.91 0 14c0 3.31 2.69 6 6 6h11.73l2 2 1.41-1.41L4.41 3.86 3 5.27zM7.73 10l8 8H6c-2.21 0-4-1.79-4-4s1.79-4 4-4h1.73z"},"1")],"CloudOffTwoTone");t.Z=c},57150:function(e,t,n){n.d(t,{Z:function(){return a}});const a=(0,n(45711).Z)("BookText",[["path",{d:"M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H20v20H6.5a2.5 2.5 0 0 1 0-5H20",key:"t4utmx"}],["path",{d:"M8 7h6",key:"1f0q6e"}],["path",{d:"M8 11h8",key:"vwpz6n"}]])},33587:function(e,t,n){n.d(t,{Z:function(){return a}});const a=(0,n(45711).Z)("Database",[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]])},3848:function(e,t,n){n.d(t,{Z:function(){return a}});const a=(0,n(45711).Z)("FileKey2",[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v6",key:"rc0qvx"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["circle",{cx:"4",cy:"16",r:"2",key:"1ehqvc"}],["path",{d:"m10 10-4.5 4.5",key:"7fwrp6"}],["path",{d:"m9 11 1 1",key:"wa6s5q"}]])},4844:function(e,t,n){n.d(t,{Z:function(){return a}});const a=(0,n(45711).Z)("Globe",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]])},68599:function(e,t,n){n.d(t,{Z:function(){return a}});const a=(0,n(45711).Z)("HardDrive",[["line",{x1:"22",x2:"2",y1:"12",y2:"12",key:"1y58io"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"oot6mr"}],["line",{x1:"6",x2:"6.01",y1:"16",y2:"16",key:"sgf278"}],["line",{x1:"10",x2:"10.01",y1:"16",y2:"16",key:"1l4acy"}]])},78107:function(e,t,n){n.d(t,{Z:function(){return a}});const a=(0,n(45711).Z)("Images",[["path",{d:"M18 22H4a2 2 0 0 1-2-2V6",key:"pblm9e"}],["path",{d:"m22 13-1.296-1.296a2.41 2.41 0 0 0-3.408 0L11 18",key:"nf6bnh"}],["circle",{cx:"12",cy:"8",r:"2",key:"1822b1"}],["rect",{width:"16",height:"16",x:"6",y:"2",rx:"2",key:"12espp"}]])},62888:function(e,t,n){n.d(t,{Z:function(){return a}});const a=(0,n(45711).Z)("RotateCw",[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]])},49525:function(e,t,n){n.d(t,{Z:function(){return a}});const a=(0,n(45711).Z)("Users",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["path",{d:"M16 3.13a4 4 0 0 1 0 7.75",key:"1da9ce"}]])},41352:function(e,t,n){n.d(t,{Z:function(){return a}});const a=(0,n(45711).Z)("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]])},9417:function(e,t,n){n.d(t,{Z:function(){return f}});var a=n(828),s=n(29815),l=n(85893),c=n(67294),i=n(86729),o=n(25472),r=n(95264),d=n(49486),u=n(44114);function f(e){var t,f,h=e.targetUser,m=e.user,p=e.setTargetUser,x=n(19169);if(!h)return null;var v=(0,a.Z)(c.useState(!0),2),b=v[0],y=v[1],g=c.useState([]),k=(0,a.Z)(g,2),Z=k[0],j=k[1],w=(0,a.Z)(c.useState(!1),2),_=w[0],N=w[1],M=c.useState(h?null===(t=h.user_priviledge)||void 0===t?void 0:t.split("|"):[]),C=(0,a.Z)(M,2),T=C[0],z=C[1],E=(0,a.Z)(c.useState((null===h||void 0===h?void 0:h.database_access)?h.database_access.split("|"):[]),2),H=E[0],S=E[1],A=c.useState(h?null===(f=h.database_access)||void 0===f?void 0:f.split("|")[0]:null),L=(0,a.Z)(A,2),V=L[0],q=L[1],D=c.useState([]),U=(0,a.Z)(D,2),R=U[0],B=U[1],F=c.useState([]),I=(0,a.Z)(F,2),O=I[0],P=I[1];return c.useEffect((function(){(0,i.Z)("/api/getUserDatabases").then((function(e){e.success&&j(e.databases)}))}),[]),c.useEffect((function(){var e;h&&(V?(0,i.Z)("/api/getDatabaseTables?dbSlug=".concat(V,"&dbOwnerId=").concat(m.id,"&delegatedUserId=").concat(h.invited_user_id)).then((function(e){e.success&&(B(null),setTimeout((function(){B((0,s.Z)(e.tables))}),200)),e.accessed_tables&&e.accessed_tables[0]&&!O[0]&&P(e.accessed_tables.map((function(e){return"".concat(e.database,"-").concat(e.table)})))})):q((null===(e=h.database_access)||void 0===e?void 0:e.split("|")[0])||null))}),[V]),c.useEffect((function(){var e,t;(y(!0),h)&&(z((null===(e=h.user_priviledge)||void 0===e?void 0:e.split("|"))||[]),S((null===(t=h.database_access)||void 0===t?void 0:t.split("|"))||[]));setTimeout((function(){y(!1)}),500)}),[h]),c.useEffect((function(){q((null===H||void 0===H?void 0:H[0])||null)}),[H]),(0,l.jsxs)(o.ZP,{title:"target-user-popup",closePopupDispatch:function(){p(null)},children:[b&&(0,l.jsx)(r.Z,{position:"relative"}),!b&&h&&(0,l.jsx)(c.Fragment,{children:(0,l.jsxs)("div",{className:"flex-col w-full items-start p-4",children:[(0,l.jsxs)("h4",{className:"m-0",children:["Edit ",h.first_name," ",h.last_name,"'s Access"]}),(0,l.jsx)("hr",{}),(0,l.jsxs)("form",{className:"flex flex-col items-start w-full",onSubmit:function(e){e.preventDefault(),y(!0),(0,i.Z)("/api/updateAdminUserAccess",{method:"post",body:{userObject:h,user_priviledge:T.join("|"),database_access:null===H||void 0===H?void 0:H.join("|"),db_tables:H&&H[0]?O.join("|"):"",inv_user_id:h.invited_user_id}},!0).then((function(e){window.location.reload(),setTimeout((function(){y(!1)}),500)}))},children:[(0,l.jsx)("h3",{className:"m-0 text-lg font-semibold mb-1 text-slate-600",children:"User Priviledges"}),(0,l.jsx)(d.Z,{checkBoxValues:x.map((function(e){return{title:e,name:e,default:!!T.includes(e),onChangeHandler:function(t){if(T.includes(e)){var n=T.filter((function(t){return t!=e}));z((0,s.Z)(n))}else z((function(t){return(0,s.Z)(t).concat([e])}))}}})),smallText:!0,flexRow:!0}),(0,l.jsx)("hr",{className:"my-6"}),(0,l.jsx)("h3",{className:"m-0 text-lg font-semibold mb-2 text-slate-600",children:"Databases Access"}),(0,l.jsx)("span",{className:"button outlined gray px-4 py-1 -mt-1 mb-1.5",onClick:function(e){_?(Z.forEach((function(e){setTimeout((function(){var t=document.getElementById(e.db_slug);(null===t||void 0===t?void 0:t.checked)&&t.click()}),200)})),N(!1)):(Z.forEach((function(e){setTimeout((function(){var t=document.getElementById(e.db_slug);t.checked||t.click()}),200)})),N(!0))},children:_?"Deselect All":"Select All"}),(0,l.jsx)(d.Z,{checkBoxValues:Z.map((function(e){return{title:e.db_name,name:e.db_slug,onChangeHandler:function(t){if(H.includes(e.db_slug)){var n=H.filter((function(t){return t!=e.db_slug}));S((0,s.Z)(n))}else S((function(t){return(0,s.Z)(t).concat([e.db_slug])}));H.length===Z.length?N(!0):N(!1)},default:!!H.includes(e.db_slug)}})),smallText:!0,flexRow:!0}),H&&H[0]&&(0,l.jsxs)(c.Fragment,{children:[(0,l.jsx)("hr",{className:"my-6"}),(0,l.jsx)("h3",{className:"m-0 text-lg font-semibold mb-2 text-slate-600",children:"Database Tables"}),(0,l.jsx)(u.Z,{required:!0,selectOptions:Z.filter((function(e){return H.includes(e.db_slug)})).map((function(e){return{title:e.db_name,payload:e.db_slug}})),name:"databases",onChangeHandler:function(e){q(e.target.value)}}),(0,l.jsx)("div",{className:"h-2"}),R&&R[0]&&(0,l.jsx)(d.Z,{checkBoxValues:R.map((function(e){return{title:e.table_name,name:e.table_slug,onChangeHandler:function(t){if(O.includes("".concat(V,"-").concat(e.table_slug))){var n=O.filter((function(t){return t!="".concat(V,"-").concat(e.table_slug)}));P((0,s.Z)(n))}else P((function(t){return(0,s.Z)(t).concat(["".concat(V,"-").concat(e.table_slug)])}))},default:!!O.includes("".concat(V,"-").concat(e.table_slug))}})),smallText:!0,flexRow:!0})]}),(0,l.jsx)("button",{className:"mt-4 w-full",children:"Update User Access"})]})]})})]})}},49486:function(e,t,n){n.d(t,{Z:function(){return s}});var a=n(85893);n(67294);function s(e){var t=e.name,n=e.checkBoxValues,s=e.setAlert,l=e.labelColor,c=e.flexRow,i=e.baseText,o=e.smallText,r=e.className;return(0,a.jsx)("div",{className:"flex items-start gap-x-4"+(c?" flex-row flex-wrap gap-y-2 ":" flex-col gap-y-4 ")+(r||""),children:n.map((function(e,n){var c=e.payload,r=e.title,d=e.onChangeHandler,u=e.fixed,f=e.jsx,h=e.name?"".concat(t,"-").concat(e.name):c?t+"-"+c:t;return(0,a.jsxs)("div",{className:"flex items-center"+(e.default&&u?" pointer-events-none":"")+(o?" gap-1 ":" gap-2 ")+((null===e||void 0===e?void 0:e.className)?e.className:""),children:[(0,a.jsx)("input",{className:"m-0"+(o?" w-4 h-4":" w-5 h-5"),type:"checkbox",defaultChecked:!!e.default,name:h,id:h,onChange:function(t){s&&s(null),d&&d(t,e)},value:c,style:{minWidth:"20px"}}),f||(0,a.jsx)("label",{htmlFor:h,className:"m-0 "+(l||"text-slate-800 dark:text-white/80")+(i||o?" text-base":" text-lg"),children:r})]},n+1)}))})}},44114:function(e,t,n){n.d(t,{Z:function(){return l}});var a=n(85893),s=n(8971);n(67294);function l(e){var t=e.selectOptions,n=e.name,l=e.onChangeHandler,c=e.required,i=e.setAlert,o=e.title,r=e.defaultValue,d=e.info,u=e.id;try{var f=function(e){if(!(e.type.match(/enter/i)&&window.innerWidth<1200)){var t=e.target.closest(".info-wrapper"),n=t.querySelector(".info-dropdown");!e.type.match(/leave/i)||n.classList.contains("hidden")?e.type.match(/leave/i)&&n.classList.contains("hidden")||(t&&n.classList.contains("hidden")?n.classList.remove("hidden"):n.classList.add("hidden")):n.classList.add("hidden")}};return(0,a.jsxs)("div",{className:"form-select-block flex items-start flex-col gap-0.5 w-full relative"+(d?" pr-8":""),children:[o&&(0,a.jsxs)("label",{htmlFor:n,children:[o,c?"":" (optional)"]}),(0,a.jsxs)("div",{className:"flex items-center w-full relative",children:[(0,a.jsx)("select",{name:n,id:u||n,className:"w-full bg-white",required:c,onChange:function(e){i&&i(null),e.target.classList.remove("warning"),l&&l(e)},defaultValue:r||void 0,children:t.map((function(e,t){var n=e.payload,s=e.title;return(0,a.jsx)("option",{value:n,selected:!!e.default,children:s},t+1)}))}),(0,a.jsx)(s.Z,{className:"absolute right-2 text-base text-slate-500 pointer-events-none",size:20}),d&&(0,a.jsxs)("div",{className:"info-wrapper absolute -right-10 w-8 h-8 rounded-full bg-white flex items-center justify-center z-10",style:{top:"50%",transform:"translate(0,-50%)"},onMouseEnter:f,onMouseLeave:f,onClick:f,children:[(0,a.jsx)("img",{src:"/images/info-outlined-black.png",alt:"",className:"w-6 h-6 object-contain opacity-60 pointer-events-none"}),(0,a.jsx)("div",{className:"info-dropdown absolute top-9 right-0 bg-white w-52 md:w-96 p-2 sm:p-6 shadow-xl rounded hidden text-center border border-slate-300 border-solid",children:(0,a.jsx)("span",{children:d})}),(0,a.jsx)("div",{className:"absolute -top-2 w-12",style:{height:"45px"}})]})]})]})}catch(h){return console.log("ERROR in FormSelect =>",h),(0,a.jsx)("div",{children:"Form Select Error"})}}},29815:function(e,t,n){n.d(t,{Z:function(){return c}});var a=n(20943);var s=n(13375);var l=n(91566);function c(e){return function(e){if(Array.isArray(e))return(0,a.Z)(e)}(e)||(0,s.Z)(e)||(0,l.Z)(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}},19169:function(e){e.exports=JSON.parse('["Edit Tables","Update Entries","Create Table","Delete Entries","Delete Tables"]')}}]);