"use strict";(self.webpackChunkhopsworks_front=self.webpackChunkhopsworks_front||[]).push([[1e3],{62618:function(e,t,n){var r=n(72791),i="Hopsworks";t.Z=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:i,t=document.querySelector("title");(0,r.useEffect)((function(){t&&(t.innerText=e)}),[e,t])}},11e3:function(e,t,n){n.r(t),n.d(t,{default:function(){return D}});var r=n(1413),i=n(15861),c=n(87757),o=n.n(c),s=n(72791),a=n(76237),l=n(16871),u=n(95048),d=n(38167),p=n(29439),f=n(81724),v=n(61134),h=n(44695),j=n(14193),x=n(94683),b=n(29167),m=n(88264),k=n(1281),y=n(4147),Z=n(80184),g=f.Ry().shape({name:j.u2.label("Name"),secret:j.Dy.required().label("Secret"),project:j.$e.when("visibility",{is:m.G.project,then:j.$e.required().label("Project")})}),C=function(e){var t,n=e.isLoading,i=e.initialData,c=e.onSubmit,o=(0,l.s0)(),u=(0,v.cI)({defaultValues:{name:null===i||void 0===i?void 0:i.name,secret:null===i||void 0===i?void 0:i.secret,visibility:null===i||void 0===i?void 0:i.visibility,project:null===i||void 0===i||null===(t=i.project)||void 0===t?void 0:t.projectName},resolver:(0,h.X)(g),shouldUnregister:!1}),d=u.control,f=u.handleSubmit,j=u.formState.errors,C=u.register,w=(0,u.watch)("visibility"),S=(0,b.DS)(void 0,{skip:w!==m.G.project}).currentData,D=void 0===S?[]:S,G=(0,s.useMemo)((function(){return null===D||void 0===D?void 0:D.reduce((function(e,t){return e[t.projectName]=t.projectId,e}),{})}),[D]);return(0,Z.jsx)(a.Zb,{actions:(0,Z.jsx)(a.zx,{mr:"-15px",href:"https://docs.hopsworks.ai/".concat(y.CH,"/user_guides/projects/secrets/create_secret/"),external:!0,target:"_blank",intent:"inline",children:"documentation \u2197"}),title:"Create new secret",children:(0,Z.jsxs)(a.kC,{flexDirection:"column",children:[(0,Z.jsx)(a.kC,{mb:"20px",children:(0,Z.jsx)(a.II,(0,r.Z)((0,r.Z)({},C("name")),{},{label:"Name",disabled:n,placeholder:"name of the secret"},(0,x.Z)("name",j)))}),(0,Z.jsx)(a.II,(0,r.Z)((0,r.Z)({},C("secret")),{},{label:"Secret",type:"textarea",width:"100%",disabled:n,placeholder:"value of the secret"},(0,x.Z)("secret",j))),(0,Z.jsx)(a.__,{mt:"20px",mb:"8px",children:"Visibility"}),(0,Z.jsx)(v.Qr,{control:d,name:"visibility",defaultValue:(null===i||void 0===i?void 0:i.visibility)||m.G.private,render:function(e){var t=e.field,r=t.onChange,i=t.value;return(0,Z.jsx)(a.Ee,{flexDirection:"row",mr:"20px",disabled:n,value:i,options:Object.values(m.G),onChange:r})}}),w===m.G.project&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(v.Qr,{control:d,name:"project",render:function(e){var t=e.field,i=t.onChange,c=t.value;return(0,Z.jsx)(a.Ph,(0,r.Z)({mt:"20px",mb:"20px",disabled:n||!((null===D||void 0===D?void 0:D.length)>0),noDataMessage:"no projects available",placeholder:"project",label:"",listWidth:"100%",hasPlaceholder:!0,options:Object.keys(G),value:c?[c]:[],onChange:function(e){var t=(0,p.Z)(e,1)[0];return i(t)}},(0,x.Z)("project",j)))}}),(0,Z.jsx)(a.UW,{content:"Members of the project will be able to access the secrets",type:a.u3.warning})]}),(0,Z.jsxs)(a.kC,{mt:"20px",justifyContent:"flex-end",children:[(0,Z.jsx)(a.zx,{mr:"20px",type:"button",disabled:n,intent:"secondary",onClick:function(){return o(k.Z.account.secrets.list)},children:"Back"}),(0,Z.jsx)(a.zx,{disabled:n,intent:"primary",onClick:f((function(e){var t=(0,r.Z)((0,r.Z)({},e),{},{project:G[e.project]});c(t)})),children:"Create secret"})]})]})})},w=n(62618),S=n(59728),D=function(){var e=(0,u.v9)(d.wB),t=(0,u.I0)(),n=(0,l.s0)();(0,w.Z)(S.Z.createSecret);var c=(0,s.useCallback)(function(){var e=(0,i.Z)(o().mark((function e(i){var c,s,a,l,u;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return c=i.name,s=i.secret,a=i.visibility,l=i.project,u=(0,r.Z)({name:c,secret:s,visibility:a.toUpperCase()},a===m.G.project&&{scope:l}),e.next=4,t.secrets.create({data:u});case 4:n(k.Z.account.secrets.list);case 5:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),[t.secrets,n]);return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(a.zx,{mb:"15px",ml:"-12px",intent:"inline",alignSelf:"flex-start",onClick:function(){return n(k.Z.account.secrets.list)},children:"\u21fd all secrets"}),(0,Z.jsx)(C,{isLoading:e,onSubmit:c})]})}},38167:function(e,t,n){n.d(t,{MY:function(){return r},aY:function(){return i},wB:function(){return c}});var r=function(e){return e.secrets},i=function(e){return e.loading.effects.secrets.fetchAll},c=function(e){return e.loading.effects.secrets.create}},88264:function(e,t,n){var r;n.d(t,{G:function(){return r}}),function(e){e.private="Private",e.project="Project"}(r||(r={}))}}]);
//# sourceMappingURL=1000.3bfa3396.chunk.js.map