import{u as useSelector,ag as selectIsFullscreenEnabled,j as jsxRuntimeExports,be as img$9,B as Box,Z as AvailableComponents,ak as AvailablePanels,q as mountPanel}from"./js-core.esm4.js";import{k as selectors$4,s as selectActiveResourceTab,b as selectActiveResourceSearchValues,h as actions,S as SHARED_TEXT$2}from"./js-core.esm40.js";import{E as EResourceTypeValue}from"./js-core.esm15.js";import{t as tableInfiniteScroll}from"./js-core.esm9.js";import{a$ as DAGTemplate}from"./js-core.esm7.js";import{E as EmptySearch,R as ResourceCard}from"./js-core.esm104.js";import{u as useDispatch}from"./js-core.esm12.js";import"./js-core.esm30.js";import"./js-core.esm28.js";import"./js-core.esm33.js";import"./js-core.esm37.js";var selectItems=selectors$4.selectItems,selectHasMore=selectors$4.selectHasMore,selectReadStatus=selectors$4.selectReadStatus,selectOffset=selectors$4.selectOffset,TableInfiniteScroll=tableInfiniteScroll.jsx.TableInfiniteScroll,itemHeight=150,TableRow=function(e){var s=e.item,e=e.onClick,t="".concat(itemHeight-1,"px");return jsxRuntimeExports.jsx(Box,{sx:{width:"100%",height:t,borderBottom:"1px solid #D5DFE9","&:hover":{backgroundColor:"#f2f5f9",cursor:"pointer"}},children:jsxRuntimeExports.jsx(ResourceCard,{onClick:e,height:t,cardType:EResourceTypeValue.dagTemplate,id:null==s?void 0:s.id,name:null==s?void 0:s.name,mimeType:null==s?void 0:s.mimeType,description:null==s?void 0:s.description,capability:null!=(e=null==s?void 0:s.capability)?e:"",tags:null!=(t=null==s?void 0:s.tags)?t:[],avatarUrl:void 0,fallbackIcon:jsxRuntimeExports.jsx(DAGTemplate,{fontSize:"large"})})})},DAGTemplatesTable=function(){var a=useDispatch(),o=useSelector(selectIsFullscreenEnabled),e=useSelector(selectActiveResourceTab),e=!!useSelector(selectActiveResourceSearchValues)[e],s=useSelector(selectItems),t=useSelector(selectHasMore),r=useSelector(selectOffset),l=useSelector(selectReadStatus),i=SHARED_TEXT$2.dags.emptyState,n=SHARED_TEXT$2.dags.errorState;return jsxRuntimeExports.jsx(TableInfiniteScroll,{hasMore:t,fetchMore:function(){a(actions.dagTemplates.readStart(null))},fetchOnMount:0===s.length,TableEmptyStateComponent:e?jsxRuntimeExports.jsx(EmptySearch,{}):void 0,offset:r,items:s,itemHeight:itemHeight,isLoading:"pending"===l,error:"failure"===l,TableRowComponent:function(e){var t,s=e.item;return jsxRuntimeExports.jsx(TableRow,{item:s,index:e.index,onClick:(t=null==s?void 0:s.id,function(){var e=AvailableComponents.PROCESSING_CENTER_DAG_DETAILS_PANEL,s={type:AvailablePanels.APP_BAR_PANEL_TEMPLATE,marginTop:o?0:55,marginStart:o?0:80,size:"large",parentPanelId:AvailableComponents.RESOURCE_CENTER,dimmed:0,dimmedStatus:"dimParent",borderBottom:!0};a(mountPanel({panelId:e,microFrontend:{name:e,config:{payload:{dagTemplateId:t}}},panelConfig:s}))})})},MessageEmptyState:jsxRuntimeExports.jsx(i,{}),MessageErrorState:jsxRuntimeExports.jsx(n,{}),CustomEmptyStateImage:img$9})};export{DAGTemplatesTable as default};
