@zeniai/client-epic-state 5.1.3-betaJK1 → 5.1.3-betaVR1
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 +0 -1
- package/lib/entity/task/taskPayload.js +0 -1
- package/lib/entity/task/taskReducer.d.ts +1 -5
- package/lib/entity/task/taskReducer.js +2 -8
- package/lib/entity/task/taskState.d.ts +0 -1
- package/lib/epic.d.ts +1 -3
- package/lib/epic.js +1 -3
- package/lib/esm/entity/snackbar/snackbarTypes.js +0 -1
- package/lib/esm/entity/task/taskPayload.js +0 -1
- package/lib/esm/entity/task/taskReducer.js +1 -7
- package/lib/esm/epic.js +1 -3
- package/lib/esm/index.js +5 -4
- package/lib/esm/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.js +200 -0
- package/lib/esm/view/expenseAutomationView/reducers/transactionsViewReducer.js +96 -2
- package/lib/esm/view/taskManager/taskDetailView/epics/fetchTaskDetailEpic.js +0 -13
- package/lib/esm/view/taskManager/taskDetailView/taskDetailReducer.js +2 -56
- package/lib/esm/view/taskManager/taskDetailView/taskDetailSelector.js +8 -19
- package/lib/index.d.ts +7 -6
- package/lib/index.js +41 -39
- package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.d.ts +37 -2
- package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.js +205 -1
- package/lib/view/expenseAutomationView/reducers/transactionsViewReducer.d.ts +28 -2
- package/lib/view/expenseAutomationView/reducers/transactionsViewReducer.js +96 -2
- package/lib/view/expenseAutomationView/types/transactionsViewState.d.ts +39 -0
- package/lib/view/taskManager/taskDetailView/epics/fetchTaskDetailEpic.d.ts +1 -2
- package/lib/view/taskManager/taskDetailView/epics/fetchTaskDetailEpic.js +0 -13
- package/lib/view/taskManager/taskDetailView/taskDetail.d.ts +0 -13
- 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 +6 -17
- package/package.json +2 -2
- package/lib/esm/view/taskManager/taskDetailView/epics/createSubTaskEpic.js +0 -80
- package/lib/esm/view/taskManager/taskDetailView/epics/fetchSubTasksEpic.js +0 -36
- package/lib/view/taskManager/taskDetailView/epics/createSubTaskEpic.d.ts +0 -9
- package/lib/view/taskManager/taskDetailView/epics/createSubTaskEpic.js +0 -84
- package/lib/view/taskManager/taskDetailView/epics/fetchSubTasksEpic.d.ts +0 -8
- package/lib/view/taskManager/taskDetailView/epics/fetchSubTasksEpic.js +0 -40
|
@@ -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);
|
|
@@ -50,27 +45,25 @@ const getTaskDetail = (state, taskId) => {
|
|
|
50
45
|
taskGroupId = taskEntity.taskGroupIds[0];
|
|
51
46
|
}
|
|
52
47
|
if (fileIdsInEntity.length > 0) {
|
|
53
|
-
fetchStatus = (0, reduceFetchState_1.
|
|
48
|
+
fetchStatus = (0, reduceFetchState_1.reduceFetchState)([
|
|
54
49
|
fileViewState.fetchFilesStatus,
|
|
55
50
|
sourceTaskDetail.fetchTaskStatus,
|
|
56
51
|
userList,
|
|
57
52
|
classListState,
|
|
58
|
-
taskDetailState.subTaskListFetchStatusByParentId[taskId] ?? fetchStatus,
|
|
59
53
|
]);
|
|
60
54
|
}
|
|
61
55
|
else {
|
|
62
|
-
fetchStatus = (0, reduceFetchState_1.
|
|
56
|
+
fetchStatus = (0, reduceFetchState_1.reduceFetchState)([
|
|
63
57
|
sourceTaskDetail.fetchTaskStatus,
|
|
64
58
|
userList,
|
|
65
59
|
classListState,
|
|
66
|
-
taskDetailState.subTaskListFetchStatusByParentId[taskId] ?? fetchStatus,
|
|
67
60
|
]);
|
|
68
61
|
}
|
|
69
62
|
showTaskDetailFormFooter = showFormFooter(sourceTaskDetail.taskDetailLocalData, taskEntity);
|
|
70
63
|
taskHistory = taskDetailState.taskHistoryById[taskId]?.historicEvents ?? [];
|
|
71
64
|
}
|
|
72
65
|
else if (taskId == null) {
|
|
73
|
-
fetchStatus = (0, reduceFetchState_1.
|
|
66
|
+
fetchStatus = (0, reduceFetchState_1.reduceFetchState)([userList, classListState]);
|
|
74
67
|
}
|
|
75
68
|
const { classIds } = classListState;
|
|
76
69
|
const allAccountingClasses = (0, classSelector_1.getClassesByIds)(classState, {
|
|
@@ -103,7 +96,6 @@ const getTaskDetail = (state, taskId) => {
|
|
|
103
96
|
showTaskDetailFormFooter,
|
|
104
97
|
snoozedUntil,
|
|
105
98
|
taskGroupId,
|
|
106
|
-
subtasks,
|
|
107
99
|
};
|
|
108
100
|
};
|
|
109
101
|
exports.getTaskDetail = getTaskDetail;
|
|
@@ -152,16 +144,13 @@ exports.allTaskPriority = [
|
|
|
152
144
|
},
|
|
153
145
|
];
|
|
154
146
|
const showFormFooter = (taskDetailLocalData, taskDetailInStore) => {
|
|
155
|
-
if (
|
|
156
|
-
return false;
|
|
157
|
-
}
|
|
158
|
-
if (taskDetailLocalData.name !== taskDetailInStore.name ||
|
|
147
|
+
if (taskDetailLocalData.name !== taskDetailInStore?.name ||
|
|
159
148
|
taskDetailLocalData.description !== taskDetailInStore.description ||
|
|
160
149
|
taskDetailLocalData.priority !== taskDetailInStore.priority.code ||
|
|
161
150
|
taskDetailLocalData.status !== taskDetailInStore.status.code ||
|
|
162
151
|
!(0, isEqual_1.default)(taskDetailInStore.tagIds, taskDetailLocalData.tagIds) ||
|
|
163
|
-
!(0, isEqual_1.default)(taskDetailLocalData.assignee, taskDetailInStore
|
|
164
|
-
!(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 ?? []) ||
|
|
165
154
|
!(0, isEqual_1.default)(taskDetailLocalData.fileIds, taskDetailInStore.fileIds ?? []) ||
|
|
166
155
|
!(0, isEqual_1.default)(taskDetailLocalData.dueDate, taskDetailInStore.dueDate) ||
|
|
167
156
|
!(0, isEqual_1.default)(taskDetailLocalData.type, taskDetailInStore.type) ||
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zeniai/client-epic-state",
|
|
3
|
-
"version": "5.1.3-
|
|
3
|
+
"version": "5.1.3-betaVR1",
|
|
4
4
|
"description": "Shared module between Web & Mobile containing required abstractions for state management, async network communication. ",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "lib/esm/index.js",
|
|
@@ -117,7 +117,7 @@
|
|
|
117
117
|
"find-dead-code": "ts-prune | grep -v '(used in module)'",
|
|
118
118
|
"find-unused-exports": "ts-unused-exports ./tsconfig.json",
|
|
119
119
|
"circular-dependency": "npx madge --circular --extensions ts ./src",
|
|
120
|
-
"build": "concurrently --kill-others-on-fail --handle-input \"echo 'TypeScript build in progress...' && time tsc && echo 'ESM build...' && tsc -p tsconfig.esm.json\"
|
|
120
|
+
"build": "concurrently --kill-others-on-fail --handle-input \"echo 'TypeScript build in progress...' && time tsc && echo 'ESM build...' && tsc -p tsconfig.esm.json\"",
|
|
121
121
|
"only-build": "eslint . --ext .js,.jsx,.ts,.tsx && time tsc && tsc -p tsconfig.esm.json && rimraf \"lib/**/__mocks__\" \"lib/**/__testHelpers__\"",
|
|
122
122
|
"only-build-dev": "eslint . --ext .js,.jsx,.ts,.tsx && time tsc -p tsconfig.dev.json && tsc -p tsconfig.esm.dev.json && rimraf \"lib/**/__mocks__\" \"lib/**/__testHelpers__\"",
|
|
123
123
|
"format": "prettier --write --ignore-unknown \"src/**/*\" && pnpm lint",
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
import { from, of } from 'rxjs';
|
|
2
|
-
import { catchError, filter, mergeMap } from 'rxjs/operators';
|
|
3
|
-
import { convertHHMMStrToMinutes } from '../../../../commonStateTypes/fiscalYearHelpers/formatMinutesToFromHHMM';
|
|
4
|
-
import { openSnackbar } from '../../../../entity/snackbar/snackbarReducer';
|
|
5
|
-
import { appendSubTaskId, updateTasks, } from '../../../../entity/task/taskReducer';
|
|
6
|
-
import { getTaskById } from '../../../../entity/task/taskSelector';
|
|
7
|
-
import { createZeniAPIStatus, isSuccessResponse, } from '../../../../responsePayload';
|
|
8
|
-
import { updateTaskListOnNewTaskCreationSuccess } from '../../taskListView/taskListReducer';
|
|
9
|
-
import { createSubTask, createSubTaskSuccessOrFailure, } from '../taskDetailReducer';
|
|
10
|
-
export const createSubTaskEpic = (actions$, state$, zeniAPI) => actions$.pipe(filter(createSubTask.match), mergeMap((action) => {
|
|
11
|
-
const state = state$.value;
|
|
12
|
-
const parentTask = getTaskById(state.taskState, action.payload.parentTaskId);
|
|
13
|
-
const parentTaskGroupId = parentTask?.taskGroupIds[0];
|
|
14
|
-
const isTaskListFetched = state.taskListState.fetchState === 'Completed';
|
|
15
|
-
const payload = prepareSubTaskPayload(action.payload, parentTaskGroupId);
|
|
16
|
-
return zeniAPI
|
|
17
|
-
.postAndGetJSON(`${zeniAPI.apiEndPoints.taskMicroServiceBaseUrl}/1.0/task-manager/tasks`, payload)
|
|
18
|
-
.pipe(mergeMap((response) => {
|
|
19
|
-
if (isSuccessResponse(response) &&
|
|
20
|
-
response.data != null &&
|
|
21
|
-
response.data.tasks.length > 0) {
|
|
22
|
-
const newTaskId = response.data.tasks[0].task_id;
|
|
23
|
-
const actions = [
|
|
24
|
-
updateTasks(response.data.tasks),
|
|
25
|
-
appendSubTaskId({
|
|
26
|
-
parentTaskId: action.payload.parentTaskId,
|
|
27
|
-
subTaskId: newTaskId,
|
|
28
|
-
}),
|
|
29
|
-
createSubTaskSuccessOrFailure({
|
|
30
|
-
fetchState: 'Completed',
|
|
31
|
-
newTaskId,
|
|
32
|
-
}),
|
|
33
|
-
openSnackbar({
|
|
34
|
-
messageSection: 'create_sub_task',
|
|
35
|
-
messageText: 'success',
|
|
36
|
-
type: 'success',
|
|
37
|
-
}),
|
|
38
|
-
];
|
|
39
|
-
if (isTaskListFetched === true && parentTaskGroupId != null) {
|
|
40
|
-
actions.push(updateTaskListOnNewTaskCreationSuccess({
|
|
41
|
-
taskGroupId: parentTaskGroupId,
|
|
42
|
-
task: response.data.tasks[0],
|
|
43
|
-
}));
|
|
44
|
-
}
|
|
45
|
-
return from(actions);
|
|
46
|
-
}
|
|
47
|
-
else {
|
|
48
|
-
return of(createSubTaskSuccessOrFailure({
|
|
49
|
-
fetchState: 'Error',
|
|
50
|
-
error: response.status,
|
|
51
|
-
}), openSnackbar({
|
|
52
|
-
messageSection: 'create_sub_task',
|
|
53
|
-
messageText: 'failed',
|
|
54
|
-
type: 'error',
|
|
55
|
-
variables: [
|
|
56
|
-
{
|
|
57
|
-
variableName: '_api-error_',
|
|
58
|
-
variableValue: response.status.message,
|
|
59
|
-
},
|
|
60
|
-
],
|
|
61
|
-
}));
|
|
62
|
-
}
|
|
63
|
-
}), catchError((error) => of(createSubTaskSuccessOrFailure({
|
|
64
|
-
fetchState: 'Error',
|
|
65
|
-
error: createZeniAPIStatus('Unexpected Error', 'Create Sub Task REST API call errored out' +
|
|
66
|
-
JSON.stringify(error)),
|
|
67
|
-
}))));
|
|
68
|
-
}));
|
|
69
|
-
const prepareSubTaskPayload = (subTask, parentTaskGroupId) => ({
|
|
70
|
-
name: subTask.name,
|
|
71
|
-
assignees: subTask.assignee,
|
|
72
|
-
description: subTask.description,
|
|
73
|
-
priority: subTask.priority,
|
|
74
|
-
status: subTask.status,
|
|
75
|
-
tags: subTask.tagIds,
|
|
76
|
-
time_spent: convertHHMMStrToMinutes(subTask.timeSpent),
|
|
77
|
-
group_assignees: subTask.groupAssignees,
|
|
78
|
-
parent_task_id: subTask.parentTaskId,
|
|
79
|
-
task_group_ids: parentTaskGroupId == null ? [] : [parentTaskGroupId],
|
|
80
|
-
});
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { of } from 'rxjs';
|
|
2
|
-
import { catchError, filter, mergeMap, switchMap } from 'rxjs/operators';
|
|
3
|
-
import { updateTasks } from '../../../../entity/task/taskReducer';
|
|
4
|
-
import { createZeniAPIStatus, isSuccessResponse, } from '../../../../responsePayload';
|
|
5
|
-
import { fetchSubTasks, updateSubTasks, updateSubTasksFetchStatus, } from '../taskDetailReducer';
|
|
6
|
-
export const fetchSubTasksEpic = (actions$, _state$, zeniAPI) => actions$.pipe(filter(fetchSubTasks.match), switchMap((action) => {
|
|
7
|
-
const { parentTaskId } = action.payload;
|
|
8
|
-
const query = JSON.stringify({
|
|
9
|
-
task_type: 'subtasks',
|
|
10
|
-
parent_task_id: parentTaskId,
|
|
11
|
-
});
|
|
12
|
-
return zeniAPI
|
|
13
|
-
.getJSON(`${zeniAPI.apiEndPoints.taskMicroServiceBaseUrl}/1.0/task-manager/tasks?query=${encodeURIComponent(query)}`)
|
|
14
|
-
.pipe(mergeMap((response) => {
|
|
15
|
-
if (isSuccessResponse(response) && response.data != null) {
|
|
16
|
-
const { tasks } = response.data;
|
|
17
|
-
return of(updateTasks(tasks), updateSubTasks({
|
|
18
|
-
parentTaskId,
|
|
19
|
-
}));
|
|
20
|
-
}
|
|
21
|
-
else {
|
|
22
|
-
return of(updateSubTasksFetchStatus({
|
|
23
|
-
parentTaskId,
|
|
24
|
-
fetchState: 'Error',
|
|
25
|
-
error: response.status,
|
|
26
|
-
}));
|
|
27
|
-
}
|
|
28
|
-
}), catchError((error) => {
|
|
29
|
-
return of(updateSubTasksFetchStatus({
|
|
30
|
-
parentTaskId,
|
|
31
|
-
fetchState: 'Error',
|
|
32
|
-
error: createZeniAPIStatus('Unexpected Error', 'Fetch Sub Tasks REST API call errored out' +
|
|
33
|
-
JSON.stringify(error)),
|
|
34
|
-
}));
|
|
35
|
-
}));
|
|
36
|
-
}));
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { ActionsObservable, StateObservable } from 'redux-observable';
|
|
2
|
-
import { openSnackbar } from '../../../../entity/snackbar/snackbarReducer';
|
|
3
|
-
import { appendSubTaskId, updateTasks } from '../../../../entity/task/taskReducer';
|
|
4
|
-
import { RootState } from '../../../../reducer';
|
|
5
|
-
import { ZeniAPI } from '../../../../zeniAPI';
|
|
6
|
-
import { updateTaskListOnNewTaskCreationSuccess } from '../../taskListView/taskListReducer';
|
|
7
|
-
import { createSubTask, createSubTaskSuccessOrFailure } from '../taskDetailReducer';
|
|
8
|
-
export type ActionType = ReturnType<typeof createSubTask> | ReturnType<typeof updateTasks> | ReturnType<typeof appendSubTaskId> | ReturnType<typeof openSnackbar> | ReturnType<typeof updateTaskListOnNewTaskCreationSuccess> | ReturnType<typeof createSubTaskSuccessOrFailure>;
|
|
9
|
-
export declare const createSubTaskEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => import("rxjs").Observable<ActionType>;
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createSubTaskEpic = void 0;
|
|
4
|
-
const rxjs_1 = require("rxjs");
|
|
5
|
-
const operators_1 = require("rxjs/operators");
|
|
6
|
-
const formatMinutesToFromHHMM_1 = require("../../../../commonStateTypes/fiscalYearHelpers/formatMinutesToFromHHMM");
|
|
7
|
-
const snackbarReducer_1 = require("../../../../entity/snackbar/snackbarReducer");
|
|
8
|
-
const taskReducer_1 = require("../../../../entity/task/taskReducer");
|
|
9
|
-
const taskSelector_1 = require("../../../../entity/task/taskSelector");
|
|
10
|
-
const responsePayload_1 = require("../../../../responsePayload");
|
|
11
|
-
const taskListReducer_1 = require("../../taskListView/taskListReducer");
|
|
12
|
-
const taskDetailReducer_1 = require("../taskDetailReducer");
|
|
13
|
-
const createSubTaskEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(taskDetailReducer_1.createSubTask.match), (0, operators_1.mergeMap)((action) => {
|
|
14
|
-
const state = state$.value;
|
|
15
|
-
const parentTask = (0, taskSelector_1.getTaskById)(state.taskState, action.payload.parentTaskId);
|
|
16
|
-
const parentTaskGroupId = parentTask?.taskGroupIds[0];
|
|
17
|
-
const isTaskListFetched = state.taskListState.fetchState === 'Completed';
|
|
18
|
-
const payload = prepareSubTaskPayload(action.payload, parentTaskGroupId);
|
|
19
|
-
return zeniAPI
|
|
20
|
-
.postAndGetJSON(`${zeniAPI.apiEndPoints.taskMicroServiceBaseUrl}/1.0/task-manager/tasks`, payload)
|
|
21
|
-
.pipe((0, operators_1.mergeMap)((response) => {
|
|
22
|
-
if ((0, responsePayload_1.isSuccessResponse)(response) &&
|
|
23
|
-
response.data != null &&
|
|
24
|
-
response.data.tasks.length > 0) {
|
|
25
|
-
const newTaskId = response.data.tasks[0].task_id;
|
|
26
|
-
const actions = [
|
|
27
|
-
(0, taskReducer_1.updateTasks)(response.data.tasks),
|
|
28
|
-
(0, taskReducer_1.appendSubTaskId)({
|
|
29
|
-
parentTaskId: action.payload.parentTaskId,
|
|
30
|
-
subTaskId: newTaskId,
|
|
31
|
-
}),
|
|
32
|
-
(0, taskDetailReducer_1.createSubTaskSuccessOrFailure)({
|
|
33
|
-
fetchState: 'Completed',
|
|
34
|
-
newTaskId,
|
|
35
|
-
}),
|
|
36
|
-
(0, snackbarReducer_1.openSnackbar)({
|
|
37
|
-
messageSection: 'create_sub_task',
|
|
38
|
-
messageText: 'success',
|
|
39
|
-
type: 'success',
|
|
40
|
-
}),
|
|
41
|
-
];
|
|
42
|
-
if (isTaskListFetched === true && parentTaskGroupId != null) {
|
|
43
|
-
actions.push((0, taskListReducer_1.updateTaskListOnNewTaskCreationSuccess)({
|
|
44
|
-
taskGroupId: parentTaskGroupId,
|
|
45
|
-
task: response.data.tasks[0],
|
|
46
|
-
}));
|
|
47
|
-
}
|
|
48
|
-
return (0, rxjs_1.from)(actions);
|
|
49
|
-
}
|
|
50
|
-
else {
|
|
51
|
-
return (0, rxjs_1.of)((0, taskDetailReducer_1.createSubTaskSuccessOrFailure)({
|
|
52
|
-
fetchState: 'Error',
|
|
53
|
-
error: response.status,
|
|
54
|
-
}), (0, snackbarReducer_1.openSnackbar)({
|
|
55
|
-
messageSection: 'create_sub_task',
|
|
56
|
-
messageText: 'failed',
|
|
57
|
-
type: 'error',
|
|
58
|
-
variables: [
|
|
59
|
-
{
|
|
60
|
-
variableName: '_api-error_',
|
|
61
|
-
variableValue: response.status.message,
|
|
62
|
-
},
|
|
63
|
-
],
|
|
64
|
-
}));
|
|
65
|
-
}
|
|
66
|
-
}), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, taskDetailReducer_1.createSubTaskSuccessOrFailure)({
|
|
67
|
-
fetchState: 'Error',
|
|
68
|
-
error: (0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Create Sub Task REST API call errored out' +
|
|
69
|
-
JSON.stringify(error)),
|
|
70
|
-
}))));
|
|
71
|
-
}));
|
|
72
|
-
exports.createSubTaskEpic = createSubTaskEpic;
|
|
73
|
-
const prepareSubTaskPayload = (subTask, parentTaskGroupId) => ({
|
|
74
|
-
name: subTask.name,
|
|
75
|
-
assignees: subTask.assignee,
|
|
76
|
-
description: subTask.description,
|
|
77
|
-
priority: subTask.priority,
|
|
78
|
-
status: subTask.status,
|
|
79
|
-
tags: subTask.tagIds,
|
|
80
|
-
time_spent: (0, formatMinutesToFromHHMM_1.convertHHMMStrToMinutes)(subTask.timeSpent),
|
|
81
|
-
group_assignees: subTask.groupAssignees,
|
|
82
|
-
parent_task_id: subTask.parentTaskId,
|
|
83
|
-
task_group_ids: parentTaskGroupId == null ? [] : [parentTaskGroupId],
|
|
84
|
-
});
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { ActionsObservable, StateObservable } from 'redux-observable';
|
|
2
|
-
import { Observable } from 'rxjs';
|
|
3
|
-
import { updateTasks } from '../../../../entity/task/taskReducer';
|
|
4
|
-
import { RootState } from '../../../../reducer';
|
|
5
|
-
import { ZeniAPI } from '../../../../zeniAPI';
|
|
6
|
-
import { fetchSubTasks, updateSubTasks, updateSubTasksFetchStatus } from '../taskDetailReducer';
|
|
7
|
-
export type ActionType = ReturnType<typeof fetchSubTasks> | ReturnType<typeof updateTasks> | ReturnType<typeof updateSubTasks> | ReturnType<typeof updateSubTasksFetchStatus>;
|
|
8
|
-
export declare const fetchSubTasksEpic: (actions$: ActionsObservable<ActionType>, _state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.fetchSubTasksEpic = void 0;
|
|
4
|
-
const rxjs_1 = require("rxjs");
|
|
5
|
-
const operators_1 = require("rxjs/operators");
|
|
6
|
-
const taskReducer_1 = require("../../../../entity/task/taskReducer");
|
|
7
|
-
const responsePayload_1 = require("../../../../responsePayload");
|
|
8
|
-
const taskDetailReducer_1 = require("../taskDetailReducer");
|
|
9
|
-
const fetchSubTasksEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(taskDetailReducer_1.fetchSubTasks.match), (0, operators_1.switchMap)((action) => {
|
|
10
|
-
const { parentTaskId } = action.payload;
|
|
11
|
-
const query = JSON.stringify({
|
|
12
|
-
task_type: 'subtasks',
|
|
13
|
-
parent_task_id: parentTaskId,
|
|
14
|
-
});
|
|
15
|
-
return zeniAPI
|
|
16
|
-
.getJSON(`${zeniAPI.apiEndPoints.taskMicroServiceBaseUrl}/1.0/task-manager/tasks?query=${encodeURIComponent(query)}`)
|
|
17
|
-
.pipe((0, operators_1.mergeMap)((response) => {
|
|
18
|
-
if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
|
|
19
|
-
const { tasks } = response.data;
|
|
20
|
-
return (0, rxjs_1.of)((0, taskReducer_1.updateTasks)(tasks), (0, taskDetailReducer_1.updateSubTasks)({
|
|
21
|
-
parentTaskId,
|
|
22
|
-
}));
|
|
23
|
-
}
|
|
24
|
-
else {
|
|
25
|
-
return (0, rxjs_1.of)((0, taskDetailReducer_1.updateSubTasksFetchStatus)({
|
|
26
|
-
parentTaskId,
|
|
27
|
-
fetchState: 'Error',
|
|
28
|
-
error: response.status,
|
|
29
|
-
}));
|
|
30
|
-
}
|
|
31
|
-
}), (0, operators_1.catchError)((error) => {
|
|
32
|
-
return (0, rxjs_1.of)((0, taskDetailReducer_1.updateSubTasksFetchStatus)({
|
|
33
|
-
parentTaskId,
|
|
34
|
-
fetchState: 'Error',
|
|
35
|
-
error: (0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Fetch Sub Tasks REST API call errored out' +
|
|
36
|
-
JSON.stringify(error)),
|
|
37
|
-
}));
|
|
38
|
-
}));
|
|
39
|
-
}));
|
|
40
|
-
exports.fetchSubTasksEpic = fetchSubTasksEpic;
|