fix: Only display name editable when editing storage and storage type
This commit is contained in:
@@ -325,7 +325,7 @@ const Clusters: React.FC = () => {
|
|||||||
providerHint?: string;
|
providerHint?: string;
|
||||||
presetClusterType?: 'model' | 'gpu';
|
presetClusterType?: 'model' | 'gpu';
|
||||||
}>({
|
}>({
|
||||||
providerHint: '',
|
providerHint: undefined,
|
||||||
presetClusterType: undefined
|
presetClusterType: undefined
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -343,7 +343,7 @@ const Clusters: React.FC = () => {
|
|||||||
|
|
||||||
const handleClusterModalClose = () => {
|
const handleClusterModalClose = () => {
|
||||||
setPendingProviderHint({
|
setPendingProviderHint({
|
||||||
providerHint: '',
|
providerHint: undefined,
|
||||||
presetClusterType: undefined
|
presetClusterType: undefined
|
||||||
});
|
});
|
||||||
closeClusterModal();
|
closeClusterModal();
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import { FormData } from '../config/types';
|
|||||||
const NFSForm = ({ action }: { action: string }) => {
|
const NFSForm = ({ action }: { action: string }) => {
|
||||||
const intl = useIntl();
|
const intl = useIntl();
|
||||||
const { getRuleMessage } = useAppUtils();
|
const { getRuleMessage } = useAppUtils();
|
||||||
|
const disabled = action === PageAction.EDIT;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
@@ -24,6 +25,7 @@ const NFSForm = ({ action }: { action: string }) => {
|
|||||||
>
|
>
|
||||||
<CInput.Input
|
<CInput.Input
|
||||||
required
|
required
|
||||||
|
disabled={disabled}
|
||||||
description={intl.formatMessage({
|
description={intl.formatMessage({
|
||||||
id: 'gpuservice.storageType.nfs.server.tips'
|
id: 'gpuservice.storageType.nfs.server.tips'
|
||||||
})}
|
})}
|
||||||
@@ -43,6 +45,7 @@ const NFSForm = ({ action }: { action: string }) => {
|
|||||||
>
|
>
|
||||||
<CInput.Input
|
<CInput.Input
|
||||||
required
|
required
|
||||||
|
disabled={disabled}
|
||||||
description={intl.formatMessage({
|
description={intl.formatMessage({
|
||||||
id: 'gpuservice.storageType.nfs.share.tips'
|
id: 'gpuservice.storageType.nfs.share.tips'
|
||||||
})}
|
})}
|
||||||
@@ -51,6 +54,7 @@ const NFSForm = ({ action }: { action: string }) => {
|
|||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Form.Item<FormData> name={['spec', 'nfs', 'subDirectory']}>
|
<Form.Item<FormData> name={['spec', 'nfs', 'subDirectory']}>
|
||||||
<CInput.Input
|
<CInput.Input
|
||||||
|
disabled={disabled}
|
||||||
label={intl.formatMessage({
|
label={intl.formatMessage({
|
||||||
id: 'gpuservice.storageType.nfs.subDirectory'
|
id: 'gpuservice.storageType.nfs.subDirectory'
|
||||||
})}
|
})}
|
||||||
@@ -58,6 +62,7 @@ const NFSForm = ({ action }: { action: string }) => {
|
|||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Form.Item<FormData> name={['spec', 'nfs', 'mountPermissions']}>
|
<Form.Item<FormData> name={['spec', 'nfs', 'mountPermissions']}>
|
||||||
<CInput.Input
|
<CInput.Input
|
||||||
|
disabled={disabled}
|
||||||
placeholder="0755,0777,..."
|
placeholder="0755,0777,..."
|
||||||
description={intl.formatMessage({
|
description={intl.formatMessage({
|
||||||
id: 'gpuservice.storageType.nfs.mountPermissions.tips'
|
id: 'gpuservice.storageType.nfs.mountPermissions.tips'
|
||||||
@@ -69,7 +74,7 @@ const NFSForm = ({ action }: { action: string }) => {
|
|||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Form.Item<FormData> name={['spec', 'nfs', 'mountOptions']}>
|
<Form.Item<FormData> name={['spec', 'nfs', 'mountOptions']}>
|
||||||
<ListInput
|
<ListInput
|
||||||
disabled={action === PageAction.EDIT}
|
disabled={disabled}
|
||||||
label={intl.formatMessage({
|
label={intl.formatMessage({
|
||||||
id: 'gpuservice.storageType.mountOptions'
|
id: 'gpuservice.storageType.mountOptions'
|
||||||
})}
|
})}
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ const S3Form = ({ action }: { action: string }) => {
|
|||||||
const intl = useIntl();
|
const intl = useIntl();
|
||||||
const form = Form.useFormInstance<FormData>();
|
const form = Form.useFormInstance<FormData>();
|
||||||
const { getRuleMessage } = useAppUtils();
|
const { getRuleMessage } = useAppUtils();
|
||||||
|
const disabled = action === PageAction.EDIT;
|
||||||
|
|
||||||
const handleEndpointBlur = (e: any) => {
|
const handleEndpointBlur = (e: any) => {
|
||||||
const value: string = e.target.value;
|
const value: string = e.target.value;
|
||||||
@@ -51,6 +52,7 @@ const S3Form = ({ action }: { action: string }) => {
|
|||||||
>
|
>
|
||||||
<CInput.Input
|
<CInput.Input
|
||||||
required
|
required
|
||||||
|
disabled={disabled}
|
||||||
label={intl.formatMessage({
|
label={intl.formatMessage({
|
||||||
id: 'gpuservice.storageType.s3.endpoint'
|
id: 'gpuservice.storageType.s3.endpoint'
|
||||||
})}
|
})}
|
||||||
@@ -65,6 +67,7 @@ const S3Form = ({ action }: { action: string }) => {
|
|||||||
<div style={{ flex: 1 }}>
|
<div style={{ flex: 1 }}>
|
||||||
<Form.Item<FormData> name={['spec', 's3', 'region']}>
|
<Form.Item<FormData> name={['spec', 's3', 'region']}>
|
||||||
<CInput.Input
|
<CInput.Input
|
||||||
|
disabled={disabled}
|
||||||
label={intl.formatMessage({
|
label={intl.formatMessage({
|
||||||
id: 'gpuservice.storageType.s3.region'
|
id: 'gpuservice.storageType.s3.region'
|
||||||
})}
|
})}
|
||||||
@@ -86,6 +89,7 @@ const S3Form = ({ action }: { action: string }) => {
|
|||||||
>
|
>
|
||||||
<CInput.Input
|
<CInput.Input
|
||||||
required
|
required
|
||||||
|
disabled={disabled}
|
||||||
description={
|
description={
|
||||||
<Flex orientation="vertical" gap={4} align="start">
|
<Flex orientation="vertical" gap={4} align="start">
|
||||||
<span>
|
<span>
|
||||||
@@ -111,6 +115,7 @@ const S3Form = ({ action }: { action: string }) => {
|
|||||||
</Flex>
|
</Flex>
|
||||||
<Form.Item<FormData> name={['spec', 's3', 'accessKey']}>
|
<Form.Item<FormData> name={['spec', 's3', 'accessKey']}>
|
||||||
<CInput.Input
|
<CInput.Input
|
||||||
|
disabled={disabled}
|
||||||
label={intl.formatMessage({
|
label={intl.formatMessage({
|
||||||
id: 'gpuservice.storageType.s3.accessKey'
|
id: 'gpuservice.storageType.s3.accessKey'
|
||||||
})}
|
})}
|
||||||
@@ -118,6 +123,7 @@ const S3Form = ({ action }: { action: string }) => {
|
|||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Form.Item<FormData> name={['spec', 's3', 'secretKey']}>
|
<Form.Item<FormData> name={['spec', 's3', 'secretKey']}>
|
||||||
<CInput.Password
|
<CInput.Password
|
||||||
|
disabled={disabled}
|
||||||
label={intl.formatMessage({
|
label={intl.formatMessage({
|
||||||
id: 'gpuservice.storageType.s3.secretKey'
|
id: 'gpuservice.storageType.s3.secretKey'
|
||||||
})}
|
})}
|
||||||
@@ -129,6 +135,7 @@ const S3Form = ({ action }: { action: string }) => {
|
|||||||
style={{ marginBottom: 12 }}
|
style={{ marginBottom: 12 }}
|
||||||
>
|
>
|
||||||
<CheckboxField
|
<CheckboxField
|
||||||
|
disabled={disabled}
|
||||||
description={intl.formatMessage({
|
description={intl.formatMessage({
|
||||||
id: 'gpuservice.storageType.s3.insecure.tips'
|
id: 'gpuservice.storageType.s3.insecure.tips'
|
||||||
})}
|
})}
|
||||||
@@ -139,7 +146,7 @@ const S3Form = ({ action }: { action: string }) => {
|
|||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Form.Item<FormData> name={['spec', 's3', 'mountOptions']}>
|
<Form.Item<FormData> name={['spec', 's3', 'mountOptions']}>
|
||||||
<ListInput
|
<ListInput
|
||||||
disabled={action === PageAction.EDIT}
|
disabled={disabled}
|
||||||
label={intl.formatMessage({
|
label={intl.formatMessage({
|
||||||
id: 'gpuservice.storageType.mountOptions'
|
id: 'gpuservice.storageType.mountOptions'
|
||||||
})}
|
})}
|
||||||
|
|||||||
Reference in New Issue
Block a user