import{u as useSelector,r as reactExports,j as jsxRuntimeExports,ae as selectOrgId,ag as selectIsFullscreenEnabled,B as Box,Z as AvailableComponents,q as mountPanel}from"./js-core.esm4.js";import{j as selectors$3,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,N as useEventBus}from"./js-core.esm9.js";import{E as EmptySearch,R as ResourceCard}from"./js-core.esm104.js";import"./js-core.esm7.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";function _define_property(e,t,s){return t in e?Object.defineProperty(e,t,{value:s,enumerable:!0,configurable:!0,writable:!0}):e[t]=s,e}function _object_spread(t){for(var e=1;e<arguments.length;e++){var s=null!=arguments[e]?arguments[e]:{},r=Object.keys(s);(r="function"==typeof Object.getOwnPropertySymbols?r.concat(Object.getOwnPropertySymbols(s).filter(function(e){return Object.getOwnPropertyDescriptor(s,e).enumerable})):r).forEach(function(e){_define_property(t,e,s[e])})}return t}var selectItems=selectors$3.selectItems,selectHasMore=selectors$3.selectHasMore,selectOffset=selectors$3.selectOffset,selectReadStatus=selectors$3.selectReadStatus,TableInfiniteScroll=tableInfiniteScroll.jsx.TableInfiniteScroll,itemHeight=150,TableRow=function(e){var o=e.item,a=useDispatch(),c=useSelector(selectOrgId),n=useSelector(selectIsFullscreenEnabled);useEventBus("resource-center-resources:update",function(e){e=e.application;a(actions.applications.updateSucceeded(_object_spread({},o,e)))});return jsxRuntimeExports.jsx(Box,{sx:{width:"100%",height:"".concat(itemHeight,"px")},children:jsxRuntimeExports.jsx(ResourceCard,{height:"".concat(itemHeight,"px"),onClick:function(){var e=o||{},t=e.id,e=e.ownerOrganizationId,s="APPLICATION_DETAILS_PANEL-".concat(t),e={name:AvailableComponents.APPLICATION_DETAILS_PANEL,config:{initValue:o,appIsOwned:e.toString()===(c||"").toString()}},r={panelId:s,type:"APP_BAR_PANEL_TEMPLATE",marginTop:n?0:55,marginStart:n?0:80,size:"large",parentPanelId:AvailableComponents.RESOURCE_CENTER,dimmed:0,dimmedStatus:"dimParent",borderBottom:!0};t&&a(mountPanel({panelId:s,microFrontend:e,panelConfig:r}))},cardType:EResourceTypeValue.application,name:o.name,description:o.description,status:o.status,avatarUrl:o.signedIconUrl||o.signedIconSvg})})},ApplicationsTable=function(){var e=useDispatch(),t=useSelector(selectActiveResourceTab),t=!!useSelector(selectActiveResourceSearchValues)[t],s=useSelector(selectItems),r=useSelector(selectHasMore),o=useSelector(selectOffset),a=useSelector(selectReadStatus),c=reactExports.useCallback(function(){e(actions.applications.readStart(null))},[]),n=SHARED_TEXT$2.applications.emptyState,i=SHARED_TEXT$2.applications.errorState;return jsxRuntimeExports.jsx(TableInfiniteScroll,{testId:"os-resource-center-resources-applications",hasMore:r,fetchMore:c,fetchOnMount:0===s.length,TableEmptyStateComponent:t?jsxRuntimeExports.jsx(EmptySearch,{}):void 0,offset:o,items:s,itemHeight:itemHeight,isLoading:"pending"===a,error:"failure"===a,TableRowComponent:TableRow,MessageEmptyState:jsxRuntimeExports.jsx(n,{}),MessageErrorState:jsxRuntimeExports.jsx(i,{})})};export{ApplicationsTable,ApplicationsTable as default};
