"use strict";(self.webpackChunkhopsworks_front=self.webpackChunkhopsworks_front||[]).push([[6882],{62618:function(e,n,o){var t=o(72791),r="Hopsworks";n.Z=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:r,n=document.querySelector("title");(0,t.useEffect)((function(){n&&(n.innerText=e)}),[e,n])}},56882:function(e,n,o){o.r(n),o.d(n,{default:function(){return X}});var t=o(1632),r=o(76237),i=o(16871),l=o(62618),c=o(59728),s=o(754),a=o(1281),u=o(1413),d=o(29439),p=o(72791),j=o(81724),f=o(44695),h=o(61134),x=o(94683),g=o(42643),b=o(88679),m=o(19060),k=o(99468),v=o(23428),y=o(35070),R=o(80184),Z=j.Ry().shape({project:j.Rx().label("Project").required(),role:j.nK().oneOf(Object.keys(g.jg)).label("Role").required(),cloudRole:j.Z_().label("Cloud Role").required()}),w=function(){var e=(0,i.s0)(),n=(0,y.BN)(),o=(0,d.Z)(n,2),l=o[0],c=o[1].isLoading,j=(0,b.Z)(),w=j.projectOptions,C=j.isLoading,X={project:"",role:g.jg.DATA_SCIENTIST,cloudRole:"",defaultRole:!1},I=(0,h.cI)({defaultValues:X,resolver:(0,f.X)(Z),shouldUnregister:!1,reValidateMode:"onChange",mode:"onBlur"}),L=I.formState.errors,O=I.register,S=I.handleSubmit,V=I.watch,q=I.setValue,D=I.reset,P=V(["role","project"]),T=(0,d.Z)(P,2),E=T[0],F=T[1],A=function(e,n,o){r.ps.create({isError:e,type:(0,R.jsx)(m.Z,{message:n}),content:(0,R.jsx)(k.Z,{message:o})})},B=(0,p.useCallback)((function(e){l({projectId:e.project,projectRole:e.role,cloudRole:e.cloudRole}).unwrap().then((function(n){D({project:"",role:g.jg.ALL,cloudRole:"",defaultRole:!1}),A(!1,"New mapping created","".concat(e.project," -> ").concat(e.cloudRole))})).catch((function(e){var n=e.response.data.errorMsg;A(!0,"Error creating mapping",n)}))}),[l,D]);return(0,R.jsxs)(t.Flex,{flexDirection:"column",children:[(0,R.jsxs)(t.Flex,{mb:"20px",sx:{gap:"20px"},children:[(0,R.jsx)(r.ub,{width:"180px",label:"Project",value:F,options:w,placeholder:"pick a project",disabled:C,onChange:function(e){q("project",e.key,{shouldValidate:!0,shouldDirty:!0})}}),(0,R.jsx)(r.ub,{width:"180px",label:"Role",value:E,options:v.V,placeholder:"pick a role",onChange:function(e){q("role",e.key,{shouldValidate:!0,shouldDirty:!0})}})]}),(0,R.jsx)(t.Flex,{flexDirection:"row",mb:"20px",children:(0,R.jsx)(r.II,(0,u.Z)((0,u.Z)({width:"100%",label:"Cloud Role"},O("cloudRole")),{},{placeholder:"arn:aws:iam::XXXXXXXXXX:roles/s3-role"},(0,x.Z)("cloudRole",L)))}),(0,R.jsxs)(t.Flex,{justifyContent:"right",sx:{gap:"20px"},children:[(0,R.jsx)(r.zx,{type:"button",intent:"secondary",onClick:function(){return e((0,s.Z)(a.Z.settings.iamRoleChaining.list))},children:"Back"}),(0,R.jsx)(r.zx,{type:"button",isLoading:c,onClick:S(B),children:"Create new role chaining"})]})]})},C=(0,p.memo)(w),X=function(){(0,l.Z)(c.Z.UserManagement);var e=(0,i.s0)();return(0,R.jsxs)(t.Flex,{flexGrow:1,flexDirection:"column",children:[(0,R.jsx)(r.zx,{mb:"20px",pl:"0px",width:"150px",intent:"inline",onClick:function(){return e((0,s.Z)(a.Z.settings.iamRoleChaining.list))},children:"<- all role chainings"}),(0,R.jsx)(r.Zb,{title:"Create new role chaining",children:(0,R.jsx)(C,{})})]})}},88679:function(e,n,o){var t=o(72791),r=o(46723);n.Z=function(){var e=(0,r.S)(),n=e.data,o=void 0===n?[]:n,i=e.isLoading;return{projectOptions:(0,t.useMemo)((function(){return o.map((function(e){return{key:e.projectId,label:e.projectName}}))}),[o]),isLoading:i}}},23428:function(e,n,o){o.d(n,{I:function(){return l},V:function(){return i}});var t=o(29439),r=o(42643),i=Object.entries(r.jg).map((function(e){var n=(0,t.Z)(e,2);return{key:n[0],label:n[1]}})),l=function(e){return Object.keys(r.jg)[Object.values(r.jg).indexOf(e)]}},46723:function(e,n,o){o.d(n,{S:function(){return i}});var t=o(86307),r=o(80339),i=t.JB.injectEndpoints({endpoints:function(e){return{getProjects:e.query({query:function(){return{url:"/admin/projects"}},providesTags:r.p5.providesList(t.y4.AdminProjectTags.Projects)})}}}).useGetProjectsQuery}}]);
//# sourceMappingURL=6882.4e6f7090.chunk.js.map