@zeniai/client-epic-state 5.2.77 → 5.2.79
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/esm/view/invoicing/couponView/couponViewReducer.js +14 -25
- package/lib/esm/view/invoicing/couponView/couponViewSelector.js +21 -22
- package/lib/esm/view/invoicing/couponView/couponViewState.js +2 -0
- package/lib/esm/view/invoicing/couponView/fetchInvoicingCouponListEpic.js +26 -8
- package/lib/esm/view/invoicing/couponView/fetchInvoicingCouponListPageEpic.js +16 -2
- package/lib/esm/view/invoicing/createInvoice/createInvoiceSelector.js +23 -15
- package/lib/esm/view/invoicing/createInvoice/epics/fetchCreateInvoiceFormPageEpic.js +5 -2
- package/lib/esm/view/invoicing/editInvoicingSubscriptionDetailView/editInvoicingSubscriptionDetailViewSelector.js +2 -2
- package/lib/esm/view/invoicing/editInvoicingSubscriptionDetailView/fetchInvoicingSubscriptionDetailPageEpic.js +9 -6
- package/lib/esm/view/invoicing/invoicingCreditNoteListView/epics/fetchInvoicingCreditNoteListEpic.js +25 -8
- package/lib/esm/view/invoicing/invoicingCreditNoteListView/epics/fetchInvoicingCreditNoteListPageEpic.js +15 -2
- package/lib/esm/view/invoicing/invoicingCreditNoteListView/invoicingCreditNoteListViewReducer.js +12 -23
- package/lib/esm/view/invoicing/invoicingCreditNoteListView/invoicingCreditNoteListViewSelector.js +6 -9
- package/lib/esm/view/invoicing/invoicingCustomerListView/epics/fetchInvoicingCustomerListEpic.js +26 -8
- package/lib/esm/view/invoicing/invoicingCustomerListView/epics/fetchInvoicingCustomerListPageEpic.js +16 -2
- package/lib/esm/view/invoicing/invoicingCustomerListView/invoicingCustomerListViewReducer.js +14 -25
- package/lib/esm/view/invoicing/invoicingCustomerListView/invoicingCustomerListViewSelector.js +16 -13
- package/lib/esm/view/invoicing/invoicingCustomerListView/invoicingCustomerListViewState.js +2 -0
- package/lib/esm/view/invoicing/invoicingDunningCaseListView/epics/fetchInvoicingDunningCaseListEpic.js +25 -8
- package/lib/esm/view/invoicing/invoicingDunningCaseListView/epics/fetchInvoicingDunningCaseListPageEpic.js +15 -2
- package/lib/esm/view/invoicing/invoicingDunningCaseListView/invoicingDunningCaseListViewReducer.js +12 -23
- package/lib/esm/view/invoicing/invoicingDunningCaseListView/invoicingDunningCaseListViewSelector.js +6 -9
- package/lib/esm/view/invoicing/invoicingListTabCache.js +98 -0
- package/lib/esm/view/invoicing/invoicingOverview/epics/fetchInvoicingOverviewEpic.js +4 -7
- package/lib/esm/view/invoicing/invoicingOverview/invoicingOverviewSelector.js +8 -5
- package/lib/esm/view/invoicing/invoicingSubscriptionListView/epics/fetchInvoicingSubscriptionListEpic.js +28 -9
- package/lib/esm/view/invoicing/invoicingSubscriptionListView/epics/fetchInvoicingSubscriptionListPageEpic.js +15 -2
- package/lib/esm/view/invoicing/invoicingSubscriptionListView/invoicingSubscriptionListViewReducer.js +13 -25
- package/lib/esm/view/invoicing/invoicingSubscriptionListView/invoicingSubscriptionListViewSelector.js +6 -9
- package/lib/esm/view/taskManager/taskDetailView/epics/fetchTaskDetailEpic.js +82 -41
- package/lib/esm/view/taskManager/taskDetailView/epics/fetchTaskDetailPageEpic.js +9 -1
- package/lib/esm/view/taskManager/taskDetailView/epics/initializeTaskToLocalStoreEpic.js +2 -23
- package/lib/esm/view/taskManager/taskDetailView/taskDetailLocalData.js +36 -0
- package/lib/esm/view/taskManager/taskDetailView/taskDetailReducer.js +11 -3
- package/lib/view/invoicing/couponView/couponViewReducer.d.ts +8 -1
- package/lib/view/invoicing/couponView/couponViewReducer.js +14 -25
- package/lib/view/invoicing/couponView/couponViewSelector.js +20 -21
- package/lib/view/invoicing/couponView/couponViewState.d.ts +7 -4
- package/lib/view/invoicing/couponView/couponViewState.js +3 -1
- package/lib/view/invoicing/couponView/fetchInvoicingCouponListEpic.d.ts +1 -1
- package/lib/view/invoicing/couponView/fetchInvoicingCouponListEpic.js +25 -7
- package/lib/view/invoicing/couponView/fetchInvoicingCouponListPageEpic.js +16 -2
- package/lib/view/invoicing/createInvoice/createInvoiceSelector.js +22 -14
- package/lib/view/invoicing/createInvoice/epics/fetchCreateInvoiceFormPageEpic.js +5 -2
- package/lib/view/invoicing/editInvoicingSubscriptionDetailView/editInvoicingSubscriptionDetailViewSelector.js +1 -1
- package/lib/view/invoicing/editInvoicingSubscriptionDetailView/fetchInvoicingSubscriptionDetailPageEpic.js +9 -6
- package/lib/view/invoicing/invoicingCreditNoteListView/epics/fetchInvoicingCreditNoteListEpic.d.ts +1 -1
- package/lib/view/invoicing/invoicingCreditNoteListView/epics/fetchInvoicingCreditNoteListEpic.js +24 -7
- package/lib/view/invoicing/invoicingCreditNoteListView/epics/fetchInvoicingCreditNoteListPageEpic.js +15 -2
- package/lib/view/invoicing/invoicingCreditNoteListView/invoicingCreditNoteListViewReducer.d.ts +8 -1
- package/lib/view/invoicing/invoicingCreditNoteListView/invoicingCreditNoteListViewReducer.js +12 -23
- package/lib/view/invoicing/invoicingCreditNoteListView/invoicingCreditNoteListViewSelector.js +6 -9
- package/lib/view/invoicing/invoicingCreditNoteListView/invoicingCreditNoteListViewState.d.ts +5 -4
- package/lib/view/invoicing/invoicingCustomerListView/epics/fetchInvoicingCustomerListEpic.d.ts +1 -1
- package/lib/view/invoicing/invoicingCustomerListView/epics/fetchInvoicingCustomerListEpic.js +25 -7
- package/lib/view/invoicing/invoicingCustomerListView/epics/fetchInvoicingCustomerListPageEpic.js +16 -2
- package/lib/view/invoicing/invoicingCustomerListView/invoicingCustomerListViewReducer.d.ts +8 -1
- package/lib/view/invoicing/invoicingCustomerListView/invoicingCustomerListViewReducer.js +14 -25
- package/lib/view/invoicing/invoicingCustomerListView/invoicingCustomerListViewSelector.d.ts +5 -0
- package/lib/view/invoicing/invoicingCustomerListView/invoicingCustomerListViewSelector.js +17 -13
- package/lib/view/invoicing/invoicingCustomerListView/invoicingCustomerListViewState.d.ts +7 -4
- package/lib/view/invoicing/invoicingCustomerListView/invoicingCustomerListViewState.js +3 -1
- package/lib/view/invoicing/invoicingDunningCaseListView/epics/fetchInvoicingDunningCaseListEpic.d.ts +1 -1
- package/lib/view/invoicing/invoicingDunningCaseListView/epics/fetchInvoicingDunningCaseListEpic.js +24 -7
- package/lib/view/invoicing/invoicingDunningCaseListView/epics/fetchInvoicingDunningCaseListPageEpic.js +15 -2
- package/lib/view/invoicing/invoicingDunningCaseListView/invoicingDunningCaseListViewReducer.d.ts +8 -1
- package/lib/view/invoicing/invoicingDunningCaseListView/invoicingDunningCaseListViewReducer.js +12 -23
- package/lib/view/invoicing/invoicingDunningCaseListView/invoicingDunningCaseListViewSelector.js +6 -9
- package/lib/view/invoicing/invoicingDunningCaseListView/invoicingDunningCaseListViewState.d.ts +5 -4
- package/lib/view/invoicing/invoicingListTabCache.d.ts +71 -0
- package/lib/view/invoicing/invoicingListTabCache.js +111 -0
- package/lib/view/invoicing/invoicingOverview/epics/fetchInvoicingOverviewEpic.js +4 -7
- package/lib/view/invoicing/invoicingOverview/invoicingOverviewSelector.js +8 -5
- package/lib/view/invoicing/invoicingSubscriptionListView/epics/fetchInvoicingSubscriptionListEpic.d.ts +1 -1
- package/lib/view/invoicing/invoicingSubscriptionListView/epics/fetchInvoicingSubscriptionListEpic.js +27 -8
- package/lib/view/invoicing/invoicingSubscriptionListView/epics/fetchInvoicingSubscriptionListPageEpic.js +15 -2
- package/lib/view/invoicing/invoicingSubscriptionListView/invoicingSubscriptionListViewReducer.d.ts +8 -1
- package/lib/view/invoicing/invoicingSubscriptionListView/invoicingSubscriptionListViewReducer.js +13 -25
- package/lib/view/invoicing/invoicingSubscriptionListView/invoicingSubscriptionListViewSelector.js +6 -9
- package/lib/view/invoicing/invoicingSubscriptionListView/invoicingSubscriptionListViewState.d.ts +5 -5
- package/lib/view/taskManager/taskDetailView/epics/fetchTaskDetailEpic.d.ts +2 -2
- package/lib/view/taskManager/taskDetailView/epics/fetchTaskDetailEpic.js +80 -39
- package/lib/view/taskManager/taskDetailView/epics/fetchTaskDetailPageEpic.js +9 -1
- package/lib/view/taskManager/taskDetailView/epics/initializeTaskToLocalStoreEpic.js +2 -23
- package/lib/view/taskManager/taskDetailView/taskDetailLocalData.d.ts +5 -0
- package/lib/view/taskManager/taskDetailView/taskDetailLocalData.js +45 -0
- package/lib/view/taskManager/taskDetailView/taskDetailReducer.js +11 -3
- package/package.json +1 -1
|
@@ -5,19 +5,26 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.fetchTaskDetailEpic = void 0;
|
|
7
7
|
const get_1 = __importDefault(require("lodash/get"));
|
|
8
|
+
const isEqual_1 = __importDefault(require("lodash/isEqual"));
|
|
8
9
|
const rxjs_1 = require("rxjs");
|
|
9
10
|
const operators_1 = require("rxjs/operators");
|
|
10
11
|
const snackbarReducer_1 = require("../../../../entity/snackbar/snackbarReducer");
|
|
11
12
|
const tagReducer_1 = require("../../../../entity/tag/tagReducer");
|
|
13
|
+
const taskPayload_1 = require("../../../../entity/task/taskPayload");
|
|
12
14
|
const taskReducer_1 = require("../../../../entity/task/taskReducer");
|
|
15
|
+
const taskSelector_1 = require("../../../../entity/task/taskSelector");
|
|
13
16
|
const responsePayload_1 = require("../../../../responsePayload");
|
|
14
17
|
const fileViewReducer_1 = require("../../../fileView/fileViewReducer");
|
|
18
|
+
const taskDetailLocalData_1 = require("../taskDetailLocalData");
|
|
15
19
|
const taskDetailReducer_1 = require("../taskDetailReducer");
|
|
16
20
|
const fetchTaskDetailEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(taskDetailReducer_1.fetchTaskDetail.match), (0, operators_1.mergeMap)((action) => {
|
|
17
21
|
const { taskId, cacheOverride } = action.payload;
|
|
18
22
|
const taskActions = [];
|
|
19
23
|
const state = state$.value;
|
|
20
24
|
const taskDetail = (0, get_1.default)(state.taskDetailState.editTaskStateById, taskId, undefined);
|
|
25
|
+
if (cacheOverride === true && (0, taskDetailLocalData_1.isLoadedTaskDetail)(taskDetail)) {
|
|
26
|
+
return refreshLoadedTaskDetail(taskId, state$, zeniAPI);
|
|
27
|
+
}
|
|
21
28
|
if (cacheOverride === true) {
|
|
22
29
|
taskActions.push((0, taskDetailReducer_1.removeTaskDetail)(taskId));
|
|
23
30
|
}
|
|
@@ -26,7 +33,7 @@ const fetchTaskDetailEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, ope
|
|
|
26
33
|
taskDetail.fetchTaskStatus.fetchState !== 'In-Progress') {
|
|
27
34
|
taskActions.push((0, taskDetailReducer_1.updateEditTaskFetchStatus)({ taskId, fetchState: 'In-Progress' }));
|
|
28
35
|
const getTaskDetail$ = zeniAPI
|
|
29
|
-
.getJSON(
|
|
36
|
+
.getJSON(getTaskDetailUrl(zeniAPI, taskId))
|
|
30
37
|
.pipe((0, operators_1.mergeMap)((response) => {
|
|
31
38
|
if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
|
|
32
39
|
const fetchActions = [
|
|
@@ -44,44 +51,7 @@ const fetchTaskDetailEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, ope
|
|
|
44
51
|
}
|
|
45
52
|
return (0, rxjs_1.from)(fetchActions);
|
|
46
53
|
}
|
|
47
|
-
|
|
48
|
-
const fetchActions = [
|
|
49
|
-
(0, taskDetailReducer_1.updateEditTaskFetchStatus)({
|
|
50
|
-
taskId,
|
|
51
|
-
fetchState: 'Error',
|
|
52
|
-
error: response.status,
|
|
53
|
-
}),
|
|
54
|
-
];
|
|
55
|
-
if (response.status.message.includes('delete')) {
|
|
56
|
-
fetchActions.push((0, snackbarReducer_1.openSnackbar)({
|
|
57
|
-
messageSection: 'fetch_task_detail',
|
|
58
|
-
messageText: 'failed',
|
|
59
|
-
type: 'error',
|
|
60
|
-
showStatusIcon: true,
|
|
61
|
-
variables: [
|
|
62
|
-
{
|
|
63
|
-
variableName: '_api-error_',
|
|
64
|
-
variableValue: 'Cannot retrieve deleted task.',
|
|
65
|
-
},
|
|
66
|
-
],
|
|
67
|
-
}));
|
|
68
|
-
}
|
|
69
|
-
else {
|
|
70
|
-
fetchActions.push((0, snackbarReducer_1.openSnackbar)({
|
|
71
|
-
messageSection: 'fetch_task_detail',
|
|
72
|
-
messageText: 'failed',
|
|
73
|
-
type: 'error',
|
|
74
|
-
showStatusIcon: true,
|
|
75
|
-
variables: [
|
|
76
|
-
{
|
|
77
|
-
variableName: '_api-error_',
|
|
78
|
-
variableValue: response.status.message,
|
|
79
|
-
},
|
|
80
|
-
],
|
|
81
|
-
}));
|
|
82
|
-
}
|
|
83
|
-
return (0, rxjs_1.from)(fetchActions);
|
|
84
|
-
}
|
|
54
|
+
return (0, rxjs_1.from)(getFetchFailureActions(taskId, response.status));
|
|
85
55
|
}), (0, operators_1.catchError)((error) => {
|
|
86
56
|
console.error(`REST API call errored out ${error}`);
|
|
87
57
|
return (0, rxjs_1.of)((0, taskDetailReducer_1.updateEditTaskFetchStatus)({
|
|
@@ -98,3 +68,74 @@ const fetchTaskDetailEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, ope
|
|
|
98
68
|
}
|
|
99
69
|
}));
|
|
100
70
|
exports.fetchTaskDetailEpic = fetchTaskDetailEpic;
|
|
71
|
+
const getTaskDetailUrl = (zeniAPI, taskId) => `${zeniAPI.apiEndPoints.taskMicroServiceBaseUrl}/1.0/task-manager/tasks/${taskId}`;
|
|
72
|
+
const getFetchFailureActions = (taskId, status) => [
|
|
73
|
+
(0, taskDetailReducer_1.updateEditTaskFetchStatus)({ taskId, fetchState: 'Error', error: status }),
|
|
74
|
+
(0, snackbarReducer_1.openSnackbar)({
|
|
75
|
+
messageSection: 'fetch_task_detail',
|
|
76
|
+
messageText: 'failed',
|
|
77
|
+
type: 'error',
|
|
78
|
+
showStatusIcon: true,
|
|
79
|
+
variables: [
|
|
80
|
+
{
|
|
81
|
+
variableName: '_api-error_',
|
|
82
|
+
variableValue: status.message.includes('delete')
|
|
83
|
+
? 'Cannot retrieve deleted task.'
|
|
84
|
+
: status.message,
|
|
85
|
+
},
|
|
86
|
+
],
|
|
87
|
+
}),
|
|
88
|
+
];
|
|
89
|
+
// An unparseable token is never treated as stale, so the refresh still applies.
|
|
90
|
+
const isOlderSyncToken = (candidate, stored) => {
|
|
91
|
+
const candidateTime = Date.parse(candidate ?? '');
|
|
92
|
+
const storedTime = Date.parse(stored);
|
|
93
|
+
return (!Number.isNaN(candidateTime) &&
|
|
94
|
+
!Number.isNaN(storedTime) &&
|
|
95
|
+
candidateTime < storedTime);
|
|
96
|
+
};
|
|
97
|
+
const isSaveInProgress = (state, taskId) => state.taskDetailState.editTaskStateById[taskId]?.saveStatus.fetchState ===
|
|
98
|
+
'In-Progress';
|
|
99
|
+
// Live refresh of an open page: no reset or loading state, unsaved edits kept,
|
|
100
|
+
// skipped during the user's own save, stale responses dropped.
|
|
101
|
+
const refreshLoadedTaskDetail = (taskId, state$, zeniAPI) => {
|
|
102
|
+
if (isSaveInProgress(state$.value, taskId)) {
|
|
103
|
+
return rxjs_1.EMPTY;
|
|
104
|
+
}
|
|
105
|
+
return zeniAPI
|
|
106
|
+
.getJSON(getTaskDetailUrl(zeniAPI, taskId))
|
|
107
|
+
.pipe((0, operators_1.mergeMap)((response) => {
|
|
108
|
+
if (!(0, responsePayload_1.isSuccessResponse)(response) || response.data == null) {
|
|
109
|
+
return (0, rxjs_1.from)(getFetchFailureActions(taskId, response.status));
|
|
110
|
+
}
|
|
111
|
+
const state = state$.value;
|
|
112
|
+
const taskPayload = response.data.tasks.find((task) => task.task_id === taskId);
|
|
113
|
+
const storedTask = (0, taskSelector_1.getTaskById)(state.taskState, taskId);
|
|
114
|
+
const taskDetail = state.taskDetailState.editTaskStateById[taskId];
|
|
115
|
+
if (taskPayload == null ||
|
|
116
|
+
storedTask == null ||
|
|
117
|
+
taskDetail == null ||
|
|
118
|
+
isSaveInProgress(state, taskId) ||
|
|
119
|
+
isOlderSyncToken(taskPayload.sync_token, storedTask.syncToken)) {
|
|
120
|
+
return rxjs_1.EMPTY;
|
|
121
|
+
}
|
|
122
|
+
const refreshedTask = (0, taskPayload_1.mapTaskPayloadToTask)(taskPayload, storedTask);
|
|
123
|
+
const actions = [
|
|
124
|
+
(0, taskReducer_1.updateTasks)(response.data.tasks),
|
|
125
|
+
(0, tagReducer_1.updateTags)(response.data.tasks.map((task) => task.tags).flat()),
|
|
126
|
+
(0, taskDetailReducer_1.saveTaskUpdatesToLocalStore)({
|
|
127
|
+
taskId,
|
|
128
|
+
taskDetailLocalData: (0, taskDetailLocalData_1.rebaseTaskDetailLocalData)(taskDetail.taskDetailLocalData, (0, taskDetailLocalData_1.buildTaskDetailLocalData)(storedTask), (0, taskDetailLocalData_1.buildTaskDetailLocalData)(refreshedTask)),
|
|
129
|
+
}),
|
|
130
|
+
];
|
|
131
|
+
if (refreshedTask.fileIds.length > 0 &&
|
|
132
|
+
!(0, isEqual_1.default)(refreshedTask.fileIds, storedTask.fileIds)) {
|
|
133
|
+
actions.push((0, fileViewReducer_1.fetchFileList)(refreshedTask.fileIds));
|
|
134
|
+
}
|
|
135
|
+
return (0, rxjs_1.from)(actions);
|
|
136
|
+
}), (0, operators_1.catchError)((error) => {
|
|
137
|
+
// Keep the page on screen; the next update or reload recovers.
|
|
138
|
+
console.error(`Task detail refresh errored out ${error}`);
|
|
139
|
+
return rxjs_1.EMPTY;
|
|
140
|
+
}));
|
|
141
|
+
};
|
|
@@ -5,12 +5,20 @@ const rxjs_1 = require("rxjs");
|
|
|
5
5
|
const operators_1 = require("rxjs/operators");
|
|
6
6
|
const classListReducer_1 = require("../../../classList/classListReducer");
|
|
7
7
|
const userListViewReducer_1 = require("../../../userListView/userListViewReducer");
|
|
8
|
+
const taskDetailLocalData_1 = require("../taskDetailLocalData");
|
|
8
9
|
const taskDetailReducer_1 = require("../taskDetailReducer");
|
|
9
10
|
const fetchTaskDetailPageEpic = (actions$, state$) => actions$.pipe((0, operators_1.filter)(taskDetailReducer_1.fetchTaskDetailPage.match), (0, operators_1.mergeMap)((action) => {
|
|
10
11
|
const { cacheOverride, taskId } = action.payload;
|
|
11
12
|
const taskDetailActions = [];
|
|
12
13
|
const state = state$.value;
|
|
13
|
-
if (cacheOverride === true
|
|
14
|
+
if (cacheOverride === true &&
|
|
15
|
+
taskId != null &&
|
|
16
|
+
(0, taskDetailLocalData_1.isLoadedTaskDetail)(state.taskDetailState.editTaskStateById[taskId])) {
|
|
17
|
+
// Only the task changes on a live refresh; the list refetches would show the skeleton.
|
|
18
|
+
taskDetailActions.push((0, taskDetailReducer_1.fetchTaskDetail)(taskId, true));
|
|
19
|
+
taskDetailActions.push((0, taskDetailReducer_1.fetchTaskHistory)(taskId, true));
|
|
20
|
+
}
|
|
21
|
+
else if (cacheOverride === true) {
|
|
14
22
|
taskDetailActions.push((0, userListViewReducer_1.fetchUserListByType)('taskManagerCandidate', true));
|
|
15
23
|
taskDetailActions.push((0, classListReducer_1.fetchClassList)());
|
|
16
24
|
if (taskId != null) {
|
|
@@ -7,35 +7,14 @@ exports.initializeTaskToLocalStoreEpic = void 0;
|
|
|
7
7
|
const get_1 = __importDefault(require("lodash/get"));
|
|
8
8
|
const rxjs_1 = require("rxjs");
|
|
9
9
|
const operators_1 = require("rxjs/operators");
|
|
10
|
+
const taskDetailLocalData_1 = require("../taskDetailLocalData");
|
|
10
11
|
const taskDetailReducer_1 = require("../taskDetailReducer");
|
|
11
12
|
const initializeTaskToLocalStoreEpic = (actions$, state$) => actions$.pipe((0, operators_1.filter)(taskDetailReducer_1.initializeTaskToLocalStore.match), (0, operators_1.mergeMap)((action) => {
|
|
12
13
|
const { taskId } = action.payload;
|
|
13
14
|
const state = state$.value;
|
|
14
15
|
const task = (0, get_1.default)(state.taskState.taskByID, taskId, undefined);
|
|
15
16
|
if (task != null) {
|
|
16
|
-
const taskDetailLocalData =
|
|
17
|
-
name: task.name,
|
|
18
|
-
description: task.description,
|
|
19
|
-
status: task.status.code,
|
|
20
|
-
assignee: task.assignees,
|
|
21
|
-
groupAssignees: task.groupAssignees,
|
|
22
|
-
dueDate: task.dueDate,
|
|
23
|
-
priority: task.priority.code,
|
|
24
|
-
tagIds: task.tagIds,
|
|
25
|
-
fileIds: task.fileIds,
|
|
26
|
-
type: task.type,
|
|
27
|
-
recurringFrequency: task.recurringFrequency,
|
|
28
|
-
recurringDaysOfWeek: task.recurringDaysOfWeek,
|
|
29
|
-
recurringEndDateLocalData: {
|
|
30
|
-
recurringDatePickerOptionsType: 'date', // by default, date would be selected
|
|
31
|
-
recurringEndDate: task.recurringEndDate,
|
|
32
|
-
},
|
|
33
|
-
savedRecurringEndDate: task.recurringEndDate,
|
|
34
|
-
recurringStartDate: task.recurringStartDate,
|
|
35
|
-
timeSpent: task.timeSpent,
|
|
36
|
-
isPrivate: task.isPrivate,
|
|
37
|
-
taskGroupId: task.taskGroupIds[0],
|
|
38
|
-
};
|
|
17
|
+
const taskDetailLocalData = (0, taskDetailLocalData_1.buildTaskDetailLocalData)(task);
|
|
39
18
|
const actions = [
|
|
40
19
|
(0, taskDetailReducer_1.saveTaskUpdatesToLocalStore)({ taskDetailLocalData, taskId }),
|
|
41
20
|
(0, taskDetailReducer_1.updateEditTaskFetchStatus)({ taskId, fetchState: 'Completed' }),
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Task } from '../../../entity/task/taskState';
|
|
2
|
+
import { EditTaskDetail, EditTaskLocalData } from './taskDetail';
|
|
3
|
+
export declare const buildTaskDetailLocalData: (task: Task) => EditTaskLocalData;
|
|
4
|
+
export declare const rebaseTaskDetailLocalData: (local: EditTaskLocalData, baseline: EditTaskLocalData, fresh: EditTaskLocalData) => EditTaskLocalData;
|
|
5
|
+
export declare const isLoadedTaskDetail: (taskDetail: EditTaskDetail | undefined) => taskDetail is EditTaskDetail;
|
|
@@ -0,0 +1,45 @@
|
|
|
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.isLoadedTaskDetail = exports.rebaseTaskDetailLocalData = exports.buildTaskDetailLocalData = void 0;
|
|
7
|
+
const isEqual_1 = __importDefault(require("lodash/isEqual"));
|
|
8
|
+
const buildTaskDetailLocalData = (task) => ({
|
|
9
|
+
name: task.name,
|
|
10
|
+
description: task.description,
|
|
11
|
+
status: task.status.code,
|
|
12
|
+
assignee: task.assignees,
|
|
13
|
+
groupAssignees: task.groupAssignees,
|
|
14
|
+
dueDate: task.dueDate,
|
|
15
|
+
priority: task.priority.code,
|
|
16
|
+
tagIds: task.tagIds,
|
|
17
|
+
fileIds: task.fileIds,
|
|
18
|
+
type: task.type,
|
|
19
|
+
recurringFrequency: task.recurringFrequency,
|
|
20
|
+
recurringDaysOfWeek: task.recurringDaysOfWeek,
|
|
21
|
+
recurringEndDateLocalData: {
|
|
22
|
+
recurringDatePickerOptionsType: 'date', // by default, date would be selected
|
|
23
|
+
recurringEndDate: task.recurringEndDate,
|
|
24
|
+
},
|
|
25
|
+
savedRecurringEndDate: task.recurringEndDate,
|
|
26
|
+
recurringStartDate: task.recurringStartDate,
|
|
27
|
+
timeSpent: task.timeSpent,
|
|
28
|
+
isPrivate: task.isPrivate,
|
|
29
|
+
taskGroupId: task.taskGroupIds[0],
|
|
30
|
+
});
|
|
31
|
+
exports.buildTaskDetailLocalData = buildTaskDetailLocalData;
|
|
32
|
+
// Untouched fields (still equal to `baseline`) take the server value; edited ones keep the user's.
|
|
33
|
+
const rebaseTaskDetailLocalData = (local, baseline, fresh) => {
|
|
34
|
+
const rebased = { ...fresh };
|
|
35
|
+
const keys = Object.keys({ ...local, ...fresh });
|
|
36
|
+
keys.forEach((key) => {
|
|
37
|
+
if (!(0, isEqual_1.default)(local[key], baseline[key])) {
|
|
38
|
+
Object.assign(rebased, { [key]: local[key] });
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
return rebased;
|
|
42
|
+
};
|
|
43
|
+
exports.rebaseTaskDetailLocalData = rebaseTaskDetailLocalData;
|
|
44
|
+
const isLoadedTaskDetail = (taskDetail) => taskDetail?.fetchTaskStatus.fetchState === 'Completed';
|
|
45
|
+
exports.isLoadedTaskDetail = isLoadedTaskDetail;
|
|
@@ -11,6 +11,7 @@ const rootActions_1 = require("../../../rootActions");
|
|
|
11
11
|
const commonHistory_1 = require("../../spendManagement/commonHistoryView/commonHistory");
|
|
12
12
|
const commonHistoryPayload_1 = require("../../spendManagement/commonHistoryView/commonHistoryPayload");
|
|
13
13
|
const taskDetail_1 = require("./taskDetail");
|
|
14
|
+
const taskDetailLocalData_1 = require("./taskDetailLocalData");
|
|
14
15
|
exports.initialState = {
|
|
15
16
|
newTaskState: taskDetail_1.initialTaskDetail,
|
|
16
17
|
editTaskStateById: {},
|
|
@@ -30,9 +31,11 @@ const taskDetailView = (0, toolkit_1.createSlice)({
|
|
|
30
31
|
const { taskId } = action.payload;
|
|
31
32
|
if (taskId != null) {
|
|
32
33
|
const detail = (0, get_1.default)(draft.editTaskStateById, taskId, undefined);
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
34
|
+
const isRefresh = action.payload.cacheOverride === true && (0, taskDetailLocalData_1.isLoadedTaskDetail)(detail);
|
|
35
|
+
if (!isRefresh &&
|
|
36
|
+
(action.payload.cacheOverride === true ||
|
|
37
|
+
detail == null ||
|
|
38
|
+
detail.fetchTaskStatus.fetchState !== 'In-Progress')) {
|
|
36
39
|
draft.editTaskStateById[taskId] = {
|
|
37
40
|
...taskDetail_1.initialTaskDetail,
|
|
38
41
|
};
|
|
@@ -357,6 +360,11 @@ const taskDetailView = (0, toolkit_1.createSlice)({
|
|
|
357
360
|
fetchSubTasks: {
|
|
358
361
|
reducer(draft, action) {
|
|
359
362
|
const { parentTaskId } = action.payload;
|
|
363
|
+
// Only the first load reports In-Progress; it gates the detail page skeleton.
|
|
364
|
+
if (draft.subTaskListFetchStatusByParentId[parentTaskId]?.fetchState ===
|
|
365
|
+
'Completed') {
|
|
366
|
+
return;
|
|
367
|
+
}
|
|
360
368
|
draft.subTaskListFetchStatusByParentId[parentTaskId] = {
|
|
361
369
|
fetchState: 'In-Progress',
|
|
362
370
|
error: undefined,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zeniai/client-epic-state",
|
|
3
|
-
"version": "5.2.
|
|
3
|
+
"version": "5.2.79",
|
|
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",
|