Skip to content

Commit

Permalink
CM-332: fetch tasks only for particular searcher (#14)
Browse files Browse the repository at this point in the history
* CM-332: fetch tasks only for particular searcher

* CM-332: fix eslint

---------

Co-authored-by: Jan <[email protected]>
  • Loading branch information
jdolkowski and Jan authored Sep 28, 2023
1 parent 8e96e77 commit a47bfcc
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/components/TaskSearcher.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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',
Expand Down Expand Up @@ -94,6 +93,10 @@ function TaskSearcher({
value: false,
filter: 'isDeleted: false',
},
source: {
value: contribution.taskSource,
filter: `source: "${contribution.taskSource}"`,
},
});

const taskFilter = (props) => (
Expand All @@ -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}
Expand Down

0 comments on commit a47bfcc

Please sign in to comment.