Commit 728e16c9 by zhaochengxiang

调度进度

parent f947c507
...@@ -253,7 +253,7 @@ const ScheduleCURDModal = (props) => { ...@@ -253,7 +253,7 @@ const ScheduleCURDModal = (props) => {
visible={visible} visible={visible}
title={title} title={title}
width={1000} width={1000}
maskClosable={false} maskClosable={true}
onCancel={cancel} onCancel={cancel}
footer={footer} footer={footer}
> >
......
import React, { useContext } from 'react'; import React, { useContext } from 'react';
import { Card, Typography, Space, Button, Tooltip } from 'antd'; import { Card, Typography, Space, Button, Tooltip, Progress } from 'antd';
import { EditOutlined, DeleteOutlined, DatabaseOutlined, FileOutlined, ScheduleOutlined } from '@ant-design/icons'; import { EditOutlined, DeleteOutlined, DatabaseOutlined, FileOutlined, ScheduleOutlined } from '@ant-design/icons';
import { DatasourceContext } from './ContextManager'; import { DatasourceContext } from './ContextManager';
...@@ -8,11 +8,11 @@ import './TaskItem.less'; ...@@ -8,11 +8,11 @@ import './TaskItem.less';
const TaskItem = (props) => { const TaskItem = (props) => {
const { data } = props; const { data } = props;
const { onStartTask, onLogTask, onEditTask, onDeleteTask, onScheduleShow } = useContext(DatasourceContext); const { onStartTask, onLogTask, onEditTask, onDeleteTask, onScheduleShow, tasksProgress } = useContext(DatasourceContext);
return ( return (
<Card className='task-item'> <Card className='task-item'>
<div style={{ height: 80, overflow: 'auto' }}> <div>
{ {
data && (data.targetConfParameters||[]).map((param, index) => { data && (data.targetConfParameters||[]).map((param, index) => {
return ( return (
...@@ -23,6 +23,15 @@ const TaskItem = (props) => { ...@@ -23,6 +23,15 @@ const TaskItem = (props) => {
}) })
} }
</div> </div>
{
tasksProgress && tasksProgress[data.id] ?
<div className='mt-1 flex' style={{ alignItems: 'center', justifyContent: 'space-between' }}>
<span style={{ marginRight: 5 }}>抽取进度: </span>
<div style={{ flex: 1 }}>
<Progress percent={tasksProgress[data.id]} status="active" size='small' />
</div>
</div> : <div className='mt-1' style={{ height: 22 }} ></div>
}
<div className='d-flex mt-2'> <div className='d-flex mt-2'>
<Space style={{ marginLeft: 'auto' }}> <Space style={{ marginLeft: 'auto' }}>
<Tooltip placement='bottom' title='定时调度'> <Tooltip placement='bottom' title='定时调度'>
......
...@@ -40,11 +40,20 @@ const DatasourceManage = (props) => { ...@@ -40,11 +40,20 @@ const DatasourceManage = (props) => {
const [ currentDatasourceId, setCurrentDatasourceId ] = useState(''); const [ currentDatasourceId, setCurrentDatasourceId ] = useState('');
const [ currentDatasourceIdBindTasksNeedRefresh, setCurrentDatasourceIdBindTasksNeedRefresh ] = useState(''); const [ currentDatasourceIdBindTasksNeedRefresh, setCurrentDatasourceIdBindTasksNeedRefresh ] = useState('');
const [ currentTaskId, setCurrentTaskId ] = useState(''); const [ currentTaskId, setCurrentTaskId ] = useState('');
const [ tasksProgress, setTasksProgress ] = useState({});
const [modal, contextHolder] = Modal.useModal(); const [modal, contextHolder] = Modal.useModal();
useEffect(() => { useEffect(() => {
getScopesAndSupportDatabases(); getScopesAndSupportDatabases();
const interval = setInterval(() => {
getAllTasksProgress();
}, 5000);
return () => {
clearInterval(interval);
}
//eslint-disable-next-line react-hooks/exhaustive-deps //eslint-disable-next-line react-hooks/exhaustive-deps
}, []) }, [])
...@@ -136,6 +145,15 @@ const DatasourceManage = (props) => { ...@@ -136,6 +145,15 @@ const DatasourceManage = (props) => {
}) })
} }
const getAllTasksProgress = () => {
dispatch({
type: 'datasource.getAllTaskProgress',
callback: data => {
setTasksProgress(data||{});
}
})
}
const onScopeChange = (value) => { const onScopeChange = (value) => {
setSelectedScope(value); setSelectedScope(value);
} }
...@@ -288,6 +306,7 @@ const DatasourceManage = (props) => { ...@@ -288,6 +306,7 @@ const DatasourceManage = (props) => {
onLogTask: logTask, onLogTask: logTask,
onEditTask: editTask, onEditTask: editTask,
onDeleteTask: deleteTask, onDeleteTask: deleteTask,
tasksProgress: tasksProgress
}}> }}>
<div className='datasource-manage' style={{ backgroundColor: '#fff' }}> <div className='datasource-manage' style={{ backgroundColor: '#fff' }}>
<div <div
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment