@truedat/bg 6.3.2 → 6.3.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/package.json +6 -6
- package/src/concepts/api.js +3 -7
- package/src/concepts/components/ConceptActions.js +1 -0
- package/src/concepts/components/ConceptCreate.js +6 -4
- package/src/concepts/components/ConceptRoutes.js +10 -33
- package/src/concepts/components/Concepts.js +25 -16
- package/src/concepts/components/ConceptsActions.js +8 -14
- package/src/concepts/components/ConceptsBulkUpdate.js +25 -64
- package/src/concepts/components/ConceptsLabelResults.js +13 -26
- package/src/concepts/components/ConceptsLinksManagement.js +6 -92
- package/src/concepts/components/ConceptsPagination.js +13 -11
- package/src/concepts/components/ConceptsPanel.js +51 -22
- package/src/concepts/components/ConceptsTable.js +77 -106
- package/src/concepts/components/ConceptsUpdateButton.js +49 -37
- package/src/concepts/components/DomainConcepts.js +2 -11
- package/src/concepts/components/LinkedMessage.js +81 -0
- package/src/concepts/components/__tests__/ConceptLinksManagement.spec.js +60 -12
- package/src/concepts/components/__tests__/Concepts.spec.js +66 -11
- package/src/concepts/components/__tests__/ConceptsActions.spec.js +47 -3
- package/src/concepts/components/__tests__/ConceptsBulkUpdate.spec.js +7 -3
- package/src/concepts/components/__tests__/ConceptsLabelResults.spec.js +34 -4
- package/src/concepts/components/__tests__/ConceptsPanel.spec.js +59 -13
- package/src/concepts/components/__tests__/ConceptsTable.spec.js +53 -6
- package/src/concepts/components/__tests__/ConceptsUpdateButton.spec.js +26 -13
- package/src/concepts/components/__tests__/__snapshots__/ConceptLinksManagement.spec.js.snap +164 -8
- package/src/concepts/components/__tests__/__snapshots__/Concepts.spec.js.snap +284 -34
- package/src/concepts/components/__tests__/__snapshots__/ConceptsActions.spec.js.snap +1 -1
- package/src/concepts/components/__tests__/__snapshots__/ConceptsPanel.spec.js.snap +125 -2
- package/src/concepts/components/__tests__/__snapshots__/ConceptsTable.spec.js.snap +28 -44
- package/src/concepts/components/__tests__/__snapshots__/ConceptsUpdateButton.spec.js.snap +10 -47
- package/src/concepts/hooks/useConcepts.js +34 -0
- package/src/concepts/reducers/bulkUpdateQueryInfo.js +12 -0
- package/src/concepts/reducers/index.js +2 -26
- package/src/concepts/relations/components/ConceptRelationsRoutes.js +39 -35
- package/src/concepts/relations/components/ConceptSelector.js +37 -31
- package/src/concepts/relations/components/__tests__/ConceptRelationForm.spec.js +63 -23
- package/src/concepts/relations/components/__tests__/ConceptSelector.spec.js +74 -41
- package/src/concepts/relations/components/__tests__/ConceptSelector2.spec.js +72 -0
- package/src/concepts/relations/components/__tests__/__snapshots__/ConceptRelationForm.spec.js.snap +44 -8
- package/src/concepts/relations/components/__tests__/__snapshots__/ConceptSelector.spec.js.snap +44 -27
- package/src/concepts/routines.js +2 -29
- package/src/concepts/sagas/__tests__/bulkUpdate.spec.js +6 -10
- package/src/concepts/sagas/__tests__/downloadConcepts.spec.js +4 -8
- package/src/concepts/sagas/bulkUpdate.js +6 -5
- package/src/concepts/sagas/downloadConcepts.js +3 -4
- package/src/concepts/sagas/index.js +2 -17
- package/src/concepts/selectors/getConceptColumns.js +12 -21
- package/src/concepts/selectors/index.js +1 -7
- package/src/concepts/utils/filterOptions.js +6 -5
- package/src/concepts/components/ConceptFilters.js +0 -20
- package/src/concepts/components/ConceptFiltersLoader.js +0 -27
- package/src/concepts/components/ConceptSelectedFilters.js +0 -29
- package/src/concepts/components/ConceptSelectedFiltersDefault.js +0 -42
- package/src/concepts/components/ConceptSelectedFiltersPending.js +0 -41
- package/src/concepts/components/ConceptSelectedFiltersPublished.js +0 -73
- package/src/concepts/components/ConceptUserFiltersLoader.js +0 -27
- package/src/concepts/components/ConceptsLoader.js +0 -38
- package/src/concepts/components/ConceptsSearch.js +0 -32
- package/src/concepts/components/__tests__/ConceptFilters.spec.js +0 -19
- package/src/concepts/components/__tests__/ConceptSelectedFilters.spec.js +0 -10
- package/src/concepts/components/__tests__/ConceptUserFiltersLoader.spec.js +0 -27
- package/src/concepts/components/__tests__/ConceptsLoader.spec.js +0 -34
- package/src/concepts/components/__tests__/__snapshots__/ConceptFilters.spec.js.snap +0 -47
- package/src/concepts/components/__tests__/__snapshots__/ConceptSelectedFilters.spec.js.snap +0 -9
- package/src/concepts/components/__tests__/__snapshots__/ConceptUserFiltersLoader.spec.js.snap +0 -3
- package/src/concepts/reducers/__tests__/conceptActiveFilters.spec.js +0 -83
- package/src/concepts/reducers/__tests__/conceptCount.spec.js +0 -33
- package/src/concepts/reducers/__tests__/conceptFilters.spec.js +0 -49
- package/src/concepts/reducers/__tests__/conceptFiltersLoading.spec.js +0 -28
- package/src/concepts/reducers/__tests__/conceptQuery.spec.js +0 -75
- package/src/concepts/reducers/__tests__/conceptSelectedFilter.spec.js +0 -66
- package/src/concepts/reducers/__tests__/conceptSelectedUserFilter.spec.js +0 -53
- package/src/concepts/reducers/__tests__/conceptUserFilters.spec.js +0 -76
- package/src/concepts/reducers/__tests__/concepts.spec.js +0 -40
- package/src/concepts/reducers/__tests__/conceptsActions.spec.js +0 -38
- package/src/concepts/reducers/__tests__/conceptsLoading.spec.js +0 -32
- package/src/concepts/reducers/__tests__/conceptsPageSize.spec.js +0 -33
- package/src/concepts/reducers/__tests__/previousConceptQuery.spec.js +0 -23
- package/src/concepts/reducers/conceptActiveFilters.js +0 -58
- package/src/concepts/reducers/conceptCount.js +0 -20
- package/src/concepts/reducers/conceptFilters.js +0 -21
- package/src/concepts/reducers/conceptFiltersLoading.js +0 -14
- package/src/concepts/reducers/conceptQuery.js +0 -60
- package/src/concepts/reducers/conceptSelectedFilter.js +0 -34
- package/src/concepts/reducers/conceptSelectedUserFilter.js +0 -31
- package/src/concepts/reducers/conceptUserFilters.js +0 -36
- package/src/concepts/reducers/concepts.js +0 -21
- package/src/concepts/reducers/conceptsActions.js +0 -24
- package/src/concepts/reducers/conceptsLoading.js +0 -16
- package/src/concepts/reducers/conceptsPageSize.js +0 -16
- package/src/concepts/reducers/previousConceptQuery.js +0 -15
- package/src/concepts/sagas/__tests__/deleteConceptUserFilter.spec.js +0 -75
- package/src/concepts/sagas/__tests__/fetchConceptUserFilters.spec.js +0 -70
- package/src/concepts/sagas/__tests__/fetchConcepts.spec.js +0 -87
- package/src/concepts/sagas/__tests__/saveConceptFilters.spec.js +0 -78
- package/src/concepts/sagas/deleteConceptUserFilter.js +0 -34
- package/src/concepts/sagas/fecthConceptUserFilters.js +0 -30
- package/src/concepts/sagas/fetchConceptFilters.js +0 -29
- package/src/concepts/sagas/fetchConcepts.js +0 -27
- package/src/concepts/sagas/saveConceptFilters.js +0 -30
- package/src/concepts/selectors/__tests__/getConceptAvailableFilters.spec.js +0 -16
- package/src/concepts/selectors/__tests__/getConceptFilterTypes.spec.js +0 -19
- package/src/concepts/selectors/__tests__/getConceptSelectedFilterActiveValues.spec.js +0 -16
- package/src/concepts/selectors/__tests__/getConceptSelectedFilterValues.spec.js +0 -15
- package/src/concepts/selectors/__tests__/getConceptSelectedFilters.spec.js +0 -15
- package/src/concepts/selectors/__tests__/mapSelectedFilterStateToPropsByStatus.spec.js +0 -37
- package/src/concepts/selectors/getConceptAvailableFilters.js +0 -15
- package/src/concepts/selectors/getConceptFilterTypes.js +0 -7
- package/src/concepts/selectors/getConceptSelectedFilterActiveValues.js +0 -9
- package/src/concepts/selectors/getConceptSelectedFilterValues.js +0 -12
- package/src/concepts/selectors/getConceptSelectedFilters.js +0 -7
- package/src/concepts/selectors/getPreviousConceptQuery.js +0 -1
- package/src/concepts/selectors/mapSelectedFilterStateToPropsByStatus.js +0 -47
|
@@ -2,9 +2,67 @@ import React from "react";
|
|
|
2
2
|
import { render } from "@truedat/test/render";
|
|
3
3
|
import { waitFor } from "@testing-library/react";
|
|
4
4
|
import userEvent from "@testing-library/user-event";
|
|
5
|
-
import
|
|
5
|
+
import ConceptSelector from "../ConceptSelector";
|
|
6
6
|
import en from "../../../../messages/en";
|
|
7
7
|
|
|
8
|
+
const concept = {
|
|
9
|
+
id: 1,
|
|
10
|
+
name: "foo",
|
|
11
|
+
domain: { id: 1, name: "bar" },
|
|
12
|
+
status: "draft",
|
|
13
|
+
business_concept_id: 1,
|
|
14
|
+
last_change_at: "2020-01-01T00:00:00.000Z",
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
const data = {
|
|
18
|
+
data: [
|
|
19
|
+
{
|
|
20
|
+
id: 1,
|
|
21
|
+
name: "foo",
|
|
22
|
+
domain: { id: 1, name: "bar" },
|
|
23
|
+
status: "draft",
|
|
24
|
+
business_concept_id: 1,
|
|
25
|
+
last_change_at: "2020-01-01T00:00:00.000Z",
|
|
26
|
+
},
|
|
27
|
+
],
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
const filterData = {
|
|
31
|
+
data: {
|
|
32
|
+
some: {
|
|
33
|
+
values: ["some_xxx", "some_yyy", "some_xwy"],
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
jest.mock("@truedat/bg/concepts/hooks/useConcepts", () => {
|
|
39
|
+
const originalModule = jest.requireActual(
|
|
40
|
+
"@truedat/bg/concepts/hooks/useConcepts"
|
|
41
|
+
);
|
|
42
|
+
|
|
43
|
+
return {
|
|
44
|
+
__esModule: true,
|
|
45
|
+
...originalModule,
|
|
46
|
+
useConceptFilters: () => ({
|
|
47
|
+
trigger: () => ({
|
|
48
|
+
then: (callback) =>
|
|
49
|
+
callback({
|
|
50
|
+
data: filterData,
|
|
51
|
+
}),
|
|
52
|
+
}),
|
|
53
|
+
}),
|
|
54
|
+
useConceptVersionsSearch: () => ({
|
|
55
|
+
trigger: () => ({
|
|
56
|
+
then: (callback) =>
|
|
57
|
+
callback({
|
|
58
|
+
data,
|
|
59
|
+
headers: {},
|
|
60
|
+
}),
|
|
61
|
+
}),
|
|
62
|
+
}),
|
|
63
|
+
};
|
|
64
|
+
});
|
|
65
|
+
|
|
8
66
|
const messages = {
|
|
9
67
|
en: {
|
|
10
68
|
...en,
|
|
@@ -12,33 +70,24 @@ const messages = {
|
|
|
12
70
|
"search.save_filters": "save filters",
|
|
13
71
|
"search.clear_filters": "clear filters",
|
|
14
72
|
"search.applied_filters": "apply filters",
|
|
73
|
+
"search.placeholder": "Search concepts...",
|
|
15
74
|
},
|
|
16
75
|
};
|
|
17
|
-
const renderOpts = {
|
|
18
|
-
messages,
|
|
19
|
-
state: {
|
|
20
|
-
conceptActiveFilters: { filter: "some" },
|
|
21
|
-
},
|
|
22
|
-
};
|
|
76
|
+
const renderOpts = { messages };
|
|
23
77
|
|
|
24
78
|
describe("<ConceptSelector />", () => {
|
|
25
79
|
const handleConceptSelected = jest.fn();
|
|
26
|
-
|
|
27
|
-
id: 1,
|
|
28
|
-
name: "foo",
|
|
29
|
-
domain: { id: 1, name: "bar" },
|
|
30
|
-
status: "draft",
|
|
31
|
-
business_concept_id: 1,
|
|
32
|
-
};
|
|
80
|
+
|
|
33
81
|
const props = {
|
|
34
|
-
conceptsLoading: false,
|
|
35
|
-
concepts: [concept],
|
|
36
|
-
selectedConcept: {},
|
|
37
|
-
handleConceptSelected,
|
|
38
82
|
defaultFilters: {},
|
|
83
|
+
handleConceptSelected,
|
|
39
84
|
};
|
|
40
|
-
it("matches the latest snapshot", () => {
|
|
41
|
-
const { container } = render(
|
|
85
|
+
it("matches the latest snapshot", async () => {
|
|
86
|
+
const { container, queryByText } = render(
|
|
87
|
+
<ConceptSelector {...props} />,
|
|
88
|
+
renderOpts
|
|
89
|
+
);
|
|
90
|
+
userEvent.click(await queryByText(/some/));
|
|
42
91
|
expect(container).toMatchSnapshot();
|
|
43
92
|
});
|
|
44
93
|
|
|
@@ -60,29 +109,13 @@ describe("<ConceptSelector />", () => {
|
|
|
60
109
|
<ConceptSelector {...{ ...props, selectedConcept: null }} />,
|
|
61
110
|
renderOpts
|
|
62
111
|
);
|
|
63
|
-
|
|
64
|
-
await
|
|
65
|
-
|
|
66
|
-
|
|
112
|
+
|
|
113
|
+
userEvent.click(await queryByText(/foo/i));
|
|
114
|
+
await waitFor(() =>
|
|
115
|
+
expect(handleConceptSelected.mock.calls.length).toBe(1)
|
|
116
|
+
);
|
|
67
117
|
expect(handleConceptSelected).toHaveBeenCalledWith(
|
|
68
118
|
expect.objectContaining(concept)
|
|
69
119
|
);
|
|
70
120
|
});
|
|
71
|
-
|
|
72
|
-
it("renders disable when cannot create structure link", () => {
|
|
73
|
-
const conceptWithActions = {
|
|
74
|
-
id: 1,
|
|
75
|
-
name: "foo",
|
|
76
|
-
domain: { id: 1, name: "bar" },
|
|
77
|
-
status: "draft",
|
|
78
|
-
business_concept_id: 1,
|
|
79
|
-
_actions: { can_create_structure_link: false },
|
|
80
|
-
};
|
|
81
|
-
|
|
82
|
-
const { container } = render(
|
|
83
|
-
<ConceptSelector {...{ ...props, concepts: [conceptWithActions] }} />,
|
|
84
|
-
renderOpts
|
|
85
|
-
);
|
|
86
|
-
expect(container.querySelector("tbody > tr")).toHaveClass("disabled");
|
|
87
|
-
});
|
|
88
121
|
});
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { render } from "@truedat/test/render";
|
|
3
|
+
import ConceptSelector from "../ConceptSelector";
|
|
4
|
+
import en from "../../../../messages/en";
|
|
5
|
+
|
|
6
|
+
const data = {
|
|
7
|
+
data: [
|
|
8
|
+
{
|
|
9
|
+
id: 1,
|
|
10
|
+
name: "foo",
|
|
11
|
+
domain: { id: 1, name: "bar" },
|
|
12
|
+
status: "draft",
|
|
13
|
+
business_concept_id: 1,
|
|
14
|
+
last_change_at: "2020-01-01T00:00:00.000Z",
|
|
15
|
+
_actions: { can_create_structure_link: false },
|
|
16
|
+
},
|
|
17
|
+
],
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
jest.mock("@truedat/bg/concepts/hooks/useConcepts", () => {
|
|
21
|
+
const originalModule = jest.requireActual(
|
|
22
|
+
"@truedat/bg/concepts/hooks/useConcepts"
|
|
23
|
+
);
|
|
24
|
+
|
|
25
|
+
return {
|
|
26
|
+
__esModule: true,
|
|
27
|
+
...originalModule,
|
|
28
|
+
useConceptFilters: () => ({
|
|
29
|
+
trigger: () => ({
|
|
30
|
+
then: (callback) =>
|
|
31
|
+
callback({
|
|
32
|
+
data: {},
|
|
33
|
+
}),
|
|
34
|
+
}),
|
|
35
|
+
}),
|
|
36
|
+
useConceptVersionsSearch: () => ({
|
|
37
|
+
trigger: () => ({
|
|
38
|
+
then: (callback) =>
|
|
39
|
+
callback({
|
|
40
|
+
data,
|
|
41
|
+
headers: {},
|
|
42
|
+
}),
|
|
43
|
+
}),
|
|
44
|
+
}),
|
|
45
|
+
};
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
const messages = {
|
|
49
|
+
en: {
|
|
50
|
+
...en,
|
|
51
|
+
"concepts.status.undefined": "undefined",
|
|
52
|
+
"search.save_filters": "save filters",
|
|
53
|
+
"search.clear_filters": "clear filters",
|
|
54
|
+
"search.applied_filters": "apply filters",
|
|
55
|
+
"search.placeholder": "Search concepts...",
|
|
56
|
+
},
|
|
57
|
+
};
|
|
58
|
+
const renderOpts = { messages };
|
|
59
|
+
|
|
60
|
+
describe("<ConceptSelector />", () => {
|
|
61
|
+
const handleConceptSelected = jest.fn();
|
|
62
|
+
|
|
63
|
+
const props = {
|
|
64
|
+
defaultFilters: {},
|
|
65
|
+
handleConceptSelected,
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
it("renders disable when cannot create structure link", () => {
|
|
69
|
+
const { container } = render(<ConceptSelector {...props} />, renderOpts);
|
|
70
|
+
expect(container.querySelector("tbody > tr")).toHaveClass("disabled");
|
|
71
|
+
});
|
|
72
|
+
});
|
package/src/concepts/relations/components/__tests__/__snapshots__/ConceptRelationForm.spec.js.snap
CHANGED
|
@@ -28,8 +28,10 @@ exports[`<ConceptRelationForm /> matches the latest snapshot 1`] = `
|
|
|
28
28
|
class="search link icon"
|
|
29
29
|
/>
|
|
30
30
|
<div
|
|
31
|
-
aria-
|
|
32
|
-
|
|
31
|
+
aria-busy="false"
|
|
32
|
+
aria-disabled="false"
|
|
33
|
+
aria-expanded="true"
|
|
34
|
+
class="ui active visible button floating labeled scrolling dropdown icon"
|
|
33
35
|
role="listbox"
|
|
34
36
|
tabindex="0"
|
|
35
37
|
>
|
|
@@ -46,7 +48,7 @@ exports[`<ConceptRelationForm /> matches the latest snapshot 1`] = `
|
|
|
46
48
|
class="filter icon"
|
|
47
49
|
/>
|
|
48
50
|
<div
|
|
49
|
-
class="menu transition"
|
|
51
|
+
class="menu transition visible"
|
|
50
52
|
>
|
|
51
53
|
<div
|
|
52
54
|
class="item"
|
|
@@ -68,23 +70,57 @@ exports[`<ConceptRelationForm /> matches the latest snapshot 1`] = `
|
|
|
68
70
|
applied filters
|
|
69
71
|
</div>
|
|
70
72
|
<div
|
|
71
|
-
aria-expanded="
|
|
72
|
-
class="ui floating item scrolling dropdown"
|
|
73
|
+
aria-expanded="true"
|
|
74
|
+
class="ui active visible floating item scrolling dropdown"
|
|
73
75
|
role="listbox"
|
|
74
76
|
tabindex="0"
|
|
75
77
|
>
|
|
76
78
|
<div
|
|
77
79
|
class="ui label"
|
|
78
80
|
>
|
|
79
|
-
|
|
81
|
+
some
|
|
80
82
|
<i
|
|
81
83
|
aria-hidden="true"
|
|
82
84
|
class="delete icon"
|
|
83
85
|
/>
|
|
84
86
|
</div>
|
|
85
87
|
<div
|
|
86
|
-
class="menu transition dimmable"
|
|
87
|
-
|
|
88
|
+
class="menu transition dimmable visible"
|
|
89
|
+
>
|
|
90
|
+
<div
|
|
91
|
+
aria-checked="false"
|
|
92
|
+
class="item"
|
|
93
|
+
role="option"
|
|
94
|
+
>
|
|
95
|
+
<i
|
|
96
|
+
aria-hidden="true"
|
|
97
|
+
class="square outline icon"
|
|
98
|
+
/>
|
|
99
|
+
some_xwy
|
|
100
|
+
</div>
|
|
101
|
+
<div
|
|
102
|
+
aria-checked="false"
|
|
103
|
+
class="item"
|
|
104
|
+
role="option"
|
|
105
|
+
>
|
|
106
|
+
<i
|
|
107
|
+
aria-hidden="true"
|
|
108
|
+
class="square outline icon"
|
|
109
|
+
/>
|
|
110
|
+
some_xxx
|
|
111
|
+
</div>
|
|
112
|
+
<div
|
|
113
|
+
aria-checked="false"
|
|
114
|
+
class="item"
|
|
115
|
+
role="option"
|
|
116
|
+
>
|
|
117
|
+
<i
|
|
118
|
+
aria-hidden="true"
|
|
119
|
+
class="square outline icon"
|
|
120
|
+
/>
|
|
121
|
+
some_yyy
|
|
122
|
+
</div>
|
|
123
|
+
</div>
|
|
88
124
|
</div>
|
|
89
125
|
<a
|
|
90
126
|
class="resetFilters"
|
package/src/concepts/relations/components/__tests__/__snapshots__/ConceptSelector.spec.js.snap
CHANGED
|
@@ -21,8 +21,10 @@ exports[`<ConceptSelector /> matches the latest snapshot 1`] = `
|
|
|
21
21
|
class="search link icon"
|
|
22
22
|
/>
|
|
23
23
|
<div
|
|
24
|
-
aria-
|
|
25
|
-
|
|
24
|
+
aria-busy="false"
|
|
25
|
+
aria-disabled="false"
|
|
26
|
+
aria-expanded="true"
|
|
27
|
+
class="ui active visible button floating labeled scrolling dropdown icon"
|
|
26
28
|
role="listbox"
|
|
27
29
|
tabindex="0"
|
|
28
30
|
>
|
|
@@ -39,7 +41,7 @@ exports[`<ConceptSelector /> matches the latest snapshot 1`] = `
|
|
|
39
41
|
class="filter icon"
|
|
40
42
|
/>
|
|
41
43
|
<div
|
|
42
|
-
class="menu transition"
|
|
44
|
+
class="menu transition visible"
|
|
43
45
|
>
|
|
44
46
|
<div
|
|
45
47
|
class="item"
|
|
@@ -61,23 +63,57 @@ exports[`<ConceptSelector /> matches the latest snapshot 1`] = `
|
|
|
61
63
|
apply filters
|
|
62
64
|
</div>
|
|
63
65
|
<div
|
|
64
|
-
aria-expanded="
|
|
65
|
-
class="ui floating item scrolling dropdown"
|
|
66
|
+
aria-expanded="true"
|
|
67
|
+
class="ui active visible floating item scrolling dropdown"
|
|
66
68
|
role="listbox"
|
|
67
69
|
tabindex="0"
|
|
68
70
|
>
|
|
69
71
|
<div
|
|
70
72
|
class="ui label"
|
|
71
73
|
>
|
|
72
|
-
|
|
74
|
+
some
|
|
73
75
|
<i
|
|
74
76
|
aria-hidden="true"
|
|
75
77
|
class="delete icon"
|
|
76
78
|
/>
|
|
77
79
|
</div>
|
|
78
80
|
<div
|
|
79
|
-
class="menu transition dimmable"
|
|
80
|
-
|
|
81
|
+
class="menu transition dimmable visible"
|
|
82
|
+
>
|
|
83
|
+
<div
|
|
84
|
+
aria-checked="false"
|
|
85
|
+
class="item"
|
|
86
|
+
role="option"
|
|
87
|
+
>
|
|
88
|
+
<i
|
|
89
|
+
aria-hidden="true"
|
|
90
|
+
class="square outline icon"
|
|
91
|
+
/>
|
|
92
|
+
some_xwy
|
|
93
|
+
</div>
|
|
94
|
+
<div
|
|
95
|
+
aria-checked="false"
|
|
96
|
+
class="item"
|
|
97
|
+
role="option"
|
|
98
|
+
>
|
|
99
|
+
<i
|
|
100
|
+
aria-hidden="true"
|
|
101
|
+
class="square outline icon"
|
|
102
|
+
/>
|
|
103
|
+
some_xxx
|
|
104
|
+
</div>
|
|
105
|
+
<div
|
|
106
|
+
aria-checked="false"
|
|
107
|
+
class="item"
|
|
108
|
+
role="option"
|
|
109
|
+
>
|
|
110
|
+
<i
|
|
111
|
+
aria-hidden="true"
|
|
112
|
+
class="square outline icon"
|
|
113
|
+
/>
|
|
114
|
+
some_yyy
|
|
115
|
+
</div>
|
|
116
|
+
</div>
|
|
81
117
|
</div>
|
|
82
118
|
<a
|
|
83
119
|
class="resetFilters"
|
|
@@ -142,25 +178,6 @@ exports[`<ConceptSelector /> matches the latest snapshot 1`] = `
|
|
|
142
178
|
</div>
|
|
143
179
|
</td>
|
|
144
180
|
</tr>
|
|
145
|
-
<tr
|
|
146
|
-
class="active"
|
|
147
|
-
>
|
|
148
|
-
<td
|
|
149
|
-
class=""
|
|
150
|
-
/>
|
|
151
|
-
<td
|
|
152
|
-
class=""
|
|
153
|
-
/>
|
|
154
|
-
<td
|
|
155
|
-
class=""
|
|
156
|
-
>
|
|
157
|
-
<div
|
|
158
|
-
class="ui label"
|
|
159
|
-
>
|
|
160
|
-
undefined
|
|
161
|
-
</div>
|
|
162
|
-
</td>
|
|
163
|
-
</tr>
|
|
164
181
|
</tbody>
|
|
165
182
|
</table>
|
|
166
183
|
</div>
|
package/src/concepts/routines.js
CHANGED
|
@@ -1,41 +1,14 @@
|
|
|
1
1
|
import { createRoutine } from "redux-saga-routines";
|
|
2
|
-
|
|
3
|
-
export const applyConceptUserFilter = createRoutine(
|
|
4
|
-
"APPLY_CONCEPT_USER_FILTER"
|
|
5
|
-
);
|
|
6
2
|
export const clearConcept = createRoutine("CLEAR_CONCEPT");
|
|
7
3
|
export const clearConceptArchive = createRoutine("CLEAR_CONCEPT_ARCHIVE");
|
|
8
|
-
export const clearConceptFilters = createRoutine("CLEAR_CONCEPT_FILTERS");
|
|
9
|
-
export const clearConceptUserFilters = createRoutine(
|
|
10
|
-
"CLEAR_CONCEPT_USER_FILTERS"
|
|
11
|
-
);
|
|
12
|
-
export const clearConcepts = createRoutine("CLEAR_CONCEPTS");
|
|
13
4
|
export const conceptAction = createRoutine("CONCEPT_ACTION");
|
|
14
|
-
export const deleteConceptUserFilter = createRoutine(
|
|
15
|
-
"DELETE_CONCEPT_USER_FILTER"
|
|
16
|
-
);
|
|
17
5
|
export const downloadConcepts = createRoutine("DOWNLOAD_CONCEPTS");
|
|
18
6
|
export const fetchConcept = createRoutine("FETCH_CONCEPT");
|
|
19
7
|
export const fetchConceptArchive = createRoutine("FETCH_CONCEPT_ARCHIVE");
|
|
20
|
-
export const fetchConceptFilters = createRoutine("FETCH_CONCEPT_FILTERS");
|
|
21
|
-
export const fetchConceptUserFilters = createRoutine(
|
|
22
|
-
"FETCH_CONCEPT_USER_FILTERS"
|
|
23
|
-
);
|
|
24
|
-
export const fetchConcepts = createRoutine("FETCH_CONCEPTS");
|
|
25
|
-
export const searchConcepts = createRoutine("SEARCH_CONCEPTS");
|
|
26
|
-
export const selectConceptPage = createRoutine("SELECT_CONCEPT_PAGE");
|
|
27
8
|
export const uploadConcepts = createRoutine("UPLOAD_CONCEPTS");
|
|
28
|
-
|
|
29
|
-
export const addConceptFilter = createRoutine("ADD_CONCEPT_FILTER");
|
|
30
|
-
export const closeConceptFilter = createRoutine("CLOSE_CONCEPT_FILTER");
|
|
31
|
-
export const openConceptFilter = createRoutine("OPEN_CONCEPT_FILTER");
|
|
32
|
-
export const removeConceptFilter = createRoutine("REMOVE_CONCEPT_FILTER");
|
|
33
|
-
export const resetConceptFilters = createRoutine("RESET_CONCEPT_FILTERS");
|
|
34
|
-
export const saveConceptFilters = createRoutine("SAVE_CONCEPT_FILTERS");
|
|
35
|
-
export const toggleConceptFilterValue = createRoutine(
|
|
36
|
-
"TOGGLE_CONCEPT_FILTER_VALUE"
|
|
37
|
-
);
|
|
9
|
+
|
|
38
10
|
export const bulkUpdate = createRoutine("BULK_UPDATE");
|
|
11
|
+
export const bulkUpdateQuery = createRoutine("BULK_UPDATE_QUERY");
|
|
39
12
|
export const saveSharedTo = createRoutine("SAVE_SHARED_TO");
|
|
40
13
|
export const setConfidentialConcept = createRoutine("SET_CONFIDENTIAL_CONCEPT");
|
|
41
14
|
|
|
@@ -3,7 +3,6 @@ import { apiJsonPost, JSON_OPTS } from "@truedat/core/services/api";
|
|
|
3
3
|
import { bulkUpdateRequestsSaga, bulkUpdateSaga } from "../bulkUpdate";
|
|
4
4
|
import { bulkUpdate } from "../../routines";
|
|
5
5
|
import { API_BUSINESS_CONCEPT_BULK_UPDATE } from "../../api";
|
|
6
|
-
import { getPreviousConceptQuery } from "../../selectors";
|
|
7
6
|
|
|
8
7
|
describe("sagas: bulkUpdateRequestsSaga", () => {
|
|
9
8
|
it("should invoke bulkUpdateSaga on bulkUpdate.TRIGGER", () => {
|
|
@@ -18,18 +17,19 @@ describe("sagas: bulkUpdateRequestsSaga", () => {
|
|
|
18
17
|
|
|
19
18
|
it("should throw exception if an unhandled action is received", () => {
|
|
20
19
|
expect(() => {
|
|
21
|
-
testSaga(bulkUpdateRequestsSaga)
|
|
22
|
-
.next()
|
|
23
|
-
.takeLatest("FOO", bulkUpdateSaga);
|
|
20
|
+
testSaga(bulkUpdateRequestsSaga).next().takeLatest("FOO", bulkUpdateSaga);
|
|
24
21
|
}).toThrow();
|
|
25
22
|
});
|
|
26
23
|
});
|
|
27
24
|
|
|
28
25
|
describe("sagas: bulkUpdateSaga", () => {
|
|
29
26
|
const update_attributes = { foo: "foo", bar: "bar" };
|
|
30
|
-
const payload = { update_attributes };
|
|
31
|
-
|
|
32
27
|
const conceptQuery = { filters: {} };
|
|
28
|
+
const payload = {
|
|
29
|
+
updateAttributes: update_attributes,
|
|
30
|
+
searchParams: conceptQuery,
|
|
31
|
+
};
|
|
32
|
+
|
|
33
33
|
const data = { message: [155, 21, 17, 16, 4, 3, 2] };
|
|
34
34
|
|
|
35
35
|
const body = { update_attributes, search_params: conceptQuery };
|
|
@@ -39,8 +39,6 @@ describe("sagas: bulkUpdateSaga", () => {
|
|
|
39
39
|
expect(() => {
|
|
40
40
|
testSaga(bulkUpdateSaga, { payload })
|
|
41
41
|
.next()
|
|
42
|
-
.select(getPreviousConceptQuery)
|
|
43
|
-
.next(conceptQuery)
|
|
44
42
|
.put(bulkUpdate.request())
|
|
45
43
|
.next()
|
|
46
44
|
.call(apiJsonPost, API_BUSINESS_CONCEPT_BULK_UPDATE, body, JSON_OPTS)
|
|
@@ -60,8 +58,6 @@ describe("sagas: bulkUpdateSaga", () => {
|
|
|
60
58
|
expect(() => {
|
|
61
59
|
testSaga(bulkUpdateSaga, { payload })
|
|
62
60
|
.next()
|
|
63
|
-
.select(getPreviousConceptQuery)
|
|
64
|
-
.next(conceptQuery)
|
|
65
61
|
.put(bulkUpdate.request())
|
|
66
62
|
.next()
|
|
67
63
|
.call(apiJsonPost, API_BUSINESS_CONCEPT_BULK_UPDATE, body, JSON_OPTS)
|
|
@@ -7,7 +7,6 @@ import {
|
|
|
7
7
|
} from "../downloadConcepts";
|
|
8
8
|
import { downloadConcepts } from "../../routines";
|
|
9
9
|
import { API_BUSINESS_CONCEPT_VERSIONS_XLSX } from "../../api";
|
|
10
|
-
import { getPreviousConceptQuery } from "../../selectors";
|
|
11
10
|
|
|
12
11
|
describe("sagas: downloadConceptsRequestSaga", () => {
|
|
13
12
|
it("should invoke downloadConceptsSaga on downloadConcepts.TRIGGER", () => {
|
|
@@ -31,7 +30,8 @@ describe("sagas: downloadConceptsRequestSaga", () => {
|
|
|
31
30
|
|
|
32
31
|
describe("sagas: downloadConceptsSaga", () => {
|
|
33
32
|
const lang = "es";
|
|
34
|
-
const
|
|
33
|
+
const searchParams = { must: {} };
|
|
34
|
+
const payload = { lang, searchParams };
|
|
35
35
|
|
|
36
36
|
const conceptQuery = { filters: {} };
|
|
37
37
|
const data = new Blob(["SOME XLS DATA BINARY"]);
|
|
@@ -40,18 +40,16 @@ describe("sagas: downloadConceptsSaga", () => {
|
|
|
40
40
|
};
|
|
41
41
|
|
|
42
42
|
const body = {
|
|
43
|
-
lang: lang,
|
|
44
43
|
concept_url_schema:
|
|
45
44
|
"http://localhost/concepts/:business_concept_id/versions/:id",
|
|
46
|
-
|
|
45
|
+
lang: lang,
|
|
46
|
+
...searchParams,
|
|
47
47
|
};
|
|
48
48
|
|
|
49
49
|
it("should put a success action when a response is returned", () => {
|
|
50
50
|
expect(() => {
|
|
51
51
|
testSaga(downloadConceptsSaga, { payload })
|
|
52
52
|
.next()
|
|
53
|
-
.select(getPreviousConceptQuery)
|
|
54
|
-
.next(conceptQuery)
|
|
55
53
|
.put(downloadConcepts.request(body))
|
|
56
54
|
.next()
|
|
57
55
|
.call(apiJsonPost, API_BUSINESS_CONCEPT_VERSIONS_XLSX, body, {
|
|
@@ -76,8 +74,6 @@ describe("sagas: downloadConceptsSaga", () => {
|
|
|
76
74
|
expect(() => {
|
|
77
75
|
testSaga(downloadConceptsSaga, { payload })
|
|
78
76
|
.next()
|
|
79
|
-
.select(getPreviousConceptQuery)
|
|
80
|
-
.next(conceptQuery)
|
|
81
77
|
.put(downloadConcepts.request(body))
|
|
82
78
|
.next()
|
|
83
79
|
.call(apiJsonPost, API_BUSINESS_CONCEPT_VERSIONS_XLSX, body, {
|
|
@@ -1,17 +1,18 @@
|
|
|
1
|
-
import { call, put,
|
|
1
|
+
import { call, put, takeLatest } from "redux-saga/effects";
|
|
2
2
|
import { CONCEPTS } from "@truedat/core/routes";
|
|
3
3
|
import { apiJsonPost, JSON_OPTS } from "@truedat/core/services/api";
|
|
4
|
-
import { getPreviousConceptQuery } from "../selectors";
|
|
5
4
|
import { bulkUpdate } from "../routines";
|
|
6
5
|
import { API_BUSINESS_CONCEPT_BULK_UPDATE } from "../api";
|
|
7
6
|
|
|
8
7
|
export function* bulkUpdateSaga({ payload }) {
|
|
9
8
|
try {
|
|
10
|
-
const {
|
|
11
|
-
const search_params = yield select(getPreviousConceptQuery);
|
|
9
|
+
const { updateAttributes, searchParams } = payload;
|
|
12
10
|
const meta = { redirectUrl: CONCEPTS };
|
|
13
11
|
yield put(bulkUpdate.request());
|
|
14
|
-
const body = {
|
|
12
|
+
const body = {
|
|
13
|
+
update_attributes: updateAttributes,
|
|
14
|
+
search_params: searchParams,
|
|
15
|
+
};
|
|
15
16
|
const { data } = yield call(
|
|
16
17
|
apiJsonPost,
|
|
17
18
|
API_BUSINESS_CONCEPT_BULK_UPDATE,
|
|
@@ -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 { CONCEPT_VERSION } from "@truedat/core/routes";
|
|
6
6
|
import { downloadConcepts } from "../routines";
|
|
7
|
-
import { getPreviousConceptQuery } from "../selectors";
|
|
8
7
|
import { API_BUSINESS_CONCEPT_VERSIONS_XLSX } from "../api";
|
|
9
8
|
|
|
10
9
|
export function saveFile({ data, headers }) {
|
|
@@ -19,12 +18,12 @@ export function saveFile({ data, headers }) {
|
|
|
19
18
|
export function* downloadConceptsSaga({ payload }) {
|
|
20
19
|
try {
|
|
21
20
|
const lang = _.propOr("es", "lang")(payload);
|
|
22
|
-
const
|
|
21
|
+
const searchParams = _.prop("searchParams")(payload);
|
|
23
22
|
const conceptUrlSchema = window.location.origin + CONCEPT_VERSION;
|
|
24
23
|
const body = {
|
|
25
24
|
concept_url_schema: conceptUrlSchema,
|
|
26
25
|
lang,
|
|
27
|
-
...
|
|
26
|
+
...searchParams,
|
|
28
27
|
};
|
|
29
28
|
const url = API_BUSINESS_CONCEPT_VERSIONS_XLSX;
|
|
30
29
|
yield put(downloadConcepts.request(body));
|
|
@@ -2,46 +2,31 @@ import relationsSagas from "../relations/sagas";
|
|
|
2
2
|
import { conceptActionRequestSaga } from "./conceptAction";
|
|
3
3
|
import { downloadConceptsRequestSaga } from "./downloadConcepts";
|
|
4
4
|
import { fetchConceptArchiveRequestSaga } from "./fetchConceptArchive";
|
|
5
|
-
import { fetchConceptFiltersRequestSaga } from "./fetchConceptFilters";
|
|
6
5
|
import { fetchConceptRequestSaga } from "./fetchConcept";
|
|
7
|
-
import { fetchConceptsRequestSaga } from "./fetchConcepts";
|
|
8
6
|
import { uploadConceptsRequestsSaga } from "./uploadConcepts";
|
|
9
7
|
import { bulkUpdateRequestsSaga } from "./bulkUpdate";
|
|
10
|
-
import { saveConceptFiltersRequestSaga } from "./saveConceptFilters";
|
|
11
8
|
import { saveSharedToRequestSaga } from "./saveSharedTo";
|
|
12
9
|
import { setConfidentialConceptRequestSaga } from "./setConfidentialConcept";
|
|
13
|
-
import { fetchConceptUserFiltersRequestSaga } from "./fecthConceptUserFilters";
|
|
14
|
-
import { deleteConceptUserFilterRequestSaga } from "./deleteConceptUserFilter";
|
|
15
10
|
|
|
16
11
|
export {
|
|
17
12
|
conceptActionRequestSaga,
|
|
18
|
-
deleteConceptUserFilterRequestSaga,
|
|
19
13
|
downloadConceptsRequestSaga,
|
|
20
14
|
fetchConceptArchiveRequestSaga,
|
|
21
|
-
fetchConceptFiltersRequestSaga,
|
|
22
|
-
fetchConceptUserFiltersRequestSaga,
|
|
23
15
|
fetchConceptRequestSaga,
|
|
24
|
-
fetchConceptsRequestSaga,
|
|
25
16
|
uploadConceptsRequestsSaga,
|
|
26
17
|
bulkUpdateRequestsSaga,
|
|
27
|
-
saveConceptFiltersRequestSaga,
|
|
28
18
|
saveSharedToRequestSaga,
|
|
29
|
-
setConfidentialConceptRequestSaga
|
|
19
|
+
setConfidentialConceptRequestSaga,
|
|
30
20
|
};
|
|
31
21
|
|
|
32
22
|
export default [
|
|
33
23
|
conceptActionRequestSaga(),
|
|
34
|
-
deleteConceptUserFilterRequestSaga(),
|
|
35
24
|
downloadConceptsRequestSaga(),
|
|
36
25
|
fetchConceptArchiveRequestSaga(),
|
|
37
|
-
fetchConceptFiltersRequestSaga(),
|
|
38
|
-
fetchConceptUserFiltersRequestSaga(),
|
|
39
26
|
fetchConceptRequestSaga(),
|
|
40
|
-
fetchConceptsRequestSaga(),
|
|
41
27
|
uploadConceptsRequestsSaga(),
|
|
42
28
|
bulkUpdateRequestsSaga(),
|
|
43
|
-
saveConceptFiltersRequestSaga(),
|
|
44
29
|
saveSharedToRequestSaga(),
|
|
45
30
|
setConfidentialConceptRequestSaga(),
|
|
46
|
-
...relationsSagas
|
|
31
|
+
...relationsSagas,
|
|
47
32
|
];
|