import{bx as $,u as E,f$ as C,r as l,b0 as q,g1 as J,f as K,j as e,L as F,B as s,g4 as Y,b5 as Q,be as v,d as S,at as V,cG as W,b as I,b4 as m,au as X,C as x,d_ as Z,c5 as ee,q as te,s as N,by as se,iT as ae}from"./index-C1DmWO_C.js";import{N as re}from"./NoData-Y_e6mfNf.js";import{u as ie}from"./useUserPermissions-BiARnwL4.js";import{s as ne}from"./searchText-DQ-LeNvB.js";import"./sort-BOLIcXtz.js";import{u as oe}from"./useMultiStoreSelect-BV826hNF.js";import{F as le}from"./FeatureViewsListContent-C3fc99IQ.js";import"./FilterResult-BLSGYVa5.js";import"./LoadMore-ramCqe-V.js";import"./TableCells-CQ18q5Zw.js";import"./Deprecated-BQWZLUTP.js";import"./FeatureGroupTypeBadge-DwrDNbIL.js";import"./TagsSection-orrH5BjP.js";import"./SchematisedTagTable-v59rHKRx.js";import"./SchematisedTagsEdit-5zU0QcNA.js";import"./index-DMOJMCC5.js";import"./SchematisedTagsForm-Cki5D0WB.js";import"./useUpdateTdOrFvInfoService-BlTBzWj5.js";import"./schematised-tags.selectors-xn4c-iOu.js";import"./randomArrayString---X8tfjV.js";const y=[{value:"CREATION:DESC",label:"last created"},{value:"CREATION:ASC",label:"first created"},{value:"VERSION:DESC",label:"version"},{value:"NAME:ASC",label:"name ascending"},{value:"NAME:DESC",label:"name descending"}],Le=()=>{$(se.featureViews);const{id:t,fsId:a}=E(),{selectFSValue:r,selectFSOptions:c,handleFSSelectionChange:T,isLoading:i,hasSharedFS:f,isSharedLoading:A}=oe(),[d,_]=C("fvListSort_v2",y[0].value),[n,g]=l.useState(""),u=q(n,300),D=l.useMemo(()=>({pId:+t,fsId:+a,params:{filter_by:["latest_version",...u?[`NAME_LIKE:${u}`]:[]],sort_by:d}}),[u,a,t,d]),{data:o,hasMore:M,loadMore:R,isFetchingMore:P,isFetching:O,isLoading:k,refetch:H}=J({api:ae,apiEndpointName:"getFeatureViews",apiArgs:D}),[b,B]=C("fgAsTable",!1),{canEdit:j,isLoading:w}=ie(),z=()=>{g("")},G=h=>{g(h.target.value)},U=()=>B(h=>!h),p=l.useMemo(()=>K(ne(n))(o),[o,n]);return A||k?e.jsx(F,{}):e.jsxs(s,{flexDirection:"column",mt:"-20px",children:[e.jsxs(s,{sx:Y.stickyHeader,pt:"20px",children:[e.jsxs(s,{gap:"10px",alignItems:"center",children:[e.jsx(Q,{labelProps:{flexGrow:1},variant:"white",value:n,placeholder:"Find a Feature View...",onChange:G,autoFocus:!0}),f&&e.jsx(v,{width:"auto",variant:"white",label:"feature store",labelPosition:"inline",value:r,options:c,onChange:T}),e.jsx(S,{children:e.jsx(V,{mainText:"You have no edit right on the feature store",disabled:j&&!w,children:e.jsx(L,{disabled:!j||w})})})]}),e.jsx(W,{mt:"10px",mb:"10px",ml:"0px",width:"100%",sx:{backgroundColor:"grayShade2",height:"3px"}}),e.jsxs(s,{mb:"10px",justifyContent:"space-between",alignItems:"center",children:[e.jsx(s,{children:!i&&e.jsxs(e.Fragment,{children:[e.jsx(I,{primary:!0,mr:"5px",children:p.length}),e.jsx(I,{children:"feature views"})]})}),e.jsxs(s,{gap:"10px",alignItems:"center",children:[e.jsx(V,{mainText:"Change View",children:e.jsx(m,{p:"4px",intent:"secondary",onClick:U,children:e.jsx(X,{icon:b?x.card:x.lines,size:"lg"})})}),e.jsx(v,{labelPosition:"inline",variant:"white",value:d,isDisabled:i,options:y,label:"sort by",onChange:_}),e.jsx(Z,{onClick:H,icon:x.refresh,tooltipText:"Refresh"})]})]})]}),(i||O)&&e.jsx(F,{}),e.jsxs(S,{mt:"20px",children:[e.jsx(le,{data:p,isFiltered:o.length!==p.length,asTable:b,onResetFilters:z,hasMore:M,loadMore:R,isFetchingMore:P}),!i&&!o.length&&e.jsx(ce,{hasSharedFS:f})]})]})},ce=({hasSharedFS:t})=>e.jsxs(re,{mainText:t?"No Feature Views for the selected feature store":"No Feature Views",secondaryText:t?"Create one from feature groups or select another feature store":"Create one from feature groups",sx:{gap:"14px"},children:[e.jsx(L,{}),e.jsx(m,{intent:"secondary",href:ee("/user_guides/fs/feature_view/overview/"),external:!0,target:"_blank",children:"Feature View Documentation"})]}),L=({disabled:t})=>{const{id:a,fsId:r}=E(),c=l.useMemo(()=>te(N.featureView.create,N.project.value,{id:a,fsId:r}),[r,a]);return e.jsx(m,{href:c,intent:"primary",disabled:t,children:"New Feature View"})};export{Le as default,y as sortOptions};
