From a47bfccf3462d29937a8d8ec1ecb3a7e6952968b Mon Sep 17 00:00:00 2001 From: Jan Date: Thu, 28 Sep 2023 15:53:44 +0200 Subject: [PATCH] CM-332: fetch tasks only for particular searcher (#14) * CM-332: fetch tasks only for particular searcher * CM-332: fix eslint --------- Co-authored-by: Jan --- src/components/TaskSearcher.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/components/TaskSearcher.js b/src/components/TaskSearcher.js index ee7b0ed..ab4f590 100644 --- a/src/components/TaskSearcher.js +++ b/src/components/TaskSearcher.js @@ -29,6 +29,7 @@ function TaskSearcher({ const errorTasks = useSelector((state) => state?.tasksManagement?.errorTasks); const tasks = useSelector((state) => state?.tasksManagement?.tasks); const tasksPageInfo = useSelector((state) => state?.tasksManagement?.tasksPageInfo); + const tasksTotalCount = useSelector((state) => state?.tasksManagement?.tasksTotalCount); const openTask = (task, newTab = false) => historyPush( modulesManager, @@ -45,8 +46,6 @@ function TaskSearcher({ const isRowDisabled = (_, task) => task.status !== TASK_STATUS.ACCEPTED; - const filterTasks = (tasks) => tasks.filter((task) => contribution.taskSource.includes(task.source)); - const headers = () => { const headers = [ 'task.source', @@ -94,6 +93,10 @@ function TaskSearcher({ value: false, filter: 'isDeleted: false', }, + source: { + value: contribution.taskSource, + filter: `source: "${contribution.taskSource}"`, + }, }); const taskFilter = (props) => ( @@ -110,13 +113,13 @@ function TaskSearcher({ module="tasksManagement" FilterPane={taskFilter} fetch={fetch} - items={filterTasks(tasks)} + items={tasks} itemsPageInfo={tasksPageInfo} fetchingItems={fetchingTasks} fetchedItems={fetchedTasks} errorItems={errorTasks} tableTitle={formatMessageWithValues('task.searcherResultsTitle', { - tasksTotalCount: filterTasks(tasks).length, + tasksTotalCount, })} headers={headers} itemFormatters={itemFormatters}