(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1911],{12222:function(e,r,n){"use strict";n.r(r);var u=n(77837),t=n(82394),s=n(38860),i=n.n(s),o=n(82684),a=n(34376),c=n(71180),l=n(85854),d=n(93808),f=n(38276),p=n(75499),v=n(30160),b=n(59533),m=n(35686),w=n(98464),_=n(72473),j=n(70515),O=n(75083),h=n(72619),P=n(50178),g=n(42122),Z=n(69419),y=n(28598);function x(e,r){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var u=Object.getOwnPropertySymbols(e);r&&(u=u.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),n.push.apply(n,u)}return n}function E(e){for(var r=1;r<arguments.length;r++){var n=null!=arguments[r]?arguments[r]:{};r%2?x(Object(n),!0).forEach((function(r){(0,t.Z)(e,r,n[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):x(Object(n)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))}))}return e}function k(){var e=(0,a.useRouter)(),r=(0,o.useState)(null),n=r[0],u=r[1],t=((0,P.PR)()||{}).owner,s=(0,o.useState)(null),i=s[0],d=s[1],x=m.ZP.users.list({},{revalidateOnFocus:!1}),k=x.data;x.mutate;(0,o.useEffect)((function(){(0,h.bB)(k,u)}),[k]);var S=(0,o.useMemo)((function(){return(null===k||void 0===k?void 0:k.users)||[]}),[null===k||void 0===k?void 0:k.users]),N=m.ZP.users.detail(null===i||void 0===i?void 0:i.user_id,{},{revalidateOnFocus:!1}),R=N.data;N.mutate;(0,o.useEffect)((function(){(0,h.bB)(R,u)}),[R]);var C=null===R||void 0===R?void 0:R.user,D=(0,Z.iV)(),U=(0,w.Z)(D);return(0,o.useEffect)((function(){var e=D.add_new_user,r=D.user_id;if(!(0,g.Xy)(D,U)){var n=E(E({},U),D);r?n.user_id=r:delete n.user_id,e?n.add_new_user=e:delete n.add_new_user,d(n)}}),[D,U]),(0,y.jsxs)(b.Z,{breadcrumbs:[{label:function(){return"Workspaces"},linkProps:{as:"/manage",href:"/manage"}},{bold:!0,label:function(){return"Users"}}],errors:n,pageName:O.L6.USERS,children:[t&&(0,y.jsx)(f.Z,{p:j.cd,children:(0,y.jsx)(c.ZP,{beforeIcon:(0,y.jsx)(_.Add,{}),onClick:function(){return e.push("/manage/users/new")},primary:!0,children:"Add new user"})}),(0,y.jsx)(f.Z,{p:j.cd,children:(0,y.jsx)(l.Z,{children:"Users"})}),(0,y.jsx)(p.Z,{columnFlex:[1,1,1],columns:[{uuid:"Username"},{uuid:"Email"},{uuid:"Role"}],isSelectedRow:function(e){var r;return(null===(r=S[e])||void 0===r?void 0:r.id)===(null===C||void 0===C?void 0:C.id)},onClickRow:function(r){var n,u=null===(n=S[r])||void 0===n?void 0:n.id;e.push("/manage/users/[user]","/manage/users/".concat(u))},rows:S.map((function(e){var r=e.email,n=e.roles_display,u=e.roles_new,t=e.username;return[(0,y.jsx)(v.ZP,{bold:!0,children:t},"username"),(0,y.jsx)(v.ZP,{default:!0,children:r},"email"),(0,y.jsx)(v.ZP,{default:!0,children:u&&u[0]?u[0].name:n},"roles")]})),uuid:"pipeline-runs"})]})}k.getInitialProps=(0,u.Z)(i().mark((function e(){return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",{});case 1:case"end":return e.stop()}}),e)}))),r.default=(0,d.Z)(k)},72695:function(e,r,n){(window.__NEXT_P=window.__NEXT_P||[]).push(["/manage/users",function(){return n(12222)}])}},function(e){e.O(0,[1557,1598,9774,2888,179],(function(){return r=72695,e(e.s=r);var r}));var r=e.O();_N_E=r}]);