@zeniai/client-epic-state 5.0.36 → 5.0.37
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/commonStateTypes/fiscalYearHelpers/formatZeniDateFY.d.ts +0 -1
- package/lib/commonStateTypes/fiscalYearHelpers/formatZeniDateFY.js +1 -2
- package/lib/entity/file/fileState.d.ts +4 -4
- package/lib/entity/file/fileState.js +0 -4
- package/lib/entity/snackbar/snackbarTypes.d.ts +1 -1
- package/lib/entity/snackbar/snackbarTypes.js +0 -4
- 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/entity/tenant/clearAllEpic.d.ts +2 -4
- package/lib/entity/tenant/clearAllEpic.js +0 -4
- package/lib/entity/transaction/stateTypes/attachment.d.ts +2 -2
- package/lib/epic.d.ts +1 -7
- package/lib/epic.js +1 -7
- package/lib/esm/commonStateTypes/fiscalYearHelpers/formatZeniDateFY.js +0 -1
- package/lib/esm/entity/file/fileState.js +0 -4
- package/lib/esm/entity/snackbar/snackbarTypes.js +0 -4
- package/lib/esm/entity/task/taskPayload.js +0 -5
- package/lib/esm/entity/tenant/clearAllEpic.js +0 -4
- package/lib/esm/epic.js +1 -7
- package/lib/esm/index.js +4 -10
- package/lib/esm/init.js +16 -71
- package/lib/esm/reducer.js +0 -6
- package/lib/esm/view/taskManager/taskDetailView/epics/archiveTaskEpic.js +0 -3
- package/lib/esm/view/taskManager/taskDetailView/epics/deleteTaskEpic.js +0 -5
- 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 +7 -60
- package/lib/esm/view/taskManager/taskDetailView/taskDetailSelector.js +0 -12
- package/lib/esm/view/taskManager/taskListView/epics/bulkUpdateTaskListEpic.js +21 -56
- package/lib/esm/view/taskManager/taskListView/epics/dragNDropTasksEpic.js +0 -1
- package/lib/esm/view/taskManager/taskListView/epics/fetchTaskListEpic.js +4 -13
- package/lib/esm/view/taskManager/taskListView/epics/updateTaskFromListViewEpic.js +2 -3
- package/lib/esm/view/taskManager/taskListView/taskList.js +0 -7
- package/lib/esm/view/taskManager/taskListView/taskListReducer.js +12 -106
- package/lib/esm/view/taskManager/taskListView/taskListSelector.js +39 -48
- package/lib/index.d.ts +4 -12
- package/lib/index.js +5 -28
- package/lib/init.d.ts +3 -5
- package/lib/init.js +16 -71
- package/lib/reducer.d.ts +0 -6
- package/lib/reducer.js +0 -6
- package/lib/tsconfig.typecheck.tsbuildinfo +1 -1
- package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.d.ts +1 -1
- package/lib/view/taskManager/taskDetailView/epics/archiveTaskEpic.d.ts +1 -2
- package/lib/view/taskManager/taskDetailView/epics/archiveTaskEpic.js +0 -3
- package/lib/view/taskManager/taskDetailView/epics/deleteTaskEpic.d.ts +1 -2
- package/lib/view/taskManager/taskDetailView/epics/deleteTaskEpic.js +0 -5
- 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 +8 -61
- package/lib/view/taskManager/taskDetailView/taskDetailSelector.d.ts +0 -5
- package/lib/view/taskManager/taskDetailView/taskDetailSelector.js +0 -12
- package/lib/view/taskManager/taskListView/epics/bulkUpdateTaskListEpic.d.ts +7 -6
- package/lib/view/taskManager/taskListView/epics/bulkUpdateTaskListEpic.js +22 -56
- package/lib/view/taskManager/taskListView/epics/dragNDropTasksEpic.js +0 -1
- package/lib/view/taskManager/taskListView/epics/fetchTaskListEpic.js +4 -13
- package/lib/view/taskManager/taskListView/epics/updateTaskFromListViewEpic.js +2 -3
- package/lib/view/taskManager/taskListView/taskList.d.ts +1 -14
- package/lib/view/taskManager/taskListView/taskList.js +1 -8
- package/lib/view/taskManager/taskListView/taskListPayload.d.ts +0 -3
- package/lib/view/taskManager/taskListView/taskListReducer.d.ts +6 -9
- package/lib/view/taskManager/taskListView/taskListReducer.js +13 -107
- package/lib/view/taskManager/taskListView/taskListSelector.d.ts +3 -9
- package/lib/view/taskManager/taskListView/taskListSelector.js +39 -48
- package/package.json +1 -1
- package/lib/esm/view/taskManager/cannedResponsesView/cannedResponses.js +0 -1
- package/lib/esm/view/taskManager/cannedResponsesView/cannedResponsesPayload.js +0 -12
- package/lib/esm/view/taskManager/cannedResponsesView/cannedResponsesReducer.js +0 -64
- package/lib/esm/view/taskManager/cannedResponsesView/cannedResponsesSelector.js +0 -3
- package/lib/esm/view/taskManager/cannedResponsesView/epics/deleteCannedResponseEpic.js +0 -17
- package/lib/esm/view/taskManager/cannedResponsesView/epics/fetchCannedResponsesEpic.js +0 -21
- package/lib/esm/view/taskManager/cannedResponsesView/epics/saveCannedResponseEpic.js +0 -29
- package/lib/esm/view/taskManager/taskDetailView/epics/snoozeTaskEpic.js +0 -66
- package/lib/esm/view/taskManager/taskDetailView/epics/unsnoozeTaskEpic.js +0 -57
- package/lib/esm/view/zeniOAuthView/epics/approveOAuthConsentEpic.js +0 -65
- package/lib/esm/view/zeniOAuthView/zeniOAuthParamsParser.js +0 -41
- package/lib/esm/view/zeniOAuthView/zeniOAuthReducer.js +0 -49
- package/lib/esm/view/zeniOAuthView/zeniOAuthSelector.js +0 -3
- package/lib/esm/view/zeniOAuthView/zeniOAuthState.js +0 -1
- package/lib/view/taskManager/cannedResponsesView/cannedResponses.d.ts +0 -19
- package/lib/view/taskManager/cannedResponsesView/cannedResponses.js +0 -2
- package/lib/view/taskManager/cannedResponsesView/cannedResponsesPayload.d.ts +0 -21
- package/lib/view/taskManager/cannedResponsesView/cannedResponsesPayload.js +0 -15
- package/lib/view/taskManager/cannedResponsesView/cannedResponsesReducer.d.ts +0 -30
- package/lib/view/taskManager/cannedResponsesView/cannedResponsesReducer.js +0 -68
- package/lib/view/taskManager/cannedResponsesView/cannedResponsesSelector.d.ts +0 -3
- package/lib/view/taskManager/cannedResponsesView/cannedResponsesSelector.js +0 -6
- package/lib/view/taskManager/cannedResponsesView/epics/deleteCannedResponseEpic.d.ts +0 -7
- package/lib/view/taskManager/cannedResponsesView/epics/deleteCannedResponseEpic.js +0 -21
- package/lib/view/taskManager/cannedResponsesView/epics/fetchCannedResponsesEpic.d.ts +0 -7
- package/lib/view/taskManager/cannedResponsesView/epics/fetchCannedResponsesEpic.js +0 -25
- package/lib/view/taskManager/cannedResponsesView/epics/saveCannedResponseEpic.d.ts +0 -7
- package/lib/view/taskManager/cannedResponsesView/epics/saveCannedResponseEpic.js +0 -33
- package/lib/view/taskManager/taskDetailView/epics/snoozeTaskEpic.d.ts +0 -9
- package/lib/view/taskManager/taskDetailView/epics/snoozeTaskEpic.js +0 -70
- package/lib/view/taskManager/taskDetailView/epics/unsnoozeTaskEpic.d.ts +0 -9
- package/lib/view/taskManager/taskDetailView/epics/unsnoozeTaskEpic.js +0 -61
- package/lib/view/zeniOAuthView/epics/approveOAuthConsentEpic.d.ts +0 -27
- package/lib/view/zeniOAuthView/epics/approveOAuthConsentEpic.js +0 -69
- package/lib/view/zeniOAuthView/zeniOAuthParamsParser.d.ts +0 -16
- package/lib/view/zeniOAuthView/zeniOAuthParamsParser.js +0 -44
- package/lib/view/zeniOAuthView/zeniOAuthReducer.d.ts +0 -29
- package/lib/view/zeniOAuthView/zeniOAuthReducer.js +0 -53
- package/lib/view/zeniOAuthView/zeniOAuthSelector.d.ts +0 -5
- package/lib/view/zeniOAuthView/zeniOAuthSelector.js +0 -9
- package/lib/view/zeniOAuthView/zeniOAuthState.d.ts +0 -4
- package/lib/view/zeniOAuthView/zeniOAuthState.js +0 -2
|
@@ -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 { fetchTaskList, 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,8 +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
|
-
fetchTaskList(),
|
|
31
28
|
archiveTaskSuccessOrFailure({
|
|
32
29
|
fetchState: 'Completed',
|
|
33
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 { fetchTaskList, 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,10 +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
|
-
actions.push(fetchTaskList());
|
|
18
13
|
actions.push(deleteTaskSuccessOrFailure({ fetchState: 'Completed', taskId }));
|
|
19
14
|
return from(actions);
|
|
20
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
|
};
|
|
@@ -149,11 +149,11 @@ const taskDetailView = createSlice({
|
|
|
149
149
|
},
|
|
150
150
|
saveTaskSuccessOrFailure(draft, action) {
|
|
151
151
|
const { taskId, fetchState, error, newTaskId } = action.payload;
|
|
152
|
-
if (taskId != null
|
|
152
|
+
if (taskId != null) {
|
|
153
153
|
draft.editTaskStateById[taskId].saveStatus.fetchState = fetchState;
|
|
154
154
|
draft.editTaskStateById[taskId].saveStatus.error = error;
|
|
155
155
|
}
|
|
156
|
-
else
|
|
156
|
+
else {
|
|
157
157
|
if (newTaskId != null) {
|
|
158
158
|
draft.newTaskState.taskId = newTaskId;
|
|
159
159
|
}
|
|
@@ -182,10 +182,8 @@ const taskDetailView = createSlice({
|
|
|
182
182
|
},
|
|
183
183
|
archiveTaskSuccessOrFailure(draft, action) {
|
|
184
184
|
const { taskId, fetchState, error } = action.payload;
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
draft.editTaskStateById[taskId].archiveStatus.error = error;
|
|
188
|
-
}
|
|
185
|
+
draft.editTaskStateById[taskId].archiveStatus.fetchState = fetchState;
|
|
186
|
+
draft.editTaskStateById[taskId].archiveStatus.error = error;
|
|
189
187
|
},
|
|
190
188
|
deleteTask: {
|
|
191
189
|
reducer(draft, action) {
|
|
@@ -218,70 +216,19 @@ const taskDetailView = createSlice({
|
|
|
218
216
|
},
|
|
219
217
|
},
|
|
220
218
|
deleteTaskSuccessOrFailure(draft, action) {
|
|
221
|
-
if (action.payload.taskId != null
|
|
222
|
-
draft.editTaskStateById[action.payload.taskId] != null) {
|
|
219
|
+
if (action.payload.taskId != null) {
|
|
223
220
|
const { taskId } = action.payload;
|
|
224
221
|
draft.editTaskStateById[taskId].deleteTaskStatus.fetchState =
|
|
225
222
|
action.payload.fetchState;
|
|
226
223
|
draft.editTaskStateById[taskId].deleteTaskStatus.error =
|
|
227
224
|
action.payload.error;
|
|
228
225
|
}
|
|
229
|
-
else
|
|
226
|
+
else {
|
|
230
227
|
draft.newTaskState.deleteTaskStatus.fetchState =
|
|
231
228
|
action.payload.fetchState;
|
|
232
229
|
draft.newTaskState.deleteTaskStatus.error = action.payload.error;
|
|
233
230
|
}
|
|
234
231
|
},
|
|
235
|
-
snoozeTask: {
|
|
236
|
-
reducer(draft, action) {
|
|
237
|
-
const { taskId } = action.payload;
|
|
238
|
-
draft.editTaskStateById[taskId] = {
|
|
239
|
-
...(draft.editTaskStateById[taskId] != null
|
|
240
|
-
? draft.editTaskStateById[taskId]
|
|
241
|
-
: initialTaskDetail),
|
|
242
|
-
snoozeStatus: {
|
|
243
|
-
fetchState: 'In-Progress',
|
|
244
|
-
error: undefined,
|
|
245
|
-
},
|
|
246
|
-
};
|
|
247
|
-
},
|
|
248
|
-
prepare(taskId, snoozedUntil) {
|
|
249
|
-
return {
|
|
250
|
-
payload: {
|
|
251
|
-
taskId,
|
|
252
|
-
snoozedUntil,
|
|
253
|
-
},
|
|
254
|
-
};
|
|
255
|
-
},
|
|
256
|
-
},
|
|
257
|
-
snoozeTaskSuccessOrFailure(draft, action) {
|
|
258
|
-
const { taskId, fetchState, error } = action.payload;
|
|
259
|
-
if (draft.editTaskStateById[taskId] != null) {
|
|
260
|
-
draft.editTaskStateById[taskId].snoozeStatus.fetchState = fetchState;
|
|
261
|
-
draft.editTaskStateById[taskId].snoozeStatus.error = error;
|
|
262
|
-
}
|
|
263
|
-
},
|
|
264
|
-
unsnoozeTask: {
|
|
265
|
-
reducer(draft, action) {
|
|
266
|
-
const { taskId } = action.payload;
|
|
267
|
-
draft.editTaskStateById[taskId] = {
|
|
268
|
-
...(draft.editTaskStateById[taskId] != null
|
|
269
|
-
? draft.editTaskStateById[taskId]
|
|
270
|
-
: initialTaskDetail),
|
|
271
|
-
snoozeStatus: {
|
|
272
|
-
fetchState: 'In-Progress',
|
|
273
|
-
error: undefined,
|
|
274
|
-
},
|
|
275
|
-
};
|
|
276
|
-
},
|
|
277
|
-
prepare(taskId) {
|
|
278
|
-
return {
|
|
279
|
-
payload: {
|
|
280
|
-
taskId,
|
|
281
|
-
},
|
|
282
|
-
};
|
|
283
|
-
},
|
|
284
|
-
},
|
|
285
232
|
fetchTaskHistory: {
|
|
286
233
|
reducer(draft, action) {
|
|
287
234
|
const { taskId, cacheOverride } = action.payload;
|
|
@@ -323,5 +270,5 @@ const taskDetailView = createSlice({
|
|
|
323
270
|
},
|
|
324
271
|
},
|
|
325
272
|
});
|
|
326
|
-
export const { fetchTaskDetailPage, fetchTaskDetail, initializeTaskToLocalStore, updateEditTaskFetchStatus, saveTaskUpdatesToLocalStore, discardTaskUpdatesInLocalStore, saveTaskDetail, archiveTask, archiveTaskSuccessOrFailure, saveTaskSuccessOrFailure, deleteTask, removeTaskDetail, deleteTaskSuccessOrFailure,
|
|
273
|
+
export const { fetchTaskDetailPage, fetchTaskDetail, initializeTaskToLocalStore, updateEditTaskFetchStatus, saveTaskUpdatesToLocalStore, discardTaskUpdatesInLocalStore, saveTaskDetail, archiveTask, archiveTaskSuccessOrFailure, saveTaskSuccessOrFailure, deleteTask, removeTaskDetail, deleteTaskSuccessOrFailure, fetchTaskHistory, updateTaskHistory, updateTaskHistoryFetchStatus, clearTaskDetail, updateCreatedTagToLocalStore, updateDeletedTagToLocalStore, } = taskDetailView.actions;
|
|
327
274
|
export default taskDetailView.reducer;
|
|
@@ -22,19 +22,11 @@ export const getTaskDetail = (state, taskId) => {
|
|
|
22
22
|
};
|
|
23
23
|
let taskHistory = [];
|
|
24
24
|
let createdByUser = undefined;
|
|
25
|
-
let isArchived = undefined;
|
|
26
|
-
let isDeleted = undefined;
|
|
27
|
-
let recurringSourceTaskId = undefined;
|
|
28
|
-
let snoozedUntil = undefined;
|
|
29
25
|
if (taskId != null && sourceTaskDetail != null) {
|
|
30
26
|
const taskEntity = getTaskById(taskState, taskId);
|
|
31
27
|
const fileIdsInEntity = taskEntity?.fileIds ?? [];
|
|
32
28
|
if (taskEntity != null) {
|
|
33
29
|
createdByUser = getUserAndUserRole(userState, userRoleState, addressState, taskEntity.createdBy);
|
|
34
|
-
isArchived = taskEntity.isArchived;
|
|
35
|
-
isDeleted = taskEntity.isDeleted;
|
|
36
|
-
recurringSourceTaskId = taskEntity.recurringSourceTaskId;
|
|
37
|
-
snoozedUntil = taskEntity.snoozedUntil;
|
|
38
30
|
}
|
|
39
31
|
if (fileIdsInEntity.length > 0) {
|
|
40
32
|
fetchStatus = reduceFetchState([
|
|
@@ -82,11 +74,7 @@ export const getTaskDetail = (state, taskId) => {
|
|
|
82
74
|
error: fetchStatus.error,
|
|
83
75
|
version: 0,
|
|
84
76
|
createdByUser,
|
|
85
|
-
isArchived,
|
|
86
|
-
isDeleted,
|
|
87
|
-
recurringSourceTaskId,
|
|
88
77
|
showTaskDetailFormFooter,
|
|
89
|
-
snoozedUntil,
|
|
90
78
|
};
|
|
91
79
|
};
|
|
92
80
|
export const allTaskStatus = [
|
|
@@ -5,26 +5,21 @@ import { convertHHMMStrToMinutes } from '../../../../commonStateTypes/fiscalYear
|
|
|
5
5
|
import { DEFAULT_DATE_FORMAT } from '../../../../commonStateTypes/fiscalYearHelpers/formatZeniDateFY';
|
|
6
6
|
import { updateTasks } from '../../../../entity/task/taskReducer';
|
|
7
7
|
import { createZeniAPIStatus, isSuccessResponse, } from '../../../../responsePayload';
|
|
8
|
-
import { bulkUpdateTaskList,
|
|
9
|
-
export const bulkUpdateTaskListEpic = (actions$,
|
|
8
|
+
import { bulkUpdateTaskList, updateTasksListOnBulkUpdateTasksFailure, updateTasksListOnBulkUpdateTasksSuccess, } from '../taskListReducer';
|
|
9
|
+
export const bulkUpdateTaskListEpic = (actions$, state$, zeniAPI) => actions$.pipe(filter(bulkUpdateTaskList.match), switchMap((action) => {
|
|
10
|
+
const state = state$.value;
|
|
10
11
|
const { taskIds, updates, groupId } = action.payload;
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
}
|
|
15
|
-
const payload = { task_ids: taskIds, updates: bulkUpdates };
|
|
12
|
+
const payload = {
|
|
13
|
+
tasks: getTasksListPayload(state, taskIds, updates),
|
|
14
|
+
};
|
|
16
15
|
return zeniAPI
|
|
17
|
-
.putAndGetJSON(`${zeniAPI.apiEndPoints.taskMicroServiceBaseUrl}/1.0/task-manager/tasks
|
|
16
|
+
.putAndGetJSON(`${zeniAPI.apiEndPoints.taskMicroServiceBaseUrl}/1.0/task-manager/tasks`, payload)
|
|
18
17
|
.pipe(mergeMap((response) => {
|
|
19
18
|
if (isSuccessResponse(response) && response.data != null) {
|
|
20
|
-
const removeFromList = updates.isArchived === true ||
|
|
21
|
-
updates.isDeleted === true ||
|
|
22
|
-
('snoozedUntil' in updates && updates.snoozedUntil == null);
|
|
23
19
|
return of(updateTasks(response.data.tasks), updateTasksListOnBulkUpdateTasksSuccess({
|
|
24
20
|
taskIds,
|
|
25
21
|
groupId,
|
|
26
|
-
|
|
27
|
-
}), fetchTaskList());
|
|
22
|
+
}));
|
|
28
23
|
}
|
|
29
24
|
else {
|
|
30
25
|
return of(updateTasksListOnBulkUpdateTasksFailure({
|
|
@@ -38,46 +33,19 @@ export const bulkUpdateTaskListEpic = (actions$, _state$, zeniAPI) => actions$.p
|
|
|
38
33
|
}));
|
|
39
34
|
}));
|
|
40
35
|
}));
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
}
|
|
55
|
-
if (updates.groupAssignees != null) {
|
|
56
|
-
payload.group_assignees = updates.groupAssignees;
|
|
57
|
-
}
|
|
58
|
-
if (updates.dueDate != null) {
|
|
59
|
-
payload.due_date = updates.dueDate.format(DEFAULT_DATE_FORMAT);
|
|
60
|
-
}
|
|
61
|
-
if (updates.tagIds != null) {
|
|
62
|
-
payload.tags = updates.tagIds;
|
|
63
|
-
}
|
|
64
|
-
if (updates.timeSpent != null) {
|
|
65
|
-
payload.time_spent = convertHHMMStrToMinutes(updates.timeSpent.replace(/\D/g, ''));
|
|
66
|
-
}
|
|
67
|
-
if (updates.isArchived != null) {
|
|
68
|
-
payload.is_archived = updates.isArchived;
|
|
69
|
-
}
|
|
70
|
-
if (updates.isDeleted != null) {
|
|
71
|
-
payload.is_deleted = updates.isDeleted;
|
|
72
|
-
}
|
|
73
|
-
// Bulk snooze is not supported — only bulk unsnooze (clear all snooze fields)
|
|
74
|
-
if ('snoozedUntil' in updates) {
|
|
75
|
-
payload.snoozed_until = null;
|
|
76
|
-
payload.snoozed_by = null;
|
|
77
|
-
payload.snoozed_at = null;
|
|
78
|
-
payload.is_snooze_notification_sent = false;
|
|
79
|
-
}
|
|
80
|
-
return payload;
|
|
36
|
+
export const getTasksListPayload = (state, taskIds, updates) => {
|
|
37
|
+
const { taskState } = state;
|
|
38
|
+
const tasksList = taskIds
|
|
39
|
+
.map((taskId) => {
|
|
40
|
+
const task = get(taskState.taskByID, taskId);
|
|
41
|
+
return {
|
|
42
|
+
...task,
|
|
43
|
+
...updates,
|
|
44
|
+
};
|
|
45
|
+
})
|
|
46
|
+
.filter((task) => task != null);
|
|
47
|
+
const tasksPayload = tasksList.map((task) => toTaskPayload(state, task));
|
|
48
|
+
return tasksPayload;
|
|
81
49
|
};
|
|
82
50
|
export const getTaskPayload = (state, taskId, updates) => {
|
|
83
51
|
const { taskState } = state;
|
|
@@ -103,9 +71,6 @@ const toTaskPayload = (state, task) => {
|
|
|
103
71
|
assignees: task.assignees,
|
|
104
72
|
description: task.description,
|
|
105
73
|
group_assignees: task.groupAssignees,
|
|
106
|
-
is_archived: task.isArchived,
|
|
107
|
-
is_deleted: task.isDeleted,
|
|
108
|
-
snoozed_until: task.snoozedUntil != null ? task.snoozedUntil.toISOString() : null,
|
|
109
74
|
due_date: task.dueDate != null ? task.dueDate.format(DEFAULT_DATE_FORMAT) : null,
|
|
110
75
|
priority: task.priority.code,
|
|
111
76
|
status: task.status.code,
|
|
@@ -9,19 +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
|
-
|
|
15
|
-
|
|
16
|
-
...(archived ?? []),
|
|
17
|
-
...(snoozed ?? []),
|
|
18
|
-
];
|
|
19
|
-
return of(updateTasks(allTasks), updateTaskList({
|
|
20
|
-
data: tasks,
|
|
21
|
-
deleted: deleted ?? [],
|
|
22
|
-
archived: archived ?? [],
|
|
23
|
-
snoozed: snoozed ?? [],
|
|
24
|
-
}), updateTags(allTasks.map((task) => task.tags).flat()));
|
|
12
|
+
return of(updateTasks(response.data.tasks), updateTaskList({
|
|
13
|
+
data: response.data.tasks,
|
|
14
|
+
updateType: 'replace',
|
|
15
|
+
}), updateTags(response.data.tasks.map((task) => task.tags).flat()));
|
|
25
16
|
}
|
|
26
17
|
else {
|
|
27
18
|
return of(updateTaskListFetchStatus({
|
|
@@ -8,10 +8,9 @@ export const updateTaskFromListViewEpic = (actions$, state$, zeniAPI) => actions
|
|
|
8
8
|
const state = state$.value;
|
|
9
9
|
const { task, updates } = action.payload;
|
|
10
10
|
const taskId = task.id;
|
|
11
|
-
|
|
12
|
-
const { snoozed_until: _snoozedUntil, ...taskData } = getTaskPayload(state, taskId, updates);
|
|
11
|
+
const taskData = getTaskPayload(state, taskId, updates);
|
|
13
12
|
return zeniAPI
|
|
14
|
-
.putAndGetJSON(`${zeniAPI.apiEndPoints.taskMicroServiceBaseUrl}/1.0/task-manager/tasks/${taskId}`, taskData)
|
|
13
|
+
.putAndGetJSON(`${zeniAPI.apiEndPoints.taskMicroServiceBaseUrl}/1.0/task-manager/tasks/${taskId}`, { ...taskData })
|
|
15
14
|
.pipe(mergeMap((response) => {
|
|
16
15
|
if (isSuccessResponse(response) && response.data != null) {
|
|
17
16
|
return from([
|
|
@@ -1,10 +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
2
|
export const DUE_DATE_GROUP_KEYS = [
|
|
9
3
|
'overdue',
|
|
10
4
|
'today',
|
|
@@ -32,7 +26,6 @@ const ALL_TASK_LIST_SORT_KEYS = [
|
|
|
32
26
|
'status',
|
|
33
27
|
'priority',
|
|
34
28
|
'timeSpent',
|
|
35
|
-
'visibility',
|
|
36
29
|
];
|
|
37
30
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
38
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;
|
|
@@ -213,13 +184,10 @@ const taskList = createSlice({
|
|
|
213
184
|
},
|
|
214
185
|
},
|
|
215
186
|
updateTasksListOnBulkUpdateTasksSuccess(draft, action) {
|
|
216
|
-
const { taskIds, groupId
|
|
187
|
+
const { taskIds, groupId } = action.payload;
|
|
217
188
|
draft.updateTasksFetchState.fetchState = 'Completed';
|
|
218
189
|
draft.updateTasksFetchState.error = undefined;
|
|
219
|
-
if (
|
|
220
|
-
removeTaskIds(draft, taskIds);
|
|
221
|
-
}
|
|
222
|
-
else if (groupId != null) {
|
|
190
|
+
if (groupId != null) {
|
|
223
191
|
const { groupByKey } = draft.uiState;
|
|
224
192
|
if (groupByKey === 'groupName') {
|
|
225
193
|
Object.keys(draft.taskIdsByGroupsIds).forEach((gId) => {
|
|
@@ -311,7 +279,6 @@ const taskList = createSlice({
|
|
|
311
279
|
newTaskGroupName: '',
|
|
312
280
|
selectedTaskIds: [],
|
|
313
281
|
};
|
|
314
|
-
syncTopLevelToActiveTab(draft);
|
|
315
282
|
},
|
|
316
283
|
updateTasksListOnBulkUpdateTasksFailure(draft, action) {
|
|
317
284
|
draft.updateTasksFetchState.fetchState = 'Error';
|
|
@@ -331,7 +298,6 @@ const taskList = createSlice({
|
|
|
331
298
|
}
|
|
332
299
|
delete draft.taskIdsByGroupsIds[taskGroupId];
|
|
333
300
|
delete draft.localData.existingTaskGroupNamesByGroupId[taskGroupId];
|
|
334
|
-
syncTopLevelToActiveTab(draft);
|
|
335
301
|
},
|
|
336
302
|
updateTaskListOnNewTaskCreationSuccess(draft, action) {
|
|
337
303
|
const { task, taskGroupId, currentTaskState } = action.payload;
|
|
@@ -366,7 +332,6 @@ const taskList = createSlice({
|
|
|
366
332
|
doUpdateTaskList(draft, task, taskGroupId);
|
|
367
333
|
}
|
|
368
334
|
});
|
|
369
|
-
syncTopLevelToActiveTab(draft);
|
|
370
335
|
},
|
|
371
336
|
updateTaskListOnTaskGroupNameUpdate(draft, action) {
|
|
372
337
|
const { taskGroupName, taskGroupId } = action.payload;
|
|
@@ -430,7 +395,6 @@ const taskList = createSlice({
|
|
|
430
395
|
};
|
|
431
396
|
}
|
|
432
397
|
}
|
|
433
|
-
syncTopLevelToActiveTab(draft);
|
|
434
398
|
},
|
|
435
399
|
updateTasksListOnUpdateTaskSuccess(draft) {
|
|
436
400
|
draft.updateTasksFetchState.fetchState = 'Completed';
|
|
@@ -440,15 +404,12 @@ const taskList = createSlice({
|
|
|
440
404
|
draft.updateTasksFetchState.fetchState = 'Error';
|
|
441
405
|
draft.updateTasksFetchState.error = action.payload.error;
|
|
442
406
|
},
|
|
443
|
-
removeTaskFromList(draft, action) {
|
|
444
|
-
removeTaskIds(draft, [action.payload]);
|
|
445
|
-
},
|
|
446
407
|
clearTaskList(draft) {
|
|
447
408
|
Object.assign(draft, initialState);
|
|
448
409
|
},
|
|
449
410
|
},
|
|
450
411
|
});
|
|
451
|
-
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;
|
|
452
413
|
export default taskList.reducer;
|
|
453
414
|
/**
|
|
454
415
|
* helpers
|
|
@@ -527,61 +488,6 @@ const getTagsGroupKey = (tags) => {
|
|
|
527
488
|
tagIds.sort();
|
|
528
489
|
return tagIds.join(',');
|
|
529
490
|
};
|
|
530
|
-
const toTabData = (grouped) => ({
|
|
531
|
-
taskIds: grouped.taskIds,
|
|
532
|
-
taskIdsByAssignees: grouped.taskIdsByAssignees,
|
|
533
|
-
taskIdsByDueDate: grouped.taskIdsByDueDate,
|
|
534
|
-
taskIdsByGroupsIds: grouped.taskIdsByGroupIds,
|
|
535
|
-
taskIdsByPriority: grouped.taskIdsGroupedByPriority,
|
|
536
|
-
taskIdsByStatus: grouped.taskIdsGroupedByStatus,
|
|
537
|
-
taskIdsByTags: grouped.taskIdsByTags,
|
|
538
|
-
});
|
|
539
|
-
const syncTopLevelToActiveTab = (draft) => {
|
|
540
|
-
const tabData = draft.byTab[draft.currentTab];
|
|
541
|
-
tabData.taskIds = draft.taskIds;
|
|
542
|
-
tabData.taskIdsByGroupsIds = draft.taskIdsByGroupsIds;
|
|
543
|
-
tabData.taskIdsByPriority = draft.taskIdsByPriority;
|
|
544
|
-
tabData.taskIdsByStatus = draft.taskIdsByStatus;
|
|
545
|
-
tabData.taskIdsByAssignees = draft.taskIdsByAssignees;
|
|
546
|
-
tabData.taskIdsByDueDate = draft.taskIdsByDueDate;
|
|
547
|
-
tabData.taskIdsByTags = draft.taskIdsByTags;
|
|
548
|
-
};
|
|
549
|
-
const copyTabDataToTopLevel = (draft, tabData) => {
|
|
550
|
-
draft.taskIds = tabData.taskIds;
|
|
551
|
-
draft.taskIdsByGroupsIds = tabData.taskIdsByGroupsIds;
|
|
552
|
-
draft.taskIdsByPriority = tabData.taskIdsByPriority;
|
|
553
|
-
draft.taskIdsByStatus = tabData.taskIdsByStatus;
|
|
554
|
-
draft.taskIdsByAssignees = tabData.taskIdsByAssignees;
|
|
555
|
-
draft.taskIdsByDueDate = tabData.taskIdsByDueDate;
|
|
556
|
-
draft.taskIdsByTags = tabData.taskIdsByTags;
|
|
557
|
-
};
|
|
558
|
-
const removeIdsFromTabData = (tabData, taskIds) => {
|
|
559
|
-
const removedSet = new Set(taskIds);
|
|
560
|
-
const isRemoved = (id) => removedSet.has(id);
|
|
561
|
-
tabData.taskIds = tabData.taskIds.filter((id) => !isRemoved(id));
|
|
562
|
-
Object.keys(tabData.taskIdsByGroupsIds).forEach((gId) => {
|
|
563
|
-
tabData.taskIdsByGroupsIds[gId] = tabData.taskIdsByGroupsIds[gId].filter((id) => !isRemoved(id));
|
|
564
|
-
});
|
|
565
|
-
Object.keys(tabData.taskIdsByPriority).forEach((key) => {
|
|
566
|
-
tabData.taskIdsByPriority[key] = tabData.taskIdsByPriority[key].filter((id) => !isRemoved(id));
|
|
567
|
-
});
|
|
568
|
-
Object.keys(tabData.taskIdsByStatus).forEach((key) => {
|
|
569
|
-
tabData.taskIdsByStatus[key] = tabData.taskIdsByStatus[key].filter((id) => !isRemoved(id));
|
|
570
|
-
});
|
|
571
|
-
Object.keys(tabData.taskIdsByDueDate).forEach((key) => {
|
|
572
|
-
tabData.taskIdsByDueDate[key] = tabData.taskIdsByDueDate[key].filter((id) => !isRemoved(id));
|
|
573
|
-
});
|
|
574
|
-
Object.keys(tabData.taskIdsByAssignees).forEach((key) => {
|
|
575
|
-
tabData.taskIdsByAssignees[key] = tabData.taskIdsByAssignees[key].filter((id) => !isRemoved(id));
|
|
576
|
-
});
|
|
577
|
-
Object.keys(tabData.taskIdsByTags).forEach((key) => {
|
|
578
|
-
tabData.taskIdsByTags[key] = tabData.taskIdsByTags[key].filter((id) => !isRemoved(id));
|
|
579
|
-
});
|
|
580
|
-
};
|
|
581
|
-
const removeTaskIds = (draft, taskIds) => {
|
|
582
|
-
removeIdsFromTabData(draft, taskIds);
|
|
583
|
-
removeIdsFromTabData(draft.byTab[draft.currentTab], taskIds);
|
|
584
|
-
};
|
|
585
491
|
const getGroupedTaskIds = (tasks) => {
|
|
586
492
|
const taskIds = [];
|
|
587
493
|
const taskIdsByGroupIds = {};
|