Skip to content

Commit

Permalink
Merge branch 'dev-4.3.2' into dev-4.3.3
Browse files Browse the repository at this point in the history
  • Loading branch information
HSunboy committed Oct 30, 2024
2 parents 39844a2 + dba42e3 commit daa8e72
Show file tree
Hide file tree
Showing 8 changed files with 46 additions and 30 deletions.
6 changes: 5 additions & 1 deletion src/component/Task/DetailModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import {
getTaskList,
getTaskLog,
getTaskResult,
getDownloadUrl,
} from '@/common/network/task';
import type { ITableLoadOptions } from '@/component/CommonTable/interface';
import CommonDetailModal from '@/component/Task/component/CommonDetailModal';
Expand Down Expand Up @@ -119,7 +120,7 @@ const DetailModal: React.FC<IProps> = React.memo((props) => {
const [approvalVisible, setApprovalVisible] = useState(false);
const [approvalStatus, setApprovalStatus] = useState(false);
const [isTaskProjectOwner, setIsTaskProjectOwner] = useState(false);

const [downloadUrl, setDownloadUrl] = useState<string>(undefined);
const hasFlow =
!!task?.nodeList?.find(
(node) =>
Expand Down Expand Up @@ -187,6 +188,8 @@ const DetailModal: React.FC<IProps> = React.memo((props) => {
...log,
[logType]: res,
});
const url = await getDownloadUrl(task?.id, flowId);
setDownloadUrl(url);
return;
}
return;
Expand Down Expand Up @@ -516,6 +519,7 @@ const DetailModal: React.FC<IProps> = React.memo((props) => {
onReload={loadData}
taskContent={taskContent}
getItems={getItems}
downloadUrl={downloadUrl}
/>
<ApprovalModal
id={
Expand Down
9 changes: 3 additions & 6 deletions src/component/Task/component/ActionBar/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ import React, { useEffect, useState } from 'react';
import { isCycleTask, isLogicalDbChangeTask } from '../../helper';
import RollBackModal from '../RollbackModal';
import { useRequest } from 'ahooks';

interface IProps {
userStore?: UserStore;
taskStore?: TaskStore;
Expand Down Expand Up @@ -105,19 +104,20 @@ const ActionBar: React.FC<IProps> = inject(
const [openRollback, setOpenRollback] = useState(false);
const [taskList, setTaskList] = useState<ICycleSubTaskRecord[]>([]);

const disabledApproval =
task?.status === TaskStatus.WAIT_FOR_CONFIRM && !isDetailModal ? true : disabledSubmit;

useEffect(() => {
if (task?.id && isLogicalDbChangeTask(task?.type) && isDetailModal) {
loadtaskList();
}
return cancel();
}, [task?.id]);

const getScheduleTask = async () => {
const taskList = await getDataArchiveSubTask(task?.id);
setTaskList(taskList?.contents);
return taskList?.contents;
};

const { run: loadtaskList, cancel } = useRequest(getScheduleTask, {
pollingInterval: 3000,
manual: true,
Expand All @@ -132,9 +132,6 @@ const ActionBar: React.FC<IProps> = inject(
},
});

const disabledApproval =
task?.status === TaskStatus.WAIT_FOR_CONFIRM && !isDetailModal ? true : disabledSubmit;

const openTaskDetail = async () => {
props.onDetailVisible(task as TaskRecord<TaskRecordParameters>, true);
};
Expand Down
6 changes: 3 additions & 3 deletions src/component/Task/component/CommonDetailModal/LogModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ const LogModal: React.FC<IProps> = function (props) {
},
);

const { run: getLogDownLoadUrl } = useRequest(async (scheduleId, recordId, logType) => {
const { run: getLogDownLoadUrl } = useRequest(async (scheduleId, recordId) => {
if (scheduleId && recordId) {
const res = await getDownloadUrl(scheduleId, recordId);
if (!!res) {
Expand All @@ -72,7 +72,7 @@ const LogModal: React.FC<IProps> = function (props) {
useEffect(() => {
if (visible) {
getLog(scheduleId, recordId, logType);
getLogDownLoadUrl(scheduleId, recordId, logType);
getLogDownLoadUrl(scheduleId, recordId);
}
}, [scheduleId, recordId, visible, logType]);

Expand Down Expand Up @@ -105,7 +105,7 @@ const LogModal: React.FC<IProps> = function (props) {
log={log}
logType={logType}
isLoading={loading}
downloadUrl={downloadUrl}
downloadUrl={logType === CommonTaskLogType.ALL ? downloadUrl : undefined}
onLogTypeChange={handleLogTypeChange}
/>
</Drawer>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { getDataSourceStyleByConnectType } from '@/common/datasource';
import Action from '@/component/Action';
import RiskLevelLabel from '@/component/RiskLevelLabel';
import StatusLabel from '@/component/Task/component/Status';
import { SubTaskStatus, TaskType } from '@/d.ts';
import { SubTaskStatus, TaskType, TaskStatus } from '@/d.ts';
import { formatMessage } from '@/util/intl';
import { getLocalFormatDateTime } from '@/util/utils';
import Icon, { QuestionCircleOutlined } from '@ant-design/icons';
Expand All @@ -14,6 +14,7 @@ const getColumns = (params: {
handleDetailVisible: (id: number) => void;
onSwapTable: (id: number) => void;
handleProgressDetailVisible: (id: number) => void;
taskStatus: TaskStatus;
}) => {
// 查看进度 提示文本
const viewProgressTooltip = (
Expand Down Expand Up @@ -72,6 +73,7 @@ const getColumns = (params: {
render: (_, record) => {
const { status } = record;
const resultJson = JSON.parse(record?.resultJson);
const isTaskFailed = [TaskStatus.EXECUTING]?.includes(params.taskStatus);
return (
<Space>
<Action.Link
Expand All @@ -81,7 +83,7 @@ const getColumns = (params: {
>
查看结构
</Action.Link>
{resultJson?.manualSwapTableEnabled && (
{resultJson?.manualSwapTableEnabled && !isTaskFailed && (
<Action.Link
onClick={async () => {
params?.onSwapTable(record?.id);
Expand Down Expand Up @@ -268,6 +270,7 @@ export const getColumnsByTaskType = (
handleMultipleAsyncOpen;
handleProgressDetailVisible;
},
status: TaskStatus,
) => {
switch (type) {
case TaskType.MULTIPLE_ASYNC: {
Expand All @@ -280,6 +283,7 @@ export const getColumnsByTaskType = (
handleDetailVisible: params?.handleDetailVisible,
onSwapTable: params?.handleSwapTable,
handleProgressDetailVisible: params?.handleProgressDetailVisible,
taskStatus: status,
});
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,12 +149,16 @@ const TaskProgress: React.FC<IProps> = (props) => {
}, []);
// #endregion

const columns = getColumnsByTaskType(task?.type, {
handleDetailVisible,
handleMultipleAsyncOpen,
handleSwapTable,
handleProgressDetailVisible,
});
const columns = getColumnsByTaskType(
task?.type,
{
handleDetailVisible,
handleMultipleAsyncOpen,
handleSwapTable,
handleProgressDetailVisible,
},
task.status,
);

return (
<>
Expand Down
17 changes: 14 additions & 3 deletions src/component/Task/component/CommonDetailModal/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import TaskLog from '@/component/Task/component/Log';
import StatusLabel from '@/component/Task/component/Status';
import type { ITaskDetailModalProps } from '@/component/Task/interface';
import { TaskDetailType } from '@/component/Task/interface';
import { ITaskResult, TaskDetail, TaskRecordParameters, TaskType } from '@/d.ts';
import { ITaskResult, TaskDetail, TaskRecordParameters, TaskType, CommonTaskLogType } from '@/d.ts';
import login from '@/store/login';
import { formatMessage } from '@/util/intl';
import { ShareAltOutlined } from '@ant-design/icons';
Expand Down Expand Up @@ -51,8 +51,19 @@ const TaskContent: React.FC<ICommonTaskDetailModalProps> = (props) => {
hasFlow,
onLogTypeChange,
onReload,
downloadUrl,
} = props;
let content = null;
const getDownloadUrl = () => {
if (isLogicalDbChangeTask(task?.type) && logType === CommonTaskLogType.ALL) {
return downloadUrl;
} else if (!isLogicalDbChangeTask(task?.type)) {
return result?.fullLogDownloadUrl;
} else {
return undefined;
}
};

switch (detailType) {
case TaskDetailType.INFO:
content = taskContent ? (
Expand All @@ -64,15 +75,14 @@ const TaskContent: React.FC<ICommonTaskDetailModalProps> = (props) => {
isSplit={isSplit}
/>
);

break;
case TaskDetailType.LOG:
content = (
<TaskLog
log={log}
logType={logType}
isLoading={isLoading}
downloadUrl={result?.fullLogDownloadUrl}
downloadUrl={getDownloadUrl()}
onLogTypeChange={onLogTypeChange}
/>
);
Expand Down Expand Up @@ -109,6 +119,7 @@ interface ICommonTaskDetailModalProps extends ITaskDetailModalProps {
width?: number;
isSplit?: boolean;
theme?: string;
downloadUrl?: string;
getItems?: (
task: TaskDetail<TaskRecordParameters>,
result: ITaskResult,
Expand Down
8 changes: 0 additions & 8 deletions src/component/Task/component/Status/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -541,7 +541,6 @@ export const cycleStatus = {
}}
/>
),

text: formatMessage({
id: 'src.component.Task.component.Status.3DCF46EC',
defaultMessage: '创建中',
Expand Down Expand Up @@ -648,7 +647,6 @@ export const logicDBChangeTaskStatus = {
}}
/>
),

text: formatMessage({
id: 'src.component.Task.component.Status.64D3C12B',
defaultMessage: '执行失败',
Expand All @@ -666,7 +664,6 @@ export const logicDBChangeTaskStatus = {
}}
/>
),

text: formatMessage({
id: 'src.component.Task.component.Status.1B9301A5',
defaultMessage: '待执行',
Expand All @@ -680,7 +677,6 @@ export const logicDBChangeTaskStatus = {
}}
/>
),

text: formatMessage({
id: 'src.component.Task.component.Status.2497FE39',
defaultMessage: '执行中',
Expand All @@ -694,7 +690,6 @@ export const logicDBChangeTaskStatus = {
}}
/>
),

text: formatMessage({
id: 'src.component.Task.component.Status.8FA22B8A',
defaultMessage: '执行成功',
Expand All @@ -715,7 +710,6 @@ export const logicDBChangeTaskStatus = {
}}
/>
),

text: formatMessage({
id: 'src.component.Task.component.Status.CA4AFAD3',
defaultMessage: '跳过中',
Expand All @@ -736,7 +730,6 @@ export const logicDBChangeTaskStatus = {
}}
/>
),

text: formatMessage({
id: 'src.component.Task.component.Status.726F85D7',
defaultMessage: '终止中',
Expand All @@ -750,7 +743,6 @@ export const logicDBChangeTaskStatus = {
}}
/>
),

text: formatMessage({
id: 'src.component.Task.component.Status.BB5E3650',
defaultMessage: '终止失败',
Expand Down
6 changes: 5 additions & 1 deletion src/page/Workspace/ActivityBar/Logo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import { formatMessage } from '@/util/intl';
*/

import { ReactComponent as ODCBlackSvg } from '@/svgr/odc_logo_color.svg';
import { isClient } from '@/util/env';
import { haveOCP, isClient } from '@/util/env';
import Icon, { HomeOutlined } from '@ant-design/icons';
import { Tooltip } from 'antd';
import { useState } from 'react';
Expand All @@ -29,6 +29,10 @@ export default function Logo() {
const backToHome = () => {
if (isClient()) return;
if (login.isPrivateSpace()) return;
if (haveOCP) {
window.open(location.origin + location.pathname);
return;
}
window.open(location.origin + '/#/project');
};

Expand Down

0 comments on commit daa8e72

Please sign in to comment.