@zeniai/client-epic-state 4.19.91-betaJK5 → 4.19.91
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/task/taskPayload.d.ts +0 -1
- package/lib/entity/task/taskPayload.js +0 -1
- package/lib/entity/task/taskState.d.ts +0 -1
- package/lib/esm/entity/task/taskPayload.js +0 -1
- package/lib/esm/reducer.js +0 -6
- package/lib/esm/view/taskManager/taskListView/taskListSelector.js +1 -3
- package/lib/esm/view/userListView/fetchUserListByTypeEpic.js +0 -11
- package/lib/index.d.ts +0 -1
- package/lib/reducer.d.ts +0 -6
- package/lib/reducer.js +0 -6
- package/lib/tsconfig.typecheck.tsbuildinfo +1 -0
- package/lib/view/taskManager/taskListView/taskListSelector.d.ts +0 -2
- package/lib/view/taskManager/taskListView/taskListSelector.js +1 -3
- package/lib/view/userListView/fetchUserListByTypeEpic.d.ts +1 -3
- package/lib/view/userListView/fetchUserListByTypeEpic.js +0 -11
- package/lib/view/userListView/userListViewPayload.d.ts +0 -2
- package/package.json +1 -1
- package/lib/entity/userGroups/userGroupsPayload.d.ts +0 -7
- package/lib/entity/userGroups/userGroupsPayload.js +0 -10
- package/lib/entity/userGroups/userGroupsReducer.d.ts +0 -8
- package/lib/entity/userGroups/userGroupsReducer.js +0 -29
- package/lib/entity/userGroups/userGroupsSelector.d.ts +0 -4
- package/lib/entity/userGroups/userGroupsSelector.js +0 -12
- package/lib/entity/userGroups/userGroupsState.d.ts +0 -9
- package/lib/entity/userGroups/userGroupsState.js +0 -2
- package/lib/esm/entity/userGroups/userGroupsPayload.js +0 -7
- package/lib/esm/entity/userGroups/userGroupsReducer.js +0 -25
- package/lib/esm/entity/userGroups/userGroupsSelector.js +0 -8
- package/lib/esm/entity/userGroups/userGroupsState.js +0 -1
- package/lib/esm/view/userGroupListView/userGroupListViewReducer.js +0 -69
- package/lib/esm/view/userGroupListView/userGroupListViewSelector.js +0 -16
- package/lib/esm/view/userGroupListView/userGroupListViewState.js +0 -1
- package/lib/view/userGroupListView/userGroupListViewReducer.d.ts +0 -23
- package/lib/view/userGroupListView/userGroupListViewReducer.js +0 -73
- package/lib/view/userGroupListView/userGroupListViewSelector.d.ts +0 -7
- package/lib/view/userGroupListView/userGroupListViewSelector.js +0 -20
- package/lib/view/userGroupListView/userGroupListViewState.d.ts +0 -8
- package/lib/view/userGroupListView/userGroupListViewState.js +0 -2
|
@@ -8,7 +8,6 @@ import { UserState } from '../../../entity/user/userState';
|
|
|
8
8
|
import { UserRoleState } from '../../../entity/userRole/userRoleState';
|
|
9
9
|
import { RootState } from '../../../reducer';
|
|
10
10
|
import { UserAndRole } from '../../companyView/types/userAndRole';
|
|
11
|
-
import { UserGroupListSelectorView } from '../../userGroupListView/userGroupListViewSelector';
|
|
12
11
|
import { UserListSelectorView } from '../../userListView/userListViewSelector';
|
|
13
12
|
import { TaskListFilters, TaskListLocalData, TaskListState, TaskListUIState } from './taskList';
|
|
14
13
|
export interface TaskWithUserDetails extends Task {
|
|
@@ -31,7 +30,6 @@ export interface TaskListSelectorView extends SelectorView {
|
|
|
31
30
|
taskGroupUpdateStatus: FetchStateAndError;
|
|
32
31
|
uiState: TaskListUIState;
|
|
33
32
|
updateTasksFetchState: FetchStateAndError;
|
|
34
|
-
userGroupList: UserGroupListSelectorView;
|
|
35
33
|
userList: UserListSelectorView;
|
|
36
34
|
}
|
|
37
35
|
export declare const getTaskListGroupedByAssignees: ({ taskListState, taskState, userState, userRoleState, addressState, tagState, }: {
|
|
@@ -17,7 +17,6 @@ const taskGroupTemplateSelector_1 = require("../../../entity/taskGroupTemplate/t
|
|
|
17
17
|
const userSelector_1 = require("../../../entity/user/userSelector");
|
|
18
18
|
const userAndRole_1 = require("../../companyView/types/userAndRole");
|
|
19
19
|
const spendManagementFilterHelpers_1 = require("../../spendManagement/spendManagementFilterHelpers");
|
|
20
|
-
const userGroupListViewSelector_1 = require("../../userGroupListView/userGroupListViewSelector");
|
|
21
20
|
const userListViewSelector_1 = require("../../userListView/userListViewSelector");
|
|
22
21
|
const taskDetailSelector_1 = require("../taskDetailView/taskDetailSelector");
|
|
23
22
|
const taskList_1 = require("./taskList");
|
|
@@ -317,7 +316,7 @@ const getTaskGroupsWithTaskList = ({ taskListState, taskState, userState, userRo
|
|
|
317
316
|
tagState,
|
|
318
317
|
});
|
|
319
318
|
};
|
|
320
|
-
exports.getAllTasks = (0, toolkit_1.createSelector)((state) => state.taskListState, (state) => state.taskState, (state) => state.userState, (state) => state.userRoleState, (state) => state.userListViewState, (state) => state.addressState, (state) => state.taskGroupState, (state) => state.taskGroupViewState, (state) => state.tagViewState, (state) => state.tagState, (state) => state.taskGroupTemplateState, (state) => state.taskGroupTemplateViewState, (
|
|
319
|
+
exports.getAllTasks = (0, toolkit_1.createSelector)((state) => state.taskListState, (state) => state.taskState, (state) => state.userState, (state) => state.userRoleState, (state) => state.userListViewState, (state) => state.addressState, (state) => state.taskGroupState, (state) => state.taskGroupViewState, (state) => state.tagViewState, (state) => state.tagState, (state) => state.taskGroupTemplateState, (state) => state.taskGroupTemplateViewState, (_state, isTaskTemplatesEnabled) => isTaskTemplatesEnabled, (taskListState, taskState, userState, userRoleState, userListViewState, addressState, taskGroupState, taskGroupViewState, tagViewState, tagState, taskGroupTemplateState, taskGroupTemplateViewState, isTaskTemplatesEnabled) => {
|
|
321
320
|
const { localData } = taskListState;
|
|
322
321
|
const taskGroupsWithTasksList = getTaskGroupsWithTaskList({
|
|
323
322
|
taskListState,
|
|
@@ -345,7 +344,6 @@ exports.getAllTasks = (0, toolkit_1.createSelector)((state) => state.taskListSta
|
|
|
345
344
|
taskGroupTemplates,
|
|
346
345
|
fetchState: fetchState,
|
|
347
346
|
userList: (0, userListViewSelector_1.getUserList)(userState, userRoleState, userListViewState, 'taskManagerCandidate'),
|
|
348
|
-
userGroupList: (0, userGroupListViewSelector_1.getUserGroupList)(userGroupsState, userGroupListViewState, 'taskManagerCandidate'),
|
|
349
347
|
error: error,
|
|
350
348
|
version: 0,
|
|
351
349
|
taskGroupsWithTasksList,
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
import { ActionsObservable, StateObservable } from 'redux-observable';
|
|
2
2
|
import { updateAddresses } from '../../entity/address/addressReducer';
|
|
3
3
|
import { updateAllUsers } from '../../entity/user/userReducer';
|
|
4
|
-
import { updateAllUserGroups } from '../../entity/userGroups/userGroupsReducer';
|
|
5
4
|
import { updateUserRoles } from '../../entity/userRole/userRoleReducer';
|
|
6
5
|
import { RootState } from '../../reducer';
|
|
7
6
|
import { ZeniAPI } from '../../zeniAPI';
|
|
8
7
|
import { updateChargeCardCount, updateDebitCardCount } from '../spendManagement/chargeCards/issueChargeCard/issueChargeCardReducer';
|
|
9
|
-
import { updateUserGroupIds } from '../userGroupListView/userGroupListViewReducer';
|
|
10
8
|
import { fetchUserListByType, updateUserIds, updateUserListFetchFailure } from './userListViewReducer';
|
|
11
|
-
export type ActionType = ReturnType<typeof fetchUserListByType> | ReturnType<typeof updateAllUsers> | ReturnType<typeof updateUserRoles> | ReturnType<typeof updateUserIds> | ReturnType<typeof updateChargeCardCount> | ReturnType<typeof updateDebitCardCount> | ReturnType<typeof updateAddresses> | ReturnType<typeof updateUserListFetchFailure
|
|
9
|
+
export type ActionType = ReturnType<typeof fetchUserListByType> | ReturnType<typeof updateAllUsers> | ReturnType<typeof updateUserRoles> | ReturnType<typeof updateUserIds> | ReturnType<typeof updateChargeCardCount> | ReturnType<typeof updateDebitCardCount> | ReturnType<typeof updateAddresses> | ReturnType<typeof updateUserListFetchFailure>;
|
|
12
10
|
export declare const fetchUserListByTypeEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => import("rxjs").Observable<ActionType>;
|
|
@@ -6,11 +6,9 @@ const operators_1 = require("rxjs/operators");
|
|
|
6
6
|
const addressReducer_1 = require("../../entity/address/addressReducer");
|
|
7
7
|
const tenantSelector_1 = require("../../entity/tenant/tenantSelector");
|
|
8
8
|
const userReducer_1 = require("../../entity/user/userReducer");
|
|
9
|
-
const userGroupsReducer_1 = require("../../entity/userGroups/userGroupsReducer");
|
|
10
9
|
const userRoleReducer_1 = require("../../entity/userRole/userRoleReducer");
|
|
11
10
|
const responsePayload_1 = require("../../responsePayload");
|
|
12
11
|
const issueChargeCardReducer_1 = require("../spendManagement/chargeCards/issueChargeCard/issueChargeCardReducer");
|
|
13
|
-
const userGroupListViewReducer_1 = require("../userGroupListView/userGroupListViewReducer");
|
|
14
12
|
const userListViewReducer_1 = require("./userListViewReducer");
|
|
15
13
|
const fetchUserListByTypeEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(userListViewReducer_1.fetchUserListByType.match), (0, operators_1.mergeMap)((action) => {
|
|
16
14
|
const { userType, cacheOverride } = action.payload;
|
|
@@ -34,15 +32,6 @@ const fetchUserListByTypeEpic = (actions$, state$, zeniAPI) => actions$.pipe((0,
|
|
|
34
32
|
usersPayload: response.data?.users ?? [],
|
|
35
33
|
}),
|
|
36
34
|
];
|
|
37
|
-
if (response.data?.user_groups != null) {
|
|
38
|
-
userListAction.push((0, userGroupsReducer_1.updateAllUserGroups)({ userGroups: response.data.user_groups }));
|
|
39
|
-
if (userType === 'taskManagerCandidate') {
|
|
40
|
-
userListAction.push((0, userGroupListViewReducer_1.updateUserGroupIds)({
|
|
41
|
-
userGroupType: userType,
|
|
42
|
-
userGroupsPayload: response.data.user_groups,
|
|
43
|
-
}));
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
35
|
if (userType === 'cardHolderCandidate') {
|
|
47
36
|
userListAction.push((0, issueChargeCardReducer_1.updateChargeCardCount)(response.data?.cards_count_by_user_id ?? []));
|
|
48
37
|
userListAction.push((0, issueChargeCardReducer_1.updateDebitCardCount)(response.data?.debit_cards_count_by_deposit_account_id ?? {}));
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import { ID } from '../../commonStateTypes/common';
|
|
2
2
|
import { AddressPayload } from '../../entity/address/addressPayload';
|
|
3
3
|
import { UserPayload } from '../../entity/user/userPayload';
|
|
4
|
-
import { UserGroupPayload } from '../../entity/userGroups/userGroupsPayload';
|
|
5
4
|
import { UserRolePayload } from '../../entity/userRole/userRolePayload';
|
|
6
5
|
import { ZeniAPIResponse } from '../../responsePayload';
|
|
7
6
|
interface UserListResponsePayload {
|
|
8
|
-
user_groups: UserGroupPayload[];
|
|
9
7
|
user_roles: UserRolePayload[];
|
|
10
8
|
users: UserPayload[];
|
|
11
9
|
addresses?: AddressPayload[];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zeniai/client-epic-state",
|
|
3
|
-
"version": "4.19.91
|
|
3
|
+
"version": "4.19.91",
|
|
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",
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.mapUserGroupPayloadToUserGroup = mapUserGroupPayloadToUserGroup;
|
|
4
|
-
function mapUserGroupPayloadToUserGroup(payload) {
|
|
5
|
-
return {
|
|
6
|
-
userGroupId: payload.id,
|
|
7
|
-
name: payload.name,
|
|
8
|
-
userIds: payload.user_ids ?? [],
|
|
9
|
-
};
|
|
10
|
-
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { UserGroupPayload } from './userGroupsPayload';
|
|
2
|
-
import { UserGroupsState } from './userGroupsState';
|
|
3
|
-
export declare const initialState: UserGroupsState;
|
|
4
|
-
export declare const updateAllUserGroups: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
5
|
-
userGroups: UserGroupPayload[];
|
|
6
|
-
}, "userGroups/updateAllUserGroups">, removeUserGroup: import("@reduxjs/toolkit").ActionCreatorWithPayload<string, "userGroups/removeUserGroup">, clearAllUserGroups: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"userGroups/clearAllUserGroups">;
|
|
7
|
-
declare const _default: import("redux").Reducer<UserGroupsState>;
|
|
8
|
-
export default _default;
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var _a;
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.clearAllUserGroups = exports.removeUserGroup = exports.updateAllUserGroups = exports.initialState = void 0;
|
|
5
|
-
const toolkit_1 = require("@reduxjs/toolkit");
|
|
6
|
-
const userGroupsPayload_1 = require("./userGroupsPayload");
|
|
7
|
-
exports.initialState = {
|
|
8
|
-
userGroupByUserGroupId: {},
|
|
9
|
-
};
|
|
10
|
-
const userGroups = (0, toolkit_1.createSlice)({
|
|
11
|
-
name: 'userGroups',
|
|
12
|
-
initialState: exports.initialState,
|
|
13
|
-
reducers: {
|
|
14
|
-
updateAllUserGroups(draft, action) {
|
|
15
|
-
action.payload.userGroups.forEach((payload) => {
|
|
16
|
-
const userGroup = (0, userGroupsPayload_1.mapUserGroupPayloadToUserGroup)(payload);
|
|
17
|
-
draft.userGroupByUserGroupId[userGroup.userGroupId] = userGroup;
|
|
18
|
-
});
|
|
19
|
-
},
|
|
20
|
-
removeUserGroup(draft, action) {
|
|
21
|
-
delete draft.userGroupByUserGroupId[action.payload];
|
|
22
|
-
},
|
|
23
|
-
clearAllUserGroups(draft) {
|
|
24
|
-
Object.assign(draft, exports.initialState);
|
|
25
|
-
},
|
|
26
|
-
},
|
|
27
|
-
});
|
|
28
|
-
_a = userGroups.actions, exports.updateAllUserGroups = _a.updateAllUserGroups, exports.removeUserGroup = _a.removeUserGroup, exports.clearAllUserGroups = _a.clearAllUserGroups;
|
|
29
|
-
exports.default = userGroups.reducer;
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { ID } from '../../commonStateTypes/common';
|
|
2
|
-
import { UserGroup, UserGroupsState } from './userGroupsState';
|
|
3
|
-
export declare function getUserGroupsByUserGroupIds(userGroupsState: UserGroupsState, userGroupIds: ID[]): UserGroup[];
|
|
4
|
-
export declare function getUserGroupByUserGroupId(userGroupsState: UserGroupsState, userGroupId: ID): UserGroup | undefined;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getUserGroupsByUserGroupIds = getUserGroupsByUserGroupIds;
|
|
4
|
-
exports.getUserGroupByUserGroupId = getUserGroupByUserGroupId;
|
|
5
|
-
function getUserGroupsByUserGroupIds(userGroupsState, userGroupIds) {
|
|
6
|
-
return userGroupIds
|
|
7
|
-
.map((id) => getUserGroupByUserGroupId(userGroupsState, id))
|
|
8
|
-
.filter((value) => value != null);
|
|
9
|
-
}
|
|
10
|
-
function getUserGroupByUserGroupId(userGroupsState, userGroupId) {
|
|
11
|
-
return userGroupsState.userGroupByUserGroupId[userGroupId] ?? undefined;
|
|
12
|
-
}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { createSlice } from '@reduxjs/toolkit';
|
|
2
|
-
import { mapUserGroupPayloadToUserGroup, } from './userGroupsPayload';
|
|
3
|
-
export const initialState = {
|
|
4
|
-
userGroupByUserGroupId: {},
|
|
5
|
-
};
|
|
6
|
-
const userGroups = createSlice({
|
|
7
|
-
name: 'userGroups',
|
|
8
|
-
initialState,
|
|
9
|
-
reducers: {
|
|
10
|
-
updateAllUserGroups(draft, action) {
|
|
11
|
-
action.payload.userGroups.forEach((payload) => {
|
|
12
|
-
const userGroup = mapUserGroupPayloadToUserGroup(payload);
|
|
13
|
-
draft.userGroupByUserGroupId[userGroup.userGroupId] = userGroup;
|
|
14
|
-
});
|
|
15
|
-
},
|
|
16
|
-
removeUserGroup(draft, action) {
|
|
17
|
-
delete draft.userGroupByUserGroupId[action.payload];
|
|
18
|
-
},
|
|
19
|
-
clearAllUserGroups(draft) {
|
|
20
|
-
Object.assign(draft, initialState);
|
|
21
|
-
},
|
|
22
|
-
},
|
|
23
|
-
});
|
|
24
|
-
export const { updateAllUserGroups, removeUserGroup, clearAllUserGroups } = userGroups.actions;
|
|
25
|
-
export default userGroups.reducer;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
export function getUserGroupsByUserGroupIds(userGroupsState, userGroupIds) {
|
|
2
|
-
return userGroupIds
|
|
3
|
-
.map((id) => getUserGroupByUserGroupId(userGroupsState, id))
|
|
4
|
-
.filter((value) => value != null);
|
|
5
|
-
}
|
|
6
|
-
export function getUserGroupByUserGroupId(userGroupsState, userGroupId) {
|
|
7
|
-
return userGroupsState.userGroupByUserGroupId[userGroupId] ?? undefined;
|
|
8
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
import { createSlice } from '@reduxjs/toolkit';
|
|
2
|
-
const initialUserGroupList = {
|
|
3
|
-
ids: [],
|
|
4
|
-
fetchState: 'Not-Started',
|
|
5
|
-
error: undefined,
|
|
6
|
-
hasValidState() {
|
|
7
|
-
return this.fetchState == 'Completed';
|
|
8
|
-
},
|
|
9
|
-
};
|
|
10
|
-
export const initialState = {
|
|
11
|
-
userGroupListByType: {
|
|
12
|
-
taskManagerCandidate: initialUserGroupList,
|
|
13
|
-
},
|
|
14
|
-
};
|
|
15
|
-
const userGroupListView = createSlice({
|
|
16
|
-
name: 'userGroupListView',
|
|
17
|
-
initialState,
|
|
18
|
-
reducers: {
|
|
19
|
-
fetchUserGroupListByType: {
|
|
20
|
-
reducer(draft, action) {
|
|
21
|
-
const { userGroupType, cacheOverride } = action.payload;
|
|
22
|
-
if (cacheOverride === true ||
|
|
23
|
-
(cacheOverride === false &&
|
|
24
|
-
draft.userGroupListByType[userGroupType].hasValidState() === false)) {
|
|
25
|
-
draft.userGroupListByType[userGroupType].fetchState = 'In-Progress';
|
|
26
|
-
draft.userGroupListByType[userGroupType].error = undefined;
|
|
27
|
-
}
|
|
28
|
-
},
|
|
29
|
-
prepare(userGroupType, cacheOverride = false) {
|
|
30
|
-
return {
|
|
31
|
-
payload: {
|
|
32
|
-
userGroupType,
|
|
33
|
-
cacheOverride,
|
|
34
|
-
},
|
|
35
|
-
};
|
|
36
|
-
},
|
|
37
|
-
},
|
|
38
|
-
updateUserGroupIds(draft, action) {
|
|
39
|
-
const { userGroupType, userGroupsPayload } = action.payload;
|
|
40
|
-
draft.userGroupListByType[userGroupType].fetchState = 'Completed';
|
|
41
|
-
draft.userGroupListByType[userGroupType].error = undefined;
|
|
42
|
-
draft.userGroupListByType[userGroupType].ids = userGroupsPayload.map((userGroup) => userGroup.id);
|
|
43
|
-
},
|
|
44
|
-
addUserGroupId(draft, action) {
|
|
45
|
-
const { userGroupType, id } = action.payload;
|
|
46
|
-
const index = draft.userGroupListByType[userGroupType].ids.indexOf(id);
|
|
47
|
-
if (index < 0) {
|
|
48
|
-
draft.userGroupListByType[userGroupType].ids.push(id);
|
|
49
|
-
}
|
|
50
|
-
},
|
|
51
|
-
removeUserGroupId(draft, action) {
|
|
52
|
-
const { userGroupType, id } = action.payload;
|
|
53
|
-
const index = draft.userGroupListByType[userGroupType].ids.indexOf(id);
|
|
54
|
-
if (index > -1) {
|
|
55
|
-
draft.userGroupListByType[userGroupType].ids.splice(index, 1);
|
|
56
|
-
}
|
|
57
|
-
},
|
|
58
|
-
updateUserGroupListFetchFailure(draft, action) {
|
|
59
|
-
const { userGroupType, status } = action.payload;
|
|
60
|
-
draft.userGroupListByType[userGroupType].fetchState = 'Error';
|
|
61
|
-
draft.userGroupListByType[userGroupType].error = status;
|
|
62
|
-
},
|
|
63
|
-
clearUserGroupListView(draft) {
|
|
64
|
-
Object.assign(draft, initialState);
|
|
65
|
-
},
|
|
66
|
-
},
|
|
67
|
-
});
|
|
68
|
-
export const { fetchUserGroupListByType, updateUserGroupIds, addUserGroupId, removeUserGroupId, updateUserGroupListFetchFailure, clearUserGroupListView, } = userGroupListView.actions;
|
|
69
|
-
export default userGroupListView.reducer;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { getUserGroupByUserGroupId } from '../../entity/userGroups/userGroupsSelector';
|
|
2
|
-
export const getUserGroupList = (userGroupsState, userGroupListViewState, userGroupType) => {
|
|
3
|
-
const listState = userGroupListViewState.userGroupListByType[userGroupType];
|
|
4
|
-
return {
|
|
5
|
-
userGroups: getUserGroupListByIds(userGroupsState, userGroupListViewState, userGroupType),
|
|
6
|
-
fetchState: listState?.fetchState,
|
|
7
|
-
error: listState?.error,
|
|
8
|
-
version: 0,
|
|
9
|
-
};
|
|
10
|
-
};
|
|
11
|
-
function getUserGroupListByIds(userGroupsState, userGroupListViewState, type) {
|
|
12
|
-
const userGroupIds = userGroupListViewState.userGroupListByType[type].ids;
|
|
13
|
-
return userGroupIds
|
|
14
|
-
.map((id) => getUserGroupByUserGroupId(userGroupsState, id))
|
|
15
|
-
.filter((value) => value != null);
|
|
16
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { ID } from '../../commonStateTypes/common';
|
|
2
|
-
import { UserGroupPayload } from '../../entity/userGroups/userGroupsPayload';
|
|
3
|
-
import { ZeniAPIStatus } from '../../responsePayload';
|
|
4
|
-
import { UserGroupListType, UserGroupListViewState } from './userGroupListViewState';
|
|
5
|
-
export declare const initialState: UserGroupListViewState;
|
|
6
|
-
export declare const fetchUserGroupListByType: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[userGroupType: "taskManagerCandidate", cacheOverride?: any], {
|
|
7
|
-
userGroupType: "taskManagerCandidate";
|
|
8
|
-
cacheOverride: any;
|
|
9
|
-
}, "userGroupListView/fetchUserGroupListByType", never, never>, updateUserGroupIds: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
10
|
-
userGroupsPayload: UserGroupPayload[];
|
|
11
|
-
userGroupType: UserGroupListType;
|
|
12
|
-
}, "userGroupListView/updateUserGroupIds">, addUserGroupId: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
13
|
-
id: ID;
|
|
14
|
-
userGroupType: UserGroupListType;
|
|
15
|
-
}, "userGroupListView/addUserGroupId">, removeUserGroupId: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
16
|
-
id: ID;
|
|
17
|
-
userGroupType: UserGroupListType;
|
|
18
|
-
}, "userGroupListView/removeUserGroupId">, updateUserGroupListFetchFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
19
|
-
status: ZeniAPIStatus;
|
|
20
|
-
userGroupType: UserGroupListType;
|
|
21
|
-
}, "userGroupListView/updateUserGroupListFetchFailure">, clearUserGroupListView: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"userGroupListView/clearUserGroupListView">;
|
|
22
|
-
declare const _default: import("redux").Reducer<UserGroupListViewState>;
|
|
23
|
-
export default _default;
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var _a;
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.clearUserGroupListView = exports.updateUserGroupListFetchFailure = exports.removeUserGroupId = exports.addUserGroupId = exports.updateUserGroupIds = exports.fetchUserGroupListByType = exports.initialState = void 0;
|
|
5
|
-
const toolkit_1 = require("@reduxjs/toolkit");
|
|
6
|
-
const initialUserGroupList = {
|
|
7
|
-
ids: [],
|
|
8
|
-
fetchState: 'Not-Started',
|
|
9
|
-
error: undefined,
|
|
10
|
-
hasValidState() {
|
|
11
|
-
return this.fetchState == 'Completed';
|
|
12
|
-
},
|
|
13
|
-
};
|
|
14
|
-
exports.initialState = {
|
|
15
|
-
userGroupListByType: {
|
|
16
|
-
taskManagerCandidate: initialUserGroupList,
|
|
17
|
-
},
|
|
18
|
-
};
|
|
19
|
-
const userGroupListView = (0, toolkit_1.createSlice)({
|
|
20
|
-
name: 'userGroupListView',
|
|
21
|
-
initialState: exports.initialState,
|
|
22
|
-
reducers: {
|
|
23
|
-
fetchUserGroupListByType: {
|
|
24
|
-
reducer(draft, action) {
|
|
25
|
-
const { userGroupType, cacheOverride } = action.payload;
|
|
26
|
-
if (cacheOverride === true ||
|
|
27
|
-
(cacheOverride === false &&
|
|
28
|
-
draft.userGroupListByType[userGroupType].hasValidState() === false)) {
|
|
29
|
-
draft.userGroupListByType[userGroupType].fetchState = 'In-Progress';
|
|
30
|
-
draft.userGroupListByType[userGroupType].error = undefined;
|
|
31
|
-
}
|
|
32
|
-
},
|
|
33
|
-
prepare(userGroupType, cacheOverride = false) {
|
|
34
|
-
return {
|
|
35
|
-
payload: {
|
|
36
|
-
userGroupType,
|
|
37
|
-
cacheOverride,
|
|
38
|
-
},
|
|
39
|
-
};
|
|
40
|
-
},
|
|
41
|
-
},
|
|
42
|
-
updateUserGroupIds(draft, action) {
|
|
43
|
-
const { userGroupType, userGroupsPayload } = action.payload;
|
|
44
|
-
draft.userGroupListByType[userGroupType].fetchState = 'Completed';
|
|
45
|
-
draft.userGroupListByType[userGroupType].error = undefined;
|
|
46
|
-
draft.userGroupListByType[userGroupType].ids = userGroupsPayload.map((userGroup) => userGroup.id);
|
|
47
|
-
},
|
|
48
|
-
addUserGroupId(draft, action) {
|
|
49
|
-
const { userGroupType, id } = action.payload;
|
|
50
|
-
const index = draft.userGroupListByType[userGroupType].ids.indexOf(id);
|
|
51
|
-
if (index < 0) {
|
|
52
|
-
draft.userGroupListByType[userGroupType].ids.push(id);
|
|
53
|
-
}
|
|
54
|
-
},
|
|
55
|
-
removeUserGroupId(draft, action) {
|
|
56
|
-
const { userGroupType, id } = action.payload;
|
|
57
|
-
const index = draft.userGroupListByType[userGroupType].ids.indexOf(id);
|
|
58
|
-
if (index > -1) {
|
|
59
|
-
draft.userGroupListByType[userGroupType].ids.splice(index, 1);
|
|
60
|
-
}
|
|
61
|
-
},
|
|
62
|
-
updateUserGroupListFetchFailure(draft, action) {
|
|
63
|
-
const { userGroupType, status } = action.payload;
|
|
64
|
-
draft.userGroupListByType[userGroupType].fetchState = 'Error';
|
|
65
|
-
draft.userGroupListByType[userGroupType].error = status;
|
|
66
|
-
},
|
|
67
|
-
clearUserGroupListView(draft) {
|
|
68
|
-
Object.assign(draft, exports.initialState);
|
|
69
|
-
},
|
|
70
|
-
},
|
|
71
|
-
});
|
|
72
|
-
_a = userGroupListView.actions, exports.fetchUserGroupListByType = _a.fetchUserGroupListByType, exports.updateUserGroupIds = _a.updateUserGroupIds, exports.addUserGroupId = _a.addUserGroupId, exports.removeUserGroupId = _a.removeUserGroupId, exports.updateUserGroupListFetchFailure = _a.updateUserGroupListFetchFailure, exports.clearUserGroupListView = _a.clearUserGroupListView;
|
|
73
|
-
exports.default = userGroupListView.reducer;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { SelectorView } from '../../commonStateTypes/viewAndReport/viewAndReport';
|
|
2
|
-
import { UserGroup, UserGroupsState } from '../../entity/userGroups/userGroupsState';
|
|
3
|
-
import { UserGroupListType, UserGroupListViewState } from './userGroupListViewState';
|
|
4
|
-
export interface UserGroupListSelectorView extends SelectorView {
|
|
5
|
-
userGroups: UserGroup[];
|
|
6
|
-
}
|
|
7
|
-
export declare const getUserGroupList: (userGroupsState: UserGroupsState, userGroupListViewState: UserGroupListViewState, userGroupType: UserGroupListType) => UserGroupListSelectorView;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getUserGroupList = void 0;
|
|
4
|
-
const userGroupsSelector_1 = require("../../entity/userGroups/userGroupsSelector");
|
|
5
|
-
const getUserGroupList = (userGroupsState, userGroupListViewState, userGroupType) => {
|
|
6
|
-
const listState = userGroupListViewState.userGroupListByType[userGroupType];
|
|
7
|
-
return {
|
|
8
|
-
userGroups: getUserGroupListByIds(userGroupsState, userGroupListViewState, userGroupType),
|
|
9
|
-
fetchState: listState?.fetchState,
|
|
10
|
-
error: listState?.error,
|
|
11
|
-
version: 0,
|
|
12
|
-
};
|
|
13
|
-
};
|
|
14
|
-
exports.getUserGroupList = getUserGroupList;
|
|
15
|
-
function getUserGroupListByIds(userGroupsState, userGroupListViewState, type) {
|
|
16
|
-
const userGroupIds = userGroupListViewState.userGroupListByType[type].ids;
|
|
17
|
-
return userGroupIds
|
|
18
|
-
.map((id) => (0, userGroupsSelector_1.getUserGroupByUserGroupId)(userGroupsState, id))
|
|
19
|
-
.filter((value) => value != null);
|
|
20
|
-
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { FetchedState, ID } from '../../commonStateTypes/common';
|
|
2
|
-
export type UserGroupListType = 'taskManagerCandidate';
|
|
3
|
-
export interface UserGroupIdsByType extends FetchedState {
|
|
4
|
-
ids: ID[];
|
|
5
|
-
}
|
|
6
|
-
export interface UserGroupListViewState {
|
|
7
|
-
userGroupListByType: Record<UserGroupListType, UserGroupIdsByType>;
|
|
8
|
-
}
|