@truedat/dd 4.51.2 → 4.51.4
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/CHANGELOG.md +13 -0
- package/package.json +6 -6
- package/src/api/queries.js +24 -0
- package/src/api.js +0 -2
- package/src/components/DictionaryRoutes.js +0 -5
- package/src/components/EditDomainForm.js +15 -20
- package/src/components/GrantRequest.js +12 -0
- package/src/components/GrantRequests.js +24 -15
- package/src/components/LineageForm.js +23 -34
- package/src/components/PendingStructureNoteRow.js +5 -8
- package/src/components/PendingStructureNotes.js +25 -46
- package/src/components/PendingStructureNotesTable.js +46 -57
- package/src/components/StructureGrantCartCheckout.js +7 -6
- package/src/components/{StructureGrantCartTemplate.js → StructureGrantCartInformation.js} +15 -5
- package/src/components/StructureGrantCartUserSelector.js +93 -0
- package/src/components/StructureGrantDropdown.js +45 -18
- package/src/components/StructureGrantRequestAddCart.js +26 -0
- package/src/components/StructuresRoutes.js +1 -11
- package/src/components/__tests__/EditDomainForm.spec.js +31 -46
- package/src/components/__tests__/LineageForm.spec.js +37 -122
- package/src/components/__tests__/MyGrantRequests.spec.js +14 -2
- package/src/components/__tests__/PendingStructureNoteRow.spec.js +2 -2
- package/src/components/__tests__/PendingStructureNotes.spec.js +13 -15
- package/src/components/__tests__/{StructureGrantCartTemplate.spec.js → StructureGrantCartInformation.spec.js} +3 -3
- package/src/components/__tests__/StructureGrantCartUserSelector.js +21 -0
- package/src/components/__tests__/__snapshots__/EditDomainForm.spec.js.snap +2 -71
- package/src/components/__tests__/__snapshots__/LineageForm.spec.js.snap +13 -14
- package/src/components/__tests__/__snapshots__/MyGrantRequests.spec.js.snap +1 -1
- package/src/components/__tests__/__snapshots__/PendingStructureNotes.spec.js.snap +1 -2
- package/src/components/__tests__/__snapshots__/PendingStructureNotesTable.spec.js.snap +8 -16
- package/src/components/__tests__/__snapshots__/{StructureGrantCartTemplate.spec.js.snap → StructureGrantCartInformation.spec.js.snap} +2 -2
- package/src/components/__tests__/__snapshots__/StructureGrantCartUserSelector.js.snap +74 -0
- package/src/messages/en.js +3 -1
- package/src/messages/es.js +3 -0
- package/src/reducers/grantRequestsCart.js +10 -0
- package/src/reducers/index.js +0 -2
- package/src/routines.js +1 -1
- package/src/sagas/index.js +0 -3
- package/src/selectors/index.js +0 -1
- package/src/reducers/__tests__/unitDomains.spec.js +0 -27
- package/src/reducers/unitDomains.js +0 -16
- package/src/sagas/__tests__/fetchUnitDomains.spec.js +0 -91
- package/src/sagas/fetchUnitDomains.js +0 -29
- package/src/selectors/__tests__/getDomainOptions.spec.js +0 -32
- package/src/selectors/getDomainOptions.js +0 -17
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
2
|
|
|
3
|
-
exports[`<
|
|
3
|
+
exports[`<StructureGrantCartInformation /> matches the latest snapshot 1`] = `
|
|
4
4
|
<div>
|
|
5
5
|
<div
|
|
6
|
-
class="ui segment"
|
|
6
|
+
class="ui loading segment"
|
|
7
7
|
style="display: none;"
|
|
8
8
|
>
|
|
9
9
|
<div
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
+
|
|
3
|
+
exports[`<StructureGrantCartUserSelector /> matches the latest snapshot 1`] = `
|
|
4
|
+
<div>
|
|
5
|
+
<div
|
|
6
|
+
class="field"
|
|
7
|
+
style="display: none;"
|
|
8
|
+
>
|
|
9
|
+
<div
|
|
10
|
+
class="ui checkbox"
|
|
11
|
+
>
|
|
12
|
+
<input
|
|
13
|
+
class="hidden"
|
|
14
|
+
readonly=""
|
|
15
|
+
tabindex="0"
|
|
16
|
+
type="checkbox"
|
|
17
|
+
value=""
|
|
18
|
+
/>
|
|
19
|
+
<label>
|
|
20
|
+
Request for:
|
|
21
|
+
</label>
|
|
22
|
+
</div>
|
|
23
|
+
<div
|
|
24
|
+
aria-expanded="false"
|
|
25
|
+
class="ui search selection dropdown"
|
|
26
|
+
role="combobox"
|
|
27
|
+
>
|
|
28
|
+
<input
|
|
29
|
+
aria-autocomplete="list"
|
|
30
|
+
autocomplete="off"
|
|
31
|
+
class="search"
|
|
32
|
+
tabindex="0"
|
|
33
|
+
type="text"
|
|
34
|
+
value=""
|
|
35
|
+
/>
|
|
36
|
+
<div
|
|
37
|
+
aria-atomic="true"
|
|
38
|
+
aria-live="polite"
|
|
39
|
+
class="divider text"
|
|
40
|
+
role="alert"
|
|
41
|
+
>
|
|
42
|
+
Select user
|
|
43
|
+
</div>
|
|
44
|
+
<i
|
|
45
|
+
aria-hidden="true"
|
|
46
|
+
class="dropdown icon clear"
|
|
47
|
+
/>
|
|
48
|
+
<div
|
|
49
|
+
class="menu transition"
|
|
50
|
+
role="listbox"
|
|
51
|
+
>
|
|
52
|
+
<div
|
|
53
|
+
aria-checked="false"
|
|
54
|
+
aria-selected="true"
|
|
55
|
+
class="selected item"
|
|
56
|
+
role="option"
|
|
57
|
+
style="pointer-events: all;"
|
|
58
|
+
>
|
|
59
|
+
<i
|
|
60
|
+
aria-hidden="true"
|
|
61
|
+
class="user icon"
|
|
62
|
+
/>
|
|
63
|
+
<span
|
|
64
|
+
class="text"
|
|
65
|
+
>
|
|
66
|
+
name
|
|
67
|
+
</span>
|
|
68
|
+
</div>
|
|
69
|
+
</div>
|
|
70
|
+
</div>
|
|
71
|
+
</div>
|
|
72
|
+
lazy
|
|
73
|
+
</div>
|
|
74
|
+
`;
|
package/src/messages/en.js
CHANGED
|
@@ -76,11 +76,13 @@ export default {
|
|
|
76
76
|
"grantRequest.header.status": "Status",
|
|
77
77
|
"grantRequest.header.updated_at": "Updated",
|
|
78
78
|
"grantRequest.header.user": "User",
|
|
79
|
-
|
|
79
|
+
"grantRequest.header.createdBy": "Created by",
|
|
80
80
|
"grantRequest.header.create": "Create grant request",
|
|
81
81
|
"grantRequest.header.update": "Request grant change",
|
|
82
82
|
"grantRequest.summary.emptyApprovals": "No approves",
|
|
83
83
|
"grantRequest.summary.pendingRoles": "Pending roles",
|
|
84
|
+
"grantRequestCart.user.label": "Request for:",
|
|
85
|
+
"grantRequestCart.user.placeholder": "Select user",
|
|
84
86
|
"grantRequestApproval.content.approved": "Approved",
|
|
85
87
|
"grantRequestApproval.content.comment": "Comment",
|
|
86
88
|
"grantRequestApproval.content.inserted_at": "Date",
|
package/src/messages/es.js
CHANGED
|
@@ -80,10 +80,13 @@ export default {
|
|
|
80
80
|
"grantRequest.header.status": "Estado",
|
|
81
81
|
"grantRequest.header.updated_at": "Actualizado",
|
|
82
82
|
"grantRequest.header.user": "Usuario",
|
|
83
|
+
"grantRequest.header.createdBy": "Creado por",
|
|
83
84
|
"grantRequest.header.create": "Crear petición de acceso",
|
|
84
85
|
"grantRequest.header.update": "Petición de modificación de acceso",
|
|
85
86
|
"grantRequest.summary.emptyApprovals": "Sin aprobaciones",
|
|
86
87
|
"grantRequest.summary.pendingRoles": "Roles pendientes",
|
|
88
|
+
"grantRequestCart.user.label": "Solicitud para:",
|
|
89
|
+
"grantRequestCart.user.placeholder": "Seleccionar usuario",
|
|
87
90
|
"grantRequestApproval.content.approved": "Aprobada",
|
|
88
91
|
"grantRequestApproval.content.comment": "Comentario",
|
|
89
92
|
"grantRequestApproval.content.inserted_at": "Fecha",
|
|
@@ -8,6 +8,7 @@ import {
|
|
|
8
8
|
setGrantChangeRequestCart,
|
|
9
9
|
updateGrantRequestFilter,
|
|
10
10
|
updateGrantRequestTemplateContent,
|
|
11
|
+
updateGrantRequestUser,
|
|
11
12
|
} from "../routines";
|
|
12
13
|
|
|
13
14
|
const initialState = {
|
|
@@ -15,6 +16,7 @@ const initialState = {
|
|
|
15
16
|
template: null,
|
|
16
17
|
templateContent: {},
|
|
17
18
|
modificationGrant: null,
|
|
19
|
+
userId: { id: null, valid: true },
|
|
18
20
|
};
|
|
19
21
|
const mapPayload = (payload) =>
|
|
20
22
|
payload?.class === "field" ? { ...payload, filters: [] } : payload;
|
|
@@ -62,6 +64,14 @@ const grantRequestsCart = (state = initialState, { type, payload }) => {
|
|
|
62
64
|
templateContent: content,
|
|
63
65
|
validCart: state.template && _.size(valid) === 0,
|
|
64
66
|
};
|
|
67
|
+
case updateGrantRequestUser.TRIGGER:
|
|
68
|
+
return {
|
|
69
|
+
...state,
|
|
70
|
+
user: {
|
|
71
|
+
id: payload.id,
|
|
72
|
+
valid: payload.valid,
|
|
73
|
+
},
|
|
74
|
+
};
|
|
65
75
|
case setGrantChangeRequestCart.TRIGGER:
|
|
66
76
|
const { structure, grant } = payload;
|
|
67
77
|
return {
|
package/src/reducers/index.js
CHANGED
|
@@ -87,7 +87,6 @@ import { systemStructuresLoading } from "./systemStructuresLoading";
|
|
|
87
87
|
import { systems } from "./systems";
|
|
88
88
|
import { systemsLoading } from "./systemsLoading";
|
|
89
89
|
import { tagSaving } from "./tagSaving";
|
|
90
|
-
import { unitDomains } from "./unitDomains";
|
|
91
90
|
import { uploadingStructuresFile } from "./uploadingStructuresFile";
|
|
92
91
|
import { userPermissions } from "./userPermissions";
|
|
93
92
|
import { userSearchFilters } from "./userSearchFilters";
|
|
@@ -184,7 +183,6 @@ export {
|
|
|
184
183
|
systems,
|
|
185
184
|
systemsLoading,
|
|
186
185
|
tagSaving,
|
|
187
|
-
unitDomains,
|
|
188
186
|
uploadingStructuresFile,
|
|
189
187
|
userPermissions,
|
|
190
188
|
userSearchFilters,
|
package/src/routines.js
CHANGED
|
@@ -80,7 +80,6 @@ export const fetchStructuresUploadEvents = createRoutine("FETCH_STRUCTURES_UPLOA
|
|
|
80
80
|
export const fetchSystem = createRoutine("FETCH_SYSTEM");
|
|
81
81
|
export const fetchSystemStructures = createRoutine("FETCH_SYSTEM_STRUCTURES");
|
|
82
82
|
export const fetchSystems = createRoutine("FETCH_SYSTEMS");
|
|
83
|
-
export const fetchUnitDomains = createRoutine("FETCH_UNIT_DOMAINS");
|
|
84
83
|
export const fetchUserSearchFilters = createRoutine("FETCH_USER_SEARCH_FILTERS");
|
|
85
84
|
export const filterStructures = createRoutine("FILTER_STRUCTURES");
|
|
86
85
|
export const hoverNode = createRoutine("HOVER_NODE");
|
|
@@ -119,6 +118,7 @@ export const toggleStructureFilterValue = createRoutine("TOGGLE_STRUCTURE_FILTER
|
|
|
119
118
|
export const updateGrant = createRoutine("UPDATE_GRANT");
|
|
120
119
|
export const updateGrantRequestFilter = createRoutine("UPDATE_GRANT_REQUEST_FILTER_SAGA");
|
|
121
120
|
export const updateGrantRequestTemplateContent = createRoutine("UPDATE_GRANT_REQUEST_TEMPLATE_CONTENT");
|
|
121
|
+
export const updateGrantRequestUser = createRoutine("UPDATE_GRANT_REQUEST_USER");
|
|
122
122
|
export const updateReferenceDataset = createRoutine("UPDATE_REFERENCE_DATASET");
|
|
123
123
|
export const updateStructure = createRoutine("UPDATE_STRUCTURE");
|
|
124
124
|
export const updateStructureType = createRoutine("UPDATE_STRUCTURE_TYPE");
|
package/src/sagas/index.js
CHANGED
|
@@ -38,7 +38,6 @@ import { fetchStructuresUploadEventsRequestSaga } from "./fetchStructuresUploadE
|
|
|
38
38
|
import { fetchSystemRequestSaga } from "./fetchSystem";
|
|
39
39
|
import { fetchSystemStructuresRequestSaga } from "./fetchSystemStructures";
|
|
40
40
|
import { fetchSystemsRequestSaga } from "./fetchSystems";
|
|
41
|
-
import { fetchUnitDomainsRequestSaga } from "./fetchUnitDomains";
|
|
42
41
|
import { fetchUserSearchFiltersRequestSaga } from "./fetchUserSearchFilters";
|
|
43
42
|
import { tagStructureRequestSaga } from "./tagStructure";
|
|
44
43
|
import { operateGrantRequestToCartRequestSaga } from "./operateGrantRequestCart";
|
|
@@ -93,7 +92,6 @@ export {
|
|
|
93
92
|
fetchSystemRequestSaga,
|
|
94
93
|
fetchSystemStructuresRequestSaga,
|
|
95
94
|
fetchSystemsRequestSaga,
|
|
96
|
-
fetchUnitDomainsRequestSaga,
|
|
97
95
|
fetchUserSearchFiltersRequestSaga,
|
|
98
96
|
tagStructureRequestSaga,
|
|
99
97
|
operateGrantRequestToCartRequestSaga,
|
|
@@ -149,7 +147,6 @@ export default [
|
|
|
149
147
|
fetchSystemRequestSaga(),
|
|
150
148
|
fetchSystemStructuresRequestSaga(),
|
|
151
149
|
fetchSystemsRequestSaga(),
|
|
152
|
-
fetchUnitDomainsRequestSaga(),
|
|
153
150
|
fetchUserSearchFiltersRequestSaga(),
|
|
154
151
|
tagStructureRequestSaga(),
|
|
155
152
|
operateGrantRequestToCartRequestSaga(),
|
package/src/selectors/index.js
CHANGED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { fetchUnitDomains } from "../../routines";
|
|
2
|
-
import { unitDomains } from "..";
|
|
3
|
-
|
|
4
|
-
const fooState = { foo: "bar" };
|
|
5
|
-
|
|
6
|
-
describe("reducers: unitDomains", () => {
|
|
7
|
-
const initialState = [];
|
|
8
|
-
|
|
9
|
-
it("should provide the initial state", () => {
|
|
10
|
-
expect(unitDomains(undefined, {})).toEqual(initialState);
|
|
11
|
-
});
|
|
12
|
-
|
|
13
|
-
it("should handle the fetchUnitDomains.SUCCESS action", () => {
|
|
14
|
-
const data = [{ id: 1, name: "foo" }];
|
|
15
|
-
|
|
16
|
-
expect(
|
|
17
|
-
unitDomains(fooState, {
|
|
18
|
-
type: fetchUnitDomains.SUCCESS,
|
|
19
|
-
payload: { data },
|
|
20
|
-
})
|
|
21
|
-
).toMatchObject(data);
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
it("should ignore unknown actions", () => {
|
|
25
|
-
expect(unitDomains(fooState, { type: "FOO" })).toBe(fooState);
|
|
26
|
-
});
|
|
27
|
-
});
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { fetchUnitDomains } from "../routines";
|
|
2
|
-
|
|
3
|
-
const initialState = [];
|
|
4
|
-
|
|
5
|
-
const unitDomains = (state = initialState, { type, payload }) => {
|
|
6
|
-
switch (type) {
|
|
7
|
-
case fetchUnitDomains.TRIGGER:
|
|
8
|
-
return initialState;
|
|
9
|
-
case fetchUnitDomains.SUCCESS:
|
|
10
|
-
return payload?.data;
|
|
11
|
-
default:
|
|
12
|
-
return state;
|
|
13
|
-
}
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
export { unitDomains };
|
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
import { testSaga } from "redux-saga-test-plan";
|
|
2
|
-
import { apiJson, JSON_OPTS } from "@truedat/core/services/api";
|
|
3
|
-
import {
|
|
4
|
-
fetchUnitDomainsRequestSaga,
|
|
5
|
-
fetchUnitDomainsSaga,
|
|
6
|
-
} from "../fetchUnitDomains";
|
|
7
|
-
import { fetchUnitDomains } from "../../routines";
|
|
8
|
-
import { API_UNIT_DOMAINS } from "../../api";
|
|
9
|
-
|
|
10
|
-
describe("sagas: fetchUnitDomainsRequestSaga", () => {
|
|
11
|
-
it("should invoke fetchUnitDomainsSaga on trigger", () => {
|
|
12
|
-
expect(() => {
|
|
13
|
-
testSaga(fetchUnitDomainsRequestSaga)
|
|
14
|
-
.next()
|
|
15
|
-
.takeLatest(fetchUnitDomains.TRIGGER, fetchUnitDomainsSaga)
|
|
16
|
-
.finish()
|
|
17
|
-
.isDone();
|
|
18
|
-
}).not.toThrow();
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
it("should throw exception if an unhandled action is received", () => {
|
|
22
|
-
expect(() => {
|
|
23
|
-
testSaga(fetchUnitDomainsRequestSaga)
|
|
24
|
-
.next()
|
|
25
|
-
.takeLatest("FOO", fetchUnitDomainsSaga);
|
|
26
|
-
}).toThrow();
|
|
27
|
-
});
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
describe("sagas: fetchUnitDomainsSaga", () => {
|
|
31
|
-
const data = [
|
|
32
|
-
{ id: 1, name: "d1" },
|
|
33
|
-
{ id: 2, name: "d2" },
|
|
34
|
-
];
|
|
35
|
-
|
|
36
|
-
it("should put a success action when a response is returned", () => {
|
|
37
|
-
expect(() => {
|
|
38
|
-
testSaga(fetchUnitDomainsSaga)
|
|
39
|
-
.next()
|
|
40
|
-
.put(fetchUnitDomains.request())
|
|
41
|
-
.next()
|
|
42
|
-
.call(apiJson, API_UNIT_DOMAINS + "?actions=view_lineage", JSON_OPTS)
|
|
43
|
-
.next({ data })
|
|
44
|
-
.put(fetchUnitDomains.success(data))
|
|
45
|
-
.next()
|
|
46
|
-
.put(fetchUnitDomains.fulfill())
|
|
47
|
-
.next()
|
|
48
|
-
.isDone();
|
|
49
|
-
}).not.toThrow();
|
|
50
|
-
});
|
|
51
|
-
|
|
52
|
-
it("should put a failure action when the call returns an error", () => {
|
|
53
|
-
const message = "Request failed";
|
|
54
|
-
const error = { message };
|
|
55
|
-
|
|
56
|
-
expect(() => {
|
|
57
|
-
testSaga(fetchUnitDomainsSaga)
|
|
58
|
-
.next()
|
|
59
|
-
.put(fetchUnitDomains.request())
|
|
60
|
-
.next()
|
|
61
|
-
.call(apiJson, API_UNIT_DOMAINS + "?actions=view_lineage", JSON_OPTS)
|
|
62
|
-
.throw(error)
|
|
63
|
-
.put(fetchUnitDomains.failure(message))
|
|
64
|
-
.next()
|
|
65
|
-
.put(fetchUnitDomains.fulfill())
|
|
66
|
-
.next()
|
|
67
|
-
.isDone();
|
|
68
|
-
}).not.toThrow();
|
|
69
|
-
});
|
|
70
|
-
|
|
71
|
-
it("should put a failure action when the call returns an object message", () => {
|
|
72
|
-
const status = 404;
|
|
73
|
-
const data = "foo";
|
|
74
|
-
const response = { status, data };
|
|
75
|
-
const error = { response };
|
|
76
|
-
|
|
77
|
-
expect(() => {
|
|
78
|
-
testSaga(fetchUnitDomainsSaga)
|
|
79
|
-
.next()
|
|
80
|
-
.put(fetchUnitDomains.request())
|
|
81
|
-
.next()
|
|
82
|
-
.call(apiJson, API_UNIT_DOMAINS + "?actions=view_lineage", JSON_OPTS)
|
|
83
|
-
.throw(error)
|
|
84
|
-
.put(fetchUnitDomains.failure({ status, data }))
|
|
85
|
-
.next()
|
|
86
|
-
.put(fetchUnitDomains.fulfill())
|
|
87
|
-
.next()
|
|
88
|
-
.isDone();
|
|
89
|
-
}).not.toThrow();
|
|
90
|
-
});
|
|
91
|
-
});
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { call, put, takeLatest } from "redux-saga/effects";
|
|
2
|
-
import { apiJson, JSON_OPTS } from "@truedat/core/services/api";
|
|
3
|
-
import { fetchUnitDomains } from "../routines";
|
|
4
|
-
import { API_UNIT_DOMAINS } from "../api";
|
|
5
|
-
|
|
6
|
-
export function* fetchUnitDomainsSaga() {
|
|
7
|
-
try {
|
|
8
|
-
yield put(fetchUnitDomains.request());
|
|
9
|
-
const { data } = yield call(
|
|
10
|
-
apiJson,
|
|
11
|
-
API_UNIT_DOMAINS + "?actions=view_lineage",
|
|
12
|
-
JSON_OPTS
|
|
13
|
-
);
|
|
14
|
-
yield put(fetchUnitDomains.success(data));
|
|
15
|
-
} catch (error) {
|
|
16
|
-
if (error.response) {
|
|
17
|
-
const { status, data } = error.response;
|
|
18
|
-
yield put(fetchUnitDomains.failure({ status, data }));
|
|
19
|
-
} else {
|
|
20
|
-
yield put(fetchUnitDomains.failure(error.message));
|
|
21
|
-
}
|
|
22
|
-
} finally {
|
|
23
|
-
yield put(fetchUnitDomains.fulfill());
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export function* fetchUnitDomainsRequestSaga() {
|
|
28
|
-
yield takeLatest(fetchUnitDomains.TRIGGER, fetchUnitDomainsSaga);
|
|
29
|
-
}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import _ from "lodash/fp";
|
|
2
|
-
import { getDomainOptions } from "..";
|
|
3
|
-
|
|
4
|
-
describe("selectors: getDomainOptions", () => {
|
|
5
|
-
it("should obtain the selected system by id from the systems reducer", () => {
|
|
6
|
-
const d1 = { id: 1, name: "foo", parent_id: undefined };
|
|
7
|
-
const d2 = { id: 2, name: "bar", parent_id: 1, parent_ids: [1] };
|
|
8
|
-
const unitDomains = [d1, d2];
|
|
9
|
-
const state = { unitDomains };
|
|
10
|
-
const res = getDomainOptions(state);
|
|
11
|
-
expect(res).toEqual([
|
|
12
|
-
{
|
|
13
|
-
id: 1,
|
|
14
|
-
name: "foo",
|
|
15
|
-
parent_id: undefined,
|
|
16
|
-
ancestors: [],
|
|
17
|
-
descendents: [_.omit(["parent_ids"])(d2)],
|
|
18
|
-
children: [_.omit(["parent_ids"])(d2)],
|
|
19
|
-
level: 0,
|
|
20
|
-
},
|
|
21
|
-
{
|
|
22
|
-
id: 2,
|
|
23
|
-
name: "bar",
|
|
24
|
-
parent_id: 1,
|
|
25
|
-
ancestors: [d1],
|
|
26
|
-
descendents: [],
|
|
27
|
-
children: [],
|
|
28
|
-
level: 1,
|
|
29
|
-
},
|
|
30
|
-
]);
|
|
31
|
-
});
|
|
32
|
-
});
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import _ from "lodash/fp";
|
|
2
|
-
import { createSelector } from "reselect";
|
|
3
|
-
import { getDomainSelectorOptions } from "@truedat/bg/selectors";
|
|
4
|
-
|
|
5
|
-
export const getDomainOptions = createSelector(
|
|
6
|
-
_.prop("unitDomains"),
|
|
7
|
-
(unitDomains) => {
|
|
8
|
-
const domains = _.flow(
|
|
9
|
-
_.map((domain) => ({
|
|
10
|
-
...domain,
|
|
11
|
-
parent_id: _.head(domain.parent_ids),
|
|
12
|
-
})),
|
|
13
|
-
_.map(_.omit(["parent_ids"]))
|
|
14
|
-
)(unitDomains);
|
|
15
|
-
return getDomainSelectorOptions({ domains });
|
|
16
|
-
}
|
|
17
|
-
);
|