import{bG as O,bH as q,u as y,h3 as v,r as l,aK as z,h5 as B,p as G,j as e,L as F,q as t,h8 as K,aH as $,F as C,an as S,bS as J,d as V,aJ as h,ao as U,v as x,be as Y,eg as Z,kH as Q,t as W,x as E,c5 as X,ci as ee}from"./index-C6OVXshM.js";import{u as se}from"./useUserPermissions-BXHH193b.js";import{s as te}from"./searchText-DQ-LeNvB.js";import"./sort-BOLIcXtz.js";import{F as ae}from"./FeatureViewsListContent-YWnM-A19.js";import"./FilterResult-DI0HiAXB.js";import"./LoadMore-CkqpLrWF.js";import"./TableCells-Bc4xey69.js";import"./Deprecated-C2s2xtW5.js";import"./FeatureGroupTypeBadge-gC-XAV-_.js";import"./TagsSection-CDMCvvkq.js";import"./SchematisedTagTable-DsPstJ1n.js";import"./TagsEdit-sFEAtdLe.js";import"./index-Clp3wC8S.js";import"./TagsForm-D7spoAiU.js";import"./useUpdateTdOrFvInfoService-CcnrN7pN.js";import"./index-Cgrh9eC0.js";import"./randomArrayString---X8tfjV.js";const I=[{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"}],Ce=()=>{O(q.featureViews);const{id:i,fsId:a}=y(),[s,c]=v("fvListSort_v2",I[0].value),[n,m]=l.useState(""),d=z(n,300),A=l.useMemo(()=>({pId:+i,fsId:+a,params:{filter_by:["latest_version",...d?[`NAME_LIKE:${d}`]:[]],sort_by:s}}),[d,a,i,s]),{data:o,hasMore:L,loadMore:T,isFetchingMore:D,isFetching:M,isLoading:r,refetch:R}=B({api:Q,apiEndpointName:"getFeatureViews",apiArgs:A}),[g,H]=v("fgAsTable",!1),{canEdit:f,isDataScientist:j,isFeatureStoreRestricted:b,isLoading:w}=se(),_=()=>{m("")},P=p=>{m(p.target.value)},k=()=>H(p=>!p),u=l.useMemo(()=>G(te(n))(o),[o,n]);return r?e.jsx(F,{}):e.jsxs(t,{flexDirection:"column",mt:"-20px",children:[e.jsxs(t,{sx:K.stickyHeader,pt:"20px",children:[e.jsxs(t,{gap:"10px",alignItems:"center",children:[e.jsx($,{labelProps:{flexGrow:1},variant:"white",value:n,placeholder:"Find a Feature View...",onChange:P,autoFocus:!0}),e.jsx(C,{children:e.jsx(S,{mainText:"You have no edit right on the feature store",disabled:(f||j||b)&&!w,children:e.jsx(N,{disabled:!(f||j||b)||w})})})]}),e.jsx(J,{mt:"10px",mb:"10px",ml:"0px",width:"100%",sx:{backgroundColor:"grayShade2",height:"3px"}}),e.jsxs(t,{mb:"10px",justifyContent:"space-between",alignItems:"center",children:[e.jsx(t,{children:!r&&e.jsxs(e.Fragment,{children:[e.jsx(V,{primary:!0,mr:"5px",children:u.length}),e.jsx(V,{children:"feature views"})]})}),e.jsxs(t,{gap:"10px",alignItems:"center",children:[e.jsx(S,{mainText:"Change View",children:e.jsx(h,{p:"4px",intent:"secondary",onClick:k,children:e.jsx(U,{icon:g?x.card:x.lines,size:"lg"})})}),e.jsx(Y,{labelPosition:"inline",variant:"white",value:s,isDisabled:r,options:I,label:"sort by",onChange:c}),e.jsx(Z,{onClick:R,icon:x.refresh,tooltipText:"Refresh"})]})]})]}),(r||M)&&e.jsx(F,{}),e.jsxs(C,{mt:"20px",children:[e.jsx(ae,{data:u,isFiltered:o.length!==u.length,asTable:g,onResetFilters:_,hasMore:L,loadMore:T,isFetchingMore:D}),!r&&!o.length&&e.jsx(re,{})]})]})},re=()=>e.jsxs(X,{mainText:"No Feature Views",secondaryText:"Create one from feature groups",sx:{gap:"14px"},children:[e.jsx(N,{}),e.jsx(h,{intent:"secondary",href:ee("/user_guides/fs/feature_view/overview/"),external:!0,target:"_blank",children:"Feature View Documentation"})]}),N=({disabled:i})=>{const{id:a,fsId:s}=y(),c=l.useMemo(()=>W(E.project.featureView.create,E.project.value,{id:a,fsId:s}),[s,a]);return e.jsx(h,{href:c,intent:"primary",disabled:i,children:"New Feature View"})};export{Ce as default,I as sortOptions};
