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
@@ -10,14 +10,17 @@ const VendorNotes = () => {
const workerCommand =
summary.get('workerCommand') ||
({
label: 'N/A',
label: '',
notes: []
} as { label: string; notes: string[] });
return (
<AlertInfoBlock
maxHeight={200}
title={`Notes for ${workerCommand.label} Device`}
title={intl.formatMessage(
{ id: 'clusters.addworker.vendorNotes.title' },
{ vendor: workerCommand.label }
)}
style={{ marginBottom: 8 }}
type="warning"
contentStyle={{
@@ -1,4 +1,6 @@
import AlertBlockInfo from '@/components/alert-info/block';
import { PageAction } from '@/config';
import { PageActionType } from '@/config/types';
import TransferInner from '@/pages/_components/transfer';
import { queryUsersList } from '@/pages/users/apis';
import { DownOutlined } from '@ant-design/icons';
@@ -25,12 +27,13 @@ const Label = styled.div`
`;
interface AccessControlFormProps {
action: PageActionType;
currentData?: ListItem | null;
onFinish: (values: AccessControlFormData) => void;
}
const AccessControlForm = forwardRef((props: AccessControlFormProps, ref) => {
const { currentData, onFinish } = props;
const { action, currentData, onFinish } = props;
const intl = useIntl();
const [form] = Form.useForm();
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]));
if (currentData?.id) {
form.setFieldsValue({
access_policy: currentData?.access_policy
});
queryModelAccessUserList(currentData.id).then((res) => {
const keys = res.items.map((item) => item.id);
setTargetKeys(keys);
@@ -220,7 +226,7 @@ const AccessControlForm = forwardRef((props: AccessControlFormProps, ref) => {
clearOnDestroy={true}
scrollToFirstError={true}
initialValues={{
access_policy: 'authed'
access_policy: action === PageAction.CREATE ? 'authed' : undefined
}}
>
<Label>{intl.formatMessage({ id: 'models.table.accessScope' })}</Label>
@@ -53,6 +53,7 @@ const AccessControlModal: React.FC<
<AccessControlForm
ref={form}
currentData={currentData}
action={action}
onFinish={handleOnFinish}
/>
</ScrollerModal>
@@ -99,7 +99,7 @@ const useWorkerMaintenance = ({ fetchData }: { fetchData: () => void }) => {
name="remark"
rules={[
{
required: true,
required: false,
message: intl.formatMessage({
id: 'resources.worker.maintenance.remark.rules'
})
@@ -107,8 +107,6 @@ const useWorkerMaintenance = ({ fetchData }: { fetchData: () => void }) => {
]}
>
<SealTextArea
required
alwaysFocus
label={intl.formatMessage({
id: 'resources.worker.maintenance.remark'
})}