"use strict";(self.webpackChunkhopsworks_front=self.webpackChunkhopsworks_front||[]).push([[4272],{62618:function(e,n,a){var t=a(72791),s="Hopsworks";n.Z=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:s,n=document.querySelector("title");(0,t.useEffect)((function(){n&&(n.innerText=e)}),[e,n])}},4272:function(e,n,a){a.r(n),a.d(n,{default:function(){return E},schema:function(){return I}});var t=a(81724),s=a(76237),r=a(55748),i=a(1413),l=a(15861),o=a(29439),c=a(87757),m=a.n(c),u=a(72791),f=a(61134),d=a(44695),p=a(95048),x=a(8028),h=a(67058),g=a(11176),Z=a(94683),j=a(14193),b=a(99468),k=a(19060),C=a(81497),v=a(80184),w=t.Ry().shape({firstname:j.O2.label("First name"),lastname:j.O2.label("Last name")}),y=function(e){var n=e.user,a=(0,p.I0)(),t=(0,h.Z)().isServiceUser,r=(0,x.o6)(void 0,{skip:!t}),c=r.data,j=r.isLoading,y=(0,u.useState)({firstname:!1,lastname:!1}),S=(0,o.Z)(y,2),D=S[0],I=S[1],E=(0,f.cI)({defaultValues:{firstname:n.firstname,lastname:n.lastname},shouldUnregister:!1,resolver:(0,d.X)(w),reValidateMode:"onChange",mode:"onChange"}),L=E.formState.errors,N=E.register,R=E.handleSubmit,T=n.accountType!==g.G2.M_ACCOUNT_TYPE,U=(0,u.useCallback)(function(){var e=(0,l.Z)(m().mark((function e(n){return m().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,a.auth.updateData({data:n});case 2:s.ps.create({isError:!1,type:(0,v.jsx)(k.Z,{message:"info updated"}),content:(0,v.jsx)(b.Z,{message:"Your information has been successfully updated"})});case 3:case"end":return e.stop()}}),e)})));return function(n){return e.apply(this,arguments)}}(),[a]);return(0,u.useEffect)((function(){t&&!j&&(window.location.href=c||"https://managed.hopsworks.ai/settings")}),[c,j,t]),!n.email||j?(0,v.jsx)(C.Z,{}):t?null:(0,v.jsx)(s.Zb,{width:"100%",title:"Edit profile",children:(0,v.jsxs)(s.kC,{flexDirection:"column",children:[(0,v.jsxs)(s.kC,{children:[(0,v.jsx)(s.n5,{firstName:n.firstname,lastName:n.lastname}),(0,v.jsxs)(s.kC,{mt:"3px",flexDirection:"column",ml:"20px",children:[(0,v.jsx)(s.ie,{mb:"3px",gray:!0,children:"Username"}),(0,v.jsx)(s.B4,{primary:!0,children:n.username})]}),(0,v.jsxs)(s.kC,{mt:"3px",flexDirection:"column",ml:"20px",children:[(0,v.jsx)(s.ie,{mb:"3px",gray:!0,children:"Email"}),(0,v.jsx)(s.B4,{primary:!0,children:n.email})]})]}),(0,v.jsxs)(s.kC,{mt:"30px",children:[(0,v.jsx)(s.II,(0,i.Z)((0,i.Z)({label:"First name"},N("firstname")),{},{labelProps:{mr:"20px"},disabled:T,placeholder:"First name",onChange:function(e){return I((0,i.Z)((0,i.Z)({},D),{},{firstname:n.firstname!==e.target.value}))}},(0,Z.Z)("firstname",L))),(0,v.jsx)(s.II,(0,i.Z)((0,i.Z)({label:"Last name"},N("lastname")),{},{disabled:T,labelProps:{mr:"20px"},placeholder:"Last name",onChange:function(e){return I((0,i.Z)((0,i.Z)({},D),{},{lastname:n.lastname!==e.target.value}))}},(0,Z.Z)("lastname",L)))]}),!T&&(0,v.jsx)(s.zx,{disabled:!D.firstname&&!D.lastname,onClick:R(U),mt:"20px",alignSelf:"flex-end",children:"Save"})]})})},S=a(62618),D=a(59728),I=t.Ry().shape({name:j.sR.label("Name"),login:j.sR.label("Description")}),E=function(){(0,S.Z)(D.Z.accountSettings);var e=(0,r.Mx)(),n=e.currentData;return e.isLoading?(0,v.jsx)(C.Z,{}):(0,v.jsx)(s.kC,{flexDirection:"column",alignItems:"center",children:(0,v.jsx)(y,{user:n})})}}}]);
//# sourceMappingURL=4272.71aa4503.chunk.js.map