@zeniai/client-epic-state 4.7.84 → 4.7.85
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 +3 -0
- package/lib/entity/task/task.d.ts +46 -0
- package/lib/entity/task/task.js +36 -0
- package/lib/entity/task/taskPayload.d.ts +20 -0
- package/lib/entity/task/taskPayload.js +37 -0
- package/lib/entity/task/taskReducer.d.ts +6 -0
- package/lib/entity/task/taskReducer.js +33 -0
- package/lib/entity/task/taskSelector.d.ts +4 -0
- package/lib/entity/task/taskSelector.js +18 -0
- package/lib/entity/taskSummary/taskSummaryPayload.d.ts +7 -0
- package/lib/entity/taskSummary/taskSummaryPayload.js +2 -0
- package/lib/entity/taskSummary/taskSummaryReducer.d.ts +6 -0
- package/lib/entity/taskSummary/taskSummaryReducer.js +32 -0
- package/lib/entity/taskSummary/taskSummarySelector.d.ts +4 -0
- package/lib/entity/taskSummary/taskSummarySelector.js +18 -0
- package/lib/entity/taskSummary/taskSummaryState.d.ts +8 -0
- package/lib/entity/taskSummary/taskSummaryState.js +2 -0
- package/lib/entity/tenant/clearAllEpic.d.ts +6 -2
- package/lib/entity/tenant/clearAllEpic.js +8 -0
- package/lib/epic.d.ts +9 -1
- package/lib/epic.js +9 -1
- package/lib/index.d.ts +10 -2
- package/lib/index.js +21 -1
- package/lib/reducer.d.ts +12 -0
- package/lib/reducer.js +12 -0
- package/lib/view/companyView/companyViewPayload.d.ts +2 -0
- package/lib/view/companyView/epic/fetchCompanyManagementViewEpic.d.ts +2 -1
- package/lib/view/companyView/epic/fetchCompanyManagementViewEpic.js +4 -0
- package/lib/view/companyView/selector/companyManagementViewSelector.js +19 -10
- package/lib/view/companyView/selectorHelpers/getCompanyView.js +4 -1
- package/lib/view/companyView/types/cockpitTypes.d.ts +2 -2
- package/lib/view/companyView/types/cockpitTypes.js +1 -0
- package/lib/view/companyView/types/companyView.d.ts +2 -0
- package/lib/view/fileView/fileUploadHelpers.d.ts +2 -2
- package/lib/view/onboardingView/cockpitView/epic/initializeOnboardingCustomerViewUpdateDataEpic.d.ts +1 -2
- package/lib/view/people/changeZeniPersonRolesEpic.d.ts +1 -1
- package/lib/view/people/deletePersonEpic.d.ts +1 -1
- package/lib/view/people/invitePeopleEpic.d.ts +1 -1
- package/lib/view/people/inviteZeniPeopleEpic.d.ts +1 -1
- package/lib/view/people/resendInviteEpic.d.ts +1 -1
- package/lib/view/spendManagement/commonHistoryView/commonHistoryPayload.d.ts +1 -1
- package/lib/view/spendManagement/spendManagementFilterHelpers.d.ts +15 -7
- package/lib/view/spendManagement/spendManagementFilterHelpers.js +22 -1
- package/lib/view/taskManager/taskDetailView/epics/deleteTaskEpic.d.ts +7 -0
- package/lib/view/taskManager/taskDetailView/epics/deleteTaskEpic.js +46 -0
- package/lib/view/taskManager/taskDetailView/epics/fetchTaskDetailEpic.d.ts +9 -0
- package/lib/view/taskManager/taskDetailView/epics/fetchTaskDetailEpic.js +66 -0
- package/lib/view/taskManager/taskDetailView/epics/fetchTaskDetailPageEpic.d.ts +8 -0
- package/lib/view/taskManager/taskDetailView/epics/fetchTaskDetailPageEpic.js +38 -0
- package/lib/view/taskManager/taskDetailView/epics/fetchTaskHistoryEpic.d.ts +7 -0
- package/lib/view/taskManager/taskDetailView/epics/fetchTaskHistoryEpic.js +54 -0
- package/lib/view/taskManager/taskDetailView/epics/initializeTaskToLocalStoreEpic.d.ts +6 -0
- package/lib/view/taskManager/taskDetailView/epics/initializeTaskToLocalStoreEpic.js +36 -0
- package/lib/view/taskManager/taskDetailView/epics/saveTaskDetailEpic.d.ts +8 -0
- package/lib/view/taskManager/taskDetailView/epics/saveTaskDetailEpic.js +76 -0
- package/lib/view/taskManager/taskDetailView/taskDetail.d.ts +27 -0
- package/lib/view/taskManager/taskDetailView/taskDetail.js +27 -0
- package/lib/view/taskManager/taskDetailView/taskDetailReducer.d.ts +48 -0
- package/lib/view/taskManager/taskDetailView/taskDetailReducer.js +197 -0
- package/lib/view/taskManager/taskDetailView/taskDetailSelector.d.ts +23 -0
- package/lib/view/taskManager/taskDetailView/taskDetailSelector.js +176 -0
- package/lib/view/taskManager/taskListView/fetchTaskListEpic.d.ts +8 -0
- package/lib/view/taskManager/taskListView/fetchTaskListEpic.js +33 -0
- package/lib/view/taskManager/taskListView/fetchTaskListPageEpic.d.ts +8 -0
- package/lib/view/taskManager/taskListView/fetchTaskListPageEpic.js +32 -0
- package/lib/view/taskManager/taskListView/taskList.d.ts +33 -0
- package/lib/view/taskManager/taskListView/taskList.js +27 -0
- package/lib/view/taskManager/taskListView/taskListPayload.d.ts +6 -0
- package/lib/view/taskManager/taskListView/taskListPayload.js +2 -0
- package/lib/view/taskManager/taskListView/taskListReducer.d.ts +22 -0
- package/lib/view/taskManager/taskListView/taskListReducer.js +81 -0
- package/lib/view/taskManager/taskListView/taskListSelector.d.ts +18 -0
- package/lib/view/taskManager/taskListView/taskListSelector.js +63 -0
- package/lib/view/userListView/fetchUserListByTypeEpic.js +2 -0
- package/lib/view/userListView/userListViewReducer.js +1 -0
- package/lib/view/userListView/userListViewState.d.ts +2 -1
- package/lib/zeniAPI.d.ts +1 -0
- package/package.json +1 -1
|
@@ -111,7 +111,9 @@ const applyAdvancedFiltersOnList = (entity, allItems, filters, filteredItems = [
|
|
|
111
111
|
const key = currentFilter.field;
|
|
112
112
|
const categoryValue = entity === 'bill_pay'
|
|
113
113
|
? getCategoryValueForBill(key, item)
|
|
114
|
-
:
|
|
114
|
+
: entity === 'reimbursement'
|
|
115
|
+
? getCategoryValueForReimbursement(key, item)
|
|
116
|
+
: getCategoryValueForTaskList(key, item);
|
|
115
117
|
if (categoryValue == null) {
|
|
116
118
|
if (currentFilter.matchingOperator === 'not-equal') {
|
|
117
119
|
return true;
|
|
@@ -174,6 +176,25 @@ const getCategoryValueForBill = (key, bill) => {
|
|
|
174
176
|
return undefined;
|
|
175
177
|
}
|
|
176
178
|
};
|
|
179
|
+
const getCategoryValueForTaskList = (key, task) => {
|
|
180
|
+
var _a;
|
|
181
|
+
switch (key) {
|
|
182
|
+
case 'dueDate':
|
|
183
|
+
return task.dueDate;
|
|
184
|
+
case 'priority':
|
|
185
|
+
return task.priority.code;
|
|
186
|
+
case 'tag':
|
|
187
|
+
return (_a = task.tag) === null || _a === void 0 ? void 0 : _a.code;
|
|
188
|
+
case 'status':
|
|
189
|
+
return task.status.code;
|
|
190
|
+
case 'createdBy':
|
|
191
|
+
return task.createdBy;
|
|
192
|
+
case 'assignee':
|
|
193
|
+
return task.assignees;
|
|
194
|
+
default:
|
|
195
|
+
return undefined;
|
|
196
|
+
}
|
|
197
|
+
};
|
|
177
198
|
const getAllBillStatus = (bill) => {
|
|
178
199
|
var _a;
|
|
179
200
|
const billStatus = bill.billPayInfo.billStatus.code;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ActionsObservable, StateObservable } from 'redux-observable';
|
|
2
|
+
import { ZeniAPI } from '../../../../zeniAPI';
|
|
3
|
+
import { RootState } from '../../../../reducer';
|
|
4
|
+
import { deleteTask, deleteTaskSuccessOrFailure } from '../taskDetailReducer';
|
|
5
|
+
import { openSnackbar } from '../../../../entity/snackbar/snackbarReducer';
|
|
6
|
+
export declare type ActionType = ReturnType<typeof deleteTask> | ReturnType<typeof openSnackbar> | ReturnType<typeof deleteTaskSuccessOrFailure>;
|
|
7
|
+
export declare const deleteTaskEpic: (actions$: ActionsObservable<ActionType>, _state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => import("rxjs").Observable<ActionType>;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.deleteTaskEpic = void 0;
|
|
4
|
+
const rxjs_1 = require("rxjs");
|
|
5
|
+
const operators_1 = require("rxjs/operators");
|
|
6
|
+
const responsePayload_1 = require("../../../../responsePayload");
|
|
7
|
+
const taskDetailReducer_1 = require("../taskDetailReducer");
|
|
8
|
+
const snackbarReducer_1 = require("../../../../entity/snackbar/snackbarReducer");
|
|
9
|
+
const deleteTaskEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(taskDetailReducer_1.deleteTask.match), (0, operators_1.mergeMap)((action) => {
|
|
10
|
+
const { taskId } = action.payload;
|
|
11
|
+
return zeniAPI
|
|
12
|
+
.deleteAndGetJSON(`${zeniAPI.apiEndPoints.taskMicroServicebaseUrl}/1.0/task-manager/tasks/${taskId}`)
|
|
13
|
+
.pipe((0, operators_1.mergeMap)((response) => {
|
|
14
|
+
if ((0, responsePayload_1.isSuccessStatus)(response)) {
|
|
15
|
+
const actions = [];
|
|
16
|
+
actions.push((0, taskDetailReducer_1.deleteTaskSuccessOrFailure)({ fetchState: 'Completed', taskId }));
|
|
17
|
+
return (0, rxjs_1.from)(actions);
|
|
18
|
+
}
|
|
19
|
+
else {
|
|
20
|
+
return (0, rxjs_1.from)([
|
|
21
|
+
(0, taskDetailReducer_1.deleteTaskSuccessOrFailure)({
|
|
22
|
+
fetchState: 'Error',
|
|
23
|
+
taskId,
|
|
24
|
+
error: response.status,
|
|
25
|
+
}),
|
|
26
|
+
(0, snackbarReducer_1.openSnackbar)({
|
|
27
|
+
messageSection: 'delete_task',
|
|
28
|
+
messageText: 'failed',
|
|
29
|
+
type: 'error',
|
|
30
|
+
variables: [
|
|
31
|
+
{
|
|
32
|
+
variableName: '_api-error_',
|
|
33
|
+
variableValue: response.status.message,
|
|
34
|
+
},
|
|
35
|
+
],
|
|
36
|
+
}),
|
|
37
|
+
]);
|
|
38
|
+
}
|
|
39
|
+
}), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, taskDetailReducer_1.deleteTaskSuccessOrFailure)({
|
|
40
|
+
fetchState: 'Error',
|
|
41
|
+
taskId,
|
|
42
|
+
error: (0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Delete Task REST API call errored out ' +
|
|
43
|
+
JSON.stringify(error)),
|
|
44
|
+
}))));
|
|
45
|
+
}));
|
|
46
|
+
exports.deleteTaskEpic = deleteTaskEpic;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ActionsObservable, StateObservable } from 'redux-observable';
|
|
2
|
+
import { Observable } from 'rxjs';
|
|
3
|
+
import { fetchTaskDetail, updateEditTaskFetchStatus, removeTaskDetail, initializeTaskToLocalStore } from '../taskDetailReducer';
|
|
4
|
+
import { ZeniAPI } from '../../../../zeniAPI';
|
|
5
|
+
import { RootState } from '../../../../reducer';
|
|
6
|
+
import { updateTasks } from '../../../../entity/task/taskReducer';
|
|
7
|
+
import { fetchFileList } from '../../../fileView/fileViewReducer';
|
|
8
|
+
export declare type ActionType = ReturnType<typeof fetchTaskDetail> | ReturnType<typeof updateEditTaskFetchStatus> | ReturnType<typeof removeTaskDetail> | ReturnType<typeof updateTasks> | ReturnType<typeof initializeTaskToLocalStore> | ReturnType<typeof fetchFileList>;
|
|
9
|
+
export declare const fetchTaskDetailEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.fetchTaskDetailEpic = void 0;
|
|
7
|
+
const rxjs_1 = require("rxjs");
|
|
8
|
+
const operators_1 = require("rxjs/operators");
|
|
9
|
+
const get_1 = __importDefault(require("lodash/get"));
|
|
10
|
+
const taskDetailReducer_1 = require("../taskDetailReducer");
|
|
11
|
+
const responsePayload_1 = require("../../../../responsePayload");
|
|
12
|
+
const taskReducer_1 = require("../../../../entity/task/taskReducer");
|
|
13
|
+
const fileViewReducer_1 = require("../../../fileView/fileViewReducer");
|
|
14
|
+
const fetchTaskDetailEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(taskDetailReducer_1.fetchTaskDetail.match), (0, operators_1.mergeMap)((action) => {
|
|
15
|
+
const { taskId, cacheOverride } = action.payload;
|
|
16
|
+
const taskActions = [];
|
|
17
|
+
const state = state$.value;
|
|
18
|
+
const taskDetail = (0, get_1.default)(state.taskDetailState.editTaskStateById, taskId, undefined);
|
|
19
|
+
if (cacheOverride === true) {
|
|
20
|
+
taskActions.push((0, taskDetailReducer_1.removeTaskDetail)(taskId));
|
|
21
|
+
}
|
|
22
|
+
if (cacheOverride === true ||
|
|
23
|
+
taskDetail == null ||
|
|
24
|
+
taskDetail.fetchTaskStatus.fetchState !== 'In-Progress') {
|
|
25
|
+
taskActions.push((0, taskDetailReducer_1.updateEditTaskFetchStatus)({ taskId, fetchState: 'In-Progress' }));
|
|
26
|
+
const getTaskDetail$ = zeniAPI
|
|
27
|
+
.getJSON(`${zeniAPI.apiEndPoints.taskMicroServicebaseUrl}/1.0/task-manager/tasks/${taskId}`)
|
|
28
|
+
.pipe((0, operators_1.mergeMap)((response) => {
|
|
29
|
+
if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
|
|
30
|
+
const fetchActions = [
|
|
31
|
+
(0, taskReducer_1.updateTasks)(response.data.tasks),
|
|
32
|
+
(0, taskDetailReducer_1.updateEditTaskFetchStatus)({
|
|
33
|
+
taskId,
|
|
34
|
+
fetchState: 'Completed',
|
|
35
|
+
}),
|
|
36
|
+
(0, taskDetailReducer_1.initializeTaskToLocalStore)(taskId),
|
|
37
|
+
];
|
|
38
|
+
const fileIds = response.data.tasks[0].file_ids;
|
|
39
|
+
if (fileIds.length > 0) {
|
|
40
|
+
fetchActions.push((0, fileViewReducer_1.fetchFileList)(fileIds));
|
|
41
|
+
}
|
|
42
|
+
return (0, rxjs_1.from)(fetchActions);
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
return (0, rxjs_1.of)((0, taskDetailReducer_1.updateEditTaskFetchStatus)({
|
|
46
|
+
taskId,
|
|
47
|
+
fetchState: 'Error',
|
|
48
|
+
error: response.status,
|
|
49
|
+
}));
|
|
50
|
+
}
|
|
51
|
+
}), (0, operators_1.catchError)((error) => {
|
|
52
|
+
console.error(`REST API call errored out ${error}`);
|
|
53
|
+
return (0, rxjs_1.of)((0, taskDetailReducer_1.updateEditTaskFetchStatus)({
|
|
54
|
+
taskId,
|
|
55
|
+
fetchState: 'Error',
|
|
56
|
+
error: (0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Fetch Task detail REST API call errored out' +
|
|
57
|
+
JSON.stringify(error)),
|
|
58
|
+
}));
|
|
59
|
+
}));
|
|
60
|
+
return (0, rxjs_1.concat)((0, rxjs_1.from)(taskActions), getTaskDetail$);
|
|
61
|
+
}
|
|
62
|
+
else {
|
|
63
|
+
return (0, rxjs_1.from)(taskActions);
|
|
64
|
+
}
|
|
65
|
+
}));
|
|
66
|
+
exports.fetchTaskDetailEpic = fetchTaskDetailEpic;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ActionsObservable, StateObservable } from 'redux-observable';
|
|
2
|
+
import { Observable } from 'rxjs';
|
|
3
|
+
import { fetchTaskDetailPage, fetchTaskDetail, initializeTaskToLocalStore, fetchTaskHistory } from '../taskDetailReducer';
|
|
4
|
+
import { RootState } from '../../../../reducer';
|
|
5
|
+
import { fetchUserListByType } from '../../../userListView/userListViewReducer';
|
|
6
|
+
import { fetchClassList } from '../../../classList/classListReducer';
|
|
7
|
+
export declare type ActionType = ReturnType<typeof fetchTaskDetailPage> | ReturnType<typeof fetchTaskDetail> | ReturnType<typeof fetchUserListByType> | ReturnType<typeof initializeTaskToLocalStore> | ReturnType<typeof fetchClassList> | ReturnType<typeof fetchTaskHistory>;
|
|
8
|
+
export declare const fetchTaskDetailPageEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>) => Observable<ActionType>;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.fetchTaskDetailPageEpic = void 0;
|
|
4
|
+
const rxjs_1 = require("rxjs");
|
|
5
|
+
const operators_1 = require("rxjs/operators");
|
|
6
|
+
const taskDetailReducer_1 = require("../taskDetailReducer");
|
|
7
|
+
const userListViewReducer_1 = require("../../../userListView/userListViewReducer");
|
|
8
|
+
const classListReducer_1 = require("../../../classList/classListReducer");
|
|
9
|
+
const fetchTaskDetailPageEpic = (actions$, state$) => actions$.pipe((0, operators_1.filter)(taskDetailReducer_1.fetchTaskDetailPage.match), (0, operators_1.mergeMap)((action) => {
|
|
10
|
+
const { cacheOverride, taskId } = action.payload;
|
|
11
|
+
const taskDetailActions = [];
|
|
12
|
+
const state = state$.value;
|
|
13
|
+
if (cacheOverride === true) {
|
|
14
|
+
taskDetailActions.push((0, userListViewReducer_1.fetchUserListByType)('taskManagerCandidate', true));
|
|
15
|
+
taskDetailActions.push((0, classListReducer_1.fetchClassList)());
|
|
16
|
+
if (taskId != null) {
|
|
17
|
+
taskDetailActions.push((0, taskDetailReducer_1.fetchTaskDetail)(taskId, true));
|
|
18
|
+
taskDetailActions.push((0, taskDetailReducer_1.fetchTaskHistory)(taskId, true));
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
else {
|
|
22
|
+
const taskManageUsers = state.userListViewState.userListByType.taskManagerCandidate;
|
|
23
|
+
if (taskManageUsers.hasValidState() === false &&
|
|
24
|
+
taskManageUsers.fetchState !== 'In-Progress') {
|
|
25
|
+
taskDetailActions.push((0, userListViewReducer_1.fetchUserListByType)('taskManagerCandidate', false));
|
|
26
|
+
}
|
|
27
|
+
if (state.classListState.hasValidState() === false &&
|
|
28
|
+
state.classListState.fetchState !== 'In-Progress') {
|
|
29
|
+
taskDetailActions.push((0, classListReducer_1.fetchClassList)());
|
|
30
|
+
}
|
|
31
|
+
if (taskId != null) {
|
|
32
|
+
taskDetailActions.push((0, taskDetailReducer_1.fetchTaskDetail)(taskId, false));
|
|
33
|
+
taskDetailActions.push((0, taskDetailReducer_1.fetchTaskHistory)(taskId, false));
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
return (0, rxjs_1.concat)((0, rxjs_1.from)(taskDetailActions));
|
|
37
|
+
}));
|
|
38
|
+
exports.fetchTaskDetailPageEpic = fetchTaskDetailPageEpic;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ActionsObservable, StateObservable } from 'redux-observable';
|
|
2
|
+
import { Observable } from 'rxjs';
|
|
3
|
+
import { ZeniAPI } from '../../../../zeniAPI';
|
|
4
|
+
import { RootState } from '../../../../reducer';
|
|
5
|
+
import { fetchTaskHistory, updateTaskHistory, updateTaskHistoryFetchStatus } from '../taskDetailReducer';
|
|
6
|
+
export declare type ActionType = ReturnType<typeof fetchTaskHistory> | ReturnType<typeof updateTaskHistory> | ReturnType<typeof updateTaskHistoryFetchStatus>;
|
|
7
|
+
export declare const fetchTaskHistoryEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.fetchTaskHistoryEpic = void 0;
|
|
7
|
+
const rxjs_1 = require("rxjs");
|
|
8
|
+
const operators_1 = require("rxjs/operators");
|
|
9
|
+
const get_1 = __importDefault(require("lodash/get"));
|
|
10
|
+
const responsePayload_1 = require("../../../../responsePayload");
|
|
11
|
+
const taskDetailReducer_1 = require("../taskDetailReducer");
|
|
12
|
+
const fetchTaskHistoryEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(taskDetailReducer_1.fetchTaskHistory.match), (0, operators_1.mergeMap)((action) => {
|
|
13
|
+
const { taskId, cacheOverride } = action.payload;
|
|
14
|
+
const historyActions = [];
|
|
15
|
+
const state = state$.value;
|
|
16
|
+
const taskHistoryDetail = (0, get_1.default)(state.taskDetailState.taskHistoryById, taskId, undefined);
|
|
17
|
+
if (cacheOverride === true ||
|
|
18
|
+
taskHistoryDetail == null ||
|
|
19
|
+
taskHistoryDetail.fetchState !== 'In-Progress') {
|
|
20
|
+
historyActions.push((0, taskDetailReducer_1.updateTaskHistoryFetchStatus)({
|
|
21
|
+
taskId,
|
|
22
|
+
fetchState: 'In-Progress',
|
|
23
|
+
}));
|
|
24
|
+
const getHistoryDetail$ = zeniAPI
|
|
25
|
+
.getJSON(`${zeniAPI.apiEndPoints.taskMicroServicebaseUrl}/1.0/task-manager/tasks/${taskId}/history`)
|
|
26
|
+
.pipe((0, operators_1.mergeMap)((response) => {
|
|
27
|
+
if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
|
|
28
|
+
return (0, rxjs_1.of)((0, taskDetailReducer_1.updateTaskHistory)({
|
|
29
|
+
taskId,
|
|
30
|
+
historicEventsPayload: response.data.activities,
|
|
31
|
+
}));
|
|
32
|
+
}
|
|
33
|
+
else {
|
|
34
|
+
return (0, rxjs_1.of)((0, taskDetailReducer_1.updateTaskHistoryFetchStatus)({
|
|
35
|
+
taskId,
|
|
36
|
+
fetchState: 'Error',
|
|
37
|
+
error: response.status,
|
|
38
|
+
}));
|
|
39
|
+
}
|
|
40
|
+
}), (0, operators_1.catchError)((error) => {
|
|
41
|
+
return (0, rxjs_1.of)((0, taskDetailReducer_1.updateTaskHistoryFetchStatus)({
|
|
42
|
+
taskId,
|
|
43
|
+
fetchState: 'Error',
|
|
44
|
+
error: (0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Fetch Task history REST API call errored out' +
|
|
45
|
+
JSON.stringify(error)),
|
|
46
|
+
}));
|
|
47
|
+
}));
|
|
48
|
+
return (0, rxjs_1.concat)((0, rxjs_1.from)(historyActions), getHistoryDetail$);
|
|
49
|
+
}
|
|
50
|
+
else {
|
|
51
|
+
return (0, rxjs_1.from)(historyActions);
|
|
52
|
+
}
|
|
53
|
+
}));
|
|
54
|
+
exports.fetchTaskHistoryEpic = fetchTaskHistoryEpic;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ActionsObservable, StateObservable } from 'redux-observable';
|
|
2
|
+
import { Observable } from 'rxjs';
|
|
3
|
+
import { initializeTaskToLocalStore, saveTaskUpdatesToLocalStore, updateEditTaskFetchStatus } from '../taskDetailReducer';
|
|
4
|
+
import { RootState } from '../../../../reducer';
|
|
5
|
+
export declare type ActionType = ReturnType<typeof initializeTaskToLocalStore> | ReturnType<typeof saveTaskUpdatesToLocalStore> | ReturnType<typeof updateEditTaskFetchStatus>;
|
|
6
|
+
export declare const initializeTaskToLocalStoreEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>) => Observable<ActionType>;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.initializeTaskToLocalStoreEpic = void 0;
|
|
7
|
+
const rxjs_1 = require("rxjs");
|
|
8
|
+
const operators_1 = require("rxjs/operators");
|
|
9
|
+
const get_1 = __importDefault(require("lodash/get"));
|
|
10
|
+
const taskDetailReducer_1 = require("../taskDetailReducer");
|
|
11
|
+
const initializeTaskToLocalStoreEpic = (actions$, state$) => actions$.pipe((0, operators_1.filter)(taskDetailReducer_1.initializeTaskToLocalStore.match), (0, operators_1.mergeMap)((action) => {
|
|
12
|
+
const { taskId } = action.payload;
|
|
13
|
+
const state = state$.value;
|
|
14
|
+
const task = (0, get_1.default)(state.taskState.taskByID, taskId, undefined);
|
|
15
|
+
if (task != null) {
|
|
16
|
+
const taskDetailLocalData = {
|
|
17
|
+
name: task.name,
|
|
18
|
+
description: task.description,
|
|
19
|
+
status: task.status.code,
|
|
20
|
+
assignee: task.assignees,
|
|
21
|
+
dueDate: task.dueDate,
|
|
22
|
+
priority: task.priority.code,
|
|
23
|
+
tag: task.tag != null ? task.tag.code : undefined,
|
|
24
|
+
fileIds: task.fileIds,
|
|
25
|
+
};
|
|
26
|
+
const actions = [
|
|
27
|
+
(0, taskDetailReducer_1.saveTaskUpdatesToLocalStore)({ taskDetailLocalData, taskId }),
|
|
28
|
+
(0, taskDetailReducer_1.updateEditTaskFetchStatus)({ taskId, fetchState: 'Completed' }),
|
|
29
|
+
];
|
|
30
|
+
return (0, rxjs_1.from)(actions);
|
|
31
|
+
}
|
|
32
|
+
return (0, rxjs_1.from)([
|
|
33
|
+
(0, taskDetailReducer_1.updateEditTaskFetchStatus)({ taskId, fetchState: 'Completed' }),
|
|
34
|
+
]);
|
|
35
|
+
}));
|
|
36
|
+
exports.initializeTaskToLocalStoreEpic = initializeTaskToLocalStoreEpic;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ActionsObservable, StateObservable } from 'redux-observable';
|
|
2
|
+
import { ZeniAPI } from '../../../../zeniAPI';
|
|
3
|
+
import { RootState } from '../../../../reducer';
|
|
4
|
+
import { saveTaskDetail, saveTaskSuccessOrFailure } from '../taskDetailReducer';
|
|
5
|
+
import { updateTasks } from '../../../../entity/task/taskReducer';
|
|
6
|
+
import { openSnackbar } from '../../../../entity/snackbar/snackbarReducer';
|
|
7
|
+
export declare type ActionType = ReturnType<typeof saveTaskDetail> | ReturnType<typeof updateTasks> | ReturnType<typeof openSnackbar> | ReturnType<typeof saveTaskSuccessOrFailure>;
|
|
8
|
+
export declare const saveTaskDetailEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => import("rxjs").Observable<ActionType>;
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.saveTaskDetailEpic = void 0;
|
|
4
|
+
const rxjs_1 = require("rxjs");
|
|
5
|
+
const operators_1 = require("rxjs/operators");
|
|
6
|
+
const responsePayload_1 = require("../../../../responsePayload");
|
|
7
|
+
const taskDetailReducer_1 = require("../taskDetailReducer");
|
|
8
|
+
const taskReducer_1 = require("../../../../entity/task/taskReducer");
|
|
9
|
+
const taskSelector_1 = require("../../../../entity/task/taskSelector");
|
|
10
|
+
const snackbarReducer_1 = require("../../../../entity/snackbar/snackbarReducer");
|
|
11
|
+
const saveTaskDetailEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(taskDetailReducer_1.saveTaskDetail.match), (0, operators_1.mergeMap)((action) => {
|
|
12
|
+
const { taskId, isArchive } = action.payload;
|
|
13
|
+
const state = state$.value;
|
|
14
|
+
const payload = prepareTaskPayload(state, isArchive, taskId);
|
|
15
|
+
const saveTaskApi = taskId != null
|
|
16
|
+
? zeniAPI.putAndGetJSON(`${zeniAPI.apiEndPoints.taskMicroServicebaseUrl}/1.0/task-manager/tasks/${taskId}`, payload)
|
|
17
|
+
: zeniAPI.postAndGetJSON(`${zeniAPI.apiEndPoints.taskMicroServicebaseUrl}/1.0/task-manager/tasks`, payload);
|
|
18
|
+
return saveTaskApi.pipe((0, operators_1.mergeMap)((response) => {
|
|
19
|
+
if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
|
|
20
|
+
const fetchActions = [
|
|
21
|
+
(0, taskReducer_1.updateTasks)(response.data.tasks),
|
|
22
|
+
(0, taskDetailReducer_1.saveTaskSuccessOrFailure)({
|
|
23
|
+
fetchState: 'Completed',
|
|
24
|
+
taskId,
|
|
25
|
+
}),
|
|
26
|
+
];
|
|
27
|
+
return (0, rxjs_1.from)(fetchActions);
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
return (0, rxjs_1.from)([
|
|
31
|
+
(0, taskDetailReducer_1.saveTaskSuccessOrFailure)({
|
|
32
|
+
fetchState: 'Error',
|
|
33
|
+
taskId,
|
|
34
|
+
error: response.status,
|
|
35
|
+
}),
|
|
36
|
+
(0, snackbarReducer_1.openSnackbar)({
|
|
37
|
+
messageSection: isArchive === true ? 'archive_task' : 'save_task_detail',
|
|
38
|
+
messageText: 'failed',
|
|
39
|
+
type: 'error',
|
|
40
|
+
variables: [
|
|
41
|
+
{
|
|
42
|
+
variableName: '_api-error_',
|
|
43
|
+
variableValue: response.status.message,
|
|
44
|
+
},
|
|
45
|
+
],
|
|
46
|
+
}),
|
|
47
|
+
]);
|
|
48
|
+
}
|
|
49
|
+
}), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, taskDetailReducer_1.saveTaskSuccessOrFailure)({
|
|
50
|
+
fetchState: 'Error',
|
|
51
|
+
taskId,
|
|
52
|
+
error: (0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Save Task REST API call errored out' + JSON.stringify(error)),
|
|
53
|
+
}))));
|
|
54
|
+
}));
|
|
55
|
+
exports.saveTaskDetailEpic = saveTaskDetailEpic;
|
|
56
|
+
const prepareTaskPayload = (state, isArchive, taskId) => {
|
|
57
|
+
var _a, _b, _c, _d;
|
|
58
|
+
const { taskDetailState, taskState } = state;
|
|
59
|
+
const syncToken = taskId != null ? (_b = (_a = (0, taskSelector_1.getTaskById)(taskState, taskId)) === null || _a === void 0 ? void 0 : _a.syncToken) !== null && _b !== void 0 ? _b : '' : '';
|
|
60
|
+
const sourceState = taskId != null
|
|
61
|
+
? taskDetailState.editTaskStateById[taskId]
|
|
62
|
+
: taskDetailState.newTaskState;
|
|
63
|
+
const localData = sourceState.taskDetailLocalData;
|
|
64
|
+
return {
|
|
65
|
+
name: localData.name,
|
|
66
|
+
assignees: localData.assignee,
|
|
67
|
+
description: localData.description,
|
|
68
|
+
due_date: (_d = (_c = localData.dueDate) === null || _c === void 0 ? void 0 : _c.format('YYYY-MM-DD')) !== null && _d !== void 0 ? _d : null,
|
|
69
|
+
priority: localData.priority,
|
|
70
|
+
status: localData.status,
|
|
71
|
+
tag: localData.tag,
|
|
72
|
+
file_ids: localData.fileIds,
|
|
73
|
+
sync_token: syncToken,
|
|
74
|
+
is_archived: isArchive,
|
|
75
|
+
};
|
|
76
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { FetchStateAndError, ID } from '../../../commonStateTypes/common';
|
|
2
|
+
import { TaskStatusCodeType, PriorityCodeType, TaskTagCodeType } from '../../../entity/task/task';
|
|
3
|
+
import { ZeniDate } from '../../../zeniDayJS';
|
|
4
|
+
import { CommonHistoryView } from '../../spendManagement/commonHistoryView/commonHistory';
|
|
5
|
+
export interface TaskDetailViewState {
|
|
6
|
+
newTaskState: EditTaskDetail;
|
|
7
|
+
editTaskStateById: Record<ID, EditTaskDetail>;
|
|
8
|
+
taskHistoryById: Record<ID, CommonHistoryView>;
|
|
9
|
+
}
|
|
10
|
+
export interface EditTaskDetail {
|
|
11
|
+
taskId?: ID;
|
|
12
|
+
taskDetailLocalData: EditTaskLocalData;
|
|
13
|
+
saveStatus: FetchStateAndError;
|
|
14
|
+
fetchTaskStatus: FetchStateAndError;
|
|
15
|
+
deleteTaskStatus: FetchStateAndError;
|
|
16
|
+
}
|
|
17
|
+
export interface EditTaskLocalData {
|
|
18
|
+
name: string;
|
|
19
|
+
description: string;
|
|
20
|
+
status: TaskStatusCodeType;
|
|
21
|
+
assignee: ID[];
|
|
22
|
+
dueDate?: ZeniDate;
|
|
23
|
+
priority: PriorityCodeType;
|
|
24
|
+
tag?: TaskTagCodeType;
|
|
25
|
+
fileIds: ID[];
|
|
26
|
+
}
|
|
27
|
+
export declare const initialTaskDetail: EditTaskDetail;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.initialTaskDetail = void 0;
|
|
4
|
+
exports.initialTaskDetail = {
|
|
5
|
+
fetchTaskStatus: {
|
|
6
|
+
fetchState: 'Not-Started',
|
|
7
|
+
error: undefined,
|
|
8
|
+
},
|
|
9
|
+
saveStatus: {
|
|
10
|
+
fetchState: 'Not-Started',
|
|
11
|
+
error: undefined,
|
|
12
|
+
},
|
|
13
|
+
deleteTaskStatus: {
|
|
14
|
+
fetchState: 'Not-Started',
|
|
15
|
+
error: undefined,
|
|
16
|
+
},
|
|
17
|
+
taskDetailLocalData: {
|
|
18
|
+
name: '',
|
|
19
|
+
description: '',
|
|
20
|
+
status: 'todo',
|
|
21
|
+
assignee: [],
|
|
22
|
+
dueDate: undefined,
|
|
23
|
+
priority: 'low',
|
|
24
|
+
tag: undefined,
|
|
25
|
+
fileIds: [],
|
|
26
|
+
},
|
|
27
|
+
};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { FetchState, ID } from '../../../commonStateTypes/common';
|
|
2
|
+
import { ZeniAPIStatus } from '../../../responsePayload';
|
|
3
|
+
import { EditTaskLocalData, TaskDetailViewState } from './taskDetail';
|
|
4
|
+
import { HistoricEventPayload } from '../../spendManagement/commonHistoryView/commonHistoryPayload';
|
|
5
|
+
export declare const initialState: TaskDetailViewState;
|
|
6
|
+
export declare const fetchTaskDetailPage: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[cacheOverride: boolean, taskId?: string | undefined], {
|
|
7
|
+
cacheOverride: boolean;
|
|
8
|
+
taskId: string | undefined;
|
|
9
|
+
}, string, never, never>, fetchTaskDetail: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[taskId: string, cacheOverride?: any], {
|
|
10
|
+
taskId: string;
|
|
11
|
+
cacheOverride: any;
|
|
12
|
+
}, string, never, never>, initializeTaskToLocalStore: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[taskId: string], {
|
|
13
|
+
taskId: string;
|
|
14
|
+
}, string, never, never>, updateEditTaskFetchStatus: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
15
|
+
taskId: ID;
|
|
16
|
+
fetchState: FetchState;
|
|
17
|
+
error?: ZeniAPIStatus<Record<string, unknown>> | undefined;
|
|
18
|
+
}, string>, saveTaskUpdatesToLocalStore: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
19
|
+
taskDetailLocalData: EditTaskLocalData;
|
|
20
|
+
taskId?: string | undefined;
|
|
21
|
+
}, string>, discardTaskUpdatesInLocalStore: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
22
|
+
taskId?: string | undefined;
|
|
23
|
+
}, string>, saveTaskDetail: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[isArchive: boolean, taskId?: string | undefined], {
|
|
24
|
+
isArchive: boolean;
|
|
25
|
+
taskId: string | undefined;
|
|
26
|
+
}, string, never, never>, saveTaskSuccessOrFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
27
|
+
fetchState: FetchState;
|
|
28
|
+
taskId?: string | undefined;
|
|
29
|
+
error?: ZeniAPIStatus<Record<string, unknown>> | undefined;
|
|
30
|
+
}, string>, deleteTask: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[taskId?: string | undefined], {
|
|
31
|
+
taskId: string | undefined;
|
|
32
|
+
}, string, never, never>, removeTaskDetail: import("@reduxjs/toolkit").ActionCreatorWithPayload<string, string>, deleteTaskSuccessOrFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
33
|
+
fetchState: FetchState;
|
|
34
|
+
taskId?: string | undefined;
|
|
35
|
+
error?: ZeniAPIStatus<Record<string, unknown>> | undefined;
|
|
36
|
+
}, string>, fetchTaskHistory: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[taskId: string, cacheOverride?: any], {
|
|
37
|
+
taskId: string;
|
|
38
|
+
cacheOverride: any;
|
|
39
|
+
}, string, never, never>, updateTaskHistory: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
40
|
+
taskId: ID;
|
|
41
|
+
historicEventsPayload: HistoricEventPayload[];
|
|
42
|
+
}, string>, updateTaskHistoryFetchStatus: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
43
|
+
taskId: ID;
|
|
44
|
+
fetchState: FetchState;
|
|
45
|
+
error?: ZeniAPIStatus<Record<string, unknown>> | undefined;
|
|
46
|
+
}, string>, clearTaskDetail: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>;
|
|
47
|
+
declare const _default: import("@reduxjs/toolkit").Reducer<TaskDetailViewState, import("@reduxjs/toolkit").AnyAction>;
|
|
48
|
+
export default _default;
|