(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9340],{33187:function(e,t,o){(window.__NEXT_P=window.__NEXT_P||[]).push(["/dataset/[datasetId]",function(){return o(1016)}])},1016:function(e,t,o){"use strict";o.r(t),o.d(t,{default:function(){return y}});var l=o(24246),n=o(92222),s=o(59003),i=o(91922),a=o(86677),c=o(27378),d=o(77213),r=o(77830),u=o(58754),m=o(14481),h=o(69828),x=o(41966),p=o(46628),j=o(79806),f=o(20386),C=o(63927),g=o(69435),w=e=>{let{dataset:t,collection:o,isOpen:n,onClose:s}=e,a=(0,c.useMemo)(()=>null==t?void 0:t.collections.indexOf(o),[]),[d]=(0,f.TG)(),r=(0,i.pmc)(),{isOpen:u,onOpen:m,onClose:h}=(0,i.qY0)(),x=async e=>{let l={...o,...e},n=(0,g.jC)(t,l,a);try{await d(n),r((0,p.t5)("Successfully modified collection"))}catch(e){r((0,p.Vo)(e))}s()},w=async()=>{if(t&&void 0!==a){let e=(0,g.qe)(t,a);try{await d(e),r((0,p.t5)("Successfully deleted collection"))}catch(e){r((0,p.Vo)(e))}s(),h()}};return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(j.ZP,{isOpen:n,onClose:s,description:"Collections are an array of objects that describe the Dataset's collections. Provide additional context to this collection by filling out the fields below.",header:(0,l.jsx)(j.zR,{title:"Collection Name: ".concat(null==o?void 0:o.name)}),footer:(0,l.jsx)(j.Gn,{onClose:s,onDelete:m,formId:C.e}),children:(0,l.jsx)(C.Z,{values:o,onSubmit:x,dataType:"collection",showDataCategories:!1})}),(0,l.jsx)(i.cVQ,{isOpen:u,onClose:h,onConfirm:w,title:"Delete Collection",message:(0,l.jsxs)(i.xvT,{children:["You are about to permanently delete the collection named"," ",(0,l.jsx)(i.xvT,{color:"complimentary.500",as:"span",fontWeight:"bold",children:null==o?void 0:o.name})," ","from this dataset. Are you sure you would like to continue?"]})})]})};let b=(0,n.Cl)(),v=()=>(0,l.jsx)(i.gCW,{mt:6,p:10,spacing:4,borderRadius:"base",maxW:"70%","data-testid":"no-results-notice",alignSelf:"center",margin:"auto",textAlign:"center",children:(0,l.jsx)(i.gCW,{children:(0,l.jsx)(i.xvT,{fontSize:"md",fontWeight:"600",children:"No collections found."})})});var y=()=>{let e=(0,a.useRouter)(),t=decodeURIComponent(e.query.datasetId),{isLoading:o,data:p}=(0,x.oM)(t),j=(0,c.useMemo)(()=>(null==p?void 0:p.collections)||[],[p]),[f,C]=(0,c.useState)(!1),[g,y]=(0,c.useState)(),[R,_]=(0,c.useState)(),M=(0,c.useMemo)(()=>[b.accessor(e=>e.name,{id:"name",cell:e=>(0,l.jsx)(m.G3,{value:e.getValue(),fontWeight:"semibold"}),header:e=>(0,l.jsx)(m.Rr,{value:"Collection Name",...e}),size:180}),b.accessor(e=>e.description,{id:"description",cell:e=>(0,l.jsx)(m.G3,{value:e.getValue(),cellProps:e}),header:e=>(0,l.jsx)(m.Rr,{value:"Description",...e}),size:300,meta:{showHeaderMenu:!0}}),b.display({id:"actions",header:"Actions",cell:e=>{let{row:t}=e,o=t.original;return(0,l.jsx)(i.Ugi,{spacing:0,"data-testid":"collection-".concat(o.name),children:(0,l.jsx)(i.wpx,{size:"small",icon:(0,l.jsx)(i.dY8,{}),onClick:()=>{y(o),C(!0)},children:"Edit"})})},meta:{disableRowClick:!0}})],[]),I=(0,c.useMemo)(()=>R?j.filter(e=>e.name.toLowerCase().includes(R.toLowerCase())):j,[j,R]),N=(0,s.b7)({getCoreRowModel:(0,n.sC)(),getFilteredRowModel:(0,n.vL)(),getSortedRowModel:(0,n.tj)(),columns:M,data:I,columnResizeMode:"onChange"}),S=(0,c.useMemo)(()=>[{title:"All datasets",href:r.$m},{title:t,icon:h.Y[1]}],[t]);return(0,l.jsxs)(d.Z,{title:"Dataset - ".concat(t),children:[(0,l.jsx)(u.Z,{heading:"Datasets",breadcrumbItems:S}),o?(0,l.jsx)(m.I4,{rowHeight:36,numRows:15}):(0,l.jsxs)(i.xuv,{"data-testid":"collections-table",children:[(0,l.jsx)(m.Q$,{children:(0,l.jsx)(m.HO,{globalFilter:R,setGlobalFilter:_,placeholder:"Search",testid:"collections-search"})}),(0,l.jsx)(m.ZK,{tableInstance:N,emptyTableNotice:(0,l.jsx)(v,{}),onRowClick:o=>{e.push({pathname:r.RF,query:{datasetId:encodeURIComponent(t),collectionName:encodeURIComponent(o.name)}})}})]}),p&&g&&(0,l.jsx)(w,{dataset:p,collection:g,isOpen:f,onClose:()=>C(!1)})]})}}},function(e){e.O(0,[8033,6060,9729,4481,5487,2888,9774,179],function(){return e(e.s=33187)}),_N_E=e.O()}]);