Skip to content

Commit

Permalink
PullRequest: 534 fix/dev-4.3.2-3378
Browse files Browse the repository at this point in the history
Merge branch 'fix/dev-4.3.2-3378 of git@code.alipay.com:oceanbase/oceanbase-developer-center.git into dev-4.3.2

https://code.alipay.com/oceanbase/oceanbase-developer-center/pull_requests/534


Signed-off-by: 晓康 <xxk268858@oceanbase.com>


* Fixes oceanbase/odc#3378
* Fixes oceanbase/odc#3498
* Fixes oceanbase/odc#3506
* fix: edit logical table
* fix: multi database change should has same connecType
* Fixes oceanbase/odc#3473
* Fixes oceanbase/odc#3509
* clear error when previewLogicalTableTopologies success
* Fixes oceanbase/odc#3476
* Fixes oceanbase/odc#3444
  • Loading branch information
yezaoshu committed Sep 23, 2024
1 parent 903dc3b commit aea920f
Show file tree
Hide file tree
Showing 17 changed files with 161 additions and 97 deletions.
1 change: 1 addition & 0 deletions src/common/datasource/pg/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ const items: Record<ConnectType.PG, IDataSourceModeConfig> = {
sys: false,
ssl: false,
jdbcDoc: 'https://jdbc.postgresql.org/documentation/use/',
disableURLParse: true,
},
features: {
task: [TaskType.DATA_ARCHIVE, TaskType.DATA_DELETE],
Expand Down
7 changes: 6 additions & 1 deletion src/component/Task/DataArchiveTask/CreateModal/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ import ArchiveRange from './ArchiveRange';
import styles from './index.less';
import VariableConfig, { timeUnitOptions } from './VariableConfig';
import ShardingStrategyItem from '../../component/ShardingStrategyItem';
import { disabledDate } from '@/util/utils';

export enum IArchiveRange {
PORTION = 'portion',
Expand Down Expand Up @@ -654,7 +655,11 @@ const CreateModal: React.FC<IProps> = (props) => {
})}
/*执行时间*/ required
>
<DatePicker showTime suffixIcon={<FieldTimeOutlined />} />
<DatePicker
showTime
suffixIcon={<FieldTimeOutlined />}
disabledDate={disabledDate}
/>
</Form.Item>
);
}
Expand Down
7 changes: 6 additions & 1 deletion src/component/Task/DataClearTask/CreateModal/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ import ArchiveRange from './ArchiveRange';
import styles from './index.less';
import VariableConfig from './VariableConfig';
import ShardingStrategyItem from '../../component/ShardingStrategyItem';
import { disabledDate } from '@/util/utils';

export enum IArchiveRange {
PORTION = 'portion',
Expand Down Expand Up @@ -612,7 +613,11 @@ const CreateModal: React.FC<IProps> = (props) => {
if (triggerStrategy === TaskExecStrategy.START_AT) {
return (
<Form.Item name="startAt">
<DatePicker showTime suffixIcon={<FieldTimeOutlined />} />
<DatePicker
showTime
suffixIcon={<FieldTimeOutlined />}
disabledDate={disabledDate}
/>
</Form.Item>
);
}
Expand Down
13 changes: 8 additions & 5 deletions src/component/Task/DetailModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -174,9 +174,13 @@ const DetailModal: React.FC<IProps> = React.memo((props) => {
}
};

const getLog = async function () {
const getLog = async function (args?: ITableLoadOptions) {
if (isLogicalDbChangeTask(task?.type)) {
const flowId = subTasks?.contents?.[0]?.id;
let flowId = subTasks?.contents?.[0]?.id;
if (!flowId) {
const data = await loadDataArchiveSubTask(args);
flowId = data?.contents?.[0]?.id;
}
if (flowId) {
const res = await getCycleTaskLog(task?.id, flowId, logType);
setLog({
Expand Down Expand Up @@ -220,7 +224,7 @@ const DetailModal: React.FC<IProps> = React.memo((props) => {
const data = await getDataArchiveSubTask(task?.id, { page: current, size: pageSize });
setLoading(false);
setSubTasks(data);
// debugger;
return data;
};

const getResult = async function () {
Expand Down Expand Up @@ -286,8 +290,7 @@ const DetailModal: React.FC<IProps> = React.memo((props) => {
switch (detailType) {
case TaskDetailType.LOG: {
if (isLogicalDbChangeTask(task?.type)) {
await getExecuteRecord(args);
getLog();
getLog(args);
} else {
getLog();
}
Expand Down
17 changes: 8 additions & 9 deletions src/component/Task/LogicDatabaseAsyncTask/CreateModal/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import type { TaskStore } from '@/store/task';
import utils, { IEditor } from '@/util/editor';
import { formatMessage } from '@/util/intl';
import { FieldTimeOutlined } from '@ant-design/icons';

import { disabledDate } from '@/util/utils';
import { ICycleTaskTriggerConfig, TaskOperationType } from '@/d.ts';
import {
Alert,
Expand Down Expand Up @@ -93,6 +93,7 @@ const CreateModal: React.FC<IProps> = (props) => {
useEffect(() => {
if (logicDatabaseInfo?.ddl) {
form?.setFieldValue('sqlContent', logicDatabaseInfo?.ddl);
form?.setFieldValue('databaseId', logicDatabaseInfo?.databaseId);
}
}, [logicDatabaseInfo?.ddl]);

Expand Down Expand Up @@ -243,19 +244,13 @@ const CreateModal: React.FC<IProps> = (props) => {
name="basic"
initialValues={{
triggerStrategy: TaskExecStrategy.START_NOW,
databaseId: logicDatabaseInfo?.databaseId,
}}
layout="vertical"
requiredMark="optional"
form={form}
onFieldsChange={handleFieldsChange}
>
<DatabaseSelect
isLogicalDatabase
label={'逻辑库'}
type={TaskType.ALTER_SCHEDULE}
projectId={logicDatabaseInfo?.projectId}
/>
<DatabaseSelect isLogicalDatabase label={'逻辑库'} type={TaskType.ALTER_SCHEDULE} />
<Form.Item label="SQL 内容" required>
<div
style={{
Expand Down Expand Up @@ -395,7 +390,11 @@ const CreateModal: React.FC<IProps> = (props) => {
})}
/*执行时间*/ required
>
<DatePicker showTime suffixIcon={<FieldTimeOutlined />} />
<DatePicker
showTime
suffixIcon={<FieldTimeOutlined />}
disabledDate={disabledDate}
/>
</Form.Item>
);
}
Expand Down
30 changes: 23 additions & 7 deletions src/component/Task/MutipleAsyncTask/CreateModal/DatabaseQueue.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ export const DatabaseQueueSelect: React.FC<{
const form = Form.useFormInstance();
const statusMap = datasourceStatus.statusMap;
const projectId = Form.useWatch('projectId', form);
const orderedDatabaseIds = Form.useWatch(['parameters', 'orderedDatabaseIds'], form);
const [databaseIdMap, setDatabaseIdMap] = useState<Map<number, boolean>>(new Map());
const [_databaseOptions, setDatabaseOptions] = useState<DatabaseOption[]>([]);
const {
Expand Down Expand Up @@ -87,6 +88,7 @@ export const DatabaseQueueSelect: React.FC<{
DatabasePermissionType.CHANGE,
),
expired: checkDbExpiredByDataSourceStatus(statusInfo?.status),
connectType: item?.connectType,
};
}),
);
Expand All @@ -98,13 +100,27 @@ export const DatabaseQueueSelect: React.FC<{
};

const databaseOptions = useMemo(() => {
return _databaseOptions?.map((item) => {
return {
...item,
expired: checkDbExpiredByDataSourceStatus(statusMap.get(item?.dataSource?.id)?.status),
};
});
}, [statusMap, _databaseOptions]);
const selectedDbId = orderedDatabaseIds?.flat()?.filter(Boolean)?.[0];
const selectedDbInfo = _databaseOptions?.find((_db) => _db.value === selectedDbId);
if (selectedDbId) {
// 这里加同数据源类型的限制
return _databaseOptions
?.filter((_db) => _db?.connectType === selectedDbInfo?.connectType)
?.map((item) => {
return {
...item,
expired: checkDbExpiredByDataSourceStatus(statusMap.get(item?.dataSource?.id)?.status),
};
});
} else {
return _databaseOptions?.map((item) => {
return {
...item,
expired: checkDbExpiredByDataSourceStatus(statusMap.get(item?.dataSource?.id)?.status),
};
});
}
}, [statusMap, _databaseOptions, orderedDatabaseIds]);

useEffect(() => {
if (multipleDatabaseChangeOpen && projectId) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { getDataSourceStyleByConnectType } from '@/common/datasource';
import ConnectionPopover from '@/component/ConnectionPopover';
import RiskLevelLabel from '@/component/RiskLevelLabel';
import { IConnection } from '@/d.ts';
import { ConnectType, IConnection } from '@/d.ts';
import { IEnvironment } from '@/d.ts/environment';
import { ReactComponent as DragSvg } from '@/svgr/drag.svg';
import { formatMessage } from '@/util/intl';
Expand All @@ -22,6 +22,7 @@ export type DatabaseOption = {
existed: boolean;
unauthorized: boolean;
expired: boolean;
connectType: ConnectType;
};
const InnerSelect: React.FC<{
rootName: (number | string)[];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ const EditTemplate: React.FC<{
DatabasePermissionType.CHANGE,
),
expired: checkDbExpiredByDataSourceStatus(statusInfo?.status),
connectType: item?.connectType,
};
}),
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,11 @@ const getColumns = () => {
dataIndex: 'traceId',
ellipsis: true,
render: (value: string, row: any) => {
if (!value) return '-';
return value;
return (
<Tooltip placement="topLeft" title={value || '-'}>
{value || '-'}
</Tooltip>
);
},
width: 200,
},
Expand Down
26 changes: 23 additions & 3 deletions src/component/Task/component/TaskTable/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,8 @@ const TaskTable: React.FC<IProps> = inject(
return !start || !end ? null : [moment(start), moment(end)];
});
const [loading, setLoading] = useState(false);
const [hoverInNewTaskMenuBtn, setHoverInNewTaskMenuBtn] = useState(false);
const [hoverInNewTaskMenu, setHoverInNewTaskMenu] = useState(false);
const [listParams, setListParams] = useState(null);
const loadParams = useRef(null);
const { activePageKey } = pageStore;
Expand Down Expand Up @@ -486,7 +488,12 @@ const TaskTable: React.FC<IProps> = inject(
.filter(Boolean),
);
return (
<Space align="start" size={20}>
<Space
align="start"
size={20}
onMouseMove={() => setHoverInNewTaskMenuBtn(true)}
onMouseLeave={() => setHoverInNewTaskMenuBtn(false)}
>
{items?.map((i) => {
return (
<Space direction="vertical">
Expand All @@ -499,6 +506,7 @@ const TaskTable: React.FC<IProps> = inject(
<div
className={styles.menuItem}
onClick={() => {
setHoverInNewTaskMenuBtn(false);
props.onMenuClick(i?.key as TaskPageType);
}}
>
Expand All @@ -525,8 +533,20 @@ const TaskTable: React.FC<IProps> = inject(
? {
type: IOperationOptionType.custom,
render: () => (
<Popover content={newTaskMenu} placement="bottomLeft">
<Button type="primary">
<Popover
content={newTaskMenu}
placement="bottomLeft"
open={hoverInNewTaskMenuBtn || hoverInNewTaskMenu}
>
<Button
type="primary"
onMouseMove={() => setHoverInNewTaskMenu(true)}
onMouseLeave={() => {
setTimeout(() => {
setHoverInNewTaskMenu(false);
}, 500);
}}
>
{
formatMessage({
id: 'odc.component.TaskTable.NewWorkOrder',
Expand Down
35 changes: 22 additions & 13 deletions src/page/Project/Database/components/AddDataBaseButton/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ interface IProps {
onSuccess: () => void;
clearSelectedRowKeys: () => void;
onOpenLogicialDatabase: () => void;
disabledMultiDBChanges?: boolean;
}
const AddDataBaseButton: React.FC<IProps> = ({
projectId,
Expand All @@ -56,6 +57,7 @@ const AddDataBaseButton: React.FC<IProps> = ({
onSuccess,
clearSelectedRowKeys,
onOpenLogicialDatabase,
disabledMultiDBChanges,
}) => {
const [open, setOpen] = useState<boolean>(false);
const { project } = useContext(ProjectContext);
Expand Down Expand Up @@ -148,20 +150,27 @@ const AddDataBaseButton: React.FC<IProps> = ({
添加数据库
</Dropdown.Button>
</TooltipAction>
<Button
onClick={() => {
modalStore?.changeMultiDatabaseChangeModal(true, {
projectId,
orderedDatabaseIds,
});
clearSelectedRowKeys?.();
}}
<Tooltip
title={
disabledMultiDBChanges ? '仅支持选择相同类型的数据源的数据库发起多库变更任务' : null
}
>
{formatMessage({
id: 'src.page.Project.Database.AddDataBaseButton.693C4817',
defaultMessage: '多库变更',
})}
</Button>
<Button
disabled={disabledMultiDBChanges}
onClick={() => {
modalStore?.changeMultiDatabaseChangeModal(true, {
projectId,
orderedDatabaseIds,
});
clearSelectedRowKeys?.();
}}
>
{formatMessage({
id: 'src.page.Project.Database.AddDataBaseButton.693C4817',
defaultMessage: '多库变更',
})}
</Button>
</Tooltip>
<ApplyDatabasePermissionButton
label={
formatMessage({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ const ManageLogicDatabase: React.FC<{
const handleExtractLogicalTables = async () => {
const successful = await extractLogicalTables(database?.id);
if (successful) {
message.info('逻辑表正在提取中,请耐心等待。提取后需确认是否更新逻辑表。');
message.info('逻辑表正在提取中,请耐心等待。');
}
};
const queryLogicalDatabaseById = async () => {
Expand Down
Loading

0 comments on commit aea920f

Please sign in to comment.