Skip to content

Commit

Permalink
PullRequest: 533 fix/dev-4.3.2-3449
Browse files Browse the repository at this point in the history
Merge branch 'fix/dev-4.3.2-3449 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/533


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


* Fixes oceanbase/odc#3449
* Fixes oceanbase/odc#3447
* Fixes oceanbase/odc#3462
* Fixes oceanbase/odc#3464
* Fixes oceanbase/odc#3472
* Fixes oceanbase/odc#3351
* Fixes oceanbase/odc#3439
  • Loading branch information
yezaoshu committed Sep 20, 2024
1 parent fcd5430 commit c146975
Show file tree
Hide file tree
Showing 12 changed files with 102 additions and 37 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ const LogicDatabaseAsyncTaskContent: React.FC<IProps> = (props) => {
<ODCRiskLevelLabel
iconMode
level={task?.riskLevel?.level}
content={task?.riskLevel?.name}
content={task?.riskLevel?.name || '-'}
/>
</Descriptions.Item>
)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -404,15 +404,15 @@ const TaskExecuteRecord: React.FC<IProps> = (props) => {
if (res) {
message.success('正在尝试终止');
} else {
message.warning('正在尝试终止');
message.warning('当前任务状态不支持终止');
}
onReload?.();
};

const handleLogicalDatabaseTaskSkip = async (detailId: number) => {
const res = await skipPhysicalSqlExecute(flowList?.contents?.[0]?.id, detailId);
if (res) {
message.success('当前任务状态不支持终止');
message.success('正在尝试跳过');
} else {
message.warning('当前任务状态不支持跳过');
}
Expand Down
5 changes: 4 additions & 1 deletion src/component/Task/component/CommonDetailModal/TaskFlow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,7 @@ const TaskFlow: React.FC<IProps> = (props) => {
if (
(task?.type === TaskType.ASYNC && task.status === TaskStatus.COMPLETED) ||
(task?.type === TaskType.ASYNC && task.status === TaskStatus.EXECUTION_SUCCEEDED) ||
(task?.type === TaskType.LOGICAL_DATABASE_CHANGE && task.status === TaskStatus.COMPLETED) ||
(task?.type !== TaskType.ASYNC && task.status === TaskStatus.EXECUTION_SUCCEEDED)
) {
currentNodeIndex = taskFlow.length + 1;
Expand Down Expand Up @@ -753,7 +754,9 @@ const TaskFlow: React.FC<IProps> = (props) => {

/*处理时间*/
>
{getLocalFormatDateTime(task?.completeTime)}
{getLocalFormatDateTime(
isLogicDbChangeTask ? flowDetail?.completeTime : task?.completeTime,
)}
</Descriptions.Item>
</Descriptions>
</Space>
Expand Down
18 changes: 17 additions & 1 deletion src/component/Task/component/CommonDetailModal/TaskTools.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -136,13 +136,29 @@ const ActionBar: React.FC<IProps> = inject(
});
};
const handleExecute = async () => {
Modal.confirm({
title: '是否确定执行任务?',
icon: <ExclamationCircleOutlined />,
okText: formatMessage({
id: 'odc.component.CommonDetailModal.TaskTools.Confirm',
defaultMessage: '确认',
}),
cancelText: formatMessage({
id: 'odc.component.CommonDetailModal.TaskTools.Cancel',
defaultMessage: '取消',
}),
onOk: confirmExecute,
});
};

const confirmExecute = async () => {
const res = await startDataArchiveSubTask(taskId, record.id);
if (res) {
message.success('发起执行成功');

props.onReloadList();
}
};

const handleReTry = async () => {
const res = await startDataArchiveSubTask(taskId, record.id);
if (res) {
Expand Down
11 changes: 11 additions & 0 deletions src/component/Task/component/Status/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -521,6 +521,17 @@ export const cycleStatus = {
defaultMessage: '执行失败',
}), //执行失败
},

[TaskStatus.CREATING]: {
icon: (
<LoadingOutlined
style={{
color: 'var(--icon-blue-color)',
}}
/>
),
text: '创建中',
},
};

// 子任务状态(仅周期任务 + 无锁结构变更)
Expand Down
10 changes: 9 additions & 1 deletion src/component/WindowManager/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import DefaultPage from './DefaultPage';
import DraggableTabs from './DraggableTabs';
import { getPageTitleText } from './helper';
import styles from './index.less';
import { isLogicalDatabase } from '@/util/database';

interface IProps {
pages: IPage[];
Expand Down Expand Up @@ -345,7 +346,14 @@ const WindowManager: React.FC<IProps> = function (props) {
key: 'newPL',
onClick(e) {
e.domEvent.stopPropagation();
openNewDefaultPLPage(undefined, treeContext?.currentDatabaseId);
const db = treeContext.currentDatabaseId;
const isLogicalDb = isLogicalDatabase(
treeContext?.databaseList?.find((_db) => _db?.id === db),
);
openNewDefaultPLPage(
undefined,
isLogicalDb ? null : treeContext?.currentDatabaseId,
);
},
},
],
Expand Down
1 change: 1 addition & 0 deletions src/d.ts/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3037,6 +3037,7 @@ export enum TaskStatus {
TERMINATION = 'TERMINATION',
TIMEOUT = 'TIMEOUT',
PRE_CHECK_FAILED = 'PRE_CHECK_FAILED',
CREATING = 'CREATING',
}

export enum SubTaskStatus {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,21 +113,6 @@ const CreateLogicialDatabase: React.FC<{
const [databaseList, setDatabaseList] = useState<IDatabase[]>([]);
const [checkedDatabaseList, setCheckedDatabaseList] = useState<number[]>([]);

useEffect(() => {
const name = databaseOptions?.find((i) => i.value === baseDatabase)?.name;
form.setFields([
{
name: 'alias',
value: name,
errors: [],
},
{
name: 'name',
value: `logical_${name}`,
errors: [],
},
]);
}, [baseDatabase]);
const {
data,
run,
Expand Down Expand Up @@ -335,14 +320,18 @@ const CreateLogicialDatabase: React.FC<{
<ProjectDatabaseSelector databaseOptions={databaseOptions} width={'400px'} />
<Form.Item
label={
<HelpDoc isTip leftText title={'别名可用于区分同名的逻辑库'}>
逻辑库别名
<HelpDoc
isTip
leftText
title={'逻辑数据库名,即物理库名共同前缀,例如foo00~foo99所对应的逻辑库为foo'}
>
逻辑库名
</HelpDoc>
}
>
<Form.Item
noStyle
name={'alias'}
name={'name'}
rules={[
{
required: true,
Expand All @@ -365,20 +354,44 @@ const CreateLogicialDatabase: React.FC<{
<Input
style={{ width: '400px' }}
placeholder={'请输入'}
onChange={async (e) => {
await form.setFields([
{
name: 'name',
value: `${e.target.value}`,
errors: [],
},
]);
}}
onChange={async (e) => {}}
showCount
maxLength={64}
/>
</Form.Item>
</Form.Item>
<Form.Item
label={
<HelpDoc isTip leftText title={'别名可用于区分同名的逻辑库'}>
逻辑库别名
</HelpDoc>
}
>
<Form.Item
noStyle
name={'alias'}
rules={[
{
required: true,
message: '请输入',
},
{
validator: async (ruler, value) => {
const name = value?.trim();
if (!name) {
return;
}
},
},
{
pattern: SPACE_REGEX,
message: '不能包含空格',
},
]}
>
<Input style={{ width: '400px' }} placeholder={'请输入'} showCount maxLength={64} />
</Form.Item>
</Form.Item>
<Form.Item label="数据库" name="physicalDatabaseIds" shouldUpdate>
<DatabaseSelecter
projectId={baseDatabase ? projectId : null}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,7 @@ const ManageLogicDatabase: React.FC<{
null,
'',
isLogicalDatabase(database),
true,
)
}
>
Expand Down
3 changes: 2 additions & 1 deletion src/page/Workspace/components/TablePage/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,8 @@ const TablePage: React.FC<IProps> = function ({ params, pageStore, pageKey, sett
{settingStore.enableDBExport &&
getDataSourceModeConfig(session?.connection?.type)?.features?.task?.includes(
TaskType.EXPORT,
) ? (
) &&
!isLogicalDatabase(session?.odcDatabase) ? (
<Toolbar.Button
text={
formatMessage({ id: 'odc.components.TablePage.Export', defaultMessage: '导出' }) //导出
Expand Down
12 changes: 10 additions & 2 deletions src/page/Workspace/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import WindowManager from '@/component/WindowManager';
import WorkspaceSideTip from '@/component/WorkspaceSideTip';
import type { IPage } from '@/d.ts';
import odc from '@/plugins/odc';
import { movePagePostion, openNewSQLPage } from '@/store/helper/page';
import { movePagePostion, openNewSQLPage, openCreateTablePage } from '@/store/helper/page';
import type { UserStore } from '@/store/login';
import type { ModalStore } from '@/store/modal';
import type { PageStore } from '@/store/page';
Expand All @@ -43,6 +43,7 @@ import WorkspaceStore from './context/WorkspaceStore';
import GlobalModals from './GlobalModals';
import WorkBenchLayout from './Layout';
import SideBar from './SideBar';
import { isLogicalDatabase } from '@/util/database';

let _closeMsg = '';
export function changeCloseMsg(t: any) {
Expand Down Expand Up @@ -75,13 +76,17 @@ const Workspace: React.FC<WorkspaceProps> = (props: WorkspaceProps) => {
const databaseId = toInteger(params.get('databaseId'));
const datasourceId = toInteger(params.get('datasourceId'));
const isLogicalDatabase = params.get('isLogicalDatabase') === 'true';
const isCreateTable = params.get('isCreateTable') === 'true';
if (projectId) {
resourceTreeContext?.setSelectTabKey(ResourceTreeTab.project);
resourceTreeContext?.setSelectProjectId(projectId);
databaseId && resourceTreeContext?.setCurrentDatabaseId(databaseId);
if (!isLogicalDatabase) {
databaseId && openNewSQLPage(databaseId, 'project');
}
if (isCreateTable) {
openCreateTablePage(databaseId);
}
} else if (datasourceId) {
resourceTreeContext?.setSelectTabKey(ResourceTreeTab.datasource);
resourceTreeContext?.setSelectDatasourceId(datasourceId);
Expand All @@ -105,7 +110,10 @@ const Workspace: React.FC<WorkspaceProps> = (props: WorkspaceProps) => {

const handleOpenPage = async () => {
const db = resourceTreeContext.currentDatabaseId;
openNewSQLPage(db);
const isLogicalDb = isLogicalDatabase(
resourceTreeContext?.databaseList?.find((_db) => _db?.id === db),
);
openNewSQLPage(isLogicalDb ? null : db);
};

const openPageAfterTargetPage = async (targetPage: IPage) => {
Expand Down
5 changes: 4 additions & 1 deletion src/util/route/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ export function gotoSQLWorkspace(
currentPage?: boolean,
tabKey: string = '',
isLogicalDatabase: boolean = false,
isCreateTable: boolean = false,
) {
const url =
location.origin +
Expand All @@ -31,7 +32,9 @@ export function gotoSQLWorkspace(
? `#/sqlworkspace/${tabKey}/${datasourceId}`
: `#/sqlworkspace?projectId=${projectId || ''}&datasourceId=${
datasourceId || ''
}&databaseId=${databaseId || ''}&isLogicalDatabase=${isLogicalDatabase}`);
}&databaseId=${
databaseId || ''
}&isLogicalDatabase=${isLogicalDatabase}&isCreateTable=${isCreateTable}`);

const name = 'sqlworkspace' + '%' + login.organizationId + tabKey;
if (currentPage) {
Expand Down

0 comments on commit c146975

Please sign in to comment.