import{bb as G,u as L,fg as v,r as l,cI as J,fi as K,f as Q,j as e,L as C,d as s,fl as U,aR as Y,aQ as F,c as S,am as V,ca as W,p as I,b6 as x,an as X,T as h,b$ as Z,o as ee,q as N,bc as te,h5 as se}from"./index-CK33qGU_.js";import{N as ae}from"./NoData-CuLyR2Bg.js";import{u as re}from"./useUserPermissions-CGy0I-II.js";import{s as ie}from"./searchText-DQ-LeNvB.js";import"./sort-BOLIcXtz.js";import{u as oe}from"./useMultiStoreSelect-Ckt9gw8q.js";import{C as ne}from"./CardActionButton-DcsFpjJz.js";import{F as le}from"./FeatureViewsListContent-f--XUzpa.js";import"./FileUploaderButton-Bppadu35.js";import"./useDownload-hrjXceJg.js";import"./useProject-BzBQtp4J.js";import"./length-fOfC3W0h.js";import"./dumbPluralize-CcxDsNiu.js";import"./FilterResult-DPWa8YHE.js";import"./LoadMore-Dc94HdUG.js";import"./TableCells-BffaHPpQ.js";import"./Deprecated-D5xZ0QMJ.js";import"./FeatureGroupTypeBadge-CamLRb8D.js";import"./TagsSection-BlED_e24.js";import"./SchematisedTagTable-CjDYaMqz.js";import"./SchematisedTagsEdit-Df0L3KpY.js";import"./index-B4h3z62J.js";import"./ButtonWithRole-NHXEosto.js";import"./SchematisedTagsForm-BQySjcvw.js";import"./useUpdateTdOrFvInfoService-iD5D3Lyd.js";import"./schematised-tags.selectors-xn4c-iOu.js";import"./randomArrayString---X8tfjV.js";import"./index-CIxm3shV.js";const E=[{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"}],ke=()=>{G(te.featureViews);const{id:t,fsId:a}=L(),{selectFSValue:r,selectFSOptions:c,handleFSSelectionChange:y,isLoading:i,hasSharedFS:f,isSharedLoading:A}=oe(),[d,D]=v("fvListSort_v2",E[0].value),[o,g]=l.useState(""),p=J(o,300),M=l.useMemo(()=>({pId:+t,fsId:+a,params:{filter_by:["latest_version",...p?[`NAME_LIKE:${p}`]:[]],sort_by:d}}),[p,a,t,d]),{data:n,hasMore:R,loadMore:_,isFetchingMore:P,isFetching:k,isLoading:H,refetch:O}=K({api:se,apiEndpointName:"getFeatureViews",apiArgs:M}),[j,z]=v("fgAsTable",!1),{canEdit:b,isLoading:w}=re(),B=()=>{g("")},$=m=>{g(m.target.value)},q=()=>z(m=>!m),u=l.useMemo(()=>Q(ie(o))(n),[n,o]);return A||H?e.jsx(C,{}):e.jsxs(s,{flexDirection:"column",mt:"-20px",children:[e.jsxs(s,{sx:U.stickyHeader,pt:"20px",children:[e.jsxs(s,{gap:"10px",alignItems:"center",children:[e.jsx(Y,{labelProps:{flexGrow:1},variant:"white",value:o,placeholder:"Find a Feature View...",onChange:$,autoFocus:!0}),f&&e.jsx(F,{width:"auto",variant:"white",label:"feature store",labelPosition:"inline",value:r,options:c,onChange:y}),e.jsx(S,{children:e.jsx(V,{mainText:"You have no edit right on the feature store",disabled:b&&!w,children:e.jsx(T,{disabled:!b||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:u.length}),e.jsx(I,{children:"feature views"})]})}),e.jsxs(s,{gap:"10px",alignItems:"center",children:[e.jsx(V,{mainText:"Change View",children:e.jsx(x,{p:"4px",intent:"secondary",onClick:q,children:e.jsx(X,{icon:j?h.card:h.lines,size:"lg"})})}),e.jsx(F,{labelPosition:"inline",variant:"white",value:d,isDisabled:i,options:E,label:"sort by",onChange:D}),e.jsx(ne,{onClick:O,icon:h.refresh,tooltipText:"Refresh"})]})]})]}),(i||k)&&e.jsx(C,{}),e.jsxs(S,{mt:"20px",children:[e.jsx(le,{data:u,isFiltered:n.length!==u.length,asTable:j,onResetFilters:B,hasMore:R,loadMore:_,isFetchingMore:P}),!i&&!n.length&&e.jsx(ce,{hasSharedFS:f})]})]})},ce=({hasSharedFS:t})=>e.jsxs(ae,{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(T,{}),e.jsx(x,{intent:"secondary",href:Z("/user_guides/fs/feature_view/overview/"),external:!0,target:"_blank",children:"Feature View Documentation"})]}),T=({disabled:t})=>{const{id:a,fsId:r}=L(),c=l.useMemo(()=>ee(N.featureView.create,N.project.value,{id:a,fsId:r}),[r,a]);return e.jsx(x,{href:c,intent:"primary",disabled:t,children:"New Feature View"})};export{ke as default,E as sortOptions};
