diff --git a/web/features/deployments/list/index.tsx b/web/features/deployments/list/index.tsx index 60be35e26c..e1bcf88a91 100644 --- a/web/features/deployments/list/index.tsx +++ b/web/features/deployments/list/index.tsx @@ -1,6 +1,7 @@ 'use client' import type { ReactNode } from 'react' +import { cn } from '@langgenius/dify-ui/cn' import { keepPreviousData, useInfiniteQuery } from '@tanstack/react-query' import { debounce, useQueryState } from 'nuqs' import { useEffect, useRef } from 'react' @@ -15,6 +16,7 @@ import { NewInstanceCard } from './new-instance-card' import { envFilterQueryState, keywordsQueryState } from './query-state' const INSTANCE_CARD_SKELETON_KEYS = ['first', 'second', 'third', 'fourth', 'fifth', 'sixth'] +const EMPTY_INSTANCE_CARD_KEYS = Array.from({ length: 36 }, (_, index) => `empty-instance-card-${index}`) function DeploymentsListState({ children }: { children: ReactNode @@ -26,6 +28,26 @@ function DeploymentsListState({ children }: { ) } +function DeploymentsListEmpty() { + const { t } = useTranslation('deployments') + + return ( + <> + {EMPTY_INSTANCE_CARD_KEYS.map(key => ( +
+ ))} +
+ + {t('list.empty')} + +
+ + ) +} + function InstanceCardSkeleton() { return (
@@ -140,6 +162,7 @@ export function DeploymentsList() { const pages = data?.pages ?? [] const apps = pages.flatMap(page => page.data ?? []) const showSkeleton = isLoading || (isFetching && pages.length === 0) + const showEmptyState = !showSkeleton && !isError && apps.length === 0 useEffect(() => { if (!hasNextPage || isLoading || isFetchingNextPage || error) @@ -166,14 +189,18 @@ export function DeploymentsList() { return (
-
+
{showSkeleton ? : isError ? {t('common.loadFailed')} : apps.length === 0 - ? {t('list.empty')} + ? : apps.map(app => (