diff --git a/src/components/app/list/DevtronAppListContainer.tsx b/src/components/app/list/DevtronAppListContainer.tsx index 3d6b434c25..7de430f24b 100644 --- a/src/components/app/list/DevtronAppListContainer.tsx +++ b/src/components/app/list/DevtronAppListContainer.tsx @@ -27,6 +27,7 @@ import { PaginationEnum, Table, TableRowActionsOnHoverComponentProps, + TableViewWrapperProps, URLS as CommonURLS, } from '@devtron-labs/devtron-fe-common-lib' @@ -73,6 +74,49 @@ const HoverComponent = ({ row: { data } }: TableRowActionsOnHoverComponentProps< ) } +const renderGuidedCards = () => ( +
+

Create your first application

+
+ + +
+
+) + +const ViewWrapper = ({ + children, + noRows, + isSearchOrFilterApplied, +}: TableViewWrapperProps) => { + if (noRows && !isSearchOrFilterApplied) { + return renderGuidedCards() + } + + // eslint-disable-next-line react/jsx-no-useless-fragment + return <>{children} +} + const DevtronAppList = ({ filterConfig, environmentList, @@ -106,36 +150,6 @@ const DevtronAppList = ({ return `${URLS.APPLICATION_MANAGEMENT_APP}/${app.id}/trigger` } - const renderGuidedCards = () => ( -
-

Create your first application

-
- - -
-
- ) - const getRows = useCallback( async (_, signal) => { updateDataSyncing(true) @@ -191,10 +205,6 @@ const DevtronAppList = ({ const columns = useMemo(() => getTableColumns(isArgoInstalled), [isArgoInstalled]) - if (noRows && !isSearchOrFilterApplied) { - return renderGuidedCards() - } - return ( id="table__devtron-app-list" @@ -208,6 +218,8 @@ const DevtronAppList = ({ }} additionalProps={{ filterConfig, + noRows, + isSearchOrFilterApplied, }} additionalFilterProps={{ initialSortKey: AppListSortableKeys.APP_NAME, @@ -225,6 +237,7 @@ const DevtronAppList = ({ size: 18, }} onRowClick={onRowClick} + ViewWrapper={ViewWrapper} /> ) } diff --git a/src/components/app/list/types.tsx b/src/components/app/list/types.tsx index 13efb56bc6..8d4efd2d63 100644 --- a/src/components/app/list/types.tsx +++ b/src/components/app/list/types.tsx @@ -104,4 +104,7 @@ export interface GetEnvironmentsFromClusterNamespaceProps { namespaceList: EnvironmentListHelmResult[] } -export interface TableAdditionalPropsType extends Pick {} +export interface TableAdditionalPropsType extends Pick { + noRows: boolean + isSearchOrFilterApplied: boolean +}