fix: gate research pool trial creation
This commit is contained in:
@@ -619,6 +619,7 @@
|
||||
"createTrial": "Create Trial Config",
|
||||
"trialConfirmTitle": "This creates a disabled FIXED small trial config",
|
||||
"trialConfirmDesc": "Confirm fixed amount, max daily orders, max daily loss, price range, and max position before submitting.",
|
||||
"trialRequiresResearchReady": "Research candidates must be trial-ready before a trial config can be created.",
|
||||
"account": "Account",
|
||||
"selectAccount": "Please select an account",
|
||||
"noAccounts": "No accounts yet",
|
||||
|
||||
@@ -619,6 +619,7 @@
|
||||
"createTrial": "创建试跟配置",
|
||||
"trialConfirmTitle": "将创建默认禁用的小额 FIXED 跟单配置",
|
||||
"trialConfirmDesc": "提交前请确认固定金额、每日最大单数、每日最大亏损、价格区间和最大持仓。",
|
||||
"trialRequiresResearchReady": "研究候选进入建议试跟后才能创建试跟配置",
|
||||
"account": "账户",
|
||||
"selectAccount": "请选择账户",
|
||||
"noAccounts": "暂无账户,请先添加账户",
|
||||
|
||||
@@ -619,6 +619,7 @@
|
||||
"createTrial": "創建試跟配置",
|
||||
"trialConfirmTitle": "將創建默認禁用的小額 FIXED 跟單配置",
|
||||
"trialConfirmDesc": "提交前請確認固定金額、每日最大單數、每日最大虧損、價格區間和最大持倉。",
|
||||
"trialRequiresResearchReady": "研究候選進入建議試跟後才能創建試跟配置",
|
||||
"account": "賬戶",
|
||||
"selectAccount": "請選擇賬戶",
|
||||
"noAccounts": "暫無賬戶,請先添加賬戶",
|
||||
|
||||
@@ -19,6 +19,7 @@ import {
|
||||
Statistic,
|
||||
Table,
|
||||
Tag,
|
||||
Tooltip,
|
||||
Typography,
|
||||
message
|
||||
} from 'antd'
|
||||
@@ -45,6 +46,9 @@ const formatDate = (timestamp?: number) => {
|
||||
return dayjs(timestamp).format('YYYY-MM-DD HH:mm')
|
||||
}
|
||||
|
||||
const canCreateTrialConfig = (item: LeaderPoolItem) =>
|
||||
!item.researchCandidateId || item.researchState === 'TRIAL_READY'
|
||||
|
||||
const LeaderPool: React.FC = () => {
|
||||
const { t } = useTranslation()
|
||||
const navigate = useNavigate()
|
||||
@@ -333,36 +337,46 @@ const LeaderPool: React.FC = () => {
|
||||
key: 'actions',
|
||||
fixed: 'right' as const,
|
||||
width: 320,
|
||||
render: (_: unknown, item: LeaderPoolItem) => (
|
||||
<Space wrap size={4}>
|
||||
<Button size="small" icon={<EyeOutlined />} onClick={() => window.open(item.profileUrl, '_blank', 'noopener,noreferrer')}>
|
||||
Profile
|
||||
</Button>
|
||||
<Button size="small" onClick={() => openStatusModal(item)}>
|
||||
{t('leaderPool.updateStatus')}
|
||||
</Button>
|
||||
<Button size="small" onClick={() => openPlanModal(item)}>
|
||||
{t('leaderPool.editPlan')}
|
||||
</Button>
|
||||
render: (_: unknown, item: LeaderPoolItem) => {
|
||||
const trialAllowed = canCreateTrialConfig(item)
|
||||
const trialButton = (
|
||||
<Button
|
||||
size="small"
|
||||
type="primary"
|
||||
loading={creatingMap[item.id]}
|
||||
disabled={creatingMap[item.id]}
|
||||
disabled={creatingMap[item.id] || !trialAllowed}
|
||||
onClick={() => openTrialModal(item)}
|
||||
>
|
||||
{t('leaderPool.createTrial')}
|
||||
</Button>
|
||||
<Popconfirm
|
||||
title={t('leaderPool.removeConfirm')}
|
||||
okText={t('common.confirm')}
|
||||
cancelText={t('common.cancel')}
|
||||
onConfirm={() => handleRemove(item)}
|
||||
>
|
||||
<Button size="small" danger>{t('common.delete')}</Button>
|
||||
</Popconfirm>
|
||||
</Space>
|
||||
)
|
||||
)
|
||||
return (
|
||||
<Space wrap size={4}>
|
||||
<Button size="small" icon={<EyeOutlined />} onClick={() => window.open(item.profileUrl, '_blank', 'noopener,noreferrer')}>
|
||||
Profile
|
||||
</Button>
|
||||
<Button size="small" onClick={() => openStatusModal(item)}>
|
||||
{t('leaderPool.updateStatus')}
|
||||
</Button>
|
||||
<Button size="small" onClick={() => openPlanModal(item)}>
|
||||
{t('leaderPool.editPlan')}
|
||||
</Button>
|
||||
{trialAllowed ? trialButton : (
|
||||
<Tooltip title={t('leaderPool.trialRequiresResearchReady')}>
|
||||
<span>{trialButton}</span>
|
||||
</Tooltip>
|
||||
)}
|
||||
<Popconfirm
|
||||
title={t('leaderPool.removeConfirm')}
|
||||
okText={t('common.confirm')}
|
||||
cancelText={t('common.cancel')}
|
||||
onConfirm={() => handleRemove(item)}
|
||||
>
|
||||
<Button size="small" danger>{t('common.delete')}</Button>
|
||||
</Popconfirm>
|
||||
</Space>
|
||||
)
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user