From f89460215ff601c947de2f1b70fd8ac242ce5338 Mon Sep 17 00:00:00 2001 From: Damian Borowiecki Date: Mon, 11 Mar 2024 18:07:48 +0100 Subject: [PATCH 1/4] C-719: Remove business status display (#39) --- src/actions.js | 9 ++++++--- src/components/TaskApprovementPanel.js | 15 +++++++++++++++ src/components/TaskSearcher.js | 3 --- src/index.js | 4 +++- 4 files changed, 24 insertions(+), 7 deletions(-) diff --git a/src/actions.js b/src/actions.js index 66f3541..afa7e0a 100644 --- a/src/actions.js +++ b/src/actions.js @@ -36,7 +36,7 @@ const TASK_FULL_PROJECTION = () => [ 'jsonExt', ]; -const TASKS_FULL_PROJECTION = () => [ +const TASK_PROJECTION = () => [ 'id', 'entityId', 'entityString', @@ -44,7 +44,6 @@ const TASKS_FULL_PROJECTION = () => [ 'status', 'executorActionEvent', 'businessEvent', - 'businessStatus', 'dateCreated', 'isDeleted', 'taskGroup{id, code, completionPolicy}', @@ -52,6 +51,10 @@ const TASKS_FULL_PROJECTION = () => [ 'jsonExt', ]; +const TASKS_FULL_PROJECTION = () => [ + ...TASK_PROJECTION, 'businessEvent' +]; + export const formatTaskGroupGQL = (taskGroup) => { const executors = taskGroup?.taskexecutorSet?.map((executor) => decodeId(executor.id)); const taskSources = taskGroup?.taskSources?.map((taskSource) => taskSource.name); @@ -101,7 +104,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); } diff --git a/src/components/TaskApprovementPanel.js b/src/components/TaskApprovementPanel.js index daf742c..9c2894d 100644 --- a/src/components/TaskApprovementPanel.js +++ b/src/components/TaskApprovementPanel.js @@ -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'; @@ -49,6 +50,7 @@ function TaskApprovementPanel({ const [disable, setDisable] = useState(false); const task = { ...edited }; + useEffect(() => { if (task?.businessStatus && user) { const businesStatus = JSON.parse(task.businessStatus); @@ -99,6 +101,19 @@ function TaskApprovementPanel({ } }; + if (task.source) { + const contrib = modulesManager.getContribs(TASK_CONTRIBUTION_KEY) + .find((c) => c.taskSource.includes(task.source)); + + if (contrib?.confirmationPanel) { + return + } + } + return (
diff --git a/src/components/TaskSearcher.js b/src/components/TaskSearcher.js index d9f507a..d84155b 100644 --- a/src/components/TaskSearcher.js +++ b/src/components/TaskSearcher.js @@ -52,7 +52,6 @@ function TaskSearcher({ 'task.type', 'task.entity', 'task.assignee', - 'task.businessStatus', 'task.status', ]; if (rights.includes(RIGHT_TASKS_MANAGEMENT_SEARCH)) { @@ -66,7 +65,6 @@ function TaskSearcher({ ['type', true], ['entity', true], ['assignee', true], - ['businessStatus', true], ['status', true], ]; @@ -75,7 +73,6 @@ function TaskSearcher({ (task) => trimBusinessEvent(task.businessEvent), (task) => task.entityString, (task) => task?.taskGroup?.code, - (task) => task.businessStatus, (task) => task.status, (task) => ( diff --git a/src/index.js b/src/index.js index 08ddfb9..5e79930 100644 --- a/src/index.js +++ b/src/index.js @@ -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'; @@ -47,3 +47,5 @@ const DEFAULT_CONFIG = { }; export const TasksManagementModule = (cfg) => ({ ...DEFAULT_CONFIG, ...cfg }); + +export { resolveTask }; \ No newline at end of file From 5159e73b1b315514acc65f413d15325d3321aad9 Mon Sep 17 00:00:00 2001 From: Jan Date: Thu, 21 Mar 2024 11:18:37 +0100 Subject: [PATCH 2/4] CM-728: remove iso parse (#40) * CM-728: remove iso parse * CM-728: order by dateCreated --------- Co-authored-by: Jan --- src/actions.js | 4 ++-- src/components/TaskApprovementPanel.js | 15 ++++++++------- src/components/TaskSearcher.js | 2 +- src/index.js | 2 +- src/reducer.js | 7 +------ 5 files changed, 13 insertions(+), 17 deletions(-) diff --git a/src/actions.js b/src/actions.js index afa7e0a..d29aad7 100644 --- a/src/actions.js +++ b/src/actions.js @@ -36,7 +36,7 @@ const TASK_FULL_PROJECTION = () => [ 'jsonExt', ]; -const TASK_PROJECTION = () => [ +const TASK_PROJECTION = () => [ 'id', 'entityId', 'entityString', @@ -52,7 +52,7 @@ const TASK_PROJECTION = () => [ ]; const TASKS_FULL_PROJECTION = () => [ - ...TASK_PROJECTION, 'businessEvent' + ...TASK_PROJECTION, 'businessEvent', ]; export const formatTaskGroupGQL = (taskGroup) => { diff --git a/src/components/TaskApprovementPanel.js b/src/components/TaskApprovementPanel.js index 9c2894d..4b6e59b 100644 --- a/src/components/TaskApprovementPanel.js +++ b/src/components/TaskApprovementPanel.js @@ -13,7 +13,7 @@ import CheckIcon from '@material-ui/icons/Check'; import { APPROVED, EMPTY_STRING, FAILED, TASK_STATUS, - TASK_CONTRIBUTION_KEY + TASK_CONTRIBUTION_KEY, } from '../constants'; import { resolveTask } from '../actions'; @@ -50,7 +50,6 @@ function TaskApprovementPanel({ const [disable, setDisable] = useState(false); const task = { ...edited }; - useEffect(() => { if (task?.businessStatus && user) { const businesStatus = JSON.parse(task.businessStatus); @@ -106,11 +105,13 @@ function TaskApprovementPanel({ .find((c) => c.taskSource.includes(task.source)); if (contrib?.confirmationPanel) { - return + return ( + + ); } } diff --git a/src/components/TaskSearcher.js b/src/components/TaskSearcher.js index d84155b..29709fe 100644 --- a/src/components/TaskSearcher.js +++ b/src/components/TaskSearcher.js @@ -140,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()} diff --git a/src/index.js b/src/index.js index 5e79930..6b04f6f 100644 --- a/src/index.js +++ b/src/index.js @@ -48,4 +48,4 @@ const DEFAULT_CONFIG = { export const TasksManagementModule = (cfg) => ({ ...DEFAULT_CONFIG, ...cfg }); -export { resolveTask }; \ No newline at end of file +export { resolveTask }; diff --git a/src/reducer.js b/src/reducer.js index a702960..8be83b1 100644 --- a/src/reducer.js +++ b/src/reducer.js @@ -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, }; From a03fc6d3d440e59ebe437676f7b8ace44ce13352 Mon Sep 17 00:00:00 2001 From: Jan Date: Fri, 22 Mar 2024 09:43:14 +0100 Subject: [PATCH 3/4] CM-762: fix group task tab (#42) * CM-750: fix task filtering * CM-750: fix eslint * CM-762: fix group task tab --------- Co-authored-by: Jan --- src/actions.js | 4 ---- src/components/TaskFilter.js | 12 ++---------- src/components/TaskSearcher.js | 2 +- 3 files changed, 3 insertions(+), 15 deletions(-) diff --git a/src/actions.js b/src/actions.js index d29aad7..b261a96 100644 --- a/src/actions.js +++ b/src/actions.js @@ -51,10 +51,6 @@ const TASK_PROJECTION = () => [ 'jsonExt', ]; -const TASKS_FULL_PROJECTION = () => [ - ...TASK_PROJECTION, 'businessEvent', -]; - export const formatTaskGroupGQL = (taskGroup) => { const executors = taskGroup?.taskexecutorSet?.map((executor) => decodeId(executor.id)); const taskSources = taskGroup?.taskSources?.map((taskSource) => taskSource.name); diff --git a/src/components/TaskFilter.js b/src/components/TaskFilter.js index 944c758..cd7f3cb 100644 --- a/src/components/TaskFilter.js +++ b/src/components/TaskFilter.js @@ -64,7 +64,7 @@ function TaskFilter({ module="tasksManagement" label="task.entity" value={filterTextFieldValue('entity')} - onChange={onChangeStringFilter('entity', CONTAINS_LOOKUP)} + onChange={onChangeStringFilter('entityString', CONTAINS_LOOKUP)} /> @@ -81,14 +81,6 @@ function TaskFilter({ ])} /> - - - diff --git a/src/components/TaskSearcher.js b/src/components/TaskSearcher.js index 29709fe..f647a67 100644 --- a/src/components/TaskSearcher.js +++ b/src/components/TaskSearcher.js @@ -107,7 +107,7 @@ function TaskSearcher({ if (entityIds) { filters.entityIds = { value: entityIds, - filter: `entityIds: "${entityIds}"`, + filter: `entityIds: [${entityIds.map((id) => `"${id}"`)}]`, }; } return filters; From 35f989e06ae644efb3872981cf18d7750dcb2d4d Mon Sep 17 00:00:00 2001 From: Jan Date: Fri, 22 Mar 2024 10:02:08 +0100 Subject: [PATCH 4/4] CM-750: fix task filtering (#41) * CM-750: fix task filtering * CM-750: fix eslint --------- Co-authored-by: Jan