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

MERGING develop into release/24.04 #43

Merged
merged 4 commits into from
Mar 28, 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
5 changes: 2 additions & 3 deletions src/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,14 @@ const TASK_FULL_PROJECTION = () => [
'jsonExt',
];

const TASKS_FULL_PROJECTION = () => [
const TASK_PROJECTION = () => [
'id',
'entityId',
'entityString',
'source',
'status',
'executorActionEvent',
'businessEvent',
'businessStatus',
'dateCreated',
'isDeleted',
'taskGroup{id, code, completionPolicy}',
Expand Down Expand Up @@ -101,7 +100,7 @@ export function fetchTaskGroups(modulesManager, params) {
}

export function fetchTasks(modulesManager, params) {
const payload = formatPageQueryWithCount('task', params, TASKS_FULL_PROJECTION());
const payload = formatPageQueryWithCount('task', params, TASK_PROJECTION());
return graphql(payload, ACTION_TYPE.SEARCH_TASKS);
}

Expand Down
16 changes: 16 additions & 0 deletions src/components/TaskApprovementPanel.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import CheckIcon from '@material-ui/icons/Check';
import {
APPROVED, EMPTY_STRING,
FAILED, TASK_STATUS,
TASK_CONTRIBUTION_KEY,
} from '../constants';
import { resolveTask } from '../actions';

Expand Down Expand Up @@ -99,6 +100,21 @@ function TaskApprovementPanel({
}
};

if (task.source) {
const contrib = modulesManager.getContribs(TASK_CONTRIBUTION_KEY)
.find((c) => c.taskSource.includes(task.source));

if (contrib?.confirmationPanel) {
return (
<contrib.confirmationPanel
task
defaultAction={handleButtonClick}
defaultDisabled={disable}
/>
);
}
}

return (
<Paper className={classes.paper}>
<div className={classes.fabContainer}>
Expand Down
12 changes: 2 additions & 10 deletions src/components/TaskFilter.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ function TaskFilter({
module="tasksManagement"
label="task.entity"
value={filterTextFieldValue('entity')}
onChange={onChangeStringFilter('entity', CONTAINS_LOOKUP)}
onChange={onChangeStringFilter('entityString', CONTAINS_LOOKUP)}
/>
</Grid>
<Grid item xs={3} className={classes.item}>
Expand All @@ -81,14 +81,6 @@ function TaskFilter({
])}
/>
</Grid>
<Grid item xs={3} className={classes.item}>
<TextInput
module="tasksManagement"
label="task.businessStatus"
value={filterTextFieldValue('businessStatus')}
onChange={onChangeStringFilter('businessStatus', CONTAINS_LOOKUP)}
/>
</Grid>
<Grid item xs={3} className={classes.item}>
<PublishedComponent
pubRef="tasksManagement.taskStatusPicker"
Expand All @@ -101,7 +93,7 @@ function TaskFilter({
{
id: 'status',
value,
filter: `status: ${value}`,
filter: value ? `status: ${value}` : EMPTY_STRING,
},
])}
/>
Expand Down
7 changes: 2 additions & 5 deletions src/components/TaskSearcher.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ function TaskSearcher({
'task.type',
'task.entity',
'task.assignee',
'task.businessStatus',
'task.status',
];
if (rights.includes(RIGHT_TASKS_MANAGEMENT_SEARCH)) {
Expand All @@ -66,7 +65,6 @@ function TaskSearcher({
['type', true],
['entity', true],
['assignee', true],
['businessStatus', true],
['status', true],
];

Expand All @@ -75,7 +73,6 @@ function TaskSearcher({
(task) => trimBusinessEvent(task.businessEvent),
(task) => task.entityString,
(task) => task?.taskGroup?.code,
(task) => task.businessStatus,
(task) => task.status,
(task) => (
<Tooltip title={formatMessage('viewDetailsButton.tooltip')}>
Expand Down Expand Up @@ -110,7 +107,7 @@ function TaskSearcher({
if (entityIds) {
filters.entityIds = {
value: entityIds,
filter: `entityIds: "${entityIds}"`,
filter: `entityIds: [${entityIds.map((id) => `"${id}"`)}]`,
};
}
return filters;
Expand Down Expand Up @@ -143,7 +140,7 @@ function TaskSearcher({
sorts={sorts}
rowsPerPageOptions={ROWS_PER_PAGE_OPTIONS}
defaultPageSize={DEFAULT_PAGE_SIZE}
defaultOrderBy="source"
defaultOrderBy="-dateCreated"
rowIdentifier={rowIdentifier}
onDoubleClick={onDoubleClick}
defaultFilters={defaultFilters()}
Expand Down
4 changes: 3 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import TaskGroupPicker from './pickers/TaskGroupPicker';
import TaskSearcher from './components/TaskSearcher';
import getAdminMainMenuContributions from './contributions/AdminMainMenuContributions';
import { TASK_ROUTE } from './constants';
import { fetchTask } from './actions';
import { fetchTask, resolveTask } from './actions';

const ROUTE_TASKS_MANAGEMENT = 'tasks';
const ROUTE_TASK_MANAGEMENT = 'tasks/task';
Expand Down Expand Up @@ -47,3 +47,5 @@ const DEFAULT_CONFIG = {
};

export const TasksManagementModule = (cfg) => ({ ...DEFAULT_CONFIG, ...cfg });

export { resolveTask };
7 changes: 1 addition & 6 deletions src/reducer.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,12 +115,7 @@ function reducer(
task: parseData(action.payload.data.task)?.map((task) => ({
...task,
id: decodeId(task.id),
businessData: parseTaskData(JSON.parse(task.businessData, (key, value) => {
if (['date_valid_to', 'date_valid_from'].includes(key)) {
return `${value} 00:00:00`;
}
return value;
})),
businessData: parseTaskData(JSON.parse(task.businessData)),
}))?.[0],
errorTask: null,
};
Expand Down
Loading