diff --git a/react/src/components/AgentSummaryList.tsx b/react/src/components/AgentSummaryList.tsx index b9eda4ad63..17f51b0d69 100644 --- a/react/src/components/AgentSummaryList.tsx +++ b/react/src/components/AgentSummaryList.tsx @@ -1,14 +1,13 @@ import { - baiSignedRequestWithPromise, convertBinarySizeUnit, filterNonNullItems, toFixedFloorWithoutTrailingZeros, transformSorterToOrderString, } from '../helper'; -import { useSuspendedBackendaiClient, useUpdatableState } from '../hooks'; +import { useUpdatableState } from '../hooks'; import { ResourceSlotName, useResourceSlotsDetails } from '../hooks/backendai'; import { useBAIPaginationOptionState } from '../hooks/reactPaginationQueryOptions'; -import { useSuspenseTanQuery } from '../hooks/reactQueryAlias'; +import { useResourceGroupsForCurrentProject } from '../hooks/useCurrentProject'; import { useHiddenColumnKeysSetting } from '../hooks/useHiddenColumnKeysSetting'; import BAIProgressWithLabel from './BAIProgressWithLabel'; import BAIPropertyFilter from './BAIPropertyFilter'; @@ -88,7 +87,7 @@ const AgentSummaryList: React.FC = ({ startRefreshTransition(() => { updateFetchKey(); }); - const baiClient = useSuspendedBackendaiClient(); + const { allSftpScalingGroups } = useResourceGroupsForCurrentProject(); const { agent_summary_list } = useLazyLoadQuery( graphql` @@ -132,28 +131,10 @@ const AgentSummaryList: React.FC = ({ }, ); - const { data } = useSuspenseTanQuery({ - queryKey: ['baiClient.setting.list'], - queryFn: () => - baiSignedRequestWithPromise({ - method: 'POST', - url: '/config/get', - body: { - key: `volumes/proxies`, - prefix: true, - }, - client: baiClient, - }), - }); - - const sftpScalingGroups = _.flatMap(data?.result, (value) => - _.get(value, 'sftp_scaling_groups', null), - ).filter(Boolean); - // Hide sFTP upload agents const filteredAgentSummaryList = _.filter( agent_summary_list?.items, - (item) => !_.includes(sftpScalingGroups, item?.scaling_group), + (item) => !_.includes(allSftpScalingGroups, item?.scaling_group), ); const columns: ColumnsType = [ diff --git a/react/src/hooks/useCurrentProject.tsx b/react/src/hooks/useCurrentProject.tsx index 0b64906f05..740bb32ce8 100644 --- a/react/src/hooks/useCurrentProject.tsx +++ b/react/src/hooks/useCurrentProject.tsx @@ -100,6 +100,7 @@ const resourceGroupsForCurrentProjectAtom = atom(async (get) => { (rg) => !allSftpScalingGroups.includes(rg.name), ), vhostInfo, + allSftpScalingGroups, }; });