Skip to content

Commit

Permalink
Merge pull request #25 from openimis/feature/CM-396
Browse files Browse the repository at this point in the history
CM-396: export tasks searcher
  • Loading branch information
jdolkowski authored Jan 12, 2024
2 parents 4469596 + 08502ea commit 563f745
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 11 deletions.
31 changes: 20 additions & 11 deletions src/components/TaskSearcher.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import { fetchTasks } from '../actions';
import trimBusinessEvent from '../utils/trimBusinessEvent';

function TaskSearcher({
rights, contribution,
rights, contribution, entityId,
}) {
const history = useHistory();
const modulesManager = useModulesManager();
Expand Down Expand Up @@ -88,16 +88,25 @@ function TaskSearcher({
),
];

const defaultFilters = () => ({
isDeleted: {
value: false,
filter: 'isDeleted: false',
},
source: {
value: contribution.taskSource,
filter: `source: "${contribution.taskSource}"`,
},
});
const defaultFilters = () => {
const filters = {
isDeleted: {
value: false,
filter: 'isDeleted: false',
},
source: {
value: contribution.taskSource,
filter: `source: "${contribution.taskSource}"`,
},
};
if (entityId !== null && entityId !== undefined) {
filters.entityId = {
value: entityId,
filter: `entityId: "${entityId}"`,
};
}
return filters;
};

const taskFilter = (props) => (
<TaskFilter
Expand Down
2 changes: 2 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import TaskGroupPage from './pages/TaskGroupPage';
import TaskStatusPicker from './pickers/TaskStatusPicker';
import TaskPreviewCell from './components/TaskPreviewCell';
import TaskGroupPicker from './pickers/TaskGroupPicker';
import TaskSearcher from './components/TaskSearcher';
import getAdminMainMenuContributions from './contributions/AdminMainMenuContributions';
import { TASK_ROUTE } from './constants';

Expand All @@ -38,6 +39,7 @@ const DEFAULT_CONFIG = {
{ key: 'tasksManagement.taskStatusPicker', ref: TaskStatusPicker },
{ key: 'tasksManagement.taskPreviewCell', ref: TaskPreviewCell },
{ key: 'tasksManagement.taskGroupPicker', ref: TaskGroupPicker },
{ key: 'tasksManagement.taskSearcher', ref: TaskSearcher },
],
};

Expand Down

0 comments on commit 563f745

Please sign in to comment.