Commit bec4a91d by zhaochengxiang

采集

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