import{bx as U,by as q,u as E,fY as C,r as l,aZ as G,f_ as J,p as K,j as e,D as F,$ as s,g1 as Z,b2 as Q,bd as v,L as S,ao as V,cD as W,f as I,b1 as m,ap as X,C as x,ei as ee,jg as te,o as se,q as L,bT as ae,c5 as re}from"./index-ljTaFLaB.js";import{u as ie}from"./useUserPermissions-Di54216O.js";import{s as oe}from"./searchText-DQ-LeNvB.js";import"./sort-BOLIcXtz.js";import{u as ne}from"./useMultiStoreSelect-ncQZ6FYD.js";import{F as le}from"./FeatureViewsListContent-ROgGhpGR.js";import"./FilterResult-PK0SAale.js";import"./LoadMore-DIL01vg0.js";import"./TableCells-D4bbhpRX.js";import"./Deprecated-D_iwBiXP.js";import"./FeatureGroupTypeBadge-BQglSjeF.js";import"./TagsSection-TcU4jCmq.js";import"./SchematisedTagTable-Dnill13y.js";import"./SchematisedTagsEdit-BaALPfIT.js";import"./index-Df7phmI_.js";import"./SchematisedTagsForm-DnH6WBYV.js";import"./useUpdateTdOrFvInfoService-BmKEmn5U.js";import"./schematised-tags.selectors-WK3AUml0.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"}],Ee=()=>{U(q.featureViews);const{id:t,fsId:a}=E(),{selectFSValue:r,selectFSOptions:c,handleFSSelectionChange:T,isLoading:i,hasSharedFS:f,isSharedLoading:A}=ne(),[d,D]=C("fvListSort_v2",y[0].value),[o,g]=l.useState(""),u=G(o,300),_=l.useMemo(()=>({pId:+t,fsId:+a,params:{filter_by:["latest_version",...u?[`NAME_LIKE:${u}`]:[]],sort_by:d}}),[u,a,t,d]),{data:n,hasMore:M,loadMore:R,isFetchingMore:P,isFetching:k,isLoading:H,refetch:O}=J({api:te,apiEndpointName:"getFeatureViews",apiArgs:_}),[j,Y]=C("fgAsTable",!1),{canEdit:b,isLoading:w}=ie(),$=()=>{g("")},z=h=>{g(h.target.value)},B=()=>Y(h=>!h),p=l.useMemo(()=>K(oe(o))(n),[n,o]);return A||H?e.jsx(F,{}):e.jsxs(s,{flexDirection:"column",mt:"-20px",children:[e.jsxs(s,{sx:Z.stickyHeader,pt:"20px",children:[e.jsxs(s,{gap:"10px",alignItems:"center",children:[e.jsx(Q,{labelProps:{flexGrow:1},variant:"white",value:o,placeholder:"Find a Feature View...",onChange:z,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:b&&!w,children:e.jsx(N,{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: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:B,children:e.jsx(X,{icon:j?x.card:x.lines,size:"lg"})})}),e.jsx(v,{labelPosition:"inline",variant:"white",value:d,isDisabled:i,options:y,label:"sort by",onChange:D}),e.jsx(ee,{onClick:O,icon:x.refresh,tooltipText:"Refresh"})]})]})]}),(i||k)&&e.jsx(F,{}),e.jsxs(S,{mt:"20px",children:[e.jsx(le,{data:p,isFiltered:n.length!==p.length,asTable:j,onResetFilters:$,hasMore:M,loadMore:R,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(N,{}),e.jsx(m,{intent:"secondary",href:re("/user_guides/fs/feature_view/overview/"),external:!0,target:"_blank",children:"Feature View Documentation"})]}),N=({disabled:t})=>{const{id:a,fsId:r}=E(),c=l.useMemo(()=>se(L.project.featureView.create,L.project.value,{id:a,fsId:r}),[r,a]);return e.jsx(m,{href:c,intent:"primary",disabled:t,children:"New Feature View"})};export{Ee as default,y as sortOptions};
