Skip to content

Commit

Permalink
Merge branch 'dev-4.2.3' of code.alipay.com:oceanbase/oceanbase-devel…
Browse files Browse the repository at this point in the history
…oper-center into dev-4.2.3
  • Loading branch information
HSunboy committed Nov 21, 2023
2 parents ee56af1 + 4408b50 commit cc08d98
Show file tree
Hide file tree
Showing 16 changed files with 196 additions and 156 deletions.
60 changes: 24 additions & 36 deletions src/component/Task/DataArchiveTask/CreateModal/ArchiveRange.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,13 @@
* limitations under the License.
*/

import FormItemPanel from '@/component/FormItemPanel';
import HelpDoc from '@/component/helpDoc';
import { ITable } from '@/d.ts';
import { formatMessage } from '@/util/intl';
import { DeleteOutlined, PlusOutlined } from '@ant-design/icons';
import { Button, Form, Input, Radio, Select, Space, Typography } from 'antd';
import classNames from 'classnames';
import { IArchiveRange } from './index';
import ArchiveRangeTip from '../../component/ArchiveRangeTip';
import styles from './index.less';

const { Text } = Typography;
Expand All @@ -44,20 +43,20 @@ const ArchiveRange: React.FC<IProps> = (props) => {
required
>
<Radio.Group>
<Radio.Button value={IArchiveRange.PORTION}>
<Radio value={IArchiveRange.PORTION}>
{
formatMessage({
id: 'odc.DataArchiveTask.CreateModal.ArchiveRange.PartialArchive',
}) /*部分归档*/
}
</Radio.Button>
<Radio.Button value={IArchiveRange.ALL}>
</Radio>
<Radio value={IArchiveRange.ALL}>
{
formatMessage({
id: 'odc.DataArchiveTask.CreateModal.ArchiveRange.ArchiveTheEntireDatabase',
}) /*整库归档*/
}
</Radio.Button>
</Radio>
</Radio.Group>
</Form.Item>
<Form.Item shouldUpdate noStyle>
Expand All @@ -67,35 +66,27 @@ const ArchiveRange: React.FC<IProps> = (props) => {
return null;
}
return (
<FormItemPanel keepExpand>
<Space direction="vertical">
<Space className={styles.infoLabel}>
<div style={{ width: '220px' }}>
{
formatMessage({
id: 'odc.DataArchiveTask.CreateModal.ArchiveRange.TableName',
}) /*表名*/
}
</div>
<div style={{ width: '220px' }}>归档表</div>
<div style={{ width: '460px' }}>
<HelpDoc leftText isTip doc="dataArchiveFilterDoc">
<Space>
<span>
{
formatMessage({
id: 'odc.DataArchiveTask.CreateModal.ArchiveRange.FilterConditions',
}) /*过滤条件*/
}
</span>
<Text type="secondary">
{
formatMessage({
id: 'odc.DataArchiveTask.CreateModal.ArchiveRange.Optional',
}) /*(可选)*/
}
</Text>
</Space>
</HelpDoc>
<Space>
<span>
{
formatMessage({
id: 'odc.DataArchiveTask.CreateModal.ArchiveRange.FilterConditions',
}) /*过滤条件*/
}
</span>
<Text type="secondary">
{
formatMessage({
id: 'odc.DataArchiveTask.CreateModal.ArchiveRange.Optional',
}) /*(可选)*/
}
</Text>
<ArchiveRangeTip label='归档' />
</Space>
</div>
</Space>
<Form.List name="tables">
Expand All @@ -114,9 +105,7 @@ const ArchiveRange: React.FC<IProps> = (props) => {
rules={[
{
required: true,
message: formatMessage({
id: 'odc.DataArchiveTask.CreateModal.ArchiveRange.PleaseSelect',
}), //请选择
message: '请选择表'
},
]}
>
Expand Down Expand Up @@ -154,7 +143,6 @@ const ArchiveRange: React.FC<IProps> = (props) => {
)}
</Form.List>
</Space>
</FormItemPanel>
);
}}
</Form.Item>
Expand Down
101 changes: 40 additions & 61 deletions src/component/Task/DataArchiveTask/CreateModal/VariableConfig.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@
* limitations under the License.
*/

import FormItemPanel from '@/component/FormItemPanel';
import HelpDoc from '@/component/helpDoc';
import { formatMessage } from '@/util/intl';
import { DeleteOutlined, MinusOutlined, PlusOutlined } from '@ant-design/icons';
import { Button, Form, Input, InputNumber, Select, Space, Tooltip } from 'antd';
import type { FormInstance } from 'antd';
import classNames from 'classnames';
import { variable } from './index';
import styles from './index.less';
Expand Down Expand Up @@ -56,21 +56,17 @@ const timeFormatOptions = ['yyyy-MM-dd', 'yyyyMMdd'].map((item) => ({
value: item,
}));
const operatorOptions = ['+', '-'].map((item) => ({ label: item, value: item }));
interface IProps {}
interface IProps {
form: FormInstance;
}

const VariableConfig: React.FC<IProps> = (props) => {
//
const variables = Form.useWatch('variables', props.form);

return (
<FormItemPanel
keepExpand
label={
<Space direction="vertical" style={{ width: '100%'}}>
<Space>
{
formatMessage({
id: 'odc.DataArchiveTask.CreateModal.VariableConfig.VariableConfiguration',
}) /*变量配置*/
}

自定义变量
<span className={styles.desc}>
<HelpDoc leftText isTip doc="dataArchiveVariablesDoc">
{
Expand All @@ -81,42 +77,38 @@ const VariableConfig: React.FC<IProps> = (props) => {
</HelpDoc>
</span>
</Space>
}
>
<Space direction="vertical">
<Space className={styles.infoLabel}>
<div style={{ width: '194px' }}>
{
formatMessage({
id: 'odc.DataArchiveTask.CreateModal.VariableConfig.VariableName',
}) /*变量名*/
}
</div>
<div style={{ width: '170px' }}>
{
formatMessage({
id: 'odc.DataArchiveTask.CreateModal.VariableConfig.TimeFormat',
}) /*时间格式*/
}
</div>
<div style={{ width: '305px' }}>
<HelpDoc leftText isTip doc="dataArchiveTimeDoc">
{
!!variables?.length &&
<Space style={{ width: '100%'}}>
<div style={{ width: '194px' }}>
{
formatMessage({
id: 'odc.DataArchiveTask.CreateModal.VariableConfig.TimeOperation',
}) /*时间运算*/
id: 'odc.DataArchiveTask.CreateModal.VariableConfig.VariableName',
}) /*变量名*/
}
</HelpDoc>
</div>
</Space>
</div>
<div style={{ width: '170px' }}>
{
formatMessage({
id: 'odc.DataArchiveTask.CreateModal.VariableConfig.TimeFormat',
}) /*时间格式*/
}
</div>
<div style={{ width: '305px' }}>
<HelpDoc leftText isTip doc="dataArchiveTimeDoc">
时间偏移
</HelpDoc>
</div>
</Space>
}
<Form.List name="variables">
{(fields, { add, remove }) => (
<div className={styles.infoBlock}>
{fields.map(({ key, name, ...restField }) => (
<div
key={key}
className={classNames(styles.variables, {
[styles.delete]: fields?.length > 1,
[styles.delete]: true,
})}
>
<Form.Item {...restField} name={[name, 'name']}>
Expand Down Expand Up @@ -170,22 +162,12 @@ const VariableConfig: React.FC<IProps> = (props) => {
</Form.Item>
{ENABLE_PATTERN_OPERATOR && (
<>
<Tooltip
title={formatMessage({
id:
'odc.DataArchiveTask.CreateModal.VariableConfig.AddTimeOperation',
})} /*添加时间运算*/
>
<Tooltip title='添加时间偏移'>
<Button type="text" disabled={disabledAdd}>
<PlusOutlined onClick={() => _add()} />
</Button>
</Tooltip>
<Tooltip
title={formatMessage({
id:
'odc.DataArchiveTask.CreateModal.VariableConfig.DeleteTimeOperation',
})} /*删除时间运算*/
>
<Tooltip title='删除时间偏移'>
<Button type="text">
<MinusOutlined
onClick={() => {
Expand All @@ -202,18 +184,16 @@ const VariableConfig: React.FC<IProps> = (props) => {
);
}}
</Form.List>
{fields?.length > 1 && (
<Tooltip
title={formatMessage({
id: 'odc.DataArchiveTask.CreateModal.VariableConfig.DeleteAVariable',
})} /*删除变量*/
>
<DeleteOutlined onClick={() => remove(name)} />
</Tooltip>
)}
<Tooltip
title={formatMessage({
id: 'odc.DataArchiveTask.CreateModal.VariableConfig.DeleteAVariable',
})} /*删除变量*/
>
<DeleteOutlined onClick={() => remove(name)} />
</Tooltip>
</div>
))}
<Form.Item style={{ marginBottom: 0, width: '100%' }}>
<Form.Item style={{ width: '100%' }}>
<Button type="dashed" onClick={() => add(variable)} block icon={<PlusOutlined />}>
{
formatMessage({
Expand All @@ -226,7 +206,6 @@ const VariableConfig: React.FC<IProps> = (props) => {
)}
</Form.List>
</Space>
</FormItemPanel>
);
};

Expand Down
7 changes: 4 additions & 3 deletions src/component/Task/DataArchiveTask/CreateModal/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ export const variable = {
const defaultValue = {
triggerStrategy: TaskExecStrategy.START_NOW,
archiveRange: IArchiveRange.PORTION,
variables: [variable],
tables: [null],
migrationInsertAction: MigrationInsertAction.INSERT_IGNORE,
rowLimit: 100,
Expand Down Expand Up @@ -375,8 +374,10 @@ const CreateModal: React.FC<IProps> = (props) => {
projectId={projectId}
/>
</Space>
<VariableConfig />
<ArchiveRange tables={tables} />
<Space direction='vertical' size={24}>
<ArchiveRange tables={tables} />
<VariableConfig form={form} />
</Space>
<Form.Item name="deleteAfterMigration" valuePropName="checked">
<Checkbox>
<Space>
Expand Down
18 changes: 8 additions & 10 deletions src/component/Task/DataClearTask/CreateModal/ArchiveRange.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,13 @@
* limitations under the License.
*/

import FormItemPanel from '@/component/FormItemPanel';
import HelpDoc from '@/component/helpDoc';
import { ITable } from '@/d.ts';
import { formatMessage } from '@/util/intl';
import { DeleteOutlined, PlusOutlined } from '@ant-design/icons';
import { Button, Form, Input, Radio, Select, Space } from 'antd';
import classNames from 'classnames';
import { IArchiveRange } from './index';
import ArchiveRangeTip from '../../component/ArchiveRangeTip';
import styles from './index.less';

interface IProps {
Expand All @@ -42,20 +41,20 @@ const ArchiveRange: React.FC<IProps> = (props) => {
required
>
<Radio.Group>
<Radio.Button value={IArchiveRange.PORTION}>
<Radio value={IArchiveRange.PORTION}>
{
formatMessage({
id: 'odc.DataClearTask.CreateModal.ArchiveRange.PartialCleaning',
}) /*部分清理*/
}
</Radio.Button>
<Radio.Button value={IArchiveRange.ALL}>
</Radio>
<Radio value={IArchiveRange.ALL}>
{
formatMessage({
id: 'odc.DataClearTask.CreateModal.ArchiveRange.CleanUpTheEntireDatabase',
}) /*整库清理*/
}
</Radio.Button>
</Radio>
</Radio.Group>
</Form.Item>
<Form.Item shouldUpdate noStyle>
Expand All @@ -65,7 +64,6 @@ const ArchiveRange: React.FC<IProps> = (props) => {
return null;
}
return (
<FormItemPanel keepExpand>
<Space direction="vertical">
<Space className={styles.infoLabel}>
<div style={{ width: '220px' }}>
Expand All @@ -76,13 +74,14 @@ const ArchiveRange: React.FC<IProps> = (props) => {
}
</div>
<div style={{ width: '460px' }}>
<HelpDoc leftText isTip doc="dataClearFilterDoc">
<Space>
{
formatMessage({
id: 'odc.DataClearTask.CreateModal.ArchiveRange.CleaningConditions',
}) /*清理条件*/
}
</HelpDoc>
<ArchiveRangeTip label='清理' />
</Space>
</div>
</Space>
<Form.List name="tables">
Expand Down Expand Up @@ -142,7 +141,6 @@ const ArchiveRange: React.FC<IProps> = (props) => {
)}
</Form.List>
</Space>
</FormItemPanel>
);
}}
</Form.Item>
Expand Down
Loading

0 comments on commit cc08d98

Please sign in to comment.