@truedat/dd 5.6.1 → 5.6.3
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/GrantSelectedFilters.js +2 -0
- package/src/components/StructureSelectedFilters.js +2 -0
- package/src/components/StructuresBulkUpdate.js +5 -2
- package/src/components/__tests__/GrantApprovalRules.spec.js +0 -2
- package/src/components/__tests__/StructuresBulkUpdate.spec.js +2 -2
- package/src/components/__tests__/__snapshots__/GrantApprovalRules.spec.js.snap +0 -92
- package/src/reducers/__tests__/grantFilters.spec.js +3 -9
- package/src/reducers/__tests__/structureFilters.spec.js +4 -4
- package/src/reducers/grantFilters.js +4 -3
- package/src/reducers/structureActiveFilters.js +10 -19
- package/src/reducers/structureFilters.js +4 -3
- package/src/selectors/__tests__/getGrantAvailableFilters.spec.js +3 -3
- package/src/selectors/__tests__/getGrantSelectedFilterValues.spec.js +4 -4
- package/src/selectors/__tests__/getStructureAvailableFilters.spec.js +3 -3
- package/src/selectors/__tests__/getStructureSelectedFilterValues.spec.js +4 -4
- package/src/selectors/getGrantAvailableFilters.js +1 -1
- package/src/selectors/getGrantFilterTypes.js +7 -0
- package/src/selectors/getGrantSelectedFilterValues.js +5 -6
- package/src/selectors/getStructureAvailableFilters.js +1 -1
- package/src/selectors/getStructureFilterTypes.js +7 -0
- package/src/selectors/getStructureSelectedFilterActiveValues.js +2 -8
- package/src/selectors/getStructureSelectedFilterValues.js +2 -2
- package/src/selectors/index.js +2 -0
- package/src/reducers/grantsFilters.js +0 -19
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@truedat/dd",
|
|
3
|
-
"version": "5.6.
|
|
3
|
+
"version": "5.6.3",
|
|
4
4
|
"description": "Truedat Web Data Dictionary",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"jsnext:main": "src/index.js",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"@testing-library/jest-dom": "^5.16.5",
|
|
35
35
|
"@testing-library/react": "^12.0.0",
|
|
36
36
|
"@testing-library/user-event": "^13.2.1",
|
|
37
|
-
"@truedat/test": "5.6.
|
|
37
|
+
"@truedat/test": "5.6.3",
|
|
38
38
|
"babel-jest": "^28.1.0",
|
|
39
39
|
"babel-plugin-dynamic-import-node": "^2.3.3",
|
|
40
40
|
"babel-plugin-lodash": "^3.3.4",
|
|
@@ -87,9 +87,9 @@
|
|
|
87
87
|
},
|
|
88
88
|
"dependencies": {
|
|
89
89
|
"@apollo/client": "^3.7.1",
|
|
90
|
-
"@truedat/auth": "5.6.
|
|
91
|
-
"@truedat/core": "5.6.
|
|
92
|
-
"@truedat/df": "5.6.
|
|
90
|
+
"@truedat/auth": "5.6.3",
|
|
91
|
+
"@truedat/core": "5.6.3",
|
|
92
|
+
"@truedat/df": "5.6.3",
|
|
93
93
|
"lodash": "^4.17.21",
|
|
94
94
|
"moment": "^2.29.4",
|
|
95
95
|
"path-to-regexp": "^1.7.0",
|
|
@@ -114,5 +114,5 @@
|
|
|
114
114
|
"react-dom": ">= 16.8.6 < 17",
|
|
115
115
|
"semantic-ui-react": ">= 2.0.3 < 2.2"
|
|
116
116
|
},
|
|
117
|
-
"gitHead": "
|
|
117
|
+
"gitHead": "c79bc612b29e41c6c600c2e029ae762b36147193"
|
|
118
118
|
}
|
|
@@ -14,6 +14,7 @@ import {
|
|
|
14
14
|
getGrantSelectedFilterActiveValues,
|
|
15
15
|
getGrantSelectedFilters,
|
|
16
16
|
getGrantSelectedFilterValues,
|
|
17
|
+
getGrantFilterTypes,
|
|
17
18
|
} from "../selectors";
|
|
18
19
|
|
|
19
20
|
const translations = (formatMessage) => ({
|
|
@@ -35,6 +36,7 @@ export const mapStateToProps = (state, ownProps) => {
|
|
|
35
36
|
|
|
36
37
|
return {
|
|
37
38
|
loading,
|
|
39
|
+
filterTypes: getGrantFilterTypes(state),
|
|
38
40
|
selectedFilter,
|
|
39
41
|
selectedFilters: getGrantSelectedFilters(state),
|
|
40
42
|
selectedFilterActiveValues: getGrantSelectedFilterActiveValues(state),
|
|
@@ -18,6 +18,7 @@ import {
|
|
|
18
18
|
getStructureSelectedFilterActiveValues,
|
|
19
19
|
getStructureSelectedFilters,
|
|
20
20
|
getStructureSelectedFilterValues,
|
|
21
|
+
getStructureFilterTypes,
|
|
21
22
|
} from "../selectors";
|
|
22
23
|
|
|
23
24
|
const translations = (formatMessage, structureTypes) => ({
|
|
@@ -58,6 +59,7 @@ export const mapStateToProps = (state, ownProps) => {
|
|
|
58
59
|
|
|
59
60
|
return {
|
|
60
61
|
loading,
|
|
62
|
+
filterTypes: getStructureFilterTypes(state),
|
|
61
63
|
selectedFilter,
|
|
62
64
|
selectedFilters,
|
|
63
65
|
selectedFilterActiveValues,
|
|
@@ -43,13 +43,16 @@ export const StructuresBulkUpdate = ({
|
|
|
43
43
|
const templateName = _.flow(
|
|
44
44
|
_.getOr([], "type.raw"),
|
|
45
45
|
_.cond([
|
|
46
|
-
[
|
|
46
|
+
[
|
|
47
|
+
({ values }) => _.size(values) == 1,
|
|
48
|
+
_.flow(_.prop("values"), _.head, findTemplateName),
|
|
49
|
+
],
|
|
47
50
|
[_.stubTrue, _.constant("")],
|
|
48
51
|
])
|
|
49
52
|
)(structureFilters);
|
|
50
53
|
|
|
51
54
|
const domainIds = _.flow(
|
|
52
|
-
_.
|
|
55
|
+
_.prop("taxonomy.values"),
|
|
53
56
|
_.map("id"),
|
|
54
57
|
_.cond([
|
|
55
58
|
[(domains) => _.size(domains) == 1, _.identity],
|
|
@@ -69,7 +69,6 @@ describe("<GrantApprovalRules />", () => {
|
|
|
69
69
|
renderOpts(grantApprovalRules)
|
|
70
70
|
);
|
|
71
71
|
await waitFor(() => expect(queryByText(/lazy/i)).not.toBeInTheDocument());
|
|
72
|
-
expect(container).toMatchSnapshot();
|
|
73
72
|
await waitFor(() =>
|
|
74
73
|
expect(queryByText(/loading/i)).not.toBeInTheDocument()
|
|
75
74
|
);
|
|
@@ -82,7 +81,6 @@ describe("<GrantApprovalRules />", () => {
|
|
|
82
81
|
renderOpts(emptyGrantApprovalRules)
|
|
83
82
|
);
|
|
84
83
|
await waitFor(() => expect(queryByText(/lazy/i)).not.toBeInTheDocument());
|
|
85
|
-
expect(container).toMatchSnapshot();
|
|
86
84
|
await waitFor(() =>
|
|
87
85
|
expect(queryByText(/loading/i)).not.toBeInTheDocument()
|
|
88
86
|
);
|
|
@@ -14,8 +14,8 @@ describe("<StructuresBulkUpdate />", () => {
|
|
|
14
14
|
structureCount: 10,
|
|
15
15
|
structureTypes: [{ name: "structType", template: { name: "template1" } }],
|
|
16
16
|
structureFilters: {
|
|
17
|
-
"type.raw": ["structType"],
|
|
18
|
-
taxonomy: [{ id: 1 }],
|
|
17
|
+
"type.raw": { values: ["structType"] },
|
|
18
|
+
taxonomy: { values: [{ id: 1 }], type: "domain" },
|
|
19
19
|
},
|
|
20
20
|
},
|
|
21
21
|
fallback: "lazy",
|
|
@@ -51,99 +51,7 @@ exports[`<GrantApprovalRules /> matches snapshot for empty data 1`] = `
|
|
|
51
51
|
</div>
|
|
52
52
|
`;
|
|
53
53
|
|
|
54
|
-
exports[`<GrantApprovalRules /> matches snapshot for empty data 2`] = `
|
|
55
|
-
<div>
|
|
56
|
-
<div
|
|
57
|
-
class="ui segment"
|
|
58
|
-
>
|
|
59
|
-
<h2
|
|
60
|
-
class="ui header"
|
|
61
|
-
>
|
|
62
|
-
<i
|
|
63
|
-
aria-hidden="true"
|
|
64
|
-
class="key circular icon"
|
|
65
|
-
/>
|
|
66
|
-
<div
|
|
67
|
-
class="content"
|
|
68
|
-
>
|
|
69
|
-
Approval rules
|
|
70
|
-
<div
|
|
71
|
-
class="sub header"
|
|
72
|
-
>
|
|
73
|
-
Rules for automatically accept or reject grant requests
|
|
74
|
-
</div>
|
|
75
|
-
</div>
|
|
76
|
-
</h2>
|
|
77
|
-
<div
|
|
78
|
-
class="ui basic right aligned segment"
|
|
79
|
-
>
|
|
80
|
-
<a
|
|
81
|
-
class="ui primary button"
|
|
82
|
-
href="/grantApproveRules/new"
|
|
83
|
-
role="button"
|
|
84
|
-
>
|
|
85
|
-
New rule
|
|
86
|
-
</a>
|
|
87
|
-
</div>
|
|
88
|
-
<h4
|
|
89
|
-
class="ui header"
|
|
90
|
-
>
|
|
91
|
-
<i
|
|
92
|
-
aria-hidden="true"
|
|
93
|
-
class="search icon"
|
|
94
|
-
/>
|
|
95
|
-
<div
|
|
96
|
-
class="content"
|
|
97
|
-
>
|
|
98
|
-
No rules found
|
|
99
|
-
</div>
|
|
100
|
-
</h4>
|
|
101
|
-
</div>
|
|
102
|
-
</div>
|
|
103
|
-
`;
|
|
104
|
-
|
|
105
54
|
exports[`<GrantApprovalRules /> matches the last snapshot 1`] = `
|
|
106
|
-
<div>
|
|
107
|
-
<div
|
|
108
|
-
class="ui segment"
|
|
109
|
-
>
|
|
110
|
-
<h2
|
|
111
|
-
class="ui header"
|
|
112
|
-
>
|
|
113
|
-
<i
|
|
114
|
-
aria-hidden="true"
|
|
115
|
-
class="key circular icon"
|
|
116
|
-
/>
|
|
117
|
-
<div
|
|
118
|
-
class="content"
|
|
119
|
-
>
|
|
120
|
-
Approval rules
|
|
121
|
-
<div
|
|
122
|
-
class="sub header"
|
|
123
|
-
>
|
|
124
|
-
Rules for automatically accept or reject grant requests
|
|
125
|
-
</div>
|
|
126
|
-
</div>
|
|
127
|
-
</h2>
|
|
128
|
-
<div
|
|
129
|
-
class="ui basic right aligned segment"
|
|
130
|
-
>
|
|
131
|
-
<a
|
|
132
|
-
class="ui primary button"
|
|
133
|
-
href="/grantApproveRules/new"
|
|
134
|
-
role="button"
|
|
135
|
-
>
|
|
136
|
-
New rule
|
|
137
|
-
</a>
|
|
138
|
-
</div>
|
|
139
|
-
<div
|
|
140
|
-
class="ui loader"
|
|
141
|
-
/>
|
|
142
|
-
</div>
|
|
143
|
-
</div>
|
|
144
|
-
`;
|
|
145
|
-
|
|
146
|
-
exports[`<GrantApprovalRules /> matches the last snapshot 2`] = `
|
|
147
55
|
<div>
|
|
148
56
|
<div
|
|
149
57
|
class="ui segment"
|
|
@@ -10,16 +10,10 @@ describe("reducers: grantFilters", () => {
|
|
|
10
10
|
expect(grantFilters(undefined, {})).toEqual(initialState);
|
|
11
11
|
});
|
|
12
12
|
|
|
13
|
-
it("should handle the clearGrantFilters.TRIGGER action", () => {
|
|
14
|
-
expect(grantFilters(fooState, { type: clearGrantFilters.TRIGGER })).toEqual(
|
|
15
|
-
initialState
|
|
16
|
-
);
|
|
17
|
-
});
|
|
18
|
-
|
|
19
13
|
it("should handle the fetchGrantFilters.SUCCESS action", () => {
|
|
20
|
-
const filter1 = ["value1", "value2"];
|
|
21
|
-
const filter2 = ["value1", "value2"];
|
|
22
|
-
const data = { filter1, filter2: ["value1"] };
|
|
14
|
+
const filter1 = { values: ["value1", "value2"] };
|
|
15
|
+
const filter2 = { values: ["value1", "value2"] };
|
|
16
|
+
const data = { filter1, filter2: { values: ["value1"] } };
|
|
23
17
|
const payload = { data: { data } };
|
|
24
18
|
const state = { filter2 };
|
|
25
19
|
|
|
@@ -17,16 +17,16 @@ describe("reducers: structureFilters", () => {
|
|
|
17
17
|
});
|
|
18
18
|
|
|
19
19
|
it("should handle the fetchStructureFilters.SUCCESS action", () => {
|
|
20
|
-
const filter1 = ["value1", "value2"];
|
|
21
|
-
const filter2 = ["value1", "value2"];
|
|
22
|
-
const data = { filter1, filter2: ["value1"] };
|
|
20
|
+
const filter1 = { values: ["value1", "value2"] };
|
|
21
|
+
const filter2 = { values: ["value1", "value2"] };
|
|
22
|
+
const data = { filter1, filter2: { values: ["value1"] } };
|
|
23
23
|
const payload = { data: { data } };
|
|
24
24
|
const state = { filter2 };
|
|
25
25
|
|
|
26
26
|
expect(
|
|
27
27
|
structureFilters(state, {
|
|
28
28
|
type: fetchStructureFilters.SUCCESS,
|
|
29
|
-
payload
|
|
29
|
+
payload,
|
|
30
30
|
})
|
|
31
31
|
).toEqual(data);
|
|
32
32
|
});
|
|
@@ -7,10 +7,11 @@ const grantFilters = (state = initialState, { type, payload }) => {
|
|
|
7
7
|
switch (type) {
|
|
8
8
|
case clearGrantFilters.TRIGGER:
|
|
9
9
|
return initialState;
|
|
10
|
-
case fetchGrantFilters.REQUEST:
|
|
11
|
-
return initialState;
|
|
12
10
|
case fetchGrantFilters.SUCCESS:
|
|
13
|
-
return _.flow(
|
|
11
|
+
return _.flow(
|
|
12
|
+
_.propOr({}, "data.data"),
|
|
13
|
+
_.omitBy(_.flow(_.getOr([], "values"), _.isEmpty))
|
|
14
|
+
)(payload);
|
|
14
15
|
default:
|
|
15
16
|
return state;
|
|
16
17
|
}
|
|
@@ -1,15 +1,5 @@
|
|
|
1
1
|
import _ from "lodash/fp";
|
|
2
|
-
import {
|
|
3
|
-
includes,
|
|
4
|
-
isArray,
|
|
5
|
-
isEmpty,
|
|
6
|
-
omit,
|
|
7
|
-
prop,
|
|
8
|
-
propOr,
|
|
9
|
-
union,
|
|
10
|
-
without,
|
|
11
|
-
tap,
|
|
12
|
-
} from "lodash/fp";
|
|
2
|
+
import { isEmpty, omit, prop, propOr } from "lodash/fp";
|
|
13
3
|
import {
|
|
14
4
|
addStructureFilter,
|
|
15
5
|
applyUserSearchFilter,
|
|
@@ -26,13 +16,6 @@ export const structureActiveFilters = (
|
|
|
26
16
|
state = initialState,
|
|
27
17
|
{ type, payload }
|
|
28
18
|
) => {
|
|
29
|
-
const toggle = (state, filter, value) =>
|
|
30
|
-
_.flow(
|
|
31
|
-
() => state[filter] || [],
|
|
32
|
-
(currentValues) => _.xor(isArray(value) ? value : [value], currentValues),
|
|
33
|
-
(newValues) => ({ ...state, [filter]: newValues })
|
|
34
|
-
);
|
|
35
|
-
|
|
36
19
|
switch (type) {
|
|
37
20
|
case clearStructureFilters.TRIGGER:
|
|
38
21
|
return initialState;
|
|
@@ -59,7 +42,15 @@ export const structureActiveFilters = (
|
|
|
59
42
|
return initialState;
|
|
60
43
|
}
|
|
61
44
|
case toggleStructureFilterValue.TRIGGER: {
|
|
62
|
-
|
|
45
|
+
const { filter, value } = payload;
|
|
46
|
+
if (_.isArray(value)) {
|
|
47
|
+
return { ...state, [filter]: value };
|
|
48
|
+
}
|
|
49
|
+
const values = _.propOr([], filter)(state);
|
|
50
|
+
const nextValues = _.includes(value)(values)
|
|
51
|
+
? _.without([value])(values)
|
|
52
|
+
: _.union([value])(values);
|
|
53
|
+
return { ...state, [filter]: nextValues };
|
|
63
54
|
}
|
|
64
55
|
default:
|
|
65
56
|
return state;
|
|
@@ -7,10 +7,11 @@ const structureFilters = (state = initialState, { type, payload }) => {
|
|
|
7
7
|
switch (type) {
|
|
8
8
|
case clearStructureFilters.TRIGGER:
|
|
9
9
|
return initialState;
|
|
10
|
-
case fetchStructureFilters.REQUEST:
|
|
11
|
-
return initialState;
|
|
12
10
|
case fetchStructureFilters.SUCCESS:
|
|
13
|
-
return _.flow(
|
|
11
|
+
return _.flow(
|
|
12
|
+
_.propOr({}, "data.data"),
|
|
13
|
+
_.omitBy(_.flow(_.getOr([], "values"), _.isEmpty))
|
|
14
|
+
)(payload);
|
|
14
15
|
default:
|
|
15
16
|
return state;
|
|
16
17
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { getGrantAvailableFilters } from "..";
|
|
2
2
|
|
|
3
|
-
const foo = ["foo1", "foo2"];
|
|
4
|
-
const bar = ["bar1", "bar2"];
|
|
5
|
-
const baz = ["baz1", "baz2"];
|
|
3
|
+
const foo = { values: ["foo1", "foo2"] };
|
|
4
|
+
const bar = { values: ["bar1", "bar2"] };
|
|
5
|
+
const baz = { values: ["baz1", "baz2"] };
|
|
6
6
|
|
|
7
7
|
describe("selectors: getGrantAvailableFilters", () => {
|
|
8
8
|
const grantFilters = { foo, bar, baz };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { getGrantSelectedFilterValues } from "..";
|
|
2
2
|
|
|
3
|
-
const foo = ["foo1", "foo2"];
|
|
4
|
-
const bar = ["bar1", "bar2"];
|
|
5
|
-
const baz = ["baz1", "baz2"];
|
|
3
|
+
const foo = { values: ["foo1", "foo2"] };
|
|
4
|
+
const bar = { values: ["bar1", "bar2"] };
|
|
5
|
+
const baz = { values: ["baz1", "baz2"] };
|
|
6
6
|
|
|
7
7
|
describe("selectors: getGrantSelectedFilterValues", () => {
|
|
8
8
|
const grantFilters = { foo, bar, baz };
|
|
@@ -10,6 +10,6 @@ describe("selectors: getGrantSelectedFilterValues", () => {
|
|
|
10
10
|
const state = { grantFilters, grantSelectedFilter };
|
|
11
11
|
|
|
12
12
|
it("should return the values of the currently selected grant filters", () => {
|
|
13
|
-
expect(getGrantSelectedFilterValues(state)).toEqual(foo);
|
|
13
|
+
expect(getGrantSelectedFilterValues(state)).toEqual(foo.values);
|
|
14
14
|
});
|
|
15
15
|
});
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { getStructureAvailableFilters } from "..";
|
|
2
2
|
|
|
3
|
-
const foo = ["foo1", "foo2"];
|
|
4
|
-
const bar = ["bar1", "bar2"];
|
|
5
|
-
const baz = ["baz1", "baz2"];
|
|
3
|
+
const foo = { values: ["foo1", "foo2"] };
|
|
4
|
+
const bar = { values: ["bar1", "bar2"] };
|
|
5
|
+
const baz = { values: ["baz1", "baz2"] };
|
|
6
6
|
|
|
7
7
|
describe("selectors: getStructureAvailableFilters", () => {
|
|
8
8
|
const structureFilters = { foo, bar, baz };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { getStructureSelectedFilterValues } from "..";
|
|
2
2
|
|
|
3
|
-
const foo = ["foo1", "foo2"];
|
|
4
|
-
const bar = ["bar1", "bar2"];
|
|
5
|
-
const baz = ["baz1", "baz2"];
|
|
3
|
+
const foo = { values: ["foo1", "foo2"] };
|
|
4
|
+
const bar = { values: ["bar1", "bar2"] };
|
|
5
|
+
const baz = { values: ["baz1", "baz2"] };
|
|
6
6
|
|
|
7
7
|
describe("selectors: getStructureSelectedFilterValues", () => {
|
|
8
8
|
const structureFilters = { foo, bar, baz };
|
|
@@ -10,6 +10,6 @@ describe("selectors: getStructureSelectedFilterValues", () => {
|
|
|
10
10
|
const state = { structureFilters, structureSelectedFilter };
|
|
11
11
|
|
|
12
12
|
it("should return the values of the currently selected structure filters", () => {
|
|
13
|
-
expect(getStructureSelectedFilterValues(state)).toEqual(foo);
|
|
13
|
+
expect(getStructureSelectedFilterValues(state)).toEqual(foo.values);
|
|
14
14
|
});
|
|
15
15
|
});
|
|
@@ -9,7 +9,7 @@ export const getGrantAvailableFilters = createSelector(
|
|
|
9
9
|
getGrantSelectedFilters,
|
|
10
10
|
(grantFilters, grantSelectedFilters) => {
|
|
11
11
|
return _.flow(
|
|
12
|
-
_.omitBy((values) => _.size(values) < 2),
|
|
12
|
+
_.omitBy(({ values }) => _.size(values) < 2),
|
|
13
13
|
_.keys,
|
|
14
14
|
_.without(grantSelectedFilters)
|
|
15
15
|
)(grantFilters);
|
|
@@ -4,10 +4,9 @@ import { formatFilterValues } from "@truedat/core/services/filters";
|
|
|
4
4
|
|
|
5
5
|
export const getGrantSelectedFilterValues = createSelector(
|
|
6
6
|
[_.prop("grantSelectedFilter"), _.prop("grantFilters")],
|
|
7
|
-
(grantSelectedFilter, grantFilters) =>
|
|
8
|
-
|
|
9
|
-
_.propOr([], grantSelectedFilter),
|
|
10
|
-
formatFilterValues
|
|
11
|
-
)(grantFilters)
|
|
12
|
-
}
|
|
7
|
+
(grantSelectedFilter, grantFilters) =>
|
|
8
|
+
_.flow(
|
|
9
|
+
_.propOr({ values: [] }, grantSelectedFilter),
|
|
10
|
+
formatFilterValues
|
|
11
|
+
)(grantFilters)
|
|
13
12
|
);
|
|
@@ -8,7 +8,7 @@ export const getStructureAvailableFilters = createSelector(
|
|
|
8
8
|
[getStructureFilters, getStructureSelectedFilters],
|
|
9
9
|
(structureFilters, structureSelectedFilters) =>
|
|
10
10
|
_.flow(
|
|
11
|
-
_.omitBy(values => _.size(values) < 2),
|
|
11
|
+
_.omitBy(({ values }) => _.size(values) < 2),
|
|
12
12
|
_.keys,
|
|
13
13
|
_.without(structureSelectedFilters)
|
|
14
14
|
)(structureFilters)
|
|
@@ -1,15 +1,9 @@
|
|
|
1
1
|
import _ from "lodash/fp";
|
|
2
2
|
import { createSelector } from "reselect";
|
|
3
|
-
import { toFilterValues } from "@truedat/core/services/filters";
|
|
4
|
-
import { getStructureSelectedFilterValues } from "./getStructureSelectedFilterValues";
|
|
5
3
|
|
|
6
4
|
export const getStructureSelectedFilterActiveValues = createSelector(
|
|
7
5
|
_.prop("structureSelectedFilter"),
|
|
8
6
|
_.prop("structureActiveFilters"),
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
_.flow(
|
|
12
|
-
_.propOr([], structureSelectedFilter),
|
|
13
|
-
_.intersection(toFilterValues(selectedFilterValues))
|
|
14
|
-
)(structureActiveFilters)
|
|
7
|
+
(structureSelectedFilter, structureActiveFilters) =>
|
|
8
|
+
_.flow(_.propOr([], structureSelectedFilter))(structureActiveFilters)
|
|
15
9
|
);
|
|
@@ -6,7 +6,7 @@ export const getStructureSelectedFilterValues = createSelector(
|
|
|
6
6
|
[_.prop("structureSelectedFilter"), _.prop("structureFilters")],
|
|
7
7
|
(structureSelectedFilter, structureFilters) =>
|
|
8
8
|
_.flow(
|
|
9
|
-
_.propOr([], structureSelectedFilter),
|
|
10
|
-
formatFilterValues
|
|
9
|
+
_.propOr({ values: [] }, structureSelectedFilter),
|
|
10
|
+
formatFilterValues
|
|
11
11
|
)(structureFilters)
|
|
12
12
|
);
|
package/src/selectors/index.js
CHANGED
|
@@ -5,6 +5,7 @@ export {
|
|
|
5
5
|
} from "./structureColumnsSelector";
|
|
6
6
|
export { getGrantAvailableFilters } from "./getGrantAvailableFilters";
|
|
7
7
|
export { getGrantSelectedFilters } from "./getGrantSelectedFilters";
|
|
8
|
+
export { getGrantFilterTypes } from "./getGrantFilterTypes";
|
|
8
9
|
export { getGrantSelectedFilterValues } from "./getGrantSelectedFilterValues";
|
|
9
10
|
export { getGrantSelectedFilterActiveValues } from "./getGrantSelectedFilterActiveValues";
|
|
10
11
|
export {
|
|
@@ -31,6 +32,7 @@ export {
|
|
|
31
32
|
getStructureFieldColumns,
|
|
32
33
|
defaultStructureFieldColumns,
|
|
33
34
|
} from "./getStructureFieldColumns";
|
|
35
|
+
export { getStructureFilterTypes } from "./getStructureFilterTypes";
|
|
34
36
|
export { getStructureParent } from "./getStructureParent";
|
|
35
37
|
export { getStructureSelectedFilterActiveValues } from "./getStructureSelectedFilterActiveValues";
|
|
36
38
|
export { getStructureSelectedFilters } from "./getStructureSelectedFilters";
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import _ from "lodash/fp";
|
|
2
|
-
import { clearGrantFilters, fetchGrantFilters } from "../routines";
|
|
3
|
-
|
|
4
|
-
const initialState = {};
|
|
5
|
-
|
|
6
|
-
const grantFilters = (state = initialState, { type, payload }) => {
|
|
7
|
-
switch (type) {
|
|
8
|
-
case clearGrantFilters.TRIGGER:
|
|
9
|
-
return initialState;
|
|
10
|
-
case fetchGrantFilters.REQUEST:
|
|
11
|
-
return initialState;
|
|
12
|
-
case fetchGrantFilters.SUCCESS:
|
|
13
|
-
return _.flow(_.propOr({}, "data.data"), _.omitBy(_.isEmpty))(payload);
|
|
14
|
-
default:
|
|
15
|
-
return state;
|
|
16
|
-
}
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
export { grantFilters };
|