"use strict";(self.webpackChunkhopsworks_front=self.webpackChunkhopsworks_front||[]).push([[8607],{98607:function(e,a,n){n.r(a);var t=n(1413),o=n(15861),i=n(29439),r=n(87757),s=n.n(r),l=n(11942),c=n(61134),d=n(72791),u=n(76237),p=n(16871),b=n(24412),f=n(66794),h=n(62618),g=n(59728),j=n(19060),m=n(99468),x=n(754),Z=n(1281),v=n(68704),k=n(52805),w=n(29387),C=n(80184);a.default=function(){var e=(0,p.UO)(),a=e.id,n=e.jobName,r=(0,p.s0)(),c=(0,b.kG)(),f=(0,i.Z)(c,2),k=f[0],N=f[1].isLoading,P=(0,b.f$)(),y=(0,i.Z)(P,2),A=y[0],F=y[1].isLoading,I=(0,d.useContext)(w.X).handleDelete,T=(0,b.ac)({pId:a,jobName:n}),B=T.currentData,E=T.isFetching,J=(0,d.useMemo)((function(){return B?[B.config]:[]}),[B]);(0,h.Z)("".concat(g.Z.editJob," ").concat(null===B||void 0===B?void 0:B.name));var L=(0,u.BF)(),O=(0,i.Z)(L,2),z=O[0],G=O[1],H=(0,d.useCallback)(function(){var e=(0,o.Z)(s().mark((function e(n){var t,o;return s().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,k({pId:a,data:l.ATH(B.config,n),name:n.appName}).unwrap();case 2:t=e.sent,(o=t.name)&&r((0,x.Z)(Z.Z.jobs.overview,Z.Z.project.value,{id:a,jobName:o}));case 5:case"end":return e.stop()}}),e)})));return function(a){return e.apply(this,arguments)}}(),[B,r,a,k]),M=(0,d.useCallback)((0,o.Z)(s().mark((function e(){return s().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!B){e.next=7;break}return e.next=3,A({pId:a,jobName:B.name}).unwrap();case 3:I((0,x.Z)(Z.Z.jobs.overview,Z.Z.project.value,{id:a,jobName:B.name})),G(),r((0,x.Z)(Z.Z.jobs.list,Z.Z.project.value,{id:a})),u.ps.create({isError:!1,type:(0,C.jsx)(j.Z,{message:"Job deleted"}),content:(0,C.jsx)(m.Z,{message:"".concat(B.name," has been deleted")})});case 7:case"end":return e.stop()}}),e)}))),[B,A,a,I,G,r]);return(0,C.jsxs)(C.Fragment,{children:[B&&J.length>0&&(0,C.jsx)(v.Z,{isLoading:E,isDisabled:N||F,initialData:J,submitHandler:H,isSubmiting:N,disabledJobTypeChange:!0,checkedAdvancedConfig:!0,isJupyter:!1,children:function(e){return(0,C.jsx)(D,(0,t.Z)((0,t.Z)({},e),{},{jobData:B,handleToggle:G}))}}),(0,C.jsx)(u.wN,{width:"440px",title:"Delete ".concat(null===B||void 0===B?void 0:B.name),secondaryText:"Once you delete a job, there is no going back. Please be certain.",isOpen:z,mainButtonProps:{children:"Delete job",onClick:M,disabled:E,isLoading:F},secondaryButtonProps:{children:"Back",onClick:G,disabled:F||E},onClose:G})]})};var D=function(e){var a=e.advanceConfig,n=e.jobData,o=e.handleToggle,i=(0,c.Gc)(),r=i.register,s=i.setValue;return(0,d.useEffect)((function(){var e;s("appName",n.config.appName),s("appPath",n.config.appPath),s("defaultArgs",null!==(e=n.config.defaultArgs)&&void 0!==e?e:"")}),[n,n.appName,n.appPath,n.defaultArgs,s]),(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(u.Zb,{title:"Edit job",children:(0,C.jsxs)(u.kC,{flexDirection:"column",sx:{gap:"20px"},children:[(0,C.jsx)(f.Z,{name:"appPath",label:"File",fileExplorerMode:u.uF.oneFile,filePathPrefix:"hdfs://",disabled:!0}),(0,C.jsx)(u.II,(0,t.Z)((0,t.Z)({},r("appName")),{},{placeholder:"name",label:"Name",labelProps:{width:"180px"},readOnly:!0})),(0,C.jsx)(u.II,(0,t.Z)((0,t.Z)({optional:!0},r("defaultArgs")),{},{placeholder:"args",label:"Default arguments",labelProps:{width:"100%"}}))]})}),(0,C.jsx)(u.oA,{width:"100%",title:"Advanced configuration",children:a}),(0,C.jsx)(k.Z,{type:"job",job:n,mb:"0"}),(0,C.jsx)(u.oA,{title:"Danger zone",children:(0,C.jsx)(u.zx,{intent:"alert",onClick:o,children:"Delete job"})})]})}}}]);
//# sourceMappingURL=8607.5aff0146.chunk.js.map