Commit 6c0f3df3 by zhaochengxiang

采集bug

parent 9c4a36f9
......@@ -278,7 +278,11 @@ const ExecuteDateItem = ({ value, data, onChange }) => {
const onDateChange = (val) => {
setDateKey(val);
onChange?.(`${categoryKey},${val.join(',')}`);
if (val.length === 0) {
onChange?.(undefined);
} else {
onChange?.(`${categoryKey},${val.join(',')}`);
}
}
return (
......
......@@ -543,18 +543,21 @@ export function Config({ onState, autoSelect, setTargetTypes }) {
}, [scope, env])
useEffect(() => {
if (autoSelect && (datasources||[]).length > 0) {
dispatchState({type: 'selectDatasource', payload: [datasources[0].id]});
if (autoSelect) {
const filterDatasources = (datasources||[]).filter(item => !targetType || item.type === targetType);
if (filterDatasources.length > 0) {
dispatchState({type: 'selectDatasource', payload: [filterDatasources[0].id]});
} else {
dispatchState({type: 'selectDatasource', payload: [undefined]});
}
} else {
dispatchState({type: 'selectDatasource', payload: [undefined]});
}
}, [autoSelect, datasources])
useEffect(() => {
dispatchState({type: 'selectDatasource', payload: [undefined]})
}, [scope, targetType])
}, [autoSelect, datasources, scope, targetType])
const _datasources = useMemo(() => {
if (datasources && targetType) {
return (datasources||[]).filter(item => item.type === targetType);
return (datasources||[]).filter(item => !targetType || item.type === targetType);
}
return datasources;
......
import React, { useState, useEffect, useContext, useMemo } from 'react';
import { Space, DatePicker, Row, Col, Card, Spin, Empty, Typography, Pagination, Input, Select, Tooltip } from 'antd';
import { Space, DatePicker, Row, Col, Card, Spin, Empty, Typography, Pagination, Input, Select, Tooltip, Button } from 'antd';
import 'moment/locale/zh-cn';
import locale from 'antd/es/date-picker/locale/zh_CN';
......@@ -107,7 +107,7 @@ const FC = (props) => {
{ cnName: '采集总数', value: (newTasks||[]).length },
{ cnName: '成功次数', value: (newTasks||[]).filter(item => item.state==='ENDED').length },
{ cnName: '失败次数', value: (newTasks||[]).filter(item => item.state==='FAILED').length },
{ cnName: '采集时长', value: parseInt((newTasks||[]).reduce((preVal, item) => item.costTime + preVal, 0)), unit: '分钟' },
{ cnName: '采集时长', value: ((newTasks||[]).reduce((preVal, item) => item.costTime + preVal, 0)).toFixed(2), unit: '分钟' },
])
}, [reportData, taskCode, datasourceName, reportState, keyword, pagination])
......@@ -262,7 +262,8 @@ const FC = (props) => {
return (
<div style={{ overflowX: 'hidden' }}>
<div className='flex' style={{ justifyContent: 'end' }}>
<div className='flex' style={{ justifyContent: 'space-between' }}>
<Button onClick={() => { getTaskReportDetail(); }}>刷新</Button>
<Space>
<RangePicker
locale={locale}
......
......@@ -43,6 +43,10 @@ const FC = (props) => {
useEffect(() => {
if (configState?.datasourceId) {
getTaskSettings(configState?.datasourceId);
} else {
setSchemas([]);
setSelectedSchemas([]);
setTaskSettings({});
}
}, [configState?.datasourceId])
......
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