Commit 6c82d010 by Your Name

newTasks, total bug fix

parent a83aaafa
......@@ -216,7 +216,7 @@ const FC = (props) => {
return columns;
}, [visibleCols, tasksProgress, permissions])
const _tasks = useMemo(() => {
const [_tasks,total ] = useMemo(() => {
if (tasks) {
let newTasks = tasks?.filter(item => {
return (configState.scope===undefined || item.target?.scope === configState.scope?.toString())
......@@ -249,29 +249,29 @@ const FC = (props) => {
}
})
}
const total = newTasks.length
newTasks = paginate(newTasks, pagination.pageNum, pagination.pageSize);
return newTasks;
return [newTasks, total];
}
return []
}, [tasks, pagination, configState, supportedTargetTypes, sortedInfo, keyword, env])
const total = useMemo(() => {
if (tasks) {
const newTasks = tasks?.filter(item => {
return (configState.scope===undefined || item.target?.scope === configState.scope?.toString())
&& (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, env])
// const total = useMemo(() => {
// if (tasks) {
// const newTasks = tasks?.filter(item => {
// return (configState.scope===undefined || item.target?.scope === configState.scope?.toString())
// && (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, env])
const getPermissions = () => {
dispatch({
......
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