fix: Only display name editable when editing storage and storage type

This commit is contained in:
jialin
2026-06-17 12:35:24 +08:00
committed by jialin
parent aa49539210
commit ac64bb98ad
3 changed files with 16 additions and 4 deletions
+2 -2
View File
@@ -325,7 +325,7 @@ const Clusters: React.FC = () => {
providerHint?: string;
presetClusterType?: 'model' | 'gpu';
}>({
providerHint: '',
providerHint: undefined,
presetClusterType: undefined
});
@@ -343,7 +343,7 @@ const Clusters: React.FC = () => {
const handleClusterModalClose = () => {
setPendingProviderHint({
providerHint: '',
providerHint: undefined,
presetClusterType: undefined
});
closeClusterModal();
@@ -7,6 +7,7 @@ import { FormData } from '../config/types';
const NFSForm = ({ action }: { action: string }) => {
const intl = useIntl();
const { getRuleMessage } = useAppUtils();
const disabled = action === PageAction.EDIT;
return (
<>
@@ -24,6 +25,7 @@ const NFSForm = ({ action }: { action: string }) => {
>
<CInput.Input
required
disabled={disabled}
description={intl.formatMessage({
id: 'gpuservice.storageType.nfs.server.tips'
})}
@@ -43,6 +45,7 @@ const NFSForm = ({ action }: { action: string }) => {
>
<CInput.Input
required
disabled={disabled}
description={intl.formatMessage({
id: 'gpuservice.storageType.nfs.share.tips'
})}
@@ -51,6 +54,7 @@ const NFSForm = ({ action }: { action: string }) => {
</Form.Item>
<Form.Item<FormData> name={['spec', 'nfs', 'subDirectory']}>
<CInput.Input
disabled={disabled}
label={intl.formatMessage({
id: 'gpuservice.storageType.nfs.subDirectory'
})}
@@ -58,6 +62,7 @@ const NFSForm = ({ action }: { action: string }) => {
</Form.Item>
<Form.Item<FormData> name={['spec', 'nfs', 'mountPermissions']}>
<CInput.Input
disabled={disabled}
placeholder="0755,0777,..."
description={intl.formatMessage({
id: 'gpuservice.storageType.nfs.mountPermissions.tips'
@@ -69,7 +74,7 @@ const NFSForm = ({ action }: { action: string }) => {
</Form.Item>
<Form.Item<FormData> name={['spec', 'nfs', 'mountOptions']}>
<ListInput
disabled={action === PageAction.EDIT}
disabled={disabled}
label={intl.formatMessage({
id: 'gpuservice.storageType.mountOptions'
})}
@@ -14,6 +14,7 @@ const S3Form = ({ action }: { action: string }) => {
const intl = useIntl();
const form = Form.useFormInstance<FormData>();
const { getRuleMessage } = useAppUtils();
const disabled = action === PageAction.EDIT;
const handleEndpointBlur = (e: any) => {
const value: string = e.target.value;
@@ -51,6 +52,7 @@ const S3Form = ({ action }: { action: string }) => {
>
<CInput.Input
required
disabled={disabled}
label={intl.formatMessage({
id: 'gpuservice.storageType.s3.endpoint'
})}
@@ -65,6 +67,7 @@ const S3Form = ({ action }: { action: string }) => {
<div style={{ flex: 1 }}>
<Form.Item<FormData> name={['spec', 's3', 'region']}>
<CInput.Input
disabled={disabled}
label={intl.formatMessage({
id: 'gpuservice.storageType.s3.region'
})}
@@ -86,6 +89,7 @@ const S3Form = ({ action }: { action: string }) => {
>
<CInput.Input
required
disabled={disabled}
description={
<Flex orientation="vertical" gap={4} align="start">
<span>
@@ -111,6 +115,7 @@ const S3Form = ({ action }: { action: string }) => {
</Flex>
<Form.Item<FormData> name={['spec', 's3', 'accessKey']}>
<CInput.Input
disabled={disabled}
label={intl.formatMessage({
id: 'gpuservice.storageType.s3.accessKey'
})}
@@ -118,6 +123,7 @@ const S3Form = ({ action }: { action: string }) => {
</Form.Item>
<Form.Item<FormData> name={['spec', 's3', 'secretKey']}>
<CInput.Password
disabled={disabled}
label={intl.formatMessage({
id: 'gpuservice.storageType.s3.secretKey'
})}
@@ -129,6 +135,7 @@ const S3Form = ({ action }: { action: string }) => {
style={{ marginBottom: 12 }}
>
<CheckboxField
disabled={disabled}
description={intl.formatMessage({
id: 'gpuservice.storageType.s3.insecure.tips'
})}
@@ -139,7 +146,7 @@ const S3Form = ({ action }: { action: string }) => {
</Form.Item>
<Form.Item<FormData> name={['spec', 's3', 'mountOptions']}>
<ListInput
disabled={action === PageAction.EDIT}
disabled={disabled}
label={intl.formatMessage({
id: 'gpuservice.storageType.mountOptions'
})}