Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(): add tenant backup destType #628

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 59 additions & 1 deletion ui/src/pages/Tenant/Detail/NewBackup/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,11 @@ export default function NewBackup() {
const scheduleValue = Form.useWatch(['scheduleDates'], form);

const distType = [
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems to be a typo. Maybe destTypes is better.

{ label: 'OSS', value: 'OSS' },
{ label: 'NFS', value: 'NFS' },
{ label: 'OSS', value: 'OSS' },
{ label: 'COS', value: 'COS' },
{ label: 'S3', value: 'S3' },
{ label: 'S3-Compatible', value: 'S3-Compatible' },
];

const handleSubmit = async (values: API.NewBackupForm) => {
Expand Down Expand Up @@ -250,6 +253,61 @@ export default function NewBackup() {
/>
</Form.Item>
</Col>

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Input form field Host should be added to the form if destType is not NFS. Refer to PRD to see the details.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was originally there
image

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mean that a new field named Host should be added to the form when selecting COS, OSS, S3 or S3-Compatible.

<Form.Item noStyle dependencies={['destType']}>
{({ getFieldValue }) => {
if (getFieldValue(['destType']) === 'COS') {
return (
<Col span={8}>
<Form.Item
label="AppID"
name={['appID']}
rules={[
{
required: true,
message: '请输入AppID',
},
]}
>
<Password
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Plain text is more proper.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DONE

placeholder={intl.formatMessage({
id: 'Dashboard.Detail.NewBackup.PleaseEnter',
defaultMessage: '请输入',
})}
/>
</Form.Item>
</Col>
);
}
}}
</Form.Item>
<Form.Item noStyle dependencies={['destType']}>
{({ getFieldValue }) => {
if (getFieldValue(['destType']) === 'S3') {
return (
<Col span={8}>
<Form.Item
label="Region"
name={['Region']}
rules={[
{
required: true,
message: '请输入 Region',
},
]}
>
<Password
placeholder={intl.formatMessage({
id: 'Dashboard.Detail.NewBackup.PleaseEnter',
defaultMessage: '请输入',
})}
/>
</Form.Item>
</Col>
);
}
}}
</Form.Item>
</Row>
</Col>
<Col span={12}>
Expand Down