@truedat/dd 6.5.5 → 6.6.1
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/package.json +6 -6
- package/src/components/CatalogCustomViewCards.js +9 -32
- package/src/components/DictionaryRoutes.js +1 -9
- package/src/components/GrantRemovalDirectButton.js +1 -3
- package/src/components/GrantRequestCancel.js +1 -1
- package/src/components/GrantRoutes.js +1 -14
- package/src/components/StructureGrantListButton.js +4 -4
- package/src/components/StructureSelector.js +70 -44
- package/src/components/StructureStructureForm.js +1 -1
- package/src/components/StructuresBulkUpdate.js +10 -14
- package/src/components/StructuresDownloadOption.js +31 -27
- package/src/components/StructuresEditableDownloadOption.js +12 -7
- package/src/components/StructuresGrantRequestView.js +55 -24
- package/src/components/StructuresLabelResults.js +5 -11
- package/src/components/StructuresPagination.js +13 -15
- package/src/components/StructuresRoutes.js +17 -33
- package/src/components/StructuresTable.js +79 -115
- package/src/components/StructuresUpdateOption.js +77 -9
- package/src/components/StructuresView.js +67 -52
- package/src/components/__tests__/CatalogCustomViewCards.spec.js +44 -7
- package/src/components/__tests__/StructureGrantListButton.spec.js +27 -17
- package/src/components/__tests__/StructureSelector.spec.js +70 -25
- package/src/components/__tests__/StructureStructureForm.spec.js +92 -60
- package/src/components/__tests__/StructureStructureLinks.spec.js +1 -1
- package/src/components/__tests__/StructuresBulkUpdate.spec.js +26 -14
- package/src/components/__tests__/StructuresDownloadOption.spec.js +38 -5
- package/src/components/__tests__/StructuresEditableDownloadOption.spec.js +20 -8
- package/src/components/__tests__/StructuresGrantRequestView.spec.js +43 -15
- package/src/components/__tests__/StructuresLabelResults.spec.js +37 -10
- package/src/components/__tests__/StructuresOptions.spec.js +62 -1
- package/src/components/__tests__/StructuresSearchResults.spec.js +67 -12
- package/src/components/__tests__/StructuresTable.spec.js +77 -88
- package/src/components/__tests__/StructuresUpdateOption.spec.js +53 -6
- package/src/components/__tests__/StructuresView.spec.js +126 -31
- package/src/components/__tests__/__snapshots__/StructureSelector.spec.js.snap +206 -42
- package/src/components/__tests__/__snapshots__/StructuresDownloadOption.spec.js.snap +17 -0
- package/src/components/__tests__/__snapshots__/StructuresGrantRequestView.spec.js.snap +68 -5
- package/src/components/__tests__/__snapshots__/StructuresLabelResults.spec.js.snap +7 -12
- package/src/components/__tests__/__snapshots__/StructuresSearchResults.spec.js.snap +72 -27
- package/src/components/__tests__/__snapshots__/StructuresTable.spec.js.snap +226 -153
- package/src/components/__tests__/__snapshots__/StructuresUpdateOption.spec.js.snap +3 -3
- package/src/components/index.js +0 -8
- package/src/hooks/useStructures.js +6 -6
- package/src/reducers/__tests__/selectedUserSearchFilter.spec.js +2 -23
- package/src/reducers/__tests__/structureQuery.spec.js +1 -63
- package/src/reducers/index.js +0 -18
- package/src/reducers/previousStructureQuery.js +3 -6
- package/src/reducers/selectedUserSearchFilter.js +1 -10
- package/src/reducers/structureQuery.js +1 -33
- package/src/routines.js +1 -15
- package/src/sagas/__tests__/bulkUpdateStructures.spec.js +7 -7
- package/src/sagas/__tests__/downloadEditableStructures.spec.js +1 -6
- package/src/sagas/__tests__/downloadStructures.spec.js +2 -7
- package/src/sagas/__tests__/fetchStructures.spec.js +4 -4
- package/src/sagas/bulkUpdateStructures.js +6 -4
- package/src/sagas/downloadEditableStructures.js +2 -3
- package/src/sagas/downloadStructures.js +2 -3
- package/src/sagas/index.js +0 -3
- package/src/selectors/__tests__/getGrantSelectedFilters.spec.js +1 -1
- package/src/selectors/__tests__/structureColumnsSelector.spec.js +5 -19
- package/src/selectors/__tests__/templateNamesSelector.spec.js +19 -0
- package/src/selectors/index.js +1 -8
- package/src/selectors/structureColumnsSelector.js +6 -46
- package/src/selectors/templateNamesSelector.js +7 -0
- package/src/utils/structureCustomTranslations.js +19 -0
- package/src/components/StructureDateFilter.js +0 -32
- package/src/components/StructureFilters.js +0 -19
- package/src/components/StructureFiltersLoader.js +0 -32
- package/src/components/StructureSelectedFilters.js +0 -94
- package/src/components/__tests__/StructureDateFilter.spec.js +0 -11
- package/src/components/__tests__/__snapshots__/StructureDateFilter.spec.js.snap +0 -13
- package/src/reducers/__tests__/structureActiveFilters.spec.js +0 -100
- package/src/reducers/__tests__/structureDateFilter.spec.js +0 -57
- package/src/reducers/__tests__/structureFilters.spec.js +0 -37
- package/src/reducers/__tests__/structureUserFilters.spec.js +0 -76
- package/src/reducers/__tests__/structuresActions.spec.js +0 -38
- package/src/reducers/__tests__/structuresLoading.spec.js +0 -26
- package/src/reducers/structureActiveFilters.js +0 -58
- package/src/reducers/structureCount.js +0 -20
- package/src/reducers/structureDateFilter.js +0 -33
- package/src/reducers/structureFilters.js +0 -21
- package/src/reducers/structureFiltersLoading.js +0 -14
- package/src/reducers/structureSelectedFilter.js +0 -34
- package/src/reducers/structuresActions.js +0 -18
- package/src/reducers/structuresLoading.js +0 -14
- package/src/reducers/structuresPageSize.js +0 -15
- package/src/sagas/fetchStructureFilters.js +0 -29
- package/src/selectors/__tests__/bulkUpdateDisabledSelector.spec.js +0 -72
- package/src/selectors/__tests__/getStructureAvailableFilters.spec.js +0 -15
- package/src/selectors/__tests__/getStructureSelectedFilterActiveValues.spec.js +0 -20
- package/src/selectors/__tests__/getStructureSelectedFilterValues.spec.js +0 -15
- package/src/selectors/__tests__/getStructureSelectedFilters.spec.js +0 -15
- package/src/selectors/bulkUpdateDisabledSelector.js +0 -46
- package/src/selectors/getPreviousStructureQuery.js +0 -2
- package/src/selectors/getStructureAvailableFilters.js +0 -15
- package/src/selectors/getStructureFilterTypes.js +0 -7
- package/src/selectors/getStructureSelectedFilterActiveValues.js +0 -9
- package/src/selectors/getStructureSelectedFilterValues.js +0 -12
- package/src/selectors/getStructureSelectedFilters.js +0 -7
|
@@ -4,12 +4,7 @@ import {
|
|
|
4
4
|
clearImplementationFilters,
|
|
5
5
|
resetImplementationFilters,
|
|
6
6
|
} from "@truedat/dq/routines";
|
|
7
|
-
import {
|
|
8
|
-
applyUserSearchFilter,
|
|
9
|
-
clearUserSearchFilters,
|
|
10
|
-
removeStructureFilter,
|
|
11
|
-
resetStructureFilters,
|
|
12
|
-
} from "../routines";
|
|
7
|
+
import { applyUserSearchFilter, clearUserSearchFilters } from "../routines";
|
|
13
8
|
|
|
14
9
|
/** @type {string} */
|
|
15
10
|
export const initialState = null;
|
|
@@ -30,10 +25,6 @@ export const selectedUserSearchFilter = (
|
|
|
30
25
|
}
|
|
31
26
|
case clearUserSearchFilters.TRIGGER:
|
|
32
27
|
return initialState;
|
|
33
|
-
case removeStructureFilter.TRIGGER:
|
|
34
|
-
return initialState;
|
|
35
|
-
case resetStructureFilters.TRIGGER:
|
|
36
|
-
return initialState;
|
|
37
28
|
case clearRuleFilters.TRIGGER:
|
|
38
29
|
return initialState;
|
|
39
30
|
case resetRuleFilters.TRIGGER:
|
|
@@ -1,14 +1,5 @@
|
|
|
1
1
|
import _ from "lodash/fp";
|
|
2
|
-
import {
|
|
3
|
-
applyUserSearchFilter,
|
|
4
|
-
clearStructureFilters,
|
|
5
|
-
removeStructureFilter,
|
|
6
|
-
searchStructures,
|
|
7
|
-
selectStructurePage,
|
|
8
|
-
sortStructures,
|
|
9
|
-
toggleStructureFilterValue,
|
|
10
|
-
clearStructuresSort,
|
|
11
|
-
} from "../routines";
|
|
2
|
+
import { clearStructureFilters, searchStructures } from "../routines";
|
|
12
3
|
|
|
13
4
|
const defaultPage = 1;
|
|
14
5
|
const defaultSize = 20;
|
|
@@ -27,35 +18,12 @@ const structureQuery = (state = initialState, { type, payload }) => {
|
|
|
27
18
|
case clearStructureFilters.TRIGGER:
|
|
28
19
|
const page = defaultPage;
|
|
29
20
|
return { ...state, page, query: "" };
|
|
30
|
-
case removeStructureFilter.TRIGGER: {
|
|
31
|
-
const page = defaultPage;
|
|
32
|
-
return { ...state, page };
|
|
33
|
-
}
|
|
34
|
-
case applyUserSearchFilter.TRIGGER: {
|
|
35
|
-
const page = defaultPage;
|
|
36
|
-
return { ...state, page };
|
|
37
|
-
}
|
|
38
|
-
case toggleStructureFilterValue.TRIGGER: {
|
|
39
|
-
const page = defaultPage;
|
|
40
|
-
return { ...state, page };
|
|
41
|
-
}
|
|
42
21
|
case searchStructures.TRIGGER: {
|
|
43
22
|
const page = defaultPage;
|
|
44
23
|
const query = _.propOr("", "query")(payload);
|
|
45
24
|
const sort = query != "" ? defaultSearchSort : byNameSort;
|
|
46
25
|
return { ...state, query, page, sort };
|
|
47
26
|
}
|
|
48
|
-
case selectStructurePage.TRIGGER: {
|
|
49
|
-
const { activePage } = payload;
|
|
50
|
-
return { ...state, page: activePage };
|
|
51
|
-
}
|
|
52
|
-
case sortStructures.TRIGGER: {
|
|
53
|
-
const sort = payload;
|
|
54
|
-
return { ...state, sort, page: defaultPage };
|
|
55
|
-
}
|
|
56
|
-
case clearStructuresSort.TRIGGER: {
|
|
57
|
-
return { ...state, sort: byNameSort };
|
|
58
|
-
}
|
|
59
27
|
default:
|
|
60
28
|
return state;
|
|
61
29
|
}
|
package/src/routines.js
CHANGED
|
@@ -6,14 +6,10 @@ export const addGrantRequestsFilter = createRoutine(
|
|
|
6
6
|
"ADD_GRANT_REQUESTS_FILTER"
|
|
7
7
|
);
|
|
8
8
|
export const addGrantRequestToCart = createRoutine("ADD_GRANT_REQUEST_TO_CART");
|
|
9
|
-
export const addStructureFilter = createRoutine("ADD_STRUCTURE_FILTER");
|
|
10
9
|
export const addStructureSelectedFilter = createRoutine(
|
|
11
10
|
"ADD_STRUCTURE_SELECTED_FILTER"
|
|
12
11
|
);
|
|
13
12
|
export const applyGrantDateFilter = createRoutine("APPLY_GRANT_DATE_FILTER");
|
|
14
|
-
export const applyStructureDateFilter = createRoutine(
|
|
15
|
-
"APPLY_STRUCTURE_DATE_FILTER"
|
|
16
|
-
);
|
|
17
13
|
export const applyUserSearchFilter = createRoutine("APPLY_USER_SEARCH_FILTER");
|
|
18
14
|
export const bulkUpdateStructures = createRoutine("BULK_UPDATE_STRUCTURES");
|
|
19
15
|
export const cancelPoll = createRoutine("CANCEL_POLL");
|
|
@@ -45,7 +41,6 @@ export const clearStructure = createRoutine("CLEAR_STRUCTURE");
|
|
|
45
41
|
export const clearStructureFilters = createRoutine("CLEAR_STRUCTURE_FILTERS");
|
|
46
42
|
export const clearStructureNotes = createRoutine("CLEAR_STRUCTURE_NOTES");
|
|
47
43
|
export const clearStructures = createRoutine("CLEAR_STRUCTURES");
|
|
48
|
-
export const clearStructuresSort = createRoutine("CLEAR_STRUCTURES_SORT");
|
|
49
44
|
export const clearStructureType = createRoutine("CLEAR_STRUCTURE_TYPE");
|
|
50
45
|
export const clearStructureTypes = createRoutine("CLEAR_STRUCTURE_TYPES");
|
|
51
46
|
export const clearSystem = createRoutine("CLEAR_SYSTEM");
|
|
@@ -58,7 +53,6 @@ export const closeGrantFilter = createRoutine("CLOSE_GRANT_FILTER");
|
|
|
58
53
|
export const closeGrantRequestsFilter = createRoutine(
|
|
59
54
|
"CLOSE_GRANT_REQUESTS_FILTERS"
|
|
60
55
|
);
|
|
61
|
-
export const closeStructureFilter = createRoutine("CLOSE_STRUCTURE_FILTER");
|
|
62
56
|
export const createGrantApprovalRule = createRoutine(
|
|
63
57
|
"CREATE_GRANT_APPROVAL_RULE"
|
|
64
58
|
);
|
|
@@ -120,7 +114,6 @@ export const fetchNodes = createRoutine("FETCH_NODES");
|
|
|
120
114
|
export const fetchProfileExecution = createRoutine("FETCH_EXECUTION_PROFILE");
|
|
121
115
|
export const fetchProfileGroup = createRoutine("FETCH_PROFILE_GROUP");
|
|
122
116
|
export const fetchStructure = createRoutine("FETCH_STRUCTURE");
|
|
123
|
-
export const fetchStructureFilters = createRoutine("FETCH_STRUCTURE_FILTERS");
|
|
124
117
|
export const fetchStructureGraph = createRoutine("FETCH_STRUCTURE_GRAPH");
|
|
125
118
|
export const fetchStructureNotes = createRoutine("FETCH_STRUCTURE_NOTES");
|
|
126
119
|
export const fetchStructures = createRoutine("FETCH_STRUCTURES");
|
|
@@ -146,7 +139,6 @@ export const openGrantFilter = createRoutine("OPEN_GRANT_FILTER");
|
|
|
146
139
|
export const openGrantRequestsFilter = createRoutine(
|
|
147
140
|
"OPEN_GRANT_REQUESTS_FILTER"
|
|
148
141
|
);
|
|
149
|
-
export const openStructureFilter = createRoutine("OPEN_STRUCTURE_FILTER");
|
|
150
142
|
export const removeGrantFilter = createRoutine("REMOVE_GRANT_FILTER");
|
|
151
143
|
export const removeGrantRequestFromCart = createRoutine(
|
|
152
144
|
"REMOVE_GRANT_REQUEST_FROM_CART"
|
|
@@ -157,7 +149,6 @@ export const removeGrantRequestsFilter = createRoutine(
|
|
|
157
149
|
export const removeGrantRequestsQuery = createRoutine(
|
|
158
150
|
"REMOVE_GRANT_REQUESTS_QUERY"
|
|
159
151
|
);
|
|
160
|
-
export const removeStructureFilter = createRoutine("REMOVE_STRUCTURE_FILTER");
|
|
161
152
|
export const removeStructureSelectedFilter = createRoutine(
|
|
162
153
|
"REMOVE_STRUCTURE_SELECTED_FILTER"
|
|
163
154
|
);
|
|
@@ -166,7 +157,6 @@ export const resetGrantFilters = createRoutine("RESET_GRANT_FILTERS");
|
|
|
166
157
|
export const resetGrantRequestsFilters = createRoutine(
|
|
167
158
|
"RESERT_GRANT_REQUESTS_FILTERS"
|
|
168
159
|
);
|
|
169
|
-
export const resetStructureFilters = createRoutine("RESET_STRUCTURE_FILTERS");
|
|
170
160
|
export const saveNavFilter = createRoutine("SAVE_BUCKET_FILTER");
|
|
171
161
|
export const saveUserSearchFilters = createRoutine("SAVE_USER_SEARCH_FILTERS");
|
|
172
162
|
export const searchGrantRequests = createRoutine("SEARCH_GRANT_REQUESTS");
|
|
@@ -181,15 +171,14 @@ export const selectNode = createRoutine("SELECT_NODE");
|
|
|
181
171
|
export const selectPath = createRoutine("SELECT_PATH");
|
|
182
172
|
export const selectResources = createRoutine("SELECT_RESOURCES");
|
|
183
173
|
export const selectStructure = createRoutine("SELECT_STRUCTURE");
|
|
184
|
-
export const selectStructurePage = createRoutine("SELECT_STRUCTURE_PAGE");
|
|
185
174
|
export const setGrantChangeRequestCart = createRoutine(
|
|
186
175
|
"SET_GRANT_CHANGE_REQUEST_CART"
|
|
187
176
|
);
|
|
188
177
|
export const setGrantRequestsQuery = createRoutine("SET_GRANT_REQUESTS_QUERY");
|
|
189
178
|
export const sortGrantRequests = createRoutine("SORT_GRANT_REQUESTS");
|
|
190
179
|
export const sortGrants = createRoutine("SORT_GRANTS");
|
|
191
|
-
export const sortStructures = createRoutine("SORT_STRUCTURES");
|
|
192
180
|
export const tagStructure = createRoutine("TAG_STRUCTURE");
|
|
181
|
+
export const structureSearchQuery = createRoutine("STRUCTURES_SEARCH_QUERY");
|
|
193
182
|
export const toggleGrantDateFilter = createRoutine("TOGGLE_GRANT_DATE_FILTER");
|
|
194
183
|
export const toggleGrantFilterValue = createRoutine(
|
|
195
184
|
"TOGGLE_GRANT_FILTER_VALUE"
|
|
@@ -197,9 +186,6 @@ export const toggleGrantFilterValue = createRoutine(
|
|
|
197
186
|
export const toggleGrantRequestsFilterValue = createRoutine(
|
|
198
187
|
"TOGGLE_GRANT_REQUESTS_FILTER_VALUE"
|
|
199
188
|
);
|
|
200
|
-
export const toggleStructureDateFilter = createRoutine(
|
|
201
|
-
"TOGGLE_STRUCTURE_DATE_FILTER"
|
|
202
|
-
);
|
|
203
189
|
export const toggleStructureFilterValue = createRoutine(
|
|
204
190
|
"TOGGLE_STRUCTURE_FILTER_VALUE"
|
|
205
191
|
);
|
|
@@ -6,7 +6,6 @@ import {
|
|
|
6
6
|
} from "../bulkUpdateStructures";
|
|
7
7
|
import { bulkUpdateStructures } from "../../routines";
|
|
8
8
|
import { API_DATA_STRUCTURES_BULK_UPDATE } from "../../api";
|
|
9
|
-
import { getPreviousStructureQuery } from "../../selectors";
|
|
10
9
|
|
|
11
10
|
describe("sagas: bulkUpdateStructuresRequestsSaga", () => {
|
|
12
11
|
it("should invoke bulkUpdateStructuresSaga on bulkUpdateStructures.TRIGGER", () => {
|
|
@@ -32,9 +31,14 @@ describe("sagas: bulkUpdateStructuresSaga", () => {
|
|
|
32
31
|
const update_attributes = { foo: "foo", bar: "bar" };
|
|
33
32
|
const structureCount = 50;
|
|
34
33
|
const autoPublish = false;
|
|
35
|
-
const payload = { update_attributes, structureCount, autoPublish };
|
|
36
|
-
|
|
37
34
|
const structureQuery = { filters: {} };
|
|
35
|
+
const payload = {
|
|
36
|
+
update_attributes,
|
|
37
|
+
structureCount,
|
|
38
|
+
autoPublish,
|
|
39
|
+
searchParams: structureQuery,
|
|
40
|
+
};
|
|
41
|
+
|
|
38
42
|
const data = { message: [155, 21, 17, 16, 4, 3, 2] };
|
|
39
43
|
|
|
40
44
|
const body = {
|
|
@@ -49,8 +53,6 @@ describe("sagas: bulkUpdateStructuresSaga", () => {
|
|
|
49
53
|
expect(() => {
|
|
50
54
|
testSaga(bulkUpdateStructuresSaga, { payload })
|
|
51
55
|
.next()
|
|
52
|
-
.select(getPreviousStructureQuery)
|
|
53
|
-
.next(structureQuery)
|
|
54
56
|
.put(bulkUpdateStructures.request())
|
|
55
57
|
.next()
|
|
56
58
|
.call(apiJsonPost, API_DATA_STRUCTURES_BULK_UPDATE, body, JSON_OPTS)
|
|
@@ -70,8 +72,6 @@ describe("sagas: bulkUpdateStructuresSaga", () => {
|
|
|
70
72
|
expect(() => {
|
|
71
73
|
testSaga(bulkUpdateStructuresSaga, { payload })
|
|
72
74
|
.next()
|
|
73
|
-
.select(getPreviousStructureQuery)
|
|
74
|
-
.next(structureQuery)
|
|
75
75
|
.put(bulkUpdateStructures.request())
|
|
76
76
|
.next()
|
|
77
77
|
.call(apiJsonPost, API_DATA_STRUCTURES_BULK_UPDATE, body, JSON_OPTS)
|
|
@@ -7,7 +7,6 @@ import {
|
|
|
7
7
|
} from "../downloadEditableStructures";
|
|
8
8
|
import { downloadEditableStructures } from "../../routines";
|
|
9
9
|
import { API_DATA_STRUCTURES_EDITABLE_CSV } from "../../api";
|
|
10
|
-
import { getPreviousStructureQuery } from "../../selectors";
|
|
11
10
|
|
|
12
11
|
describe("sagas: downloadEditableStructuresRequestSaga", () => {
|
|
13
12
|
it("should invoke downloadEditableStructuresSaga on downloadEditableStructures.TRIGGER", () => {
|
|
@@ -34,8 +33,8 @@ describe("sagas: downloadEditableStructuresRequestSaga", () => {
|
|
|
34
33
|
|
|
35
34
|
describe("sagas: downloadEditableStructuresSaga", () => {
|
|
36
35
|
const lang = "es";
|
|
37
|
-
const payload = { lang };
|
|
38
36
|
const query = { filters: {} };
|
|
37
|
+
const payload = { lang, searchParams: query };
|
|
39
38
|
const body = {
|
|
40
39
|
structure_url_schema: "http://localhost/structures/:id",
|
|
41
40
|
...query,
|
|
@@ -47,8 +46,6 @@ describe("sagas: downloadEditableStructuresSaga", () => {
|
|
|
47
46
|
expect(() => {
|
|
48
47
|
testSaga(downloadEditableStructuresSaga, { payload })
|
|
49
48
|
.next()
|
|
50
|
-
.select(getPreviousStructureQuery)
|
|
51
|
-
.next(query)
|
|
52
49
|
.put(downloadEditableStructures.request(body))
|
|
53
50
|
.next()
|
|
54
51
|
.call(apiJsonPost, API_DATA_STRUCTURES_EDITABLE_CSV, body, JSON_OPTS)
|
|
@@ -70,8 +67,6 @@ describe("sagas: downloadEditableStructuresSaga", () => {
|
|
|
70
67
|
expect(() => {
|
|
71
68
|
testSaga(downloadEditableStructuresSaga, { payload })
|
|
72
69
|
.next()
|
|
73
|
-
.select(getPreviousStructureQuery)
|
|
74
|
-
.next(query)
|
|
75
70
|
.put(downloadEditableStructures.request(body))
|
|
76
71
|
.next()
|
|
77
72
|
.call(apiJsonPost, API_DATA_STRUCTURES_EDITABLE_CSV, body, JSON_OPTS)
|
|
@@ -7,7 +7,6 @@ import {
|
|
|
7
7
|
} from "../downloadStructures";
|
|
8
8
|
import { downloadStructures } from "../../routines";
|
|
9
9
|
import { API_DATA_STRUCTURES_CSV } from "../../api";
|
|
10
|
-
import { getPreviousStructureQuery } from "../../selectors";
|
|
11
10
|
|
|
12
11
|
describe("sagas: downloadStructuresRequestSaga", () => {
|
|
13
12
|
it("should invoke downloadStructuresSaga on downloadStructures.TRIGGER", () => {
|
|
@@ -32,9 +31,9 @@ describe("sagas: downloadStructuresRequestSaga", () => {
|
|
|
32
31
|
describe("sagas: downloadStructuresSaga", () => {
|
|
33
32
|
const headerLabels = { name: "Name" };
|
|
34
33
|
const lang = "es";
|
|
35
|
-
const payload = { headerLabels, lang: lang };
|
|
36
|
-
|
|
37
34
|
const query = { filters: {} };
|
|
35
|
+
const payload = { headerLabels, lang: lang, searchParams: query };
|
|
36
|
+
|
|
38
37
|
const data = "SOME CSV DATA";
|
|
39
38
|
|
|
40
39
|
const body = {
|
|
@@ -48,8 +47,6 @@ describe("sagas: downloadStructuresSaga", () => {
|
|
|
48
47
|
expect(() => {
|
|
49
48
|
testSaga(downloadStructuresSaga, { payload })
|
|
50
49
|
.next()
|
|
51
|
-
.select(getPreviousStructureQuery)
|
|
52
|
-
.next(query)
|
|
53
50
|
.put(downloadStructures.request(body))
|
|
54
51
|
.next()
|
|
55
52
|
.call(apiJsonPost, API_DATA_STRUCTURES_CSV, body, JSON_OPTS)
|
|
@@ -71,8 +68,6 @@ describe("sagas: downloadStructuresSaga", () => {
|
|
|
71
68
|
expect(() => {
|
|
72
69
|
testSaga(downloadStructuresSaga, { payload })
|
|
73
70
|
.next()
|
|
74
|
-
.select(getPreviousStructureQuery)
|
|
75
|
-
.next(query)
|
|
76
71
|
.put(downloadStructures.request(body))
|
|
77
72
|
.next()
|
|
78
73
|
.call(apiJsonPost, API_DATA_STRUCTURES_CSV, body, JSON_OPTS)
|
|
@@ -3,7 +3,7 @@ import { testSaga } from "redux-saga-test-plan";
|
|
|
3
3
|
import { apiJsonPost, JSON_OPTS } from "@truedat/core/services/api";
|
|
4
4
|
import {
|
|
5
5
|
fetchStructuresRequestSaga,
|
|
6
|
-
fetchStructuresSaga
|
|
6
|
+
fetchStructuresSaga,
|
|
7
7
|
} from "../fetchStructures";
|
|
8
8
|
import { fetchStructures } from "../../routines";
|
|
9
9
|
import { API_DATA_STRUCTURES_SEARCH } from "../../api";
|
|
@@ -33,11 +33,11 @@ describe("sagas: fetchStructuresSaga", () => {
|
|
|
33
33
|
const data = {
|
|
34
34
|
collection: [
|
|
35
35
|
{ id: 1, name: "Structure 1", description: "desc1" },
|
|
36
|
-
{ id: 2, name: "Structure 2", description: "desc2" }
|
|
37
|
-
]
|
|
36
|
+
{ id: 2, name: "Structure 2", description: "desc2" },
|
|
37
|
+
],
|
|
38
38
|
};
|
|
39
39
|
const headers = {
|
|
40
|
-
"x-total-count": "123"
|
|
40
|
+
"x-total-count": "123",
|
|
41
41
|
};
|
|
42
42
|
|
|
43
43
|
it("should put a success action when a response is returned", () => {
|
|
@@ -1,13 +1,15 @@
|
|
|
1
|
-
import { call, put,
|
|
1
|
+
import { call, put, takeLatest } from "redux-saga/effects";
|
|
2
2
|
import { apiJsonPost, JSON_OPTS } from "@truedat/core/services/api";
|
|
3
|
-
import { getPreviousStructureQuery } from "../selectors";
|
|
4
3
|
import { bulkUpdateStructures } from "../routines";
|
|
5
4
|
import { API_DATA_STRUCTURES_BULK_UPDATE } from "../api";
|
|
6
5
|
|
|
7
6
|
export function* bulkUpdateStructuresSaga({ payload }) {
|
|
8
7
|
try {
|
|
9
|
-
const {
|
|
10
|
-
|
|
8
|
+
const {
|
|
9
|
+
update_attributes,
|
|
10
|
+
autoPublish,
|
|
11
|
+
searchParams: search_params,
|
|
12
|
+
} = payload;
|
|
11
13
|
yield put(bulkUpdateStructures.request());
|
|
12
14
|
const body = {
|
|
13
15
|
bulk_update_request: {
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import _ from "lodash/fp";
|
|
2
2
|
import FileSaver from "file-saver";
|
|
3
|
-
import { call, put,
|
|
3
|
+
import { call, put, takeLatest } from "redux-saga/effects";
|
|
4
4
|
import { apiJsonPost, JSON_OPTS } from "@truedat/core/services/api";
|
|
5
5
|
import { STRUCTURE } from "@truedat/core/routes";
|
|
6
6
|
import { downloadEditableStructures } from "../routines";
|
|
7
|
-
import { getPreviousStructureQuery } from "../selectors";
|
|
8
7
|
import { API_DATA_STRUCTURES_EDITABLE_CSV } from "../api";
|
|
9
8
|
|
|
10
9
|
export function saveFile(data) {
|
|
@@ -19,7 +18,7 @@ export function saveFile(data) {
|
|
|
19
18
|
export function* downloadEditableStructuresSaga({ payload }) {
|
|
20
19
|
const lang = _.propOr("en", "lang")(payload);
|
|
21
20
|
try {
|
|
22
|
-
const query =
|
|
21
|
+
const query = _.prop("searchParams")(payload);
|
|
23
22
|
const body = {
|
|
24
23
|
structure_url_schema: getStructureUrlSchema(),
|
|
25
24
|
lang,
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import _ from "lodash/fp";
|
|
2
2
|
import FileSaver from "file-saver";
|
|
3
|
-
import { call, put,
|
|
3
|
+
import { call, put, takeLatest } from "redux-saga/effects";
|
|
4
4
|
import { apiJsonPost, JSON_OPTS } from "@truedat/core/services/api";
|
|
5
5
|
import { STRUCTURE } from "@truedat/core/routes";
|
|
6
6
|
import { downloadStructures } from "../routines";
|
|
7
|
-
import { getPreviousStructureQuery } from "../selectors";
|
|
8
7
|
import { API_DATA_STRUCTURES_CSV } from "../api";
|
|
9
8
|
|
|
10
9
|
export function saveFile(data) {
|
|
@@ -20,8 +19,8 @@ export function* downloadStructuresSaga({ payload }) {
|
|
|
20
19
|
try {
|
|
21
20
|
const headerLabels = _.propOr({}, "headerLabels")(payload);
|
|
22
21
|
const lang = _.propOr("en", "lang")(payload);
|
|
22
|
+
const query = _.prop("searchParams")(payload);
|
|
23
23
|
|
|
24
|
-
const query = yield select(getPreviousStructureQuery);
|
|
25
24
|
const body = {
|
|
26
25
|
header_labels: headerLabels,
|
|
27
26
|
structure_url_schema: getStructureUrlSchema(),
|
package/src/sagas/index.js
CHANGED
|
@@ -33,7 +33,6 @@ import { fetchLineageEventsRequestSaga } from "./fetchLineageEvents";
|
|
|
33
33
|
import { fetchNodesRequestSaga } from "./fetchNodes";
|
|
34
34
|
import { fetchProfileExecutionRequestSaga } from "./fetchProfileExecution";
|
|
35
35
|
import { fetchProfileGroupRequestSaga } from "./fetchProfileGroup";
|
|
36
|
-
import { fetchStructureFiltersRequestSaga } from "./fetchStructureFilters";
|
|
37
36
|
import { fetchStructureGraphRequestSaga } from "./fetchStructureGraph";
|
|
38
37
|
import { fetchStructureNotesRequestSaga } from "./fetchStructureNotes";
|
|
39
38
|
import { fetchStructureRequestSaga } from "./fetchStructure";
|
|
@@ -96,7 +95,6 @@ export {
|
|
|
96
95
|
fetchNodesRequestSaga,
|
|
97
96
|
fetchProfileExecutionRequestSaga,
|
|
98
97
|
fetchProfileGroupRequestSaga,
|
|
99
|
-
fetchStructureFiltersRequestSaga,
|
|
100
98
|
fetchStructureGraphRequestSaga,
|
|
101
99
|
fetchStructureNotesRequestSaga,
|
|
102
100
|
fetchStructureRequestSaga,
|
|
@@ -160,7 +158,6 @@ export default [
|
|
|
160
158
|
fetchNodesRequestSaga(),
|
|
161
159
|
fetchProfileExecutionRequestSaga(),
|
|
162
160
|
fetchProfileGroupRequestSaga(),
|
|
163
|
-
fetchStructureFiltersRequestSaga(),
|
|
164
161
|
fetchStructureGraphRequestSaga(),
|
|
165
162
|
fetchStructureNotesRequestSaga(),
|
|
166
163
|
fetchStructureRequestSaga(),
|
|
@@ -4,7 +4,7 @@ const foo = ["foo1", "foo2"];
|
|
|
4
4
|
const bar = ["bar1", "bar2"];
|
|
5
5
|
const baz = ["baz1", "baz2"];
|
|
6
6
|
|
|
7
|
-
describe("selectors:
|
|
7
|
+
describe("selectors: getGrantSelectedFilters", () => {
|
|
8
8
|
const grantFilters = { foo, bar, baz };
|
|
9
9
|
const grantActiveFilters = { baz: [] };
|
|
10
10
|
const state = { grantFilters, grantActiveFilters };
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { structureColumnsSelector
|
|
1
|
+
import { structureColumnsSelector } from "..";
|
|
2
2
|
|
|
3
3
|
describe("selectors: structureColumnsSelector", () => {
|
|
4
4
|
it("should return default structuresColumns when present", () => {
|
|
5
5
|
const structuresColumns = [{ name: "test" }];
|
|
6
|
-
const res = structureColumnsSelector({ structuresColumns });
|
|
6
|
+
const res = structureColumnsSelector({ structuresColumns }, {});
|
|
7
|
+
|
|
7
8
|
expect(res).toHaveLength(1);
|
|
8
9
|
expect(res).toEqual(structuresColumns);
|
|
9
10
|
});
|
|
@@ -11,7 +12,7 @@ describe("selectors: structureColumnsSelector", () => {
|
|
|
11
12
|
it("should return own columns prop when present", () => {
|
|
12
13
|
const structuresColumns = [{ name: "test" }];
|
|
13
14
|
const columns = { foo: "bar" };
|
|
14
|
-
const res = structureColumnsSelector({ structuresColumns }, { columns
|
|
15
|
+
const res = structureColumnsSelector({ structuresColumns }, {}, columns);
|
|
15
16
|
expect(res).toBe(columns);
|
|
16
17
|
});
|
|
17
18
|
|
|
@@ -22,23 +23,8 @@ describe("selectors: structureColumnsSelector", () => {
|
|
|
22
23
|
{ name: "bar" },
|
|
23
24
|
];
|
|
24
25
|
const defaultFilters = { "system.name.raw": [] };
|
|
25
|
-
const
|
|
26
|
-
const res = structureColumnsSelector({ structuresColumns }, props);
|
|
26
|
+
const res = structureColumnsSelector({ structuresColumns }, defaultFilters);
|
|
27
27
|
expect(res).toHaveLength(2);
|
|
28
28
|
expect(res).toEqual([{ name: "foo" }, { name: "bar" }]);
|
|
29
29
|
});
|
|
30
30
|
});
|
|
31
|
-
|
|
32
|
-
describe("selectors: structureRowsSelector", () => {
|
|
33
|
-
it("should return only id field and fields described on structureColumns", () => {
|
|
34
|
-
const structuresColumns = [{ name: "test" }];
|
|
35
|
-
const structures = [
|
|
36
|
-
{ id: 0, test: 1 },
|
|
37
|
-
{ id: 1, test: 2, not_test: 3 },
|
|
38
|
-
{ id: 2, not_test: 4 },
|
|
39
|
-
];
|
|
40
|
-
const res = structureRowsSelector({ structures, structuresColumns });
|
|
41
|
-
expect(res).toHaveLength(3);
|
|
42
|
-
expect(res).toEqual([{ test: 1, id: 0 }, { test: 2, id: 1 }, { id: 2 }]);
|
|
43
|
-
});
|
|
44
|
-
});
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { templateNamesSelector } from "../templateNamesSelector";
|
|
2
|
+
|
|
3
|
+
const templates = [
|
|
4
|
+
{ scope: "dd", name: "foo" },
|
|
5
|
+
{ scope: "dd", name: "bar" },
|
|
6
|
+
{ name: "baz" },
|
|
7
|
+
];
|
|
8
|
+
|
|
9
|
+
describe("selectors: templateNamesSelector", () => {
|
|
10
|
+
it("should return the names of templates within the dd scope", () => {
|
|
11
|
+
const state = { templates };
|
|
12
|
+
expect(templateNamesSelector(state)).toEqual(["foo", "bar"]);
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
it("should return an empty list if no templates are present", () => {
|
|
16
|
+
const state = { templates: [] };
|
|
17
|
+
expect(templateNamesSelector(state)).toEqual([]);
|
|
18
|
+
});
|
|
19
|
+
});
|
package/src/selectors/index.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
export {
|
|
2
2
|
defaultStructureColumns,
|
|
3
3
|
structureColumnsSelector,
|
|
4
|
-
structureRowsSelector,
|
|
5
4
|
} from "./structureColumnsSelector";
|
|
6
5
|
export { getGrantRequestsSelectedFilterActiveValues } from "./getGrantRequestsSelectedFilterActiveValues";
|
|
7
6
|
export { getGrantRequestsFilterTypes } from "./getGrantRequestsFilterTypes";
|
|
@@ -29,24 +28,18 @@ export {
|
|
|
29
28
|
} from "./getStructureRelations";
|
|
30
29
|
export { getParsedEvents } from "./getParsedEvents";
|
|
31
30
|
export { getPreviousGrantQuery } from "./getPreviousGrantQuery";
|
|
32
|
-
export { getPreviousStructureQuery } from "./getPreviousStructureQuery";
|
|
33
31
|
export {
|
|
34
32
|
getSortedChildrenRelations,
|
|
35
33
|
getSortedParentRelations,
|
|
36
34
|
} from "./getSortedRelations";
|
|
37
35
|
export { getSortedFields } from "./getSortedFields";
|
|
38
36
|
export { getSortedStructureChildren } from "./getSortedStructureChildren";
|
|
39
|
-
export { getStructureAvailableFilters } from "./getStructureAvailableFilters";
|
|
40
37
|
export { getStructureDeletedAt } from "./getStructureDeletedAt";
|
|
41
38
|
export {
|
|
42
39
|
getStructureFieldColumns,
|
|
43
40
|
defaultStructureFieldColumns,
|
|
44
41
|
} from "./getStructureFieldColumns";
|
|
45
|
-
export { getStructureFilterTypes } from "./getStructureFilterTypes";
|
|
46
42
|
export { getStructureParent } from "./getStructureParent";
|
|
47
|
-
export { getStructureSelectedFilterActiveValues } from "./getStructureSelectedFilterActiveValues";
|
|
48
|
-
export { getStructureSelectedFilters } from "./getStructureSelectedFilters";
|
|
49
|
-
export { getStructureSelectedFilterValues } from "./getStructureSelectedFilterValues";
|
|
50
43
|
export { getStructuresFields } from "./getStructuresFields";
|
|
51
44
|
export { getStructureSortingCriteria } from "./getStructureSortingCriteria";
|
|
52
45
|
export { getStructureUpdatedAt } from "./getStructureUpdatedAt";
|
|
@@ -59,7 +52,7 @@ export { getSystemTemplate } from "./getSystemTemplate";
|
|
|
59
52
|
export { getTabVisibility } from "./getTabVisibility";
|
|
60
53
|
export { groupOptionsSelector } from "./groupOptionsSelector";
|
|
61
54
|
export { resourceOptionsSelector } from "./resourceOptionsSelector";
|
|
62
|
-
export * from "./
|
|
55
|
+
export * from "./templateNamesSelector";
|
|
63
56
|
export * from "./getGrantsColumns";
|
|
64
57
|
export * from "./getLineageLevels";
|
|
65
58
|
export * from "./getSortedStructureNotes";
|
|
@@ -4,11 +4,8 @@ import { createSelector } from "reselect";
|
|
|
4
4
|
import { FormattedMessage } from "react-intl";
|
|
5
5
|
import Moment from "react-moment";
|
|
6
6
|
|
|
7
|
-
const typeTranslateDecorator = ({ type
|
|
8
|
-
<FormattedMessage
|
|
9
|
-
id={`structure.type.${type}.text`}
|
|
10
|
-
defaultMessage={_.prop("translation")(structure_type) || type}
|
|
11
|
-
/>
|
|
7
|
+
const typeTranslateDecorator = ({ type }) => (
|
|
8
|
+
<FormattedMessage id={`structure.type.${type}.text`} defaultMessage={type} />
|
|
12
9
|
);
|
|
13
10
|
|
|
14
11
|
const dateDecorator = (date) => (
|
|
@@ -31,7 +28,7 @@ export const defaultStructureColumns = [
|
|
|
31
28
|
},
|
|
32
29
|
{
|
|
33
30
|
name: "type",
|
|
34
|
-
fieldSelector: _.pick(["type"
|
|
31
|
+
fieldSelector: _.pick(["type"]),
|
|
35
32
|
fieldDecorator: typeTranslateDecorator,
|
|
36
33
|
width: 1,
|
|
37
34
|
},
|
|
@@ -56,28 +53,14 @@ export const defaultStructureColumns = [
|
|
|
56
53
|
},
|
|
57
54
|
];
|
|
58
55
|
|
|
59
|
-
const getStructures = (state) => {
|
|
60
|
-
const structures = state.structures;
|
|
61
|
-
const structureTypes = state.structureTypes;
|
|
62
|
-
return _.map((structure) => {
|
|
63
|
-
return {
|
|
64
|
-
structure_type: _.find(_.propEq("name")(structure.type))(structureTypes),
|
|
65
|
-
...structure,
|
|
66
|
-
};
|
|
67
|
-
})(structures);
|
|
68
|
-
};
|
|
69
|
-
|
|
70
56
|
// If default filters include "system.name.raw", exclude the "system" column
|
|
71
57
|
const filterExcludes = { "system.name.raw": "system" };
|
|
72
58
|
|
|
73
59
|
const columnsToExclude = (defaultFilters) =>
|
|
74
60
|
_.flow(_.pick(_.keys(defaultFilters)), _.values)(filterExcludes);
|
|
75
61
|
|
|
76
|
-
export const structureColumnsSelector =
|
|
77
|
-
_.prop("structuresColumns"),
|
|
78
|
-
(_state, props) => _.prop("defaultFilters")(props),
|
|
79
|
-
(_state, props) => _.prop("columns")(props),
|
|
80
|
-
(columns, defaultFilters, ownColumns) => {
|
|
62
|
+
export const structureColumnsSelector = (state, defaultFilters, ownColumns) =>
|
|
63
|
+
createSelector(_.prop("structuresColumns"), (columns) => {
|
|
81
64
|
const excludes = columnsToExclude(defaultFilters);
|
|
82
65
|
const res = ownColumns
|
|
83
66
|
? ownColumns
|
|
@@ -86,27 +69,4 @@ export const structureColumnsSelector = createSelector(
|
|
|
86
69
|
_.reject(({ name }) => _.includes(name)(excludes))
|
|
87
70
|
)(columns);
|
|
88
71
|
return res;
|
|
89
|
-
}
|
|
90
|
-
);
|
|
91
|
-
|
|
92
|
-
const getStructureColumnNames = createSelector(
|
|
93
|
-
structureColumnsSelector,
|
|
94
|
-
(columns) => _.concat("structure_type")(_.map("name")(columns))
|
|
95
|
-
);
|
|
96
|
-
|
|
97
|
-
export const structureRowsSelector = (state, props, extraColumns = []) =>
|
|
98
|
-
createSelector(
|
|
99
|
-
getStructures,
|
|
100
|
-
getStructureColumnNames,
|
|
101
|
-
(structures, columnNames) =>
|
|
102
|
-
_.map(
|
|
103
|
-
_.pick([
|
|
104
|
-
...columnNames,
|
|
105
|
-
"id",
|
|
106
|
-
"domain_id",
|
|
107
|
-
"note",
|
|
108
|
-
"grants",
|
|
109
|
-
...extraColumns,
|
|
110
|
-
])
|
|
111
|
-
)(structures)
|
|
112
|
-
)(state, props);
|
|
72
|
+
})(state);
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export default (formatMessage) => ({
|
|
2
|
+
"type.raw": (v) =>
|
|
3
|
+
formatMessage({
|
|
4
|
+
id: `structure.type.${v}.text`,
|
|
5
|
+
defaultMessage: v,
|
|
6
|
+
}),
|
|
7
|
+
"with_content.raw": (v) =>
|
|
8
|
+
formatMessage({
|
|
9
|
+
id: `filters.with_content.raw.${v}`,
|
|
10
|
+
defaultMessage: v,
|
|
11
|
+
}),
|
|
12
|
+
"with_profiling.raw": (v) =>
|
|
13
|
+
formatMessage({
|
|
14
|
+
id: `filters.with_profiling.raw.${v}`,
|
|
15
|
+
defaultMessage: v,
|
|
16
|
+
}),
|
|
17
|
+
linked_concepts: (v) =>
|
|
18
|
+
formatMessage({ id: `filters.linked_concepts.${v}`, defaultMessage: v }),
|
|
19
|
+
});
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { propOr } from "lodash/fp";
|
|
3
|
-
import PropTypes from "prop-types";
|
|
4
|
-
import { FormattedMessage } from "react-intl";
|
|
5
|
-
import { connect } from "react-redux";
|
|
6
|
-
import DateFilter from "@truedat/core/components/DateFilter";
|
|
7
|
-
import { applyStructureDateFilter } from "../routines";
|
|
8
|
-
|
|
9
|
-
export const StructureDateFilter = ({
|
|
10
|
-
active,
|
|
11
|
-
applyStructureDateFilter,
|
|
12
|
-
...props
|
|
13
|
-
}) =>
|
|
14
|
-
active ? (
|
|
15
|
-
<DateFilter
|
|
16
|
-
label={<FormattedMessage id="structure.updated_at" />}
|
|
17
|
-
name="updated_at"
|
|
18
|
-
onChange={applyStructureDateFilter}
|
|
19
|
-
defaultValues={props}
|
|
20
|
-
/>
|
|
21
|
-
) : null;
|
|
22
|
-
|
|
23
|
-
StructureDateFilter.propTypes = {
|
|
24
|
-
active: PropTypes.bool,
|
|
25
|
-
applyStructureDateFilter: PropTypes.func
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
export const mapStateToProps = propOr({}, "structureDateFilter");
|
|
29
|
-
|
|
30
|
-
export default connect(mapStateToProps, { applyStructureDateFilter })(
|
|
31
|
-
StructureDateFilter
|
|
32
|
-
);
|