diff --git a/src/component/Task/LogicDatabaseAsyncTask/DetailContent/index.tsx b/src/component/Task/LogicDatabaseAsyncTask/DetailContent/index.tsx index c71170add..925e7a54b 100644 --- a/src/component/Task/LogicDatabaseAsyncTask/DetailContent/index.tsx +++ b/src/component/Task/LogicDatabaseAsyncTask/DetailContent/index.tsx @@ -43,7 +43,7 @@ const LogicDatabaseAsyncTaskContent: React.FC = (props) => { )} diff --git a/src/component/Task/component/CommonDetailModal/TaskExecuteRecord.tsx b/src/component/Task/component/CommonDetailModal/TaskExecuteRecord.tsx index aa301b52b..443546274 100644 --- a/src/component/Task/component/CommonDetailModal/TaskExecuteRecord.tsx +++ b/src/component/Task/component/CommonDetailModal/TaskExecuteRecord.tsx @@ -404,7 +404,7 @@ const TaskExecuteRecord: React.FC = (props) => { if (res) { message.success('正在尝试终止'); } else { - message.warning('正在尝试终止'); + message.warning('当前任务状态不支持终止'); } onReload?.(); }; @@ -412,7 +412,7 @@ const TaskExecuteRecord: React.FC = (props) => { const handleLogicalDatabaseTaskSkip = async (detailId: number) => { const res = await skipPhysicalSqlExecute(flowList?.contents?.[0]?.id, detailId); if (res) { - message.success('当前任务状态不支持终止'); + message.success('正在尝试跳过'); } else { message.warning('当前任务状态不支持跳过'); } diff --git a/src/component/Task/component/CommonDetailModal/TaskFlow.tsx b/src/component/Task/component/CommonDetailModal/TaskFlow.tsx index d2b9902bf..adb93671a 100644 --- a/src/component/Task/component/CommonDetailModal/TaskFlow.tsx +++ b/src/component/Task/component/CommonDetailModal/TaskFlow.tsx @@ -350,6 +350,7 @@ const TaskFlow: React.FC = (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; @@ -753,7 +754,9 @@ const TaskFlow: React.FC = (props) => { /*处理时间*/ > - {getLocalFormatDateTime(task?.completeTime)} + {getLocalFormatDateTime( + isLogicDbChangeTask ? flowDetail?.completeTime : task?.completeTime, + )} diff --git a/src/component/Task/component/CommonDetailModal/TaskTools.tsx b/src/component/Task/component/CommonDetailModal/TaskTools.tsx index f649a61c2..b9f80eeef 100644 --- a/src/component/Task/component/CommonDetailModal/TaskTools.tsx +++ b/src/component/Task/component/CommonDetailModal/TaskTools.tsx @@ -136,13 +136,29 @@ const ActionBar: React.FC = inject( }); }; const handleExecute = async () => { + Modal.confirm({ + title: '是否确定执行任务?', + icon: , + 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) { diff --git a/src/component/Task/component/Status/index.tsx b/src/component/Task/component/Status/index.tsx index 96c0a5912..8110602ec 100644 --- a/src/component/Task/component/Status/index.tsx +++ b/src/component/Task/component/Status/index.tsx @@ -521,6 +521,17 @@ export const cycleStatus = { defaultMessage: '执行失败', }), //执行失败 }, + + [TaskStatus.CREATING]: { + icon: ( + + ), + text: '创建中', + }, }; // 子任务状态(仅周期任务 + 无锁结构变更) diff --git a/src/component/WindowManager/index.tsx b/src/component/WindowManager/index.tsx index f4ff385c3..b75ceb271 100644 --- a/src/component/WindowManager/index.tsx +++ b/src/component/WindowManager/index.tsx @@ -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[]; @@ -345,7 +346,14 @@ const WindowManager: React.FC = 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, + ); }, }, ], diff --git a/src/d.ts/index.ts b/src/d.ts/index.ts index 91870e2e9..57d26653e 100644 --- a/src/d.ts/index.ts +++ b/src/d.ts/index.ts @@ -3037,6 +3037,7 @@ export enum TaskStatus { TERMINATION = 'TERMINATION', TIMEOUT = 'TIMEOUT', PRE_CHECK_FAILED = 'PRE_CHECK_FAILED', + CREATING = 'CREATING', } export enum SubTaskStatus { diff --git a/src/page/Project/Database/components/LogicDatabase/CreateLogicialDatabase.tsx b/src/page/Project/Database/components/LogicDatabase/CreateLogicialDatabase.tsx index 9d21406d0..c1efa0b9d 100644 --- a/src/page/Project/Database/components/LogicDatabase/CreateLogicialDatabase.tsx +++ b/src/page/Project/Database/components/LogicDatabase/CreateLogicialDatabase.tsx @@ -113,21 +113,6 @@ const CreateLogicialDatabase: React.FC<{ const [databaseList, setDatabaseList] = useState([]); const [checkedDatabaseList, setCheckedDatabaseList] = useState([]); - 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, @@ -335,14 +320,18 @@ const CreateLogicialDatabase: React.FC<{ - 逻辑库别名 + + 逻辑库名 } > { - await form.setFields([ - { - name: 'name', - value: `${e.target.value}`, - errors: [], - }, - ]); - }} + onChange={async (e) => {}} showCount maxLength={64} /> + + 逻辑库别名 + + } + > + { + const name = value?.trim(); + if (!name) { + return; + } + }, + }, + { + pattern: SPACE_REGEX, + message: '不能包含空格', + }, + ]} + > + + + diff --git a/src/page/Workspace/components/TablePage/index.tsx b/src/page/Workspace/components/TablePage/index.tsx index e5491dd32..1a1a07b40 100644 --- a/src/page/Workspace/components/TablePage/index.tsx +++ b/src/page/Workspace/components/TablePage/index.tsx @@ -209,7 +209,8 @@ const TablePage: React.FC = function ({ params, pageStore, pageKey, sett {settingStore.enableDBExport && getDataSourceModeConfig(session?.connection?.type)?.features?.task?.includes( TaskType.EXPORT, - ) ? ( + ) && + !isLogicalDatabase(session?.odcDatabase) ? ( = (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); @@ -82,6 +84,9 @@ const Workspace: React.FC = (props: WorkspaceProps) => { if (!isLogicalDatabase) { databaseId && openNewSQLPage(databaseId, 'project'); } + if (isCreateTable) { + openCreateTablePage(databaseId); + } } else if (datasourceId) { resourceTreeContext?.setSelectTabKey(ResourceTreeTab.datasource); resourceTreeContext?.setSelectDatasourceId(datasourceId); @@ -105,7 +110,10 @@ const Workspace: React.FC = (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) => { diff --git a/src/util/route/index.tsx b/src/util/route/index.tsx index bf2b656bf..aecf67adc 100644 --- a/src/util/route/index.tsx +++ b/src/util/route/index.tsx @@ -23,6 +23,7 @@ export function gotoSQLWorkspace( currentPage?: boolean, tabKey: string = '', isLogicalDatabase: boolean = false, + isCreateTable: boolean = false, ) { const url = location.origin + @@ -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) {