fix: remark field option

This commit is contained in:
jialin
2025-11-17 15:24:22 +08:00
parent e8a0f33bde
commit d1c3edfd9b
8 changed files with 26 additions and 12 deletions
+2 -1
View File
@@ -79,5 +79,6 @@ Same applies to the <span class="bold-text">/opt/dtk</span> directory.`,
'clusters.addworker.notSpecified': 'Not Specified', 'clusters.addworker.notSpecified': 'Not Specified',
'clusters.addworker.autoDetect': 'Auto-detect', 'clusters.addworker.autoDetect': 'Auto-detect',
'clusters.addworker.extraVolume.holder': 'clusters.addworker.extraVolume.holder':
'e.g. /data/models (path must start with /)' 'e.g. /data/models (path must start with /)',
'clusters.addworker.vendorNotes.title': 'Notes for {vendor} Device'
}; };
+3 -1
View File
@@ -79,7 +79,8 @@ Same applies to the <span class="bold-text">/opt/dtk</span> directory.`,
'clusters.addworker.notSpecified': 'Not Specified', 'clusters.addworker.notSpecified': 'Not Specified',
'clusters.addworker.autoDetect': 'Auto-detect', 'clusters.addworker.autoDetect': 'Auto-detect',
'clusters.addworker.extraVolume.holder': 'clusters.addworker.extraVolume.holder':
'e.g. /data/models (path must start with /)' 'e.g. /data/models (path must start with /)',
'clusters.addworker.vendorNotes.title': 'Notes for {vendor} Device'
}; };
// ========== To-Do: Translate Keys (Remove After Translation) ========== // ========== To-Do: Translate Keys (Remove After Translation) ==========
@@ -150,4 +151,5 @@ Same applies to the <span class="bold-text">/opt/dtk</span> directory.`,
// 65. 'clusters.addworker.notSpecified': 'Not Specified', // 65. 'clusters.addworker.notSpecified': 'Not Specified',
// 66. 'clusters.addworker.autoDetect': 'Auto-detect', // 66. 'clusters.addworker.autoDetect': 'Auto-detect',
// 67. 'clusters.addworker.extraVolume.holder': 'e.g. /data/models (path must start with /)' // 67. 'clusters.addworker.extraVolume.holder': 'e.g. /data/models (path must start with /)'
// 68. 'clusters.addworker.vendorNotes.title': 'Notes for {vendor} Device'
// ========== End of To-Do List ========== // ========== End of To-Do List ==========
+4 -2
View File
@@ -79,7 +79,8 @@ export default {
'clusters.addworker.notSpecified': 'Not Specified', 'clusters.addworker.notSpecified': 'Not Specified',
'clusters.addworker.autoDetect': 'Auto-detect', 'clusters.addworker.autoDetect': 'Auto-detect',
'clusters.addworker.extraVolume.holder': 'clusters.addworker.extraVolume.holder':
'e.g. /data/models (path must start with /)' 'e.g. /data/models (path must start with /)',
'clusters.addworker.vendorNotes.title': 'Notes for {vendor} Device'
}; };
// ========== To-Do: Translate Keys (Remove After Translation) ========== // ========== To-Do: Translate Keys (Remove After Translation) ==========
@@ -102,5 +103,6 @@ export default {
// 17. 'clusters.addworker.nvidiaNotes-01': 'If multiple outbound IPs exist, specify the one you want the worker to use. Please double-check with <span class="bold-text">hostname -I | xargs -n1</span>.', // 17. 'clusters.addworker.nvidiaNotes-01': 'If multiple outbound IPs exist, specify the one you want the worker to use. Please double-check with <span class="bold-text">hostname -I | xargs -n1</span>.',
// 18. 'clusters.addworker.nvidiaNotes-02': 'If a model directory already exists on the worker, you can specify the path to mount it.', // 18. 'clusters.addworker.nvidiaNotes-02': 'If a model directory already exists on the worker, you can specify the path to mount it.',
// 19. 'clusters.addworker.autoDetect': 'Auto-detect', // 19. 'clusters.addworker.autoDetect': 'Auto-detect',
// 20. 'clusters.addworker.extraVolume.holder': 'e.g. /data/models (path must start with /)' // 20. 'clusters.addworker.extraVolume.holder': 'e.g. /data/models (path must start with /)',
// 21. 'clusters.addworker.vendorNotes.title': 'Notes for {vendor} Device'
// ========== End of To-Do List ========== // ========== End of To-Do List ==========
+2 -1
View File
@@ -77,5 +77,6 @@ export default {
'clusters.addworker.notSpecified': '未指定', 'clusters.addworker.notSpecified': '未指定',
'clusters.addworker.autoDetect': '自动检测', 'clusters.addworker.autoDetect': '自动检测',
'clusters.addworker.extraVolume.holder': 'clusters.addworker.extraVolume.holder':
'例如:/data/models(路径需以 / 开头)' '例如:/data/models(路径需以 / 开头)',
'clusters.addworker.vendorNotes.title': '{vendor}设备注意事项'
}; };
@@ -10,14 +10,17 @@ const VendorNotes = () => {
const workerCommand = const workerCommand =
summary.get('workerCommand') || summary.get('workerCommand') ||
({ ({
label: 'N/A', label: '',
notes: [] notes: []
} as { label: string; notes: string[] }); } as { label: string; notes: string[] });
return ( return (
<AlertInfoBlock <AlertInfoBlock
maxHeight={200} maxHeight={200}
title={`Notes for ${workerCommand.label} Device`} title={intl.formatMessage(
{ id: 'clusters.addworker.vendorNotes.title' },
{ vendor: workerCommand.label }
)}
style={{ marginBottom: 8 }} style={{ marginBottom: 8 }}
type="warning" type="warning"
contentStyle={{ contentStyle={{
@@ -1,4 +1,6 @@
import AlertBlockInfo from '@/components/alert-info/block'; import AlertBlockInfo from '@/components/alert-info/block';
import { PageAction } from '@/config';
import { PageActionType } from '@/config/types';
import TransferInner from '@/pages/_components/transfer'; import TransferInner from '@/pages/_components/transfer';
import { queryUsersList } from '@/pages/users/apis'; import { queryUsersList } from '@/pages/users/apis';
import { DownOutlined } from '@ant-design/icons'; import { DownOutlined } from '@ant-design/icons';
@@ -25,12 +27,13 @@ const Label = styled.div`
`; `;
interface AccessControlFormProps { interface AccessControlFormProps {
action: PageActionType;
currentData?: ListItem | null; currentData?: ListItem | null;
onFinish: (values: AccessControlFormData) => void; onFinish: (values: AccessControlFormData) => void;
} }
const AccessControlForm = forwardRef((props: AccessControlFormProps, ref) => { const AccessControlForm = forwardRef((props: AccessControlFormProps, ref) => {
const { currentData, onFinish } = props; const { action, currentData, onFinish } = props;
const intl = useIntl(); const intl = useIntl();
const [form] = Form.useForm(); const [form] = Form.useForm();
const accessPolicy = Form.useWatch('access_policy', form); const accessPolicy = Form.useWatch('access_policy', form);
@@ -133,6 +136,9 @@ const AccessControlForm = forwardRef((props: AccessControlFormProps, ref) => {
const userMap = new Map(allusers.map((u) => [u.key, u])); const userMap = new Map(allusers.map((u) => [u.key, u]));
if (currentData?.id) { if (currentData?.id) {
form.setFieldsValue({
access_policy: currentData?.access_policy
});
queryModelAccessUserList(currentData.id).then((res) => { queryModelAccessUserList(currentData.id).then((res) => {
const keys = res.items.map((item) => item.id); const keys = res.items.map((item) => item.id);
setTargetKeys(keys); setTargetKeys(keys);
@@ -220,7 +226,7 @@ const AccessControlForm = forwardRef((props: AccessControlFormProps, ref) => {
clearOnDestroy={true} clearOnDestroy={true}
scrollToFirstError={true} scrollToFirstError={true}
initialValues={{ initialValues={{
access_policy: 'authed' access_policy: action === PageAction.CREATE ? 'authed' : undefined
}} }}
> >
<Label>{intl.formatMessage({ id: 'models.table.accessScope' })}</Label> <Label>{intl.formatMessage({ id: 'models.table.accessScope' })}</Label>
@@ -53,6 +53,7 @@ const AccessControlModal: React.FC<
<AccessControlForm <AccessControlForm
ref={form} ref={form}
currentData={currentData} currentData={currentData}
action={action}
onFinish={handleOnFinish} onFinish={handleOnFinish}
/> />
</ScrollerModal> </ScrollerModal>
@@ -99,7 +99,7 @@ const useWorkerMaintenance = ({ fetchData }: { fetchData: () => void }) => {
name="remark" name="remark"
rules={[ rules={[
{ {
required: true, required: false,
message: intl.formatMessage({ message: intl.formatMessage({
id: 'resources.worker.maintenance.remark.rules' id: 'resources.worker.maintenance.remark.rules'
}) })
@@ -107,8 +107,6 @@ const useWorkerMaintenance = ({ fetchData }: { fetchData: () => void }) => {
]} ]}
> >
<SealTextArea <SealTextArea
required
alwaysFocus
label={intl.formatMessage({ label={intl.formatMessage({
id: 'resources.worker.maintenance.remark' id: 'resources.worker.maintenance.remark'
})} })}