Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CM-396: export tasks searcher #25

Merged
merged 1 commit into from
Jan 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading