Updates
This commit is contained in:
@@ -1 +0,0 @@
|
||||
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[148],{55634:function(e,n,s){(window.__NEXT_P=window.__NEXT_P||[]).push(["/admin/services",function(){return s(78701)}])},49533:function(e,n,s){"use strict";s.d(n,{Z:function(){return j}});var i=s(85893),r=s(5606),t=s(60),l=s(67294),c=s(55412),a=s(86609),o=s(94655);function u(e){let{link:n,icon:s,...r}=e;return(0,i.jsx)(a.Z,{href:n.url,...r,...n.linkProps,children:(0,i.jsxs)(o.Z,{children:[(0,i.jsx)("span",{children:n.title}),s||(0,i.jsx)(c.Z,{size:17})]})})}var d=s(56211),v=s(60826),f=s(3326),p=s(25808),x=s(96486),m=s.n(x);function _(e){let{service:n}=e,{pageProps:s,ws:c}=(0,l.useContext)(r.AppContext),{deployment:a}=s,{ready:x,setReady:_}=(0,p.Z)(),j=null==a?void 0:a.services.filter(e=>e.parent_service_name==n.service_name),h=[n,...j||[]],[Z,N]=(0,l.useState)(null==h?void 0:h[0]);h.findIndex(e=>e.service_name==(null==Z?void 0:Z.service_name));let g=null==Z?void 0:Z.servers,[w,C]=(0,l.useState)(null==g?void 0:g[0]),k=(0,l.useRef)(void 0);return(0,l.useEffect)(()=>{var e;C(null==Z?void 0:null===(e=Z.servers)||void 0===e?void 0:e[0])},[Z]),(0,l.useEffect)(()=>{if(_(!1),w&&k.current){var e;e=k.current,c.sendData({event:"client:kill-port",server:w,service:m().omit(n,["servers"]),port:e})}setTimeout(()=>{_(!0)},2e3)},[w]),(0,i.jsxs)(t.Z,{className:"grid-cell",children:[(0,i.jsxs)(t.Z,{className:"grid-cell-content",children:[(0,i.jsxs)(o.Z,{className:"w-full justify-between",children:[(0,i.jsx)(d.Z,{children:n.service_name}),(0,i.jsx)(u,{link:{url:"/admin/services/".concat(n.service_name),title:"View"}})]}),(0,i.jsxs)("code",{children:[n.service_name," service"]})]}),(0,i.jsx)("hr",{}),(0,i.jsxs)(t.Z,{className:"gap-0",children:[(0,i.jsxs)(o.Z,{className:"p-4 grid md:grid-cols-2",children:[(0,i.jsx)(f.Z,{options:h.map((e,n)=>({value:e.service_name,title:"Cluster #".concat(n+1)})),changeHandler:e=>{N(h.find(n=>n.service_name==e))}}),g?(0,i.jsx)(f.Z,{options:g.map(e=>({value:e.private_ip,title:e.private_ip})),changeHandler:e=>{C(g.find(n=>n.private_ip==e))}}):void 0]}),x&&w?(0,i.jsx)(v.Z,{server:w,service:n,portRef:k}):void 0]})]})}function j(){let{pageProps:e}=(0,l.useContext)(r.AppContext),{deployment:n,children_services:s}=e,c=null==n?void 0:n.services.filter(e=>!e.parent_service_name);return(0,i.jsx)(t.Z,{className:"w-full nested-grid-frame xl:grid-cols-2",children:null==c?void 0:c.map((e,n)=>(0,i.jsx)(_,{service:e},n))})}},78701:function(e,n,s){"use strict";s.r(n),s.d(n,{__N_SSP:function(){return v},default:function(){return f}});var i=s(85893),r=s(67294),t=s(5606),l=s(38249),c=s(60705),a=s(21147),o=s(49533);function u(){let{pageProps:e}=(0,r.useContext)(t.AppContext),{user:n,deployment:s,deployment_id:u}=e,d=null==s?void 0:s.deployment_name;return(0,i.jsxs)(r.Fragment,{children:[(0,i.jsx)(a.Z,{title:"".concat((0,l.Z)(d)," Deplyoment Dashboard"),description:(0,i.jsxs)(i.Fragment,{children:["Deployment"," ",(0,i.jsx)("code",{children:null==u?void 0:u.split("-").shift()})," > ",(0,i.jsx)("code",{children:null==s?void 0:s.deployment_name})]})}),(0,i.jsx)(c.Z,{}),(0,i.jsx)(o.Z,{})]})}var d=s(89350),v=!0;function f(){return(0,i.jsx)(d.Z,{children:(0,i.jsx)(u,{})})}}},function(e){e.O(0,[662,75,664,433,7,827,242,696,888,774,179],function(){return e(e.s=55634)}),_N_E=e.O()}]);
|
||||
@@ -0,0 +1 @@
|
||||
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[148],{55634:function(e,n,s){(window.__NEXT_P=window.__NEXT_P||[]).push(["/admin/services",function(){return s(78701)}])},49533:function(e,n,s){"use strict";s.d(n,{Z:function(){return j}});var i=s(85893),r=s(5606),t=s(60),l=s(67294),c=s(55412),a=s(86609),o=s(94655);function u(e){let{link:n,icon:s,...r}=e;return(0,i.jsx)(a.Z,{href:n.url,...r,...n.linkProps,children:(0,i.jsxs)(o.Z,{children:[(0,i.jsx)("span",{children:n.title}),s||(0,i.jsx)(c.Z,{size:17})]})})}var d=s(56211),v=s(45377),f=s(39483),p=s(25808),x=s(96486),m=s.n(x);function _(e){let{service:n}=e,{pageProps:s,ws:c}=(0,l.useContext)(r.AppContext),{deployment:a}=s,{ready:x,setReady:_}=(0,p.Z)(),j=null==a?void 0:a.services.filter(e=>e.parent_service_name==n.service_name),h=[n,...j||[]],[Z,N]=(0,l.useState)(null==h?void 0:h[0]);h.findIndex(e=>e.service_name==(null==Z?void 0:Z.service_name));let g=null==Z?void 0:Z.servers,[w,C]=(0,l.useState)(null==g?void 0:g[0]),k=(0,l.useRef)(void 0);return(0,l.useEffect)(()=>{var e;C(null==Z?void 0:null===(e=Z.servers)||void 0===e?void 0:e[0])},[Z]),(0,l.useEffect)(()=>{if(_(!1),w&&k.current){var e;e=k.current,c.sendData({event:"client:kill-port",server:w,service:m().omit(n,["servers"]),port:e})}setTimeout(()=>{_(!0)},2e3)},[w]),(0,i.jsxs)(t.Z,{className:"grid-cell",children:[(0,i.jsxs)(t.Z,{className:"grid-cell-content",children:[(0,i.jsxs)(o.Z,{className:"w-full justify-between",children:[(0,i.jsx)(d.Z,{children:n.service_name}),(0,i.jsx)(u,{link:{url:"/admin/services/".concat(n.service_name),title:"View"}})]}),(0,i.jsxs)("code",{children:[n.service_name," service"]})]}),(0,i.jsx)("hr",{}),(0,i.jsxs)(t.Z,{className:"gap-0",children:[(0,i.jsxs)(o.Z,{className:"p-4 grid md:grid-cols-2",children:[(0,i.jsx)(f.Z,{options:h.map((e,n)=>({value:e.service_name,title:"Cluster #".concat(n+1)})),changeHandler:e=>{N(h.find(n=>n.service_name==e))}}),g?(0,i.jsx)(f.Z,{options:g.map(e=>({value:e.private_ip,title:e.private_ip})),changeHandler:e=>{C(g.find(n=>n.private_ip==e))}}):void 0]}),x&&w?(0,i.jsx)(v.Z,{server:w,service:n,portRef:k}):void 0]})]})}function j(){let{pageProps:e}=(0,l.useContext)(r.AppContext),{deployment:n,children_services:s}=e,c=null==n?void 0:n.services.filter(e=>!e.parent_service_name);return(0,i.jsx)(t.Z,{className:"w-full nested-grid-frame xl:grid-cols-2",children:null==c?void 0:c.map((e,n)=>(0,i.jsx)(_,{service:e},n))})}},78701:function(e,n,s){"use strict";s.r(n),s.d(n,{__N_SSP:function(){return v},default:function(){return f}});var i=s(85893),r=s(67294),t=s(5606),l=s(38249),c=s(60705),a=s(33028),o=s(49533);function u(){let{pageProps:e}=(0,r.useContext)(t.AppContext),{user:n,deployment:s,deployment_id:u}=e,d=null==s?void 0:s.deployment_name;return(0,i.jsxs)(r.Fragment,{children:[(0,i.jsx)(a.Z,{title:"".concat((0,l.Z)(d)," Deplyoment Dashboard"),description:(0,i.jsxs)(i.Fragment,{children:["Deployment"," ",(0,i.jsx)("code",{children:null==u?void 0:u.split("-").shift()})," > ",(0,i.jsx)("code",{children:null==s?void 0:s.deployment_name})]})}),(0,i.jsx)(c.Z,{}),(0,i.jsx)(o.Z,{})]})}var d=s(89350),v=!0;function f(){return(0,i.jsx)(d.Z,{children:(0,i.jsx)(u,{})})}}},function(e){e.O(0,[662,75,664,433,7,827,910,464,888,774,179],function(){return e(e.s=55634)}),_N_E=e.O()}]);
|
||||
+1
@@ -0,0 +1 @@
|
||||
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[329],{89426:function(e,n,s){(window.__NEXT_P=window.__NEXT_P||[]).push(["/admin/services/[service_name]",function(){return s(52963)}])},52963:function(e,n,s){"use strict";s.r(n),s.d(n,{__N_SSP:function(){return h},default:function(){return _}});var l=s(85893),r=s(67294),i=s(5606),t=s(38249),c=s(60705),a=s(33028),d=s(60),o=s(94655),u=s(45377);function x(e){let{service:n}=e,{pageProps:s}=(0,r.useContext)(i.AppContext),t=n.servers,[c,a]=(0,r.useState)(null==t?void 0:t[0]),x=null!=t&&!!t.length&&!!(t.length%2);return(0,l.jsx)(d.Z,{className:"w-full grid-cell col-span-1 gap-0",children:(0,l.jsxs)(o.Z,{className:"nested-grid-frame xl:grid-cols-2",children:[null==t?void 0:t.map((e,s)=>(0,l.jsx)(u.Z,{server:e,service:n,wrapperProps:{className:"grid-cell"}},s)),x?(0,l.jsx)("div",{className:"grid-cell"}):null]})})}var v=s(39483),p=s(56211);function m(){let{pageProps:e,ws:n}=(0,r.useContext)(i.AppContext),{service:s,deployment:t,children_services:c}=e,a=[s,...c||[]],[u,m]=(0,r.useState)(s||void 0),j=a.findIndex(e=>(null==e?void 0:e.service_name)==(null==u?void 0:u.service_name))+1;return null==u||u.servers,(0,l.jsx)(d.Z,{className:"w-full nested-grid-frame grid-cols-1",children:(0,l.jsxs)(d.Z,{className:"grid-cell gap-0",children:[(0,l.jsx)(o.Z,{className:"grid-cell-content flex-nowrap",children:(0,l.jsxs)(o.Z,{className:"w-full justify-between",children:[(0,l.jsx)(o.Z,{children:(0,l.jsxs)(p.Z,{children:["Cluster #",j]})}),(0,l.jsx)(o.Z,{children:(0,l.jsx)(v.Z,{options:a.map((e,n)=>({value:null==e?void 0:e.service_name,title:"Cluster #".concat(n+1)})),wrapperWrapperProps:{className:"max-w-[250px]"},changeHandler:e=>{m(void 0),n.sendData({event:"client:kill-all-ports"}),setTimeout(()=>{m(a.find(n=>(null==n?void 0:n.service_name)==e)||void 0)},200)}})})]})}),(0,l.jsx)("hr",{}),u?(0,l.jsx)(x,{service:u}):void 0]})})}function j(){let{pageProps:e}=(0,r.useContext)(i.AppContext),{service:n,deployment:s}=e,d=null==s?void 0:s.deployment_name,o=null==n?void 0:n.service_name;return(0,l.jsxs)(r.Fragment,{children:[(0,l.jsx)(a.Z,{title:"".concat((0,t.Z)(o)," Service"),description:(0,l.jsxs)(l.Fragment,{children:["Deployment ",(0,l.jsx)("code",{children:d})," > ",(0,l.jsx)("code",{children:o})]})}),(0,l.jsx)(c.Z,{}),(0,l.jsx)(m,{})]})}var f=s(89350),h=!0;function _(){return(0,l.jsx)(f.Z,{children:(0,l.jsx)(j,{})})}}},function(e){e.O(0,[662,75,664,433,7,827,910,464,888,774,179],function(){return e(e.s=89426)}),_N_E=e.O()}]);
|
||||
-1
@@ -1 +0,0 @@
|
||||
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[329],{89426:function(e,n,s){(window.__NEXT_P=window.__NEXT_P||[]).push(["/admin/services/[service_name]",function(){return s(52963)}])},52963:function(e,n,s){"use strict";s.r(n),s.d(n,{__N_SSP:function(){return h},default:function(){return _}});var l=s(85893),r=s(67294),i=s(5606),t=s(38249),c=s(60705),a=s(21147),d=s(60),o=s(94655),u=s(60826);function x(e){let{service:n}=e,{pageProps:s}=(0,r.useContext)(i.AppContext),t=n.servers,[c,a]=(0,r.useState)(null==t?void 0:t[0]),x=null!=t&&!!t.length&&!!(t.length%2);return(0,l.jsx)(d.Z,{className:"w-full grid-cell col-span-1 gap-0",children:(0,l.jsxs)(o.Z,{className:"nested-grid-frame xl:grid-cols-2",children:[null==t?void 0:t.map((e,s)=>(0,l.jsx)(u.Z,{server:e,service:n,wrapperProps:{className:"grid-cell"}},s)),x?(0,l.jsx)("div",{className:"grid-cell"}):null]})})}var v=s(3326),p=s(56211);function m(){let{pageProps:e,ws:n}=(0,r.useContext)(i.AppContext),{service:s,deployment:t,children_services:c}=e,a=[s,...c||[]],[u,m]=(0,r.useState)(s||void 0),j=a.findIndex(e=>(null==e?void 0:e.service_name)==(null==u?void 0:u.service_name))+1;return null==u||u.servers,(0,l.jsx)(d.Z,{className:"w-full nested-grid-frame grid-cols-1",children:(0,l.jsxs)(d.Z,{className:"grid-cell gap-0",children:[(0,l.jsx)(o.Z,{className:"grid-cell-content flex-nowrap",children:(0,l.jsxs)(o.Z,{className:"w-full justify-between",children:[(0,l.jsx)(o.Z,{children:(0,l.jsxs)(p.Z,{children:["Cluster #",j]})}),(0,l.jsx)(o.Z,{children:(0,l.jsx)(v.Z,{options:a.map((e,n)=>({value:null==e?void 0:e.service_name,title:"Cluster #".concat(n+1)})),wrapperWrapperProps:{className:"max-w-[250px]"},changeHandler:e=>{m(void 0),n.sendData({event:"client:kill-all-ports"}),setTimeout(()=>{m(a.find(n=>(null==n?void 0:n.service_name)==e)||void 0)},200)}})})]})}),(0,l.jsx)("hr",{}),u?(0,l.jsx)(x,{service:u}):void 0]})})}function j(){let{pageProps:e}=(0,r.useContext)(i.AppContext),{service:n,deployment:s}=e,d=null==s?void 0:s.deployment_name,o=null==n?void 0:n.service_name;return(0,l.jsxs)(r.Fragment,{children:[(0,l.jsx)(a.Z,{title:"".concat((0,t.Z)(o)," Service"),description:(0,l.jsxs)(l.Fragment,{children:["Deployment ",(0,l.jsx)("code",{children:d})," > ",(0,l.jsx)("code",{children:o})]})}),(0,l.jsx)(c.Z,{}),(0,l.jsx)(m,{})]})}var f=s(89350),h=!0;function _(){return(0,l.jsx)(f.Z,{children:(0,l.jsx)(j,{})})}}},function(e){e.O(0,[662,75,664,433,7,827,242,696,888,774,179],function(){return e(e.s=89426)}),_N_E=e.O()}]);
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -1 +0,0 @@
|
||||
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[635],{64168:function(e,t,r){(window.__NEXT_P=window.__NEXT_P||[]).push(["/admin/users",function(){return r(45446)}])},45446:function(e,t,r){"use strict";r.r(t),r.d(t,{__N_SSP:function(){return f},default:function(){return y}});var n=r(85893),s=r(67294),a=r(5606),i=r(60705),c=r(21147),u=r(94495),d=r(53151),l=r(88584),o=r(94655),x=r(3668),m=r(60);function g(){let{pageProps:e}=(0,s.useContext)(a.AppContext),{deployment_users:t}=e;return(0,n.jsx)(m.Z,{className:"grid-cell-content",children:null==t?void 0:t.map((e,t)=>{let r=!!e.is_super_admin;return(0,n.jsx)("a",{href:"/admin/users/".concat(e.id),children:(0,n.jsxs)(o.Z,{className:"w-full justify-between",children:[(0,n.jsxs)(o.Z,{children:[(0,n.jsx)(d.Z,{image_url:e.image,title:"".concat(e.first_name," Image"),image_size:40}),(0,n.jsxs)(x.Z,{children:[e.first_name," ",e.last_name]})]}),(0,n.jsx)(o.Z,{children:r?(0,n.jsx)(l.Z,{children:"Super Admin"}):null})]})},t)})})}function h(){let{pageProps:e}=(0,s.useContext)(a.AppContext);return(0,n.jsxs)(s.Fragment,{children:[(0,n.jsx)(c.Z,{title:"Users",description:(0,n.jsx)(n.Fragment,{children:"All Users in this deployment"}),ctas:(0,n.jsx)(n.Fragment,{children:(0,n.jsx)(u.Z,{title:"Add User",href:"/admin/users/add-user",children:"Add User"})})}),(0,n.jsx)(i.Z,{}),(0,n.jsx)(g,{})]})}var p=r(89350),f=!0;function y(){return(0,n.jsx)(p.Z,{children:(0,n.jsx)(h,{})})}},88584:function(e,t,r){"use strict";r.d(t,{Z:function(){return a}});var n=r(85893);r(67294);var s=r(98388);function a(e){let{color:t,variant:r,children:a,href:i,newTab:c,linkProps:u,...d}=e,l=(0,n.jsx)("div",{...d,className:(0,s.m6)("text-xs px-2 py-0.5 rounded-full outline-0","text-center flex items-center justify-center","secondary"==t?"bg-secondary text-white outline-secbg-secondary":"success"==t?"bg-success outline-success text-white":"error"==t?"bg-orange-700 outline-orange-700":"gray"==t?(0,s.m6)("bg-slate-100 outline-slate-200 dark:bg-gray-dark dark:outline-gray-dark","text-slate-800 dark:text-white"):"bg-primary text-white outline-primbg-primary twui-tag-primary","outlined"==r?"!bg-transparent outline-1 "+("secondary"==t?"text-secondary":"success"==t?"text-success dark:text-success-dark":"error"==t?"text-orange-700":"gray"==t?"text-slate-700 dark:text-white/80":"text-primary dark:text-primary-dark twui-tag-primary-outlined"):"ghost"==r?"!bg-transparent outline-none border-none "+("secondary"==t?"text-secondary":"success"==t?"text-success dark:text-success-dark":"error"==t?"text-orange-700":"gray"==t?"text-slate-700 dark:text-white/80":"text-primary dark:text-primary-dark"):"","twui-tag",d.className),children:a});return i?(0,n.jsx)("a",{href:i,target:c?"_blank":void 0,...u,className:(0,s.m6)("hover:opacity-80",null==u?void 0:u.className),children:l}):l}}},function(e){e.O(0,[662,75,664,433,7,242,888,774,179],function(){return e(e.s=64168)}),_N_E=e.O()}]);
|
||||
-1
@@ -1 +0,0 @@
|
||||
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[786],{79845:function(e,t,r){(window.__NEXT_P=window.__NEXT_P||[]).push(["/admin/users/[deployment_user_id]",function(){return r(38347)}])},38347:function(e,t,r){"use strict";r.r(t),r.d(t,{__N_SSP:function(){return x},default:function(){return g}});var n=r(85893),s=r(67294),a=r(5606),i=r(60705),u=r(21147),c=r(88584),l=r(94655);function o(){let{pageProps:e}=(0,s.useContext)(a.AppContext),{deployment_user:t}=e;if(!(null==t?void 0:t.id))return null;let r=!!t.is_super_admin;return(0,n.jsxs)(s.Fragment,{children:[(0,n.jsx)(u.Z,{title:(0,n.jsxs)(l.Z,{children:[(0,n.jsx)("span",{children:null==t?void 0:t.first_name}),(0,n.jsx)("span",{children:null==t?void 0:t.last_name}),r?(0,n.jsx)(c.Z,{className:"inline",children:"Super Admin"}):null]})}),(0,n.jsx)(i.Z,{})]})}var d=r(89350),x=!0;function g(){return(0,n.jsx)(d.Z,{children:(0,n.jsx)(o,{})})}},88584:function(e,t,r){"use strict";r.d(t,{Z:function(){return a}});var n=r(85893);r(67294);var s=r(98388);function a(e){let{color:t,variant:r,children:a,href:i,newTab:u,linkProps:c,...l}=e,o=(0,n.jsx)("div",{...l,className:(0,s.m6)("text-xs px-2 py-0.5 rounded-full outline-0","text-center flex items-center justify-center","secondary"==t?"bg-secondary text-white outline-secbg-secondary":"success"==t?"bg-success outline-success text-white":"error"==t?"bg-orange-700 outline-orange-700":"gray"==t?(0,s.m6)("bg-slate-100 outline-slate-200 dark:bg-gray-dark dark:outline-gray-dark","text-slate-800 dark:text-white"):"bg-primary text-white outline-primbg-primary twui-tag-primary","outlined"==r?"!bg-transparent outline-1 "+("secondary"==t?"text-secondary":"success"==t?"text-success dark:text-success-dark":"error"==t?"text-orange-700":"gray"==t?"text-slate-700 dark:text-white/80":"text-primary dark:text-primary-dark twui-tag-primary-outlined"):"ghost"==r?"!bg-transparent outline-none border-none "+("secondary"==t?"text-secondary":"success"==t?"text-success dark:text-success-dark":"error"==t?"text-orange-700":"gray"==t?"text-slate-700 dark:text-white/80":"text-primary dark:text-primary-dark"):"","twui-tag",l.className),children:a});return i?(0,n.jsx)("a",{href:i,target:u?"_blank":void 0,...c,className:(0,s.m6)("hover:opacity-80",null==c?void 0:c.className),children:o}):o}}},function(e){e.O(0,[662,75,664,433,7,242,888,774,179],function(){return e(e.s=79845)}),_N_E=e.O()}]);
|
||||
+1
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -1 +0,0 @@
|
||||
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[633],{33356:function(e,t,n){(window.__NEXT_P=window.__NEXT_P||[]).push(["/admin/users/add-user",function(){return n(28043)}])},78513:function(e,t,n){"use strict";n.d(t,{Z:function(){return u}});var r=n(85893),s=n(77827),o=n(94495),a=n(60),i=n(5606),l=n(25808),c=n(67294),d=n(79265);function u(e){var t,n,u,h;let{new_deployment_user:f}=e,{newUser:p,setNewUser:m,loading:w,setLoading:y,isPasswordConfirmed:g,setIsPasswordConfirmed:j,pageProps:x}=function(e){let{new_deployment_user:t}=e,{pageProps:n}=(0,c.useContext)(i.AppContext),[r,s]=(0,c.useState)({}),{loading:o,setLoading:a}=(0,l.Z)(),[d,u]=(0,c.useState)(!1);return{newUser:r,setNewUser:s,loading:o,setLoading:a,isPasswordConfirmed:d,setIsPasswordConfirmed:u,pageProps:n}}({new_deployment_user:f}),v=!!(g&&(null===(t=p.password)||void 0===t?void 0:t.match(/./))&&(null===(n=p.confirmed_password)||void 0===n?void 0:n.match(/./)));return(0,r.jsx)("form",{onSubmit:e=>{e.preventDefault()},children:(0,r.jsxs)(a.Z,{className:"w-full items-stretch gap-6",children:[(0,r.jsx)(s.Z,{placeholder:"Eg. John",title:"First Name",changeHandler:e=>{m(t=>({...t,first_name:e}))},required:!0,showLabel:!0}),(0,r.jsx)(s.Z,{placeholder:"Eg. Doe",title:"Last Name",changeHandler:e=>{m(t=>({...t,last_name:e}))},showLabel:!0}),(0,r.jsx)(s.Z,{placeholder:"Email Address",title:"Email",type:"email",changeHandler:e=>{m(t=>({...t,email:e}))},required:!0,showLabel:!0}),x.user.id?(0,r.jsx)(s.Z,{placeholder:"Username",title:"Username",changeHandler:e=>{m(t=>({...t,username:e}))},validationRegex:/^[a-z0-9\-]{3,}$/,info:(0,r.jsxs)(r.Fragment,{children:["Allowed characters:"," ",(0,r.jsx)("code",{children:(0,r.jsx)("b",{children:"a-z, 0-9, -"})}),"."]}),wrapperWrapperProps:{className:"items-start!"},required:!0,showLabel:!0}):null,(0,r.jsx)(s.Z,{placeholder:"Password",title:"Password",type:"password",changeHandler:e=>{m(t=>({...t,password:e}))},validity:{isValid:!((null===(u=p.password)||void 0===u?void 0:u.match(/./))&&(null===(h=p.confirmed_password)||void 0===h?void 0:h.match(/./)))||v,msg:"Passwords don't match"},required:!0,showLabel:!0}),(0,r.jsx)(s.Z,{placeholder:"Confirm Password",title:"Confirm Password",type:"password",changeHandler:e=>{m(t=>({...t,confirmed_password:e})),j(e==p.password)},showLabel:!0}),(0,r.jsx)(o.Z,{title:"Login",onClick:()=>{v&&window.confirm("Create Super Admin Account?")&&(y(!0),(0,d.Z)("/api/auth/signup",{method:"POST",body:{new_user:p}}).then(e=>{console.log("res",e),e.success&&window.location.reload()}).finally(()=>{}))},loading:w,children:x.user.super_admin?"Add User":"Signup"})]})})}},28043:function(e,t,n){"use strict";n.r(t),n.d(t,{__N_SSP:function(){return h},default:function(){return f}});var r=n(85893),s=n(67294),o=n(5606),a=n(60705),i=n(21147),l=n(78513),c=n(60);function d(){let{pageProps:e}=(0,s.useContext)(o.AppContext);return(0,r.jsxs)(s.Fragment,{children:[(0,r.jsx)(i.Z,{title:"Add New User"}),(0,r.jsx)(a.Z,{}),(0,r.jsx)(c.Z,{className:"grid-cell-content max-w-[600px]",children:(0,r.jsx)(l.Z,{})})]})}var u=n(89350),h=!0;function f(){return(0,r.jsx)(u.Z,{children:(0,r.jsx)(d,{})})}},79265:function(e,t,n){"use strict";n.d(t,{Z:function(){return a}});var r=n(96486),s=n.n(r),o={stringify:function(e,t,n){try{return JSON.stringify(e,t||void 0,n)}catch(e){return}}};async function a(e,t){let n;let r={"Content-Type":"application/json"};(null==t?void 0:t.csrfKey)&&t.csrfValue&&(r[t.csrfKey]=t.csrfValue);let a=e;if((null==t?void 0:t.query)&&(a+=function(e){let t="?";if("object"!=typeof e)return console.log("Invalid Query type"),t;if(Array.isArray(e))return console.log("Query is an Array. This is invalid."),t;if(!e)return console.log("No Query provided."),t;let n=Object.keys(e),r=[];return n.forEach(t=>{if(!t||!e[t])return;let n=e[t];if("object"==typeof n){let e=o.stringify(n);r.push("".concat(t,"=").concat(encodeURIComponent(String(e))))}else"string"==typeof n||"number"==typeof n?r.push("".concat(t,"=").concat(encodeURIComponent(n))):r.push("".concat(t,"=").concat(String(n)))}),t+=r.join("&")}(t.query)),"string"==typeof t)try{n="post"===t?(await fetch(a,{method:t,headers:r})).json():(await fetch(a)).json()}catch(e){console.log("FetchAPI error #1:",e.message),n=null}else if("object"==typeof t)try{let e;if(t.body&&"object"==typeof t.body){let e=s().cloneDeep(t.body);t.body=JSON.stringify(e)}if(t.headers){t.headers=s().merge(t.headers,r);let n={...t};e=await fetch(a,n)}else{let n={...t,headers:r};e=await fetch(a,n)}n=e.json()}catch(e){console.log("FetchAPI error #2:",e.message),n=null}else try{let e=await fetch(a);n=await e.json()}catch(e){console.log("FetchAPI error #3:",e.message),n=null}return n}}},function(e){e.O(0,[662,75,664,433,7,827,242,888,774,179],function(){return e(e.s=33356)}),_N_E=e.O()}]);
|
||||
Reference in New Issue
Block a user