@zeniai/client-epic-state 4.20.2-beta29RR → 4.20.2-beta30ND
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/entity/snackbar/snackbarTypes.d.ts +1 -1
- package/lib/entity/snackbar/snackbarTypes.js +0 -2
- package/lib/entity/task/taskPayload.d.ts +0 -3
- package/lib/entity/task/taskPayload.js +0 -5
- package/lib/entity/task/taskState.d.ts +0 -3
- package/lib/epic.d.ts +1 -3
- package/lib/epic.js +1 -3
- package/lib/esm/entity/snackbar/snackbarTypes.js +0 -2
- package/lib/esm/entity/task/taskPayload.js +0 -5
- package/lib/esm/epic.js +1 -3
- package/lib/esm/index.js +4 -4
- package/lib/esm/view/companyView/types/cockpitTypes.js +0 -1
- package/lib/esm/view/profitAndLossClassesView/profitAndLossClassesByClassHorizontalSelector.js +15 -1
- package/lib/esm/view/profitAndLossClassesView/profitAndLossHorizontalEnrichment.js +17 -14
- package/lib/esm/view/taskManager/taskDetailView/epics/archiveTaskEpic.js +0 -2
- package/lib/esm/view/taskManager/taskDetailView/epics/deleteTaskEpic.js +0 -4
- package/lib/esm/view/taskManager/taskDetailView/epics/initializeTaskToLocalStoreEpic.js +0 -1
- package/lib/esm/view/taskManager/taskDetailView/epics/saveTaskDetailEpic.js +0 -1
- package/lib/esm/view/taskManager/taskDetailView/taskDetail.js +0 -4
- package/lib/esm/view/taskManager/taskDetailView/taskDetailReducer.js +1 -49
- package/lib/esm/view/taskManager/taskDetailView/taskDetailSelector.js +0 -3
- package/lib/esm/view/taskManager/taskListView/epics/bulkUpdateTaskListEpic.js +0 -6
- package/lib/esm/view/taskManager/taskListView/epics/fetchTaskListEpic.js +3 -13
- package/lib/esm/view/taskManager/taskListView/taskList.js +0 -8
- package/lib/esm/view/taskManager/taskListView/taskListReducer.js +11 -107
- package/lib/esm/view/taskManager/taskListView/taskListSelector.js +17 -56
- package/lib/index.d.ts +4 -4
- package/lib/index.js +4 -8
- package/lib/tsconfig.typecheck.tsbuildinfo +1 -1
- package/lib/view/companyTaskManagerView/companyTaskManagerViewReducer.d.ts +2 -2
- package/lib/view/companyView/types/cockpitTypes.d.ts +1 -1
- package/lib/view/companyView/types/cockpitTypes.js +0 -1
- package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.d.ts +1 -1
- package/lib/view/profitAndLossClassesView/profitAndLossClassesByClassHorizontalSelector.d.ts +2 -0
- package/lib/view/profitAndLossClassesView/profitAndLossClassesByClassHorizontalSelector.js +16 -2
- package/lib/view/profitAndLossClassesView/profitAndLossHorizontalEnrichment.js +17 -14
- package/lib/view/taskManager/taskDetailView/epics/archiveTaskEpic.d.ts +1 -2
- package/lib/view/taskManager/taskDetailView/epics/archiveTaskEpic.js +0 -2
- package/lib/view/taskManager/taskDetailView/epics/deleteTaskEpic.d.ts +1 -2
- package/lib/view/taskManager/taskDetailView/epics/deleteTaskEpic.js +0 -4
- package/lib/view/taskManager/taskDetailView/epics/initializeTaskToLocalStoreEpic.js +0 -1
- package/lib/view/taskManager/taskDetailView/epics/saveTaskDetailEpic.js +0 -1
- package/lib/view/taskManager/taskDetailView/taskDetail.d.ts +0 -2
- package/lib/view/taskManager/taskDetailView/taskDetail.js +0 -4
- package/lib/view/taskManager/taskDetailView/taskDetailReducer.d.ts +1 -10
- package/lib/view/taskManager/taskDetailView/taskDetailReducer.js +2 -50
- package/lib/view/taskManager/taskDetailView/taskDetailSelector.d.ts +0 -2
- package/lib/view/taskManager/taskDetailView/taskDetailSelector.js +0 -3
- package/lib/view/taskManager/taskListView/epics/bulkUpdateTaskListEpic.d.ts +0 -6
- package/lib/view/taskManager/taskListView/epics/bulkUpdateTaskListEpic.js +0 -6
- package/lib/view/taskManager/taskListView/epics/fetchTaskListEpic.js +3 -13
- package/lib/view/taskManager/taskListView/taskList.d.ts +1 -15
- package/lib/view/taskManager/taskListView/taskList.js +1 -10
- package/lib/view/taskManager/taskListView/taskListPayload.d.ts +0 -3
- package/lib/view/taskManager/taskListView/taskListReducer.d.ts +4 -7
- package/lib/view/taskManager/taskListView/taskListReducer.js +12 -108
- package/lib/view/taskManager/taskListView/taskListSelector.d.ts +3 -8
- package/lib/view/taskManager/taskListView/taskListSelector.js +17 -56
- package/package.json +1 -1
- package/lib/esm/view/taskManager/taskDetailView/epics/snoozeTaskEpic.js +0 -64
- package/lib/esm/view/taskManager/taskDetailView/epics/unsnoozeTaskEpic.js +0 -54
- package/lib/view/taskManager/taskDetailView/epics/snoozeTaskEpic.d.ts +0 -9
- package/lib/view/taskManager/taskDetailView/epics/snoozeTaskEpic.js +0 -68
- package/lib/view/taskManager/taskDetailView/epics/unsnoozeTaskEpic.d.ts +0 -8
- package/lib/view/taskManager/taskDetailView/epics/unsnoozeTaskEpic.js +0 -58
|
@@ -72,19 +72,22 @@ function buildHorizontalClassColumnBalancesSlice(report, classAmounts, totalAmou
|
|
|
72
72
|
return getEmptyHorizontalSectionBalancesSlice(report.firstMonthOfFY, timeframe);
|
|
73
73
|
}
|
|
74
74
|
const { startDate, endDate } = report.selectedPeriod;
|
|
75
|
-
const balances = report.classColumns.map((col, columnIndex) =>
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
75
|
+
const balances = report.classColumns.map((col, columnIndex) => {
|
|
76
|
+
const amount = classAmounts[columnIndex] ?? 0;
|
|
77
|
+
return {
|
|
78
|
+
balance: {
|
|
79
|
+
amount,
|
|
80
|
+
currencyCode,
|
|
81
|
+
currencySymbol,
|
|
82
|
+
},
|
|
83
|
+
balanceTimeFrame: timeframe,
|
|
84
|
+
startDate,
|
|
85
|
+
endDate,
|
|
86
|
+
type: amount === 0 ? 'default_with_null_balance' : 'default',
|
|
87
|
+
id: col.classId,
|
|
88
|
+
label: col.className,
|
|
89
|
+
};
|
|
90
|
+
});
|
|
88
91
|
balances.push({
|
|
89
92
|
balance: {
|
|
90
93
|
amount: totalAmount,
|
|
@@ -94,7 +97,7 @@ function buildHorizontalClassColumnBalancesSlice(report, classAmounts, totalAmou
|
|
|
94
97
|
balanceTimeFrame: timeframe,
|
|
95
98
|
startDate,
|
|
96
99
|
endDate,
|
|
97
|
-
type: 'default',
|
|
100
|
+
type: totalAmount === 0 ? 'default_with_null_balance' : 'default',
|
|
98
101
|
id: HORIZONTAL_CLASS_TOTAL_BALANCE_ID,
|
|
99
102
|
label: 'Total',
|
|
100
103
|
});
|
|
@@ -4,7 +4,6 @@ import { openSnackbar } from '../../../../entity/snackbar/snackbarReducer';
|
|
|
4
4
|
import { updateTasks } from '../../../../entity/task/taskReducer';
|
|
5
5
|
import { getTaskById } from '../../../../entity/task/taskSelector';
|
|
6
6
|
import { createZeniAPIStatus, isSuccessResponse, } from '../../../../responsePayload';
|
|
7
|
-
import { removeTaskFromList } from '../../taskListView/taskListReducer';
|
|
8
7
|
import { archiveTask, archiveTaskSuccessOrFailure } from '../taskDetailReducer';
|
|
9
8
|
// Epic function to handle archiving of tasks
|
|
10
9
|
export const archiveTaskEpic = (actions$, state$, zeniAPI) => actions$.pipe(filter(archiveTask.match), mergeMap((action) => handleArchiveTask(action.payload.taskId, state$, zeniAPI)));
|
|
@@ -26,7 +25,6 @@ const handleApiResponse = (response, taskId) => {
|
|
|
26
25
|
response.data.tasks.length > 0) {
|
|
27
26
|
const fetchActions = [
|
|
28
27
|
updateTasks(response.data.tasks),
|
|
29
|
-
removeTaskFromList(taskId),
|
|
30
28
|
archiveTaskSuccessOrFailure({
|
|
31
29
|
fetchState: 'Completed',
|
|
32
30
|
taskId,
|
|
@@ -2,7 +2,6 @@ import { from, of } from 'rxjs';
|
|
|
2
2
|
import { catchError, filter, mergeMap } from 'rxjs/operators';
|
|
3
3
|
import { openSnackbar } from '../../../../entity/snackbar/snackbarReducer';
|
|
4
4
|
import { createZeniAPIStatus, isSuccessStatus, } from '../../../../responsePayload';
|
|
5
|
-
import { removeTaskFromList } from '../../taskListView/taskListReducer';
|
|
6
5
|
import { deleteTask, deleteTaskSuccessOrFailure } from '../taskDetailReducer';
|
|
7
6
|
export const deleteTaskEpic = (actions$, _state$, zeniAPI) => actions$.pipe(filter(deleteTask.match), mergeMap((action) => {
|
|
8
7
|
const { taskId } = action.payload;
|
|
@@ -11,9 +10,6 @@ export const deleteTaskEpic = (actions$, _state$, zeniAPI) => actions$.pipe(filt
|
|
|
11
10
|
.pipe(mergeMap((response) => {
|
|
12
11
|
if (isSuccessStatus(response)) {
|
|
13
12
|
const actions = [];
|
|
14
|
-
if (taskId != null) {
|
|
15
|
-
actions.push(removeTaskFromList(taskId));
|
|
16
|
-
}
|
|
17
13
|
actions.push(deleteTaskSuccessOrFailure({ fetchState: 'Completed', taskId }));
|
|
18
14
|
return from(actions);
|
|
19
15
|
}
|
|
@@ -25,7 +25,6 @@ export const initializeTaskToLocalStoreEpic = (actions$, state$) => actions$.pip
|
|
|
25
25
|
savedRecurringEndDate: task.recurringEndDate,
|
|
26
26
|
recurringStartDate: task.recurringStartDate,
|
|
27
27
|
timeSpent: task.timeSpent,
|
|
28
|
-
isPrivate: task.isPrivate,
|
|
29
28
|
};
|
|
30
29
|
const actions = [
|
|
31
30
|
saveTaskUpdatesToLocalStore({ taskDetailLocalData, taskId }),
|
|
@@ -94,6 +94,5 @@ const prepareTaskPayload = (state, taskId, taskGroupId) => {
|
|
|
94
94
|
sync_token: syncToken,
|
|
95
95
|
task_group_ids: taskGroupId != null ? [taskGroupId] : [],
|
|
96
96
|
time_spent: convertHHMMStrToMinutes(localData.timeSpent),
|
|
97
|
-
...(taskId == null ? { is_private: localData.isPrivate ?? false } : {}),
|
|
98
97
|
};
|
|
99
98
|
};
|
|
@@ -185,54 +185,6 @@ const taskDetailView = createSlice({
|
|
|
185
185
|
draft.editTaskStateById[taskId].archiveStatus.fetchState = fetchState;
|
|
186
186
|
draft.editTaskStateById[taskId].archiveStatus.error = error;
|
|
187
187
|
},
|
|
188
|
-
snoozeTask: {
|
|
189
|
-
reducer(draft, action) {
|
|
190
|
-
const { taskId } = action.payload;
|
|
191
|
-
draft.editTaskStateById[taskId] = {
|
|
192
|
-
...(draft.editTaskStateById[taskId] != null
|
|
193
|
-
? draft.editTaskStateById[taskId]
|
|
194
|
-
: initialTaskDetail),
|
|
195
|
-
snoozeStatus: {
|
|
196
|
-
fetchState: 'In-Progress',
|
|
197
|
-
error: undefined,
|
|
198
|
-
},
|
|
199
|
-
};
|
|
200
|
-
},
|
|
201
|
-
prepare(taskId, snoozedUntil) {
|
|
202
|
-
return {
|
|
203
|
-
payload: {
|
|
204
|
-
taskId,
|
|
205
|
-
snoozedUntil,
|
|
206
|
-
},
|
|
207
|
-
};
|
|
208
|
-
},
|
|
209
|
-
},
|
|
210
|
-
snoozeTaskSuccessOrFailure(draft, action) {
|
|
211
|
-
const { taskId, fetchState, error } = action.payload;
|
|
212
|
-
draft.editTaskStateById[taskId].snoozeStatus.fetchState = fetchState;
|
|
213
|
-
draft.editTaskStateById[taskId].snoozeStatus.error = error;
|
|
214
|
-
},
|
|
215
|
-
unsnoozeTask: {
|
|
216
|
-
reducer(draft, action) {
|
|
217
|
-
const { taskId } = action.payload;
|
|
218
|
-
draft.editTaskStateById[taskId] = {
|
|
219
|
-
...(draft.editTaskStateById[taskId] != null
|
|
220
|
-
? draft.editTaskStateById[taskId]
|
|
221
|
-
: initialTaskDetail),
|
|
222
|
-
snoozeStatus: {
|
|
223
|
-
fetchState: 'In-Progress',
|
|
224
|
-
error: undefined,
|
|
225
|
-
},
|
|
226
|
-
};
|
|
227
|
-
},
|
|
228
|
-
prepare(taskId) {
|
|
229
|
-
return {
|
|
230
|
-
payload: {
|
|
231
|
-
taskId,
|
|
232
|
-
},
|
|
233
|
-
};
|
|
234
|
-
},
|
|
235
|
-
},
|
|
236
188
|
deleteTask: {
|
|
237
189
|
reducer(draft, action) {
|
|
238
190
|
const { taskId } = action.payload;
|
|
@@ -318,5 +270,5 @@ const taskDetailView = createSlice({
|
|
|
318
270
|
},
|
|
319
271
|
},
|
|
320
272
|
});
|
|
321
|
-
export const { fetchTaskDetailPage, fetchTaskDetail, initializeTaskToLocalStore, updateEditTaskFetchStatus, saveTaskUpdatesToLocalStore, discardTaskUpdatesInLocalStore, saveTaskDetail, archiveTask, archiveTaskSuccessOrFailure,
|
|
273
|
+
export const { fetchTaskDetailPage, fetchTaskDetail, initializeTaskToLocalStore, updateEditTaskFetchStatus, saveTaskUpdatesToLocalStore, discardTaskUpdatesInLocalStore, saveTaskDetail, archiveTask, archiveTaskSuccessOrFailure, saveTaskSuccessOrFailure, deleteTask, removeTaskDetail, deleteTaskSuccessOrFailure, fetchTaskHistory, updateTaskHistory, updateTaskHistoryFetchStatus, clearTaskDetail, updateCreatedTagToLocalStore, updateDeletedTagToLocalStore, } = taskDetailView.actions;
|
|
322
274
|
export default taskDetailView.reducer;
|
|
@@ -21,13 +21,11 @@ export const getTaskDetail = (state, taskId) => {
|
|
|
21
21
|
};
|
|
22
22
|
let taskHistory = [];
|
|
23
23
|
let createdByUser = undefined;
|
|
24
|
-
let snoozedUntil = undefined;
|
|
25
24
|
if (taskId != null && sourceTaskDetail != null) {
|
|
26
25
|
const taskEntity = getTaskById(taskState, taskId);
|
|
27
26
|
const fileIdsInEntity = taskEntity?.fileIds ?? [];
|
|
28
27
|
if (taskEntity != null) {
|
|
29
28
|
createdByUser = getUserAndUserRole(userState, userRoleState, addressState, taskEntity.createdBy);
|
|
30
|
-
snoozedUntil = taskEntity.snoozedUntil;
|
|
31
29
|
}
|
|
32
30
|
if (fileIdsInEntity.length > 0) {
|
|
33
31
|
fetchStatus = reduceFetchState([
|
|
@@ -76,7 +74,6 @@ export const getTaskDetail = (state, taskId) => {
|
|
|
76
74
|
version: 0,
|
|
77
75
|
createdByUser,
|
|
78
76
|
showTaskDetailFormFooter,
|
|
79
|
-
snoozedUntil,
|
|
80
77
|
};
|
|
81
78
|
};
|
|
82
79
|
export const allTaskStatus = [
|
|
@@ -71,12 +71,6 @@ const toTaskPayload = (state, task) => {
|
|
|
71
71
|
assignees: task.assignees,
|
|
72
72
|
description: task.description,
|
|
73
73
|
group_assignees: task.groupAssignees,
|
|
74
|
-
is_archived: task.isArchived,
|
|
75
|
-
is_deleted: task.isDeleted,
|
|
76
|
-
is_snooze_notification_sent: false,
|
|
77
|
-
snoozed_at: null,
|
|
78
|
-
snoozed_by: null,
|
|
79
|
-
snoozed_until: task.snoozedUntil != null ? task.snoozedUntil.toISOString() : null,
|
|
80
74
|
due_date: task.dueDate != null ? task.dueDate.format(DEFAULT_DATE_FORMAT) : null,
|
|
81
75
|
priority: task.priority.code,
|
|
82
76
|
status: task.status.code,
|
|
@@ -9,20 +9,10 @@ export const fetchTaskListEpic = (actions$, _state$, zeniAPI) => actions$.pipe(f
|
|
|
9
9
|
.getJSON(`${zeniAPI.apiEndPoints.taskMicroServiceBaseUrl}/1.0/task-manager/tasks?query=${encodeURIComponent(`{"task_type": "all"}`)}`)
|
|
10
10
|
.pipe(mergeMap((response) => {
|
|
11
11
|
if (isSuccessResponse(response) && response.data != null) {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
...tasks,
|
|
15
|
-
...(deleted ?? []),
|
|
16
|
-
...(archived ?? []),
|
|
17
|
-
...(snoozed ?? []),
|
|
18
|
-
];
|
|
19
|
-
return of(updateTasks(allTasks), updateTaskList({
|
|
20
|
-
data: tasks,
|
|
21
|
-
deleted: deleted ?? [],
|
|
22
|
-
archived: archived ?? [],
|
|
23
|
-
snoozed: snoozed ?? [],
|
|
12
|
+
return of(updateTasks(response.data.tasks), updateTaskList({
|
|
13
|
+
data: response.data.tasks,
|
|
24
14
|
updateType: 'replace',
|
|
25
|
-
}), updateTags(
|
|
15
|
+
}), updateTags(response.data.tasks.map((task) => task.tags).flat()));
|
|
26
16
|
}
|
|
27
17
|
else {
|
|
28
18
|
return of(updateTaskListFetchStatus({
|
|
@@ -1,11 +1,4 @@
|
|
|
1
1
|
import { stringToUnion, stringToUnionStrict, } from '../../../commonStateTypes/stringToUnion';
|
|
2
|
-
export const ALL_TASK_LIST_TABS = [
|
|
3
|
-
'live',
|
|
4
|
-
'archived',
|
|
5
|
-
'deleted',
|
|
6
|
-
'snoozed',
|
|
7
|
-
];
|
|
8
|
-
export const toTaskListTabType = (v) => stringToUnion(v, ALL_TASK_LIST_TABS);
|
|
9
2
|
export const DUE_DATE_GROUP_KEYS = [
|
|
10
3
|
'overdue',
|
|
11
4
|
'today',
|
|
@@ -33,7 +26,6 @@ const ALL_TASK_LIST_SORT_KEYS = [
|
|
|
33
26
|
'status',
|
|
34
27
|
'priority',
|
|
35
28
|
'timeSpent',
|
|
36
|
-
'visibility',
|
|
37
29
|
];
|
|
38
30
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
39
31
|
const toTaskListSortKeyType = (v) => stringToUnion(v, ALL_TASK_LIST_SORT_KEYS);
|
|
@@ -29,23 +29,7 @@ const initialTaskIdsByDueDate = {
|
|
|
29
29
|
today: [],
|
|
30
30
|
upcoming: [],
|
|
31
31
|
};
|
|
32
|
-
const initialTabData = {
|
|
33
|
-
taskIds: [],
|
|
34
|
-
taskIdsByAssignees: {},
|
|
35
|
-
taskIdsByDueDate: { ...initialTaskIdsByDueDate },
|
|
36
|
-
taskIdsByGroupsIds: {},
|
|
37
|
-
taskIdsByPriority: { ...initialTaskIdsByPriority },
|
|
38
|
-
taskIdsByStatus: { ...initialTaskIdsByStatus },
|
|
39
|
-
taskIdsByTags: {},
|
|
40
|
-
};
|
|
41
32
|
export const initialState = {
|
|
42
|
-
currentTab: 'live',
|
|
43
|
-
byTab: {
|
|
44
|
-
live: { ...initialTabData },
|
|
45
|
-
archived: { ...initialTabData },
|
|
46
|
-
deleted: { ...initialTabData },
|
|
47
|
-
snoozed: { ...initialTabData },
|
|
48
|
-
},
|
|
49
33
|
taskIds: [],
|
|
50
34
|
taskIdsByGroupsIds: {},
|
|
51
35
|
taskIdsByPriority: initialTaskIdsByPriority,
|
|
@@ -102,30 +86,17 @@ const taskList = createSlice({
|
|
|
102
86
|
draft.error = undefined;
|
|
103
87
|
},
|
|
104
88
|
updateTaskList(draft, action) {
|
|
105
|
-
const { data
|
|
89
|
+
const { data } = action.payload;
|
|
106
90
|
draft.fetchState = 'Completed';
|
|
107
91
|
draft.error = undefined;
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
draft.
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
draft.byTab.deleted = toTabData(getGroupedTaskIds(deleted));
|
|
117
|
-
}
|
|
118
|
-
if (snoozed != null) {
|
|
119
|
-
draft.byTab.snoozed = toTabData(getGroupedTaskIds(snoozed));
|
|
120
|
-
}
|
|
121
|
-
// Copy active tab data to top-level fields
|
|
122
|
-
const activeTabData = draft.byTab[draft.currentTab];
|
|
123
|
-
copyTabDataToTopLevel(draft, activeTabData);
|
|
124
|
-
},
|
|
125
|
-
updateTaskListTab(draft, action) {
|
|
126
|
-
draft.currentTab = action.payload;
|
|
127
|
-
const activeTabData = draft.byTab[action.payload];
|
|
128
|
-
copyTabDataToTopLevel(draft, activeTabData);
|
|
92
|
+
const { taskIds, taskIdsGroupedByPriority, taskIdsByGroupIds, taskIdsGroupedByStatus, taskIdsByAssignees, taskIdsByDueDate, taskIdsByTags, } = getGroupedTaskIds(data);
|
|
93
|
+
draft.taskIds = taskIds;
|
|
94
|
+
draft.taskIdsByGroupsIds = taskIdsByGroupIds;
|
|
95
|
+
draft.taskIdsByPriority = taskIdsGroupedByPriority;
|
|
96
|
+
draft.taskIdsByStatus = taskIdsGroupedByStatus;
|
|
97
|
+
draft.taskIdsByAssignees = taskIdsByAssignees;
|
|
98
|
+
draft.taskIdsByDueDate = taskIdsByDueDate;
|
|
99
|
+
draft.taskIdsByTags = taskIdsByTags;
|
|
129
100
|
},
|
|
130
101
|
initiateTaskListLocalData(draft, action) {
|
|
131
102
|
const { taskGroupById } = action.payload;
|
|
@@ -216,12 +187,7 @@ const taskList = createSlice({
|
|
|
216
187
|
const { taskIds, groupId } = action.payload;
|
|
217
188
|
draft.updateTasksFetchState.fetchState = 'Completed';
|
|
218
189
|
draft.updateTasksFetchState.error = undefined;
|
|
219
|
-
if (groupId
|
|
220
|
-
// Tab-changing operations (archive/delete/unarchive/undo-delete/unsnooze):
|
|
221
|
-
// Remove affected tasks from the current tab's top-level indices
|
|
222
|
-
removeTaskIdsFromTopLevel(draft, taskIds);
|
|
223
|
-
}
|
|
224
|
-
else if (groupId != null) {
|
|
190
|
+
if (groupId != null) {
|
|
225
191
|
const { groupByKey } = draft.uiState;
|
|
226
192
|
if (groupByKey === 'groupName') {
|
|
227
193
|
Object.keys(draft.taskIdsByGroupsIds).forEach((gId) => {
|
|
@@ -438,34 +404,12 @@ const taskList = createSlice({
|
|
|
438
404
|
draft.updateTasksFetchState.fetchState = 'Error';
|
|
439
405
|
draft.updateTasksFetchState.error = action.payload.error;
|
|
440
406
|
},
|
|
441
|
-
removeTaskFromList(draft, action) {
|
|
442
|
-
const taskIdToRemove = action.payload;
|
|
443
|
-
draft.taskIds = draft.taskIds.filter((id) => id !== taskIdToRemove);
|
|
444
|
-
Object.keys(draft.taskIdsByGroupsIds).forEach((groupId) => {
|
|
445
|
-
draft.taskIdsByGroupsIds[groupId] = draft.taskIdsByGroupsIds[groupId].filter((id) => id !== taskIdToRemove);
|
|
446
|
-
});
|
|
447
|
-
Object.keys(draft.taskIdsByPriority).forEach((key) => {
|
|
448
|
-
draft.taskIdsByPriority[key] = draft.taskIdsByPriority[key].filter((id) => id !== taskIdToRemove);
|
|
449
|
-
});
|
|
450
|
-
Object.keys(draft.taskIdsByStatus).forEach((key) => {
|
|
451
|
-
draft.taskIdsByStatus[key] = draft.taskIdsByStatus[key].filter((id) => id !== taskIdToRemove);
|
|
452
|
-
});
|
|
453
|
-
Object.keys(draft.taskIdsByDueDate).forEach((key) => {
|
|
454
|
-
draft.taskIdsByDueDate[key] = draft.taskIdsByDueDate[key].filter((id) => id !== taskIdToRemove);
|
|
455
|
-
});
|
|
456
|
-
Object.keys(draft.taskIdsByAssignees).forEach((key) => {
|
|
457
|
-
draft.taskIdsByAssignees[key] = draft.taskIdsByAssignees[key].filter((id) => id !== taskIdToRemove);
|
|
458
|
-
});
|
|
459
|
-
Object.keys(draft.taskIdsByTags).forEach((key) => {
|
|
460
|
-
draft.taskIdsByTags[key] = draft.taskIdsByTags[key].filter((id) => id !== taskIdToRemove);
|
|
461
|
-
});
|
|
462
|
-
},
|
|
463
407
|
clearTaskList(draft) {
|
|
464
408
|
Object.assign(draft, initialState);
|
|
465
409
|
},
|
|
466
410
|
},
|
|
467
411
|
});
|
|
468
|
-
export const { fetchTaskListPage, fetchTaskList, updateTaskList,
|
|
412
|
+
export const { fetchTaskListPage, fetchTaskList, updateTaskList, updateTaskListFetchStatus, updateTaskListSearchText, updateTaskListUIState, updateTaskFilters, updateTaskListOnNewGroupCreationSuccess, bulkUpdateTaskList, updateTasksListOnBulkUpdateTasksSuccess, updateTasksListOnBulkUpdateTasksFailure, initiateTaskListLocalData, updateTaskListLocalData, updateTaskListOnTaskGroupDeletion, dragNDropTasks, updateTaskListOnNewTaskCreationSuccess, updateTaskListOnTaskGroupNameUpdate, updateTaskFromListView, updateTasksListOnUpdateTaskSuccess, updateTasksListOnUpdateTaskFailure, updateTaskListOnCreateTaskFromTemplateSuccess, clearTaskList, } = taskList.actions;
|
|
469
413
|
export default taskList.reducer;
|
|
470
414
|
/**
|
|
471
415
|
* helpers
|
|
@@ -544,46 +488,6 @@ const getTagsGroupKey = (tags) => {
|
|
|
544
488
|
tagIds.sort();
|
|
545
489
|
return tagIds.join(',');
|
|
546
490
|
};
|
|
547
|
-
const removeTaskIdsFromTopLevel = (draft, taskIds) => {
|
|
548
|
-
const isRemoved = (id) => taskIds.includes(id);
|
|
549
|
-
draft.taskIds = draft.taskIds.filter((id) => !isRemoved(id));
|
|
550
|
-
Object.keys(draft.taskIdsByGroupsIds).forEach((gId) => {
|
|
551
|
-
draft.taskIdsByGroupsIds[gId] = draft.taskIdsByGroupsIds[gId].filter((id) => !isRemoved(id));
|
|
552
|
-
});
|
|
553
|
-
Object.keys(draft.taskIdsByPriority).forEach((key) => {
|
|
554
|
-
draft.taskIdsByPriority[key] = draft.taskIdsByPriority[key].filter((id) => !isRemoved(id));
|
|
555
|
-
});
|
|
556
|
-
Object.keys(draft.taskIdsByStatus).forEach((key) => {
|
|
557
|
-
draft.taskIdsByStatus[key] = draft.taskIdsByStatus[key].filter((id) => !isRemoved(id));
|
|
558
|
-
});
|
|
559
|
-
Object.keys(draft.taskIdsByDueDate).forEach((key) => {
|
|
560
|
-
draft.taskIdsByDueDate[key] = draft.taskIdsByDueDate[key].filter((id) => !isRemoved(id));
|
|
561
|
-
});
|
|
562
|
-
Object.keys(draft.taskIdsByAssignees).forEach((key) => {
|
|
563
|
-
draft.taskIdsByAssignees[key] = draft.taskIdsByAssignees[key].filter((id) => !isRemoved(id));
|
|
564
|
-
});
|
|
565
|
-
Object.keys(draft.taskIdsByTags).forEach((key) => {
|
|
566
|
-
draft.taskIdsByTags[key] = draft.taskIdsByTags[key].filter((id) => !isRemoved(id));
|
|
567
|
-
});
|
|
568
|
-
};
|
|
569
|
-
const toTabData = (grouped) => ({
|
|
570
|
-
taskIds: grouped.taskIds,
|
|
571
|
-
taskIdsByAssignees: grouped.taskIdsByAssignees,
|
|
572
|
-
taskIdsByDueDate: grouped.taskIdsByDueDate,
|
|
573
|
-
taskIdsByGroupsIds: grouped.taskIdsByGroupIds,
|
|
574
|
-
taskIdsByPriority: grouped.taskIdsGroupedByPriority,
|
|
575
|
-
taskIdsByStatus: grouped.taskIdsGroupedByStatus,
|
|
576
|
-
taskIdsByTags: grouped.taskIdsByTags,
|
|
577
|
-
});
|
|
578
|
-
const copyTabDataToTopLevel = (draft, tabData) => {
|
|
579
|
-
draft.taskIds = tabData.taskIds;
|
|
580
|
-
draft.taskIdsByGroupsIds = tabData.taskIdsByGroupsIds;
|
|
581
|
-
draft.taskIdsByPriority = tabData.taskIdsByPriority;
|
|
582
|
-
draft.taskIdsByStatus = tabData.taskIdsByStatus;
|
|
583
|
-
draft.taskIdsByAssignees = tabData.taskIdsByAssignees;
|
|
584
|
-
draft.taskIdsByDueDate = tabData.taskIdsByDueDate;
|
|
585
|
-
draft.taskIdsByTags = tabData.taskIdsByTags;
|
|
586
|
-
};
|
|
587
491
|
const getGroupedTaskIds = (tasks) => {
|
|
588
492
|
const taskIds = [];
|
|
589
493
|
const taskIdsByGroupIds = {};
|