Commit 6c82d010 by Your Name

newTasks, total bug fix

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