"use strict";(self.webpackChunkhopsworks_front=self.webpackChunkhopsworks_front||[]).push([[4241],{74241:function(e,t,a){a.r(t);var r=a(1413),n=a(45987),i=a(15861),o=a(29439),s=a(87757),u=a.n(s),c=a(72791),d=a(95048),p=a(16871),f=a(76237),l=a(8028),x=a(40888),g=a(89233),I=a(50616),h=a(38184),v=a(81497),k=a(56595),Z=a(25969),b=a(62618),m=a(59728),w=a(754),G=a(1281),S=a(29387),j=a(80184),y=["features","enabled","histograms","correlations","exactUniqueness","expectationSuite","type"],C=function(){var e=(0,p.UO)(),t=e.id,a=e.fsId,s=e.fgId,C=(0,l.hp)().data,D=(0,d.I0)(),T=(0,p.s0)(),E=(0,f.BF)(),L=(0,o.Z)(E,2),U=L[0],V=L[1],F=(0,h.T)(),O=F.currentData,q=F.isFetching,N=(0,x.kM)(),B=(0,o.Z)(N,2),P=B[0],X=B[1].isLoading,_=(0,x.EP)(),M=(0,o.Z)(_,2),z=M[0],A=M[1].isLoading,H=(0,c.useContext)(S.X).handleDelete,$=(0,x.$d)(),J=(0,o.Z)($,2),K=(J[0],J[1].isLoading,(0,g.j)({pId:+t,fsId:+a,fgId:+s},{skip:!C})),Q=K.currentData,R=K.isLoading;(0,c.useEffect)((function(){return D.featureGroupView.fetch({projectId:+t,featureStoreId:+a,featureGroupId:+s}),D.schematisedTags.fetch(),function(){D.featureGroupView.clear()}}),[D,t,O,a,s]);var W=(0,d.v9)((function(e){return e.featureGroupView})),Y=(0,c.useCallback)(function(){var e=(0,i.Z)(u().mark((function e(i,o,c){var d,p,f,l,x,g,h,v,k,b,m,S,j,C,E,L,U,V,F,O,q,N;return u().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(d=s,e.prev=1,!c){e.next=10;break}return p=i.features,f=i.enabled,l=i.histograms,x=i.correlations,g=i.exactUniqueness,h=i.expectationSuite,v=i.type,k=(0,n.Z)(i,y),e.next=6,D.featureGroups.create({projectId:+t,featureStoreId:+a,data:(0,r.Z)((0,r.Z)({},k),{},{type:v,features:(0,Z.Iz)(p),timeTravelFormat:k.timeTravelFormat[0].toUpperCase(),descStatsEnabled:!!(0,Z.LX)(p).length,validationType:k.validationType[0].toUpperCase(),eventTime:(0,Z.u7)(p),jobs:[],statisticsConfig:{columns:(0,Z.LX)(p),correlations:x,enabled:f,histograms:l,exactUniqueness:g}},h&&v!==I.kV.ON_DEMAND?{expectationSuite:i.expectationSuite}:{})});case 6:(b=e.sent)&&(d=String(b)),e.next=21;break;case 10:if(m=i.features,S=i.description,j=i.enabled,C=i.histograms,E=i.correlations,L=i.exactUniqueness,U=i.onlineEnabled,V=i.tags,F=i.keywords,O=i.validationType,q=i.type,N=i.expectationSuite,!(i.expectationSuite&&Object.keys(i.expectationSuite).length>1)){e.next=19;break}if(!i.expectationSuite.id){e.next=17;break}return e.next=15,z({id:t,fgId:s,fsId:a,data:i.expectationSuite}).unwrap();case 15:e.next=19;break;case 17:return e.next=19,P({id:t,fgId:s,fsId:a,data:i.expectationSuite}).unwrap();case 19:return e.next=21,D.featureGroups.edit({projectId:+t,featureStoreId:+a,featureGroupId:+s,data:(0,r.Z)({description:S,keywords:F,features:(0,Z.Iz)(m),onlineEnabled:U,tags:V,type:q,validationType:O[0],prevTags:Q.map((function(e){return e.name})),statisticsConfig:{columns:(0,Z.LX)(m),correlations:E,enabled:j,histograms:C,exactUniqueness:L}},N.expectations&&q!==I.kV.ON_DEMAND?{expectationSuite:i.expectationSuite}:{})});case 21:D.featureGroupView.clear(),D.featureGroups.fetch({projectId:+t,featureStoreId:+a}),T((0,w.Z)(G.Z.featureGroup.overview,G.Z.project.value,{id:t,fsId:a,fgId:d})),e.next=28;break;case 26:e.prev=26,e.t0=e.catch(1);case 28:case"end":return e.stop()}}),e,null,[[1,26]])})));return function(t,a,r){return e.apply(this,arguments)}}(),[s,D.featureGroupView,D.featureGroups,t,a,T,Q,z,P]),ee=(0,c.useCallback)((0,i.Z)(u().mark((function e(){return u().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return V(),e.next=3,D.featureGroups.delete({projectId:+t,featureStoreId:+a,featureGroupId:+s});case 3:H((0,w.Z)(G.Z.featureGroup.overview,G.Z.project.value,{id:t,fsId:a,fgId:s})),D.featureGroups.fetch({projectId:+t,featureStoreId:+a}),T((0,w.Z)(G.Z.featureGroup.list,G.Z.project.value,{id:t,fsId:a}));case 6:case"end":return e.stop()}}),e)}))),[V,D.featureGroups,t,a,s,H,T]),te=(0,d.v9)((function(e){return e.loading.effects.featureGroups.delete})),ae=(0,d.v9)((function(e){return e.loading.effects.featureGroups.edit}));return(0,b.Z)("".concat(m.Z.editFg," - ").concat(null===W||void 0===W?void 0:W.name)),!W||R?(0,j.jsx)(v.Z,{}):(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(k.Z,{isEdit:!0,isLoading:ae||te||q||X||A,isDisabled:ae,submitHandler:Y,onDelete:V,initialData:(0,r.Z)((0,r.Z)({},W),{},{tags:Q})}),(0,j.jsx)(f.wN,{width:"440px",title:"Delete ".concat(W.name),secondaryText:"Once you delete a feature group, there is no going back. Please be certain.",isOpen:U,mainButtonProps:{children:"Delete feature group",onClick:ee},secondaryButtonProps:{children:"Back",onClick:V},onClose:V})]})};t.default=(0,c.memo)(C)}}]);
//# sourceMappingURL=4241.af1dbfd6.chunk.js.map