Skip to content

Commit

Permalink
change soter method related to infinite value
Browse files Browse the repository at this point in the history
  • Loading branch information
yomybaby committed May 27, 2024
1 parent b33322f commit 73b9b2a
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions react/src/components/ProjectResourcePolicyList.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
import { bytesToGB, localeCompare } from '../helper';
import {
bytesToGB,
localeCompare,
numberSorterWithInfinityValue,
} from '../helper';
import { useSuspendedBackendaiClient, useUpdatableState } from '../hooks';
import Flex from './Flex';
import ProjectResourcePolicySettingModal from './ProjectResourcePolicySettingModal';
Expand Down Expand Up @@ -104,14 +108,22 @@ const ProjectResourcePolicyList: React.FC<
render: (text: ProjectResourcePolicies) =>
_.toNumber(text) === 0 ? '∞' : text,
sorter: (a, b) =>
(a?.max_vfolder_count ?? 0) - (b?.max_vfolder_count ?? 0),
numberSorterWithInfinityValue(
a?.max_vfolder_count,
b?.max_vfolder_count,
0,
),
},
supportMaxQuotaScopeSize && {
title: t('resourcePolicy.MaxQuotaScopeSize'),
dataIndex: 'max_quota_scope_size',
render: (text) => (text === -1 ? '∞' : bytesToGB(text)),
sorter: (a, b) =>
(a?.max_quota_scope_size ?? 0) - (b?.max_quota_scope_size ?? 0),
numberSorterWithInfinityValue(
a?.max_quota_scope_size,
b?.max_quota_scope_size,
-1,
),
},
{
title: 'ID',
Expand Down

0 comments on commit 73b9b2a

Please sign in to comment.