Commit 6c0f3df3 by zhaochengxiang

采集bug

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