Commit bec4a91d by zhaochengxiang

采集

parent 25c0900a
...@@ -4,6 +4,12 @@ import moment from 'moment'; ...@@ -4,6 +4,12 @@ import moment from 'moment';
import { dispatch } from '../../../../model'; import { dispatch } from '../../../../model';
function compare(val1, val2) {
var a = val1.seq;
var b = val2.seq;
return (a - b);
}
const ScheduleAction = (props) => { const ScheduleAction = (props) => {
const { action, id, form, tid, onChange } = props; const { action, id, form, tid, onChange } = props;
...@@ -11,7 +17,7 @@ const ScheduleAction = (props) => { ...@@ -11,7 +17,7 @@ const ScheduleAction = (props) => {
useEffect(() => { useEffect(() => {
reset(); reset();
if (action === 'add' && tid) { if (action === 'add') {
getScheduleForm(); getScheduleForm();
} else if (action === 'edit' && id) { } else if (action === 'edit' && id) {
getScheduleById(); getScheduleById();
...@@ -26,6 +32,9 @@ const ScheduleAction = (props) => { ...@@ -26,6 +32,9 @@ const ScheduleAction = (props) => {
targetConfId: tid targetConfId: tid
}, },
callback: data => { callback: data => {
(data?.targetParameters||[]).sort(compare);
(data?.scheduleParameters||[]).sort(compare);
setSchedule(data||{}); setSchedule(data||{});
onChange && onChange(data||{}); onChange && onChange(data||{});
} }
...@@ -39,12 +48,6 @@ const ScheduleAction = (props) => { ...@@ -39,12 +48,6 @@ const ScheduleAction = (props) => {
id id
}, },
callback: data => { callback: data => {
function compare(val1, val2) {
var a = val1.seq;
var b = val2.seq;
return (a - b);
}
(data?.targetParameters||[]).sort(compare); (data?.targetParameters||[]).sort(compare);
(data?.scheduleParameters||[]).sort(compare); (data?.scheduleParameters||[]).sort(compare);
......
...@@ -170,7 +170,7 @@ const FC = (props) => { ...@@ -170,7 +170,7 @@ const FC = (props) => {
return () => { return () => {
clearInterval(interval); clearInterval(interval);
} }
}, []) }, [env])
const _columns = useMemo(() => { const _columns = useMemo(() => {
if (visibleCols) { if (visibleCols) {
...@@ -191,6 +191,7 @@ const FC = (props) => { ...@@ -191,6 +191,7 @@ const FC = (props) => {
&& (configState.datasourceId===undefined || item.target?.id === configState.datasourceId) && (configState.datasourceId===undefined || item.target?.id === configState.datasourceId)
&& (configState.targetType===undefined || item.target?.type === configState.targetType) && (configState.targetType===undefined || item.target?.type === configState.targetType)
&& (!keyword || (item.taskCode||'').indexOf(keyword)!==-1 || (item.schema||'').indexOf(keyword)!==-1) && (!keyword || (item.taskCode||'').indexOf(keyword)!==-1 || (item.schema||'').indexOf(keyword)!==-1)
&& item.target?.namespace === env?.domainId?.toString()
}); });
newTasks?.forEach(item => { newTasks?.forEach(item => {
const index = (supportedTargetTypes||[]).findIndex(_item => _item.targetType === item.type); const index = (supportedTargetTypes||[]).findIndex(_item => _item.targetType === item.type);
...@@ -216,7 +217,7 @@ const FC = (props) => { ...@@ -216,7 +217,7 @@ const FC = (props) => {
} }
return [] return []
}, [tasks, pagination, configState, supportedTargetTypes, sortedInfo, keyword]) }, [tasks, pagination, configState, supportedTargetTypes, sortedInfo, keyword, env])
const total = useMemo(() => { const total = useMemo(() => {
if (tasks) { if (tasks) {
...@@ -225,13 +226,14 @@ const FC = (props) => { ...@@ -225,13 +226,14 @@ const FC = (props) => {
&& (configState.datasourceId===undefined || item.target?.id === configState.datasourceId) && (configState.datasourceId===undefined || item.target?.id === configState.datasourceId)
&& (configState.targetType===undefined || item.target?.type === configState.targetType) && (configState.targetType===undefined || item.target?.type === configState.targetType)
&& (!keyword || item.taskCode?.indexOf(keyword)!==-1 || item.schema?.indexOf(keyword)!==-1) && (!keyword || item.taskCode?.indexOf(keyword)!==-1 || item.schema?.indexOf(keyword)!==-1)
&& item.target?.namespace === env?.domainId?.toString()
}); });
return (newTasks||[]).length; return (newTasks||[]).length;
} }
return 0; return 0;
}, [tasks, pagination, configState, keyword]) }, [tasks, pagination, configState, keyword, env])
const getAllTasks = () => { const getAllTasks = () => {
setLoadingTasks(true); setLoadingTasks(true);
...@@ -299,12 +301,9 @@ const FC = (props) => { ...@@ -299,12 +301,9 @@ const FC = (props) => {
setPagination({pageNum: page, pageSize: size }); setPagination({pageNum: page, pageSize: size });
} }
const onUpdateTaskCancel = () => { const onUpdateTaskCancel = (refresh = false) => {
setUpdateTaskParam({ visible: false, action: undefined, id: undefined }); setUpdateTaskParam({ visible: false, action: undefined, id: undefined });
} refresh && getAllTasks();
const onUpdateTaskChange = () => {
getAllTasks();
} }
const onColConfigCancel = (refresh = false) => { const onColConfigCancel = (refresh = false) => {
...@@ -444,7 +443,7 @@ const FC = (props) => { ...@@ -444,7 +443,7 @@ const FC = (props) => {
dataSource={_tasks||[]} dataSource={_tasks||[]}
pagination={false} pagination={false}
onChange={onTableChange} onChange={onTableChange}
scroll={{ y: 'calc(100vh - 330px)' }} scroll={{ y: 'calc(100vh - 315px)' }}
sticky sticky
/> />
<Pagination <Pagination
...@@ -466,7 +465,6 @@ const FC = (props) => { ...@@ -466,7 +465,6 @@ const FC = (props) => {
action={updateTaskParam.action} action={updateTaskParam.action}
id={updateTaskParam.id} id={updateTaskParam.id}
onCancel={onUpdateTaskCancel} onCancel={onUpdateTaskCancel}
onChange={onUpdateTaskChange}
/> />
<ColConfig <ColConfig
...@@ -481,8 +479,6 @@ const FC = (props) => { ...@@ -481,8 +479,6 @@ const FC = (props) => {
export default FC; export default FC;
export const reducer = (prevState, action) => { export const reducer = (prevState, action) => {
const scope = undefined, targetType = undefined, datasourceId = undefined;
if (action.type === 'selectScope') { if (action.type === 'selectScope') {
const [scope] = action.payload const [scope] = action.payload
return { ...prevState, scope } return { ...prevState, scope }
...@@ -493,7 +489,7 @@ export const reducer = (prevState, action) => { ...@@ -493,7 +489,7 @@ export const reducer = (prevState, action) => {
const [datasourceId] = action.payload const [datasourceId] = action.payload
return { ...prevState, datasourceId } return { ...prevState, datasourceId }
} else if (action.type === 'init') { } else if (action.type === 'init') {
return { ...prevState, scope, targetType, datasourceId } return { ...prevState, scope: undefined, targetType: undefined, datasourceId: undefined }
} }
return prevState return prevState
...@@ -531,10 +527,10 @@ export function Config({ onState, autoSelect, setTargetTypes }) { ...@@ -531,10 +527,10 @@ export function Config({ onState, autoSelect, setTargetTypes }) {
setTreeData(env.children); setTreeData(env.children);
setTreeExpandKeys(newExpandKeys); setTreeExpandKeys(newExpandKeys);
dispatchState('init'); dispatchState({type: 'init'});
} else { } else {
setTreeData([]); setTreeData([]);
dispatchState('init'); dispatchState({type: 'init'});
} }
}, [env]) }, [env])
...@@ -544,7 +540,7 @@ export function Config({ onState, autoSelect, setTargetTypes }) { ...@@ -544,7 +540,7 @@ export function Config({ onState, autoSelect, setTargetTypes }) {
useEffect(() => { useEffect(() => {
getDatasources(); getDatasources();
}, [scope]) }, [scope, env])
useEffect(() => { useEffect(() => {
if (autoSelect && (datasources||[]).length > 0) { if (autoSelect && (datasources||[]).length > 0) {
......
...@@ -79,10 +79,13 @@ const FC = (props) => { ...@@ -79,10 +79,13 @@ const FC = (props) => {
}, [reportData]) }, [reportData])
const taskCodes = useMemo(() => { const taskCodes = useMemo(() => {
return tasks?.filter(item => item.taskCode).map(item => item.taskCode) return tasks?.filter(item => item.target?.namespace===env?.domainId?.toString() && item.taskCode).map(item => item.taskCode)
}, [tasks]) }, [tasks, env])
useEffect(() => { useEffect(() => {
setTaskCode(undefined);
setDatasourceName(undefined);
setReportState(undefined);
getAllTasks(); getAllTasks();
getDatasources(); getDatasources();
}, [env]) }, [env])
...@@ -377,7 +380,7 @@ const FC = (props) => { ...@@ -377,7 +380,7 @@ const FC = (props) => {
}, },
}} }}
pagination={false} pagination={false}
scroll={{ y: 'calc(100vh - 415px)' }} scroll={{ y: 'calc(100vh - 400px)' }}
sticky sticky
/> />
<Pagination <Pagination
......
.metadata-harvester { .metadata-harvester {
height: calc(100vh - 124px); height: calc(100vh - 124px);
padding: 20px; padding: 5px 20px 20px;
background: #fff; background: #fff;
overflow: hidden; overflow: hidden;
} }
\ No newline at end of file
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