@zeniai/client-epic-state 5.1.40-betaDI2 → 5.1.40
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 -1
- package/lib/entity/task/taskPayload.d.ts +1 -2
- package/lib/entity/task/taskPayload.js +1 -8
- package/lib/entity/task/taskReducer.d.ts +1 -8
- package/lib/entity/task/taskReducer.js +4 -29
- package/lib/entity/task/taskState.d.ts +0 -1
- package/lib/epic.d.ts +3 -5
- package/lib/epic.js +3 -5
- package/lib/esm/entity/snackbar/snackbarTypes.js +0 -1
- package/lib/esm/entity/task/taskPayload.js +1 -8
- package/lib/esm/entity/task/taskReducer.js +3 -28
- package/lib/esm/epic.js +3 -5
- package/lib/esm/index.js +2 -2
- package/lib/esm/view/companyTaskManagerView/epics/fetchCompanyTaskManagerViewEpic.js +0 -3
- package/lib/esm/view/companyTaskManagerView/epics/fetchTaskManagerMetricsEpic.js +1 -7
- package/lib/esm/view/expenseAutomationView/epics/transactionCategorization/fetchTransactionCategorizationViewEpic.js +3 -2
- package/lib/esm/view/taskManager/taskDetailView/epics/initializeTaskToLocalStoreEpic.js +0 -1
- package/lib/esm/view/taskManager/taskDetailView/epics/saveTaskDetailEpic.js +9 -70
- package/lib/esm/view/taskManager/taskDetailView/taskDetailReducer.js +2 -56
- package/lib/esm/view/taskManager/taskDetailView/taskDetailSelector.js +9 -32
- package/lib/esm/view/taskManager/taskListView/epics/fetchTaskListEpic.js +1 -3
- package/lib/esm/view/taskManager/taskListView/taskList.js +0 -1
- package/lib/esm/view/taskManager/taskListView/taskListReducer.js +12 -240
- package/lib/esm/view/taskManager/taskListView/taskListSelector.js +0 -1
- package/lib/index.d.ts +5 -5
- package/lib/index.js +9 -12
- package/lib/view/companyTaskManagerView/epics/fetchCompanyTaskManagerViewEpic.js +0 -3
- package/lib/view/companyTaskManagerView/epics/fetchTaskManagerMetricsEpic.js +1 -7
- package/lib/view/companyView/types/cockpitTypes.d.ts +0 -3
- package/lib/view/expenseAutomationView/epics/transactionCategorization/fetchTransactionCategorizationViewEpic.js +3 -2
- package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.d.ts +1 -1
- package/lib/view/taskManager/taskDetailView/epics/initializeTaskToLocalStoreEpic.js +0 -1
- package/lib/view/taskManager/taskDetailView/epics/saveTaskDetailEpic.d.ts +2 -2
- package/lib/view/taskManager/taskDetailView/epics/saveTaskDetailEpic.js +8 -69
- package/lib/view/taskManager/taskDetailView/taskDetail.d.ts +0 -15
- package/lib/view/taskManager/taskDetailView/taskDetailReducer.d.ts +2 -14
- package/lib/view/taskManager/taskDetailView/taskDetailReducer.js +3 -57
- package/lib/view/taskManager/taskDetailView/taskDetailSelector.d.ts +1 -2
- package/lib/view/taskManager/taskDetailView/taskDetailSelector.js +7 -30
- package/lib/view/taskManager/taskListView/epics/fetchTaskListEpic.js +1 -3
- package/lib/view/taskManager/taskListView/taskList.d.ts +1 -1
- package/lib/view/taskManager/taskListView/taskList.js +0 -1
- package/lib/view/taskManager/taskListView/taskListPayload.d.ts +0 -4
- package/lib/view/taskManager/taskListView/taskListReducer.d.ts +2 -6
- package/lib/view/taskManager/taskListView/taskListReducer.js +13 -241
- package/lib/view/taskManager/taskListView/taskListSelector.js +0 -1
- package/package.json +1 -1
- package/lib/esm/view/taskManager/taskDetailView/epics/createSubTaskEpic.js +0 -96
- package/lib/esm/view/taskManager/taskDetailView/epics/fetchSubTasksEpic.js +0 -53
- package/lib/view/taskManager/taskDetailView/epics/createSubTaskEpic.d.ts +0 -9
- package/lib/view/taskManager/taskDetailView/epics/createSubTaskEpic.js +0 -100
- package/lib/view/taskManager/taskDetailView/epics/fetchSubTasksEpic.d.ts +0 -8
- package/lib/view/taskManager/taskDetailView/epics/fetchSubTasksEpic.js +0 -57
|
@@ -34,7 +34,6 @@ const initializeTaskToLocalStoreEpic = (actions$, state$) => actions$.pipe((0, o
|
|
|
34
34
|
recurringStartDate: task.recurringStartDate,
|
|
35
35
|
timeSpent: task.timeSpent,
|
|
36
36
|
isPrivate: task.isPrivate,
|
|
37
|
-
taskGroupId: task.taskGroupIds[0],
|
|
38
37
|
};
|
|
39
38
|
const actions = [
|
|
40
39
|
(0, taskDetailReducer_1.saveTaskUpdatesToLocalStore)({ taskDetailLocalData, taskId }),
|
|
@@ -3,7 +3,7 @@ import { openSnackbar } from '../../../../entity/snackbar/snackbarReducer';
|
|
|
3
3
|
import { updateTasks } from '../../../../entity/task/taskReducer';
|
|
4
4
|
import { RootState } from '../../../../reducer';
|
|
5
5
|
import { ZeniAPI } from '../../../../zeniAPI';
|
|
6
|
-
import {
|
|
6
|
+
import { updateTaskListOnNewTaskCreationSuccess } from '../../taskListView/taskListReducer';
|
|
7
7
|
import { saveTaskDetail, saveTaskSuccessOrFailure } from '../taskDetailReducer';
|
|
8
|
-
export type ActionType = ReturnType<typeof saveTaskDetail> | ReturnType<typeof updateTasks> | ReturnType<typeof openSnackbar> | ReturnType<typeof updateTaskListOnNewTaskCreationSuccess> | ReturnType<typeof
|
|
8
|
+
export type ActionType = ReturnType<typeof saveTaskDetail> | ReturnType<typeof updateTasks> | ReturnType<typeof openSnackbar> | ReturnType<typeof updateTaskListOnNewTaskCreationSuccess> | ReturnType<typeof saveTaskSuccessOrFailure>;
|
|
9
9
|
export declare const saveTaskDetailEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => import("rxjs").Observable<ActionType>;
|
|
@@ -15,46 +15,17 @@ const saveTaskDetailEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, oper
|
|
|
15
15
|
const { taskId, taskGroupId } = action.payload;
|
|
16
16
|
const state = state$.value;
|
|
17
17
|
const isTaskListFetched = state.taskListState.fetchState === 'Completed';
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
?.taskGroupId
|
|
23
|
-
: undefined;
|
|
24
|
-
// groupWasCleared distinguishes "user explicitly cleared the group"
|
|
25
|
-
// (localTaskGroupId === null → send []) from "user did not touch it"
|
|
26
|
-
// (undefined → fall back to entity). Without this, the `??` fallback
|
|
27
|
-
// would resurrect the stale entity value after a clear.
|
|
28
|
-
const groupWasCleared = taskId != null && localTaskGroupId === null;
|
|
29
|
-
const entityTaskGroupIds = taskId != null
|
|
30
|
-
? ((0, taskSelector_1.getTaskById)(state.taskState, taskId)?.taskGroupIds ?? [])
|
|
31
|
-
: [];
|
|
32
|
-
// Distinguish three save shapes:
|
|
33
|
-
// - cleared → []
|
|
34
|
-
// - user picked a different group locally → [localTaskGroupId]
|
|
35
|
-
// - no local edit → entire entityTaskGroupIds (preserves multi-
|
|
36
|
-
// group membership; without this, unrelated field edits silently
|
|
37
|
-
// drop extra groups).
|
|
38
|
-
const localGroupChanged = localTaskGroupId != null;
|
|
39
|
-
const taskGroupIdsForPayload = groupWasCleared
|
|
40
|
-
? []
|
|
41
|
-
: localGroupChanged
|
|
42
|
-
? [localTaskGroupId]
|
|
43
|
-
: taskId != null
|
|
44
|
-
? entityTaskGroupIds
|
|
45
|
-
: taskGroupId != null
|
|
46
|
-
? [taskGroupId]
|
|
47
|
-
: [];
|
|
48
|
-
// Keep `updatedTaskGroupId` (single id) for downstream list-update
|
|
49
|
-
// dispatches that still bucket against one group at a time.
|
|
50
|
-
const updatedTaskGroupId = taskGroupIdsForPayload[0];
|
|
51
|
-
const payload = prepareTaskPayload(state, taskId, taskGroupIdsForPayload);
|
|
18
|
+
const updatedTaskGroupId = taskId == null
|
|
19
|
+
? taskGroupId
|
|
20
|
+
: (0, taskSelector_1.getTaskById)(state.taskState, taskId)?.taskGroupIds[0];
|
|
21
|
+
const payload = prepareTaskPayload(state, taskId, updatedTaskGroupId);
|
|
52
22
|
const saveTaskApi = taskId != null
|
|
53
23
|
? zeniAPI.putAndGetJSON(`${zeniAPI.apiEndPoints.taskMicroServiceBaseUrl}/1.0/task-manager/tasks/${taskId}`, payload)
|
|
54
24
|
: zeniAPI.postAndGetJSON(`${zeniAPI.apiEndPoints.taskMicroServiceBaseUrl}/1.0/task-manager/tasks`, payload);
|
|
55
25
|
return saveTaskApi.pipe((0, operators_1.mergeMap)((response) => {
|
|
56
26
|
if ((0, responsePayload_1.isSuccessResponse)(response) &&
|
|
57
27
|
response.data != null &&
|
|
28
|
+
updatedTaskGroupId != null &&
|
|
58
29
|
response.data.tasks.length > 0) {
|
|
59
30
|
const newTaskId = response.data.tasks[0].task_id;
|
|
60
31
|
const actions = [
|
|
@@ -65,24 +36,7 @@ const saveTaskDetailEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, oper
|
|
|
65
36
|
taskId,
|
|
66
37
|
}),
|
|
67
38
|
];
|
|
68
|
-
|
|
69
|
-
// when the saved task's status no longer matches the tab —
|
|
70
|
-
// otherwise doUpdateTaskList writes the row back into the
|
|
71
|
-
// current tab's grouping arrays even after updateTasks moved
|
|
72
|
-
// it to Completed. Archived/snoozed/deleted are owned by
|
|
73
|
-
// their dedicated actions and must keep the pre-PR optimistic
|
|
74
|
-
// update path so their grouping arrays don't go stale.
|
|
75
|
-
const savedTask = response.data.tasks[0];
|
|
76
|
-
const savedIsCompleted = savedTask.status?.code === 'resolved';
|
|
77
|
-
const activeTab = state.taskListState.currentTab;
|
|
78
|
-
const isLiveOrCompletedTab = activeTab === 'live' || activeTab === 'completed';
|
|
79
|
-
const statusMatchesActiveTab = !isLiveOrCompletedTab ||
|
|
80
|
-
(savedIsCompleted && activeTab === 'completed') ||
|
|
81
|
-
(!savedIsCompleted && activeTab === 'live');
|
|
82
|
-
if (isTaskListFetched === true &&
|
|
83
|
-
groupWasCleared === false &&
|
|
84
|
-
updatedTaskGroupId != null &&
|
|
85
|
-
statusMatchesActiveTab === true) {
|
|
39
|
+
if (isTaskListFetched === true) {
|
|
86
40
|
actions.push((0, taskListReducer_1.updateTaskListOnNewTaskCreationSuccess)({
|
|
87
41
|
taskGroupId: updatedTaskGroupId,
|
|
88
42
|
task: response.data.tasks[0],
|
|
@@ -91,21 +45,6 @@ const saveTaskDetailEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, oper
|
|
|
91
45
|
: undefined,
|
|
92
46
|
}));
|
|
93
47
|
}
|
|
94
|
-
else if (isTaskListFetched === true &&
|
|
95
|
-
groupWasCleared === true &&
|
|
96
|
-
taskId != null) {
|
|
97
|
-
// Group was cleared — skip the list-insert action (no
|
|
98
|
-
// destination bucket) and explicitly drop the row from every
|
|
99
|
-
// previously-held group so the list re-renders without the
|
|
100
|
-
// stale entry under the old group until next refetch.
|
|
101
|
-
const previousTask = (0, taskSelector_1.getTaskById)(state.taskState, taskId);
|
|
102
|
-
previousTask?.taskGroupIds.forEach((previousGroupId) => {
|
|
103
|
-
actions.push((0, taskListReducer_1.removeTaskFromGroupBucket)({
|
|
104
|
-
taskId,
|
|
105
|
-
taskGroupId: previousGroupId,
|
|
106
|
-
}));
|
|
107
|
-
});
|
|
108
|
-
}
|
|
109
48
|
return (0, rxjs_1.from)(actions);
|
|
110
49
|
}
|
|
111
50
|
else {
|
|
@@ -132,7 +71,7 @@ const saveTaskDetailEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, oper
|
|
|
132
71
|
}))));
|
|
133
72
|
}));
|
|
134
73
|
exports.saveTaskDetailEpic = saveTaskDetailEpic;
|
|
135
|
-
const prepareTaskPayload = (state, taskId,
|
|
74
|
+
const prepareTaskPayload = (state, taskId, taskGroupId) => {
|
|
136
75
|
const { taskDetailState, taskState } = state;
|
|
137
76
|
const syncToken = taskId != null ? ((0, taskSelector_1.getTaskById)(taskState, taskId)?.syncToken ?? '') : '';
|
|
138
77
|
const sourceState = taskId != null
|
|
@@ -161,7 +100,7 @@ const prepareTaskPayload = (state, taskId, taskGroupIds) => {
|
|
|
161
100
|
? (localData.recurringDaysOfWeek ?? [])
|
|
162
101
|
: [],
|
|
163
102
|
sync_token: syncToken,
|
|
164
|
-
task_group_ids:
|
|
103
|
+
task_group_ids: taskGroupId != null ? [taskGroupId] : [],
|
|
165
104
|
time_spent: (0, formatMinutesToFromHHMM_1.convertHHMMStrToMinutes)(localData.timeSpent),
|
|
166
105
|
group_assignees: localData.groupAssignees,
|
|
167
106
|
...(taskId == null ? { is_private: localData.isPrivate ?? false } : {}),
|
|
@@ -3,23 +3,9 @@ import { DayOfWeek, PriorityCodeType, TaskStatusCodeType, TaskType } from '../..
|
|
|
3
3
|
import { ZeniDate } from '../../../zeniDayJS';
|
|
4
4
|
import { RecurringDatePickerOptions, RecurringFrequencyType } from '../../common/recurringViewHelper';
|
|
5
5
|
import { CommonHistoryView } from '../../spendManagement/commonHistoryView/commonHistory';
|
|
6
|
-
export interface CreateSubTaskPayload {
|
|
7
|
-
assignee: ID[];
|
|
8
|
-
description: string;
|
|
9
|
-
groupAssignees: ID[];
|
|
10
|
-
name: string;
|
|
11
|
-
parentTaskId: ID;
|
|
12
|
-
priority: PriorityCodeType;
|
|
13
|
-
status: TaskStatusCodeType;
|
|
14
|
-
tagIds: ID[];
|
|
15
|
-
timeSpent: string;
|
|
16
|
-
dueDate?: ZeniDate;
|
|
17
|
-
}
|
|
18
6
|
export interface TaskDetailViewState {
|
|
19
7
|
editTaskStateById: Record<ID, EditTaskDetail>;
|
|
20
8
|
newTaskState: EditTaskDetail;
|
|
21
|
-
subTaskCreateStatus: FetchStateAndError;
|
|
22
|
-
subTaskListFetchStatusByParentId: Record<ID, FetchStateAndError>;
|
|
23
9
|
taskHistoryById: Record<ID, CommonHistoryView>;
|
|
24
10
|
}
|
|
25
11
|
export interface EditTaskDetail {
|
|
@@ -54,7 +40,6 @@ export interface EditTaskLocalData {
|
|
|
54
40
|
recurringStartDate?: ZeniDate;
|
|
55
41
|
savedRecurringEndDate?: ZeniDate;
|
|
56
42
|
savedRecurringTasksCount?: number;
|
|
57
|
-
taskGroupId?: ID | null;
|
|
58
43
|
}
|
|
59
44
|
export declare const initialTaskDetailLocalData: EditTaskLocalData;
|
|
60
45
|
export declare const initialTaskDetail: EditTaskDetail;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { FetchState, ID } from '../../../commonStateTypes/common';
|
|
2
2
|
import { ZeniAPIStatus } from '../../../responsePayload';
|
|
3
3
|
import { HistoricEventPayload } from '../../spendManagement/commonHistoryView/commonHistoryPayload';
|
|
4
|
-
import {
|
|
4
|
+
import { EditTaskLocalData, TaskDetailViewState } from './taskDetail';
|
|
5
5
|
export declare const initialState: TaskDetailViewState;
|
|
6
6
|
export declare const fetchTaskDetailPage: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[cacheOverride: boolean, taskId?: string | undefined], {
|
|
7
7
|
cacheOverride: boolean;
|
|
@@ -34,19 +34,7 @@ export declare const fetchTaskDetailPage: import("@reduxjs/toolkit").ActionCreat
|
|
|
34
34
|
error?: ZeniAPIStatus;
|
|
35
35
|
newTaskId?: ID;
|
|
36
36
|
taskId?: ID;
|
|
37
|
-
}, "taskDetailView/saveTaskSuccessOrFailure">,
|
|
38
|
-
fetchState: FetchState;
|
|
39
|
-
error?: ZeniAPIStatus;
|
|
40
|
-
newTaskId?: ID;
|
|
41
|
-
}, "taskDetailView/createSubTaskSuccessOrFailure">, resetSubTaskCreateStatus: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"taskDetailView/resetSubTaskCreateStatus">, fetchSubTasks: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[parentTaskId: string], {
|
|
42
|
-
parentTaskId: string;
|
|
43
|
-
}, "taskDetailView/fetchSubTasks", never, never>, updateSubTasks: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
44
|
-
parentTaskId: ID;
|
|
45
|
-
}, "taskDetailView/updateSubTasks">, updateSubTasksFetchStatus: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
46
|
-
fetchState: FetchState;
|
|
47
|
-
parentTaskId: ID;
|
|
48
|
-
error?: ZeniAPIStatus;
|
|
49
|
-
}, "taskDetailView/updateSubTasksFetchStatus">, deleteTask: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[taskId?: string | undefined], {
|
|
37
|
+
}, "taskDetailView/saveTaskSuccessOrFailure">, deleteTask: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[taskId?: string | undefined], {
|
|
50
38
|
taskId: string | undefined;
|
|
51
39
|
}, "taskDetailView/deleteTask", never, never>, removeTaskDetail: import("@reduxjs/toolkit").ActionCreatorWithPayload<string, "taskDetailView/removeTaskDetail">, deleteTaskSuccessOrFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
52
40
|
fetchState: FetchState;
|
|
@@ -4,7 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
var _a;
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.updateDeletedTagToLocalStore = exports.updateCreatedTagToLocalStore = exports.clearTaskDetail = exports.updateTaskHistoryFetchStatus = exports.updateTaskHistory = exports.fetchTaskHistory = exports.unsnoozeTask = exports.snoozeTaskSuccessOrFailure = exports.snoozeTask = exports.deleteTaskSuccessOrFailure = exports.removeTaskDetail = exports.deleteTask = exports.
|
|
7
|
+
exports.updateDeletedTagToLocalStore = exports.updateCreatedTagToLocalStore = exports.clearTaskDetail = exports.updateTaskHistoryFetchStatus = exports.updateTaskHistory = exports.fetchTaskHistory = exports.unsnoozeTask = exports.snoozeTaskSuccessOrFailure = exports.snoozeTask = exports.deleteTaskSuccessOrFailure = exports.removeTaskDetail = exports.deleteTask = exports.saveTaskSuccessOrFailure = exports.archiveTaskSuccessOrFailure = exports.archiveTask = exports.saveTaskDetail = exports.discardTaskUpdatesInLocalStore = exports.saveTaskUpdatesToLocalStore = exports.updateEditTaskFetchStatus = exports.initializeTaskToLocalStore = exports.fetchTaskDetail = exports.fetchTaskDetailPage = exports.initialState = void 0;
|
|
8
8
|
const toolkit_1 = require("@reduxjs/toolkit");
|
|
9
9
|
const get_1 = __importDefault(require("lodash/get"));
|
|
10
10
|
const commonHistory_1 = require("../../spendManagement/commonHistoryView/commonHistory");
|
|
@@ -13,11 +13,6 @@ const taskDetail_1 = require("./taskDetail");
|
|
|
13
13
|
exports.initialState = {
|
|
14
14
|
newTaskState: taskDetail_1.initialTaskDetail,
|
|
15
15
|
editTaskStateById: {},
|
|
16
|
-
subTaskCreateStatus: {
|
|
17
|
-
fetchState: 'Not-Started',
|
|
18
|
-
error: undefined,
|
|
19
|
-
},
|
|
20
|
-
subTaskListFetchStatusByParentId: {},
|
|
21
16
|
taskHistoryById: {},
|
|
22
17
|
};
|
|
23
18
|
const taskDetailView = (0, toolkit_1.createSlice)({
|
|
@@ -62,7 +57,7 @@ const taskDetailView = (0, toolkit_1.createSlice)({
|
|
|
62
57
|
updateEditTaskFetchStatus(draft, action) {
|
|
63
58
|
const { taskId, fetchState, error } = action.payload;
|
|
64
59
|
draft.editTaskStateById[taskId] = {
|
|
65
|
-
...
|
|
60
|
+
...draft.editTaskStateById[taskId],
|
|
66
61
|
fetchTaskStatus: {
|
|
67
62
|
fetchState,
|
|
68
63
|
error: fetchState === 'Error' ? error : undefined,
|
|
@@ -330,59 +325,10 @@ const taskDetailView = (0, toolkit_1.createSlice)({
|
|
|
330
325
|
error,
|
|
331
326
|
};
|
|
332
327
|
},
|
|
333
|
-
createSubTask: {
|
|
334
|
-
reducer(draft) {
|
|
335
|
-
draft.subTaskCreateStatus = {
|
|
336
|
-
fetchState: 'In-Progress',
|
|
337
|
-
error: undefined,
|
|
338
|
-
};
|
|
339
|
-
},
|
|
340
|
-
prepare(payload) {
|
|
341
|
-
return { payload };
|
|
342
|
-
},
|
|
343
|
-
},
|
|
344
|
-
createSubTaskSuccessOrFailure(draft, action) {
|
|
345
|
-
const { fetchState, error } = action.payload;
|
|
346
|
-
draft.subTaskCreateStatus = {
|
|
347
|
-
fetchState,
|
|
348
|
-
error,
|
|
349
|
-
};
|
|
350
|
-
},
|
|
351
|
-
resetSubTaskCreateStatus(draft) {
|
|
352
|
-
draft.subTaskCreateStatus = {
|
|
353
|
-
...exports.initialState.subTaskCreateStatus,
|
|
354
|
-
};
|
|
355
|
-
},
|
|
356
|
-
fetchSubTasks: {
|
|
357
|
-
reducer(draft, action) {
|
|
358
|
-
const { parentTaskId } = action.payload;
|
|
359
|
-
draft.subTaskListFetchStatusByParentId[parentTaskId] = {
|
|
360
|
-
fetchState: 'In-Progress',
|
|
361
|
-
error: undefined,
|
|
362
|
-
};
|
|
363
|
-
},
|
|
364
|
-
prepare(parentTaskId) {
|
|
365
|
-
return { payload: { parentTaskId } };
|
|
366
|
-
},
|
|
367
|
-
},
|
|
368
|
-
updateSubTasks(draft, action) {
|
|
369
|
-
const { parentTaskId } = action.payload;
|
|
370
|
-
draft.subTaskListFetchStatusByParentId[parentTaskId] = {
|
|
371
|
-
fetchState: 'Completed',
|
|
372
|
-
error: undefined,
|
|
373
|
-
};
|
|
374
|
-
},
|
|
375
|
-
updateSubTasksFetchStatus(draft, action) {
|
|
376
|
-
const { parentTaskId, fetchState, error } = action.payload;
|
|
377
|
-
draft.subTaskListFetchStatusByParentId[parentTaskId] = {
|
|
378
|
-
fetchState,
|
|
379
|
-
error,
|
|
380
|
-
};
|
|
381
|
-
},
|
|
382
328
|
clearTaskDetail(draft) {
|
|
383
329
|
Object.assign(draft, exports.initialState);
|
|
384
330
|
},
|
|
385
331
|
},
|
|
386
332
|
});
|
|
387
|
-
_a = taskDetailView.actions, exports.fetchTaskDetailPage = _a.fetchTaskDetailPage, exports.fetchTaskDetail = _a.fetchTaskDetail, exports.initializeTaskToLocalStore = _a.initializeTaskToLocalStore, exports.updateEditTaskFetchStatus = _a.updateEditTaskFetchStatus, exports.saveTaskUpdatesToLocalStore = _a.saveTaskUpdatesToLocalStore, exports.discardTaskUpdatesInLocalStore = _a.discardTaskUpdatesInLocalStore, exports.saveTaskDetail = _a.saveTaskDetail, exports.archiveTask = _a.archiveTask, exports.archiveTaskSuccessOrFailure = _a.archiveTaskSuccessOrFailure, exports.saveTaskSuccessOrFailure = _a.saveTaskSuccessOrFailure, exports.
|
|
333
|
+
_a = taskDetailView.actions, exports.fetchTaskDetailPage = _a.fetchTaskDetailPage, exports.fetchTaskDetail = _a.fetchTaskDetail, exports.initializeTaskToLocalStore = _a.initializeTaskToLocalStore, exports.updateEditTaskFetchStatus = _a.updateEditTaskFetchStatus, exports.saveTaskUpdatesToLocalStore = _a.saveTaskUpdatesToLocalStore, exports.discardTaskUpdatesInLocalStore = _a.discardTaskUpdatesInLocalStore, exports.saveTaskDetail = _a.saveTaskDetail, exports.archiveTask = _a.archiveTask, exports.archiveTaskSuccessOrFailure = _a.archiveTaskSuccessOrFailure, exports.saveTaskSuccessOrFailure = _a.saveTaskSuccessOrFailure, exports.deleteTask = _a.deleteTask, exports.removeTaskDetail = _a.removeTaskDetail, exports.deleteTaskSuccessOrFailure = _a.deleteTaskSuccessOrFailure, exports.snoozeTask = _a.snoozeTask, exports.snoozeTaskSuccessOrFailure = _a.snoozeTaskSuccessOrFailure, exports.unsnoozeTask = _a.unsnoozeTask, exports.fetchTaskHistory = _a.fetchTaskHistory, exports.updateTaskHistory = _a.updateTaskHistory, exports.updateTaskHistoryFetchStatus = _a.updateTaskHistoryFetchStatus, exports.clearTaskDetail = _a.clearTaskDetail, exports.updateCreatedTagToLocalStore = _a.updateCreatedTagToLocalStore, exports.updateDeletedTagToLocalStore = _a.updateDeletedTagToLocalStore;
|
|
388
334
|
exports.default = taskDetailView.reducer;
|
|
@@ -2,7 +2,7 @@ import { FetchStateAndError, ID } from '../../../commonStateTypes/common';
|
|
|
2
2
|
import { SelectorView } from '../../../commonStateTypes/viewAndReport/viewAndReport';
|
|
3
3
|
import { Class } from '../../../entity/class/classState';
|
|
4
4
|
import { File } from '../../../entity/file/fileState';
|
|
5
|
-
import {
|
|
5
|
+
import { TaskPriority, TaskStatus } from '../../../entity/task/taskState';
|
|
6
6
|
import { RootState } from '../../../reducer';
|
|
7
7
|
import { ZeniDate } from '../../../zeniDayJS';
|
|
8
8
|
import { UserAndRole } from '../../companyView/types/userAndRole';
|
|
@@ -14,7 +14,6 @@ export interface TaskDetailSelectorView extends SelectorView {
|
|
|
14
14
|
deleteFileStatusById: Record<ID, FetchStateAndError | undefined>;
|
|
15
15
|
files: File[];
|
|
16
16
|
showTaskDetailFormFooter: boolean;
|
|
17
|
-
subtasks: Task[];
|
|
18
17
|
taskDetailView: EditTaskDetail;
|
|
19
18
|
taskHistory: HistoricEvent[];
|
|
20
19
|
updateFileStatusById: Record<ID, FetchStateAndError | undefined>;
|
|
@@ -33,13 +33,8 @@ const getTaskDetail = (state, taskId) => {
|
|
|
33
33
|
let recurringSourceTaskId = undefined;
|
|
34
34
|
let snoozedUntil = undefined;
|
|
35
35
|
let taskGroupId = undefined;
|
|
36
|
-
let subtasks = [];
|
|
37
36
|
if (taskId != null && sourceTaskDetail != null) {
|
|
38
37
|
const taskEntity = (0, taskSelector_1.getTaskById)(taskState, taskId);
|
|
39
|
-
subtasks =
|
|
40
|
-
taskEntity != null
|
|
41
|
-
? (0, taskSelector_1.getTasksByIds)(taskState, taskEntity.subTasksIds)
|
|
42
|
-
: [];
|
|
43
38
|
const fileIdsInEntity = taskEntity?.fileIds ?? [];
|
|
44
39
|
if (taskEntity != null) {
|
|
45
40
|
createdByUser = (0, userAndRole_1.getUserAndUserRole)(userState, userRoleState, addressState, taskEntity.createdBy);
|
|
@@ -49,37 +44,26 @@ const getTaskDetail = (state, taskId) => {
|
|
|
49
44
|
snoozedUntil = taskEntity.snoozedUntil;
|
|
50
45
|
taskGroupId = taskEntity.taskGroupIds[0];
|
|
51
46
|
}
|
|
52
|
-
// Treat "no entry" as Completed so it doesn't block the combined
|
|
53
|
-
// fetch state. The Not-Started default would pin the detail page
|
|
54
|
-
// below Completed forever before the first fetchSubTasks dispatches.
|
|
55
|
-
const completedSubTaskStatus = {
|
|
56
|
-
fetchState: 'Completed',
|
|
57
|
-
error: undefined,
|
|
58
|
-
};
|
|
59
|
-
const subTaskStatus = taskDetailState.subTaskListFetchStatusByParentId[taskId] ??
|
|
60
|
-
completedSubTaskStatus;
|
|
61
47
|
if (fileIdsInEntity.length > 0) {
|
|
62
|
-
fetchStatus = (0, reduceFetchState_1.
|
|
48
|
+
fetchStatus = (0, reduceFetchState_1.reduceFetchState)([
|
|
63
49
|
fileViewState.fetchFilesStatus,
|
|
64
50
|
sourceTaskDetail.fetchTaskStatus,
|
|
65
51
|
userList,
|
|
66
52
|
classListState,
|
|
67
|
-
subTaskStatus,
|
|
68
53
|
]);
|
|
69
54
|
}
|
|
70
55
|
else {
|
|
71
|
-
fetchStatus = (0, reduceFetchState_1.
|
|
56
|
+
fetchStatus = (0, reduceFetchState_1.reduceFetchState)([
|
|
72
57
|
sourceTaskDetail.fetchTaskStatus,
|
|
73
58
|
userList,
|
|
74
59
|
classListState,
|
|
75
|
-
subTaskStatus,
|
|
76
60
|
]);
|
|
77
61
|
}
|
|
78
62
|
showTaskDetailFormFooter = showFormFooter(sourceTaskDetail.taskDetailLocalData, taskEntity);
|
|
79
63
|
taskHistory = taskDetailState.taskHistoryById[taskId]?.historicEvents ?? [];
|
|
80
64
|
}
|
|
81
65
|
else if (taskId == null) {
|
|
82
|
-
fetchStatus = (0, reduceFetchState_1.
|
|
66
|
+
fetchStatus = (0, reduceFetchState_1.reduceFetchState)([userList, classListState]);
|
|
83
67
|
}
|
|
84
68
|
const { classIds } = classListState;
|
|
85
69
|
const allAccountingClasses = (0, classSelector_1.getClassesByIds)(classState, {
|
|
@@ -112,7 +96,6 @@ const getTaskDetail = (state, taskId) => {
|
|
|
112
96
|
showTaskDetailFormFooter,
|
|
113
97
|
snoozedUntil,
|
|
114
98
|
taskGroupId,
|
|
115
|
-
subtasks,
|
|
116
99
|
};
|
|
117
100
|
};
|
|
118
101
|
exports.getTaskDetail = getTaskDetail;
|
|
@@ -161,16 +144,13 @@ exports.allTaskPriority = [
|
|
|
161
144
|
},
|
|
162
145
|
];
|
|
163
146
|
const showFormFooter = (taskDetailLocalData, taskDetailInStore) => {
|
|
164
|
-
if (
|
|
165
|
-
return false;
|
|
166
|
-
}
|
|
167
|
-
if (taskDetailLocalData.name !== taskDetailInStore.name ||
|
|
147
|
+
if (taskDetailLocalData.name !== taskDetailInStore?.name ||
|
|
168
148
|
taskDetailLocalData.description !== taskDetailInStore.description ||
|
|
169
149
|
taskDetailLocalData.priority !== taskDetailInStore.priority.code ||
|
|
170
150
|
taskDetailLocalData.status !== taskDetailInStore.status.code ||
|
|
171
151
|
!(0, isEqual_1.default)(taskDetailInStore.tagIds, taskDetailLocalData.tagIds) ||
|
|
172
|
-
!(0, isEqual_1.default)(taskDetailLocalData.assignee, taskDetailInStore
|
|
173
|
-
!(0, isEqual_1.default)(taskDetailLocalData.groupAssignees, taskDetailInStore
|
|
152
|
+
!(0, isEqual_1.default)(taskDetailLocalData.assignee, taskDetailInStore?.assignees ?? []) ||
|
|
153
|
+
!(0, isEqual_1.default)(taskDetailLocalData.groupAssignees, taskDetailInStore?.groupAssignees ?? []) ||
|
|
174
154
|
!(0, isEqual_1.default)(taskDetailLocalData.fileIds, taskDetailInStore.fileIds ?? []) ||
|
|
175
155
|
!(0, isEqual_1.default)(taskDetailLocalData.dueDate, taskDetailInStore.dueDate) ||
|
|
176
156
|
!(0, isEqual_1.default)(taskDetailLocalData.type, taskDetailInStore.type) ||
|
|
@@ -178,10 +158,7 @@ const showFormFooter = (taskDetailLocalData, taskDetailInStore) => {
|
|
|
178
158
|
!(0, isEqual_1.default)(taskDetailLocalData.recurringFrequency, taskDetailInStore.recurringFrequency) ||
|
|
179
159
|
!(0, isEqual_1.default)(taskDetailLocalData.recurringDaysOfWeek, taskDetailInStore.recurringDaysOfWeek) ||
|
|
180
160
|
!(0, isEqual_1.default)(taskDetailLocalData.recurringStartDate, taskDetailInStore.recurringStartDate) ||
|
|
181
|
-
!(0, isEqual_1.default)(taskDetailLocalData.timeSpent, taskDetailInStore.timeSpent)
|
|
182
|
-
!(0, isEqual_1.default)(taskDetailLocalData.taskGroupId, taskDetailInStore.taskGroupIds.length > 0
|
|
183
|
-
? taskDetailInStore.taskGroupIds[0]
|
|
184
|
-
: undefined)) {
|
|
161
|
+
!(0, isEqual_1.default)(taskDetailLocalData.timeSpent, taskDetailInStore.timeSpent)) {
|
|
185
162
|
return true;
|
|
186
163
|
}
|
|
187
164
|
return false;
|
|
@@ -12,17 +12,15 @@ const fetchTaskListEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, oper
|
|
|
12
12
|
.getJSON(`${zeniAPI.apiEndPoints.taskMicroServiceBaseUrl}/1.0/task-manager/tasks?query=${encodeURIComponent(`{"task_type": "all"}`)}`)
|
|
13
13
|
.pipe((0, operators_1.mergeMap)((response) => {
|
|
14
14
|
if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
|
|
15
|
-
const { tasks, deleted, archived, snoozed
|
|
15
|
+
const { tasks, deleted, archived, snoozed } = response.data;
|
|
16
16
|
const allTasks = [
|
|
17
17
|
...tasks,
|
|
18
|
-
...(completed ?? []),
|
|
19
18
|
...(deleted ?? []),
|
|
20
19
|
...(archived ?? []),
|
|
21
20
|
...(snoozed ?? []),
|
|
22
21
|
];
|
|
23
22
|
return (0, rxjs_1.of)((0, taskReducer_1.updateTasks)(allTasks), (0, taskListReducer_1.updateTaskList)({
|
|
24
23
|
data: tasks,
|
|
25
|
-
completed: completed ?? [],
|
|
26
24
|
deleted: deleted ?? [],
|
|
27
25
|
archived: archived ?? [],
|
|
28
26
|
snoozed: snoozed ?? [],
|
|
@@ -3,7 +3,7 @@ import { PriorityCodeType, TaskStatusCodeType } from '../../../entity/task/taskS
|
|
|
3
3
|
import { ZeniDate } from '../../../zeniDayJS';
|
|
4
4
|
import { SpendManagementUIState } from '../../spendManagement/billPay/billList/billListState';
|
|
5
5
|
import { CategoryCombinationOperator, FilterCategoryType } from '../../spendManagement/spendManagementFilterHelpers';
|
|
6
|
-
export declare const ALL_TASK_LIST_TABS: readonly ["live", "
|
|
6
|
+
export declare const ALL_TASK_LIST_TABS: readonly ["live", "archived", "deleted", "snoozed"];
|
|
7
7
|
export type TaskListTab = (typeof ALL_TASK_LIST_TABS)[number];
|
|
8
8
|
export interface TaskListTabData {
|
|
9
9
|
taskIds: ID[];
|
|
@@ -3,10 +3,6 @@ import { ZeniAPIResponse } from '../../../responsePayload';
|
|
|
3
3
|
interface FetchTaskListPayload {
|
|
4
4
|
tasks: TaskPayload[];
|
|
5
5
|
archived?: TaskPayload[];
|
|
6
|
-
/** Tasks whose status is "done" or "resolved". Returned as a separate
|
|
7
|
-
* bucket so the "Completed" tab can show them without duplicating
|
|
8
|
-
* them under Active. */
|
|
9
|
-
completed?: TaskPayload[];
|
|
10
6
|
deleted?: TaskPayload[];
|
|
11
7
|
snoozed?: TaskPayload[];
|
|
12
8
|
}
|
|
@@ -12,10 +12,9 @@ export declare const fetchTaskListPage: import("@reduxjs/toolkit").ActionCreator
|
|
|
12
12
|
}, "taskList/fetchTaskListPage", never, never>, fetchTaskList: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"taskList/fetchTaskList">, updateTaskList: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
13
13
|
data: TaskPayload[];
|
|
14
14
|
archived?: TaskPayload[];
|
|
15
|
-
completed?: TaskPayload[];
|
|
16
15
|
deleted?: TaskPayload[];
|
|
17
16
|
snoozed?: TaskPayload[];
|
|
18
|
-
}, "taskList/updateTaskList">, updateTaskListTab: import("@reduxjs/toolkit").ActionCreatorWithPayload<"
|
|
17
|
+
}, "taskList/updateTaskList">, updateTaskListTab: import("@reduxjs/toolkit").ActionCreatorWithPayload<"deleted" | "archived" | "live" | "snoozed", "taskList/updateTaskListTab">, updateTaskListFetchStatus: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
19
18
|
fetchState: FetchState;
|
|
20
19
|
error?: ZeniAPIStatus;
|
|
21
20
|
}, "taskList/updateTaskListFetchStatus">, updateTaskListSearchText: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
@@ -59,9 +58,6 @@ export declare const fetchTaskListPage: import("@reduxjs/toolkit").ActionCreator
|
|
|
59
58
|
error: ZeniAPIStatus;
|
|
60
59
|
}, "taskList/updateTasksListOnUpdateTaskFailure">, updateTaskListOnCreateTaskFromTemplateSuccess: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
61
60
|
tasks: TaskPayload[];
|
|
62
|
-
}, "taskList/updateTaskListOnCreateTaskFromTemplateSuccess">, removeTaskFromList: import("@reduxjs/toolkit").ActionCreatorWithPayload<string, "taskList/removeTaskFromList">,
|
|
63
|
-
taskGroupId: ID;
|
|
64
|
-
taskId: ID;
|
|
65
|
-
}, "taskList/removeTaskFromGroupBucket">, clearTaskList: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"taskList/clearTaskList">;
|
|
61
|
+
}, "taskList/updateTaskListOnCreateTaskFromTemplateSuccess">, removeTaskFromList: import("@reduxjs/toolkit").ActionCreatorWithPayload<string, "taskList/removeTaskFromList">, clearTaskList: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"taskList/clearTaskList">;
|
|
66
62
|
declare const _default: import("redux").Reducer<TaskListState>;
|
|
67
63
|
export default _default;
|