@zeniai/client-epic-state 4.20.0-beta10RR → 4.20.0-beta11RR
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/esm/view/taskManager/taskDetailView/epics/archiveTaskEpic.js +2 -0
- package/lib/esm/view/taskManager/taskDetailView/epics/deleteTaskEpic.js +4 -0
- package/lib/esm/view/taskManager/taskDetailView/epics/snoozeTaskEpic.js +2 -0
- package/lib/esm/view/taskManager/taskListView/taskListReducer.js +23 -1
- package/lib/tsconfig.typecheck.tsbuildinfo +1 -1
- package/lib/view/taskManager/taskDetailView/epics/archiveTaskEpic.d.ts +2 -1
- package/lib/view/taskManager/taskDetailView/epics/archiveTaskEpic.js +2 -0
- package/lib/view/taskManager/taskDetailView/epics/deleteTaskEpic.d.ts +2 -1
- package/lib/view/taskManager/taskDetailView/epics/deleteTaskEpic.js +4 -0
- package/lib/view/taskManager/taskDetailView/epics/snoozeTaskEpic.d.ts +2 -1
- package/lib/view/taskManager/taskDetailView/epics/snoozeTaskEpic.js +2 -0
- package/lib/view/taskManager/taskListView/taskListReducer.d.ts +1 -1
- package/lib/view/taskManager/taskListView/taskListReducer.js +24 -2
- package/package.json +1 -1
|
@@ -4,6 +4,7 @@ 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';
|
|
7
8
|
import { archiveTask, archiveTaskSuccessOrFailure } from '../taskDetailReducer';
|
|
8
9
|
// Epic function to handle archiving of tasks
|
|
9
10
|
export const archiveTaskEpic = (actions$, state$, zeniAPI) => actions$.pipe(filter(archiveTask.match), mergeMap((action) => handleArchiveTask(action.payload.taskId, state$, zeniAPI)));
|
|
@@ -25,6 +26,7 @@ const handleApiResponse = (response, taskId) => {
|
|
|
25
26
|
response.data.tasks.length > 0) {
|
|
26
27
|
const fetchActions = [
|
|
27
28
|
updateTasks(response.data.tasks),
|
|
29
|
+
removeTaskFromList(taskId),
|
|
28
30
|
archiveTaskSuccessOrFailure({
|
|
29
31
|
fetchState: 'Completed',
|
|
30
32
|
taskId,
|
|
@@ -2,6 +2,7 @@ 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';
|
|
5
6
|
import { deleteTask, deleteTaskSuccessOrFailure } from '../taskDetailReducer';
|
|
6
7
|
export const deleteTaskEpic = (actions$, _state$, zeniAPI) => actions$.pipe(filter(deleteTask.match), mergeMap((action) => {
|
|
7
8
|
const { taskId } = action.payload;
|
|
@@ -10,6 +11,9 @@ export const deleteTaskEpic = (actions$, _state$, zeniAPI) => actions$.pipe(filt
|
|
|
10
11
|
.pipe(mergeMap((response) => {
|
|
11
12
|
if (isSuccessStatus(response)) {
|
|
12
13
|
const actions = [];
|
|
14
|
+
if (taskId != null) {
|
|
15
|
+
actions.push(removeTaskFromList(taskId));
|
|
16
|
+
}
|
|
13
17
|
actions.push(deleteTaskSuccessOrFailure({ fetchState: 'Completed', taskId }));
|
|
14
18
|
return from(actions);
|
|
15
19
|
}
|
|
@@ -4,6 +4,7 @@ import { openSnackbar } from '../../../../entity/snackbar/snackbarReducer';
|
|
|
4
4
|
import { updateTasks } from '../../../../entity/task/taskReducer';
|
|
5
5
|
import { createZeniAPIStatus, isSuccessResponse, } from '../../../../responsePayload';
|
|
6
6
|
import { date } from '../../../../zeniDayJS';
|
|
7
|
+
import { removeTaskFromList } from '../../taskListView/taskListReducer';
|
|
7
8
|
import { snoozeTask, snoozeTaskSuccessOrFailure } from '../taskDetailReducer';
|
|
8
9
|
export const snoozeTaskEpic = (actions$, _state$, zeniAPI) => actions$.pipe(filter(snoozeTask.match), mergeMap((action) => handleSnoozeTask(action.payload.taskId, action.payload.snoozedUntil, zeniAPI)));
|
|
9
10
|
const formatSnoozedUntilForDisplay = (snoozedUntil) => date(snoozedUntil).format('MMM D, h:mm A');
|
|
@@ -21,6 +22,7 @@ const handleApiResponse = (response, taskId, snoozedUntil) => {
|
|
|
21
22
|
response.data.tasks.length > 0) {
|
|
22
23
|
const fetchActions = [
|
|
23
24
|
updateTasks(response.data.tasks),
|
|
25
|
+
removeTaskFromList(taskId),
|
|
24
26
|
snoozeTaskSuccessOrFailure({
|
|
25
27
|
fetchState: 'Completed',
|
|
26
28
|
taskId,
|
|
@@ -404,12 +404,34 @@ const taskList = createSlice({
|
|
|
404
404
|
draft.updateTasksFetchState.fetchState = 'Error';
|
|
405
405
|
draft.updateTasksFetchState.error = action.payload.error;
|
|
406
406
|
},
|
|
407
|
+
removeTaskFromList(draft, action) {
|
|
408
|
+
const taskIdToRemove = action.payload;
|
|
409
|
+
draft.taskIds = draft.taskIds.filter((id) => id !== taskIdToRemove);
|
|
410
|
+
Object.keys(draft.taskIdsByGroupsIds).forEach((groupId) => {
|
|
411
|
+
draft.taskIdsByGroupsIds[groupId] = draft.taskIdsByGroupsIds[groupId].filter((id) => id !== taskIdToRemove);
|
|
412
|
+
});
|
|
413
|
+
Object.keys(draft.taskIdsByPriority).forEach((key) => {
|
|
414
|
+
draft.taskIdsByPriority[key] = draft.taskIdsByPriority[key].filter((id) => id !== taskIdToRemove);
|
|
415
|
+
});
|
|
416
|
+
Object.keys(draft.taskIdsByStatus).forEach((key) => {
|
|
417
|
+
draft.taskIdsByStatus[key] = draft.taskIdsByStatus[key].filter((id) => id !== taskIdToRemove);
|
|
418
|
+
});
|
|
419
|
+
Object.keys(draft.taskIdsByDueDate).forEach((key) => {
|
|
420
|
+
draft.taskIdsByDueDate[key] = draft.taskIdsByDueDate[key].filter((id) => id !== taskIdToRemove);
|
|
421
|
+
});
|
|
422
|
+
Object.keys(draft.taskIdsByAssignees).forEach((key) => {
|
|
423
|
+
draft.taskIdsByAssignees[key] = draft.taskIdsByAssignees[key].filter((id) => id !== taskIdToRemove);
|
|
424
|
+
});
|
|
425
|
+
Object.keys(draft.taskIdsByTags).forEach((key) => {
|
|
426
|
+
draft.taskIdsByTags[key] = draft.taskIdsByTags[key].filter((id) => id !== taskIdToRemove);
|
|
427
|
+
});
|
|
428
|
+
},
|
|
407
429
|
clearTaskList(draft) {
|
|
408
430
|
Object.assign(draft, initialState);
|
|
409
431
|
},
|
|
410
432
|
},
|
|
411
433
|
});
|
|
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;
|
|
434
|
+
export const { fetchTaskListPage, fetchTaskList, updateTaskList, updateTaskListFetchStatus, updateTaskListSearchText, updateTaskListUIState, updateTaskFilters, updateTaskListOnNewGroupCreationSuccess, bulkUpdateTaskList, updateTasksListOnBulkUpdateTasksSuccess, updateTasksListOnBulkUpdateTasksFailure, initiateTaskListLocalData, updateTaskListLocalData, updateTaskListOnTaskGroupDeletion, dragNDropTasks, updateTaskListOnNewTaskCreationSuccess, updateTaskListOnTaskGroupNameUpdate, updateTaskFromListView, updateTasksListOnUpdateTaskSuccess, updateTasksListOnUpdateTaskFailure, updateTaskListOnCreateTaskFromTemplateSuccess, removeTaskFromList, clearTaskList, } = taskList.actions;
|
|
413
435
|
export default taskList.reducer;
|
|
414
436
|
/**
|
|
415
437
|
* helpers
|