@truedat/dd 4.28.3 → 4.28.7

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.
Files changed (72) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/package.json +6 -6
  3. package/src/api.js +8 -0
  4. package/src/components/DictionaryRoutes.js +27 -0
  5. package/src/components/EditDomainForm.js +1 -0
  6. package/src/components/GrantDateFilter.js +30 -0
  7. package/src/components/GrantFilters.js +28 -0
  8. package/src/components/GrantFiltersLoader.js +29 -0
  9. package/src/components/GrantSelectedFilters.js +63 -0
  10. package/src/components/Grants.js +54 -0
  11. package/src/components/GrantsLabelResults.js +32 -0
  12. package/src/components/GrantsLoader.js +47 -0
  13. package/src/components/GrantsPagination.js +14 -0
  14. package/src/components/GrantsSearch.js +51 -0
  15. package/src/components/GrantsTable.js +112 -0
  16. package/src/components/StructureGrantCart.js +16 -14
  17. package/src/components/StructureGrantCartCheckout.js +9 -9
  18. package/src/components/StructureSummary.js +5 -5
  19. package/src/components/StructureTabPane.js +3 -3
  20. package/src/components/StructureView.js +14 -6
  21. package/src/components/__tests__/GrantDateFilter.spec.js +11 -0
  22. package/src/components/__tests__/GrantsLabelResults.js +17 -0
  23. package/src/components/__tests__/GrantsLoader.spec.js +41 -0
  24. package/src/components/__tests__/GrantsTable.spec.js +185 -0
  25. package/src/components/__tests__/StructureGrantRequestButton.spec.js +20 -9
  26. package/src/components/__tests__/StructureSummary.spec.js +1 -1
  27. package/src/components/__tests__/__snapshots__/DictionaryRoutes.spec.js.snap +8 -0
  28. package/src/components/__tests__/__snapshots__/GrantDateFilter.spec.js.snap +16 -0
  29. package/src/components/__tests__/__snapshots__/GrantsLabelResults.js.snap +16 -0
  30. package/src/components/__tests__/__snapshots__/GrantsLoader.spec.js.snap +27 -0
  31. package/src/components/__tests__/__snapshots__/GrantsTable.spec.js.snap +231 -0
  32. package/src/components/index.js +4 -0
  33. package/src/messages/en.js +12 -2
  34. package/src/messages/es.js +12 -2
  35. package/src/reducers/__tests__/grantDateFilter.spec.js +54 -0
  36. package/src/reducers/__tests__/grantFilters.spec.js +37 -0
  37. package/src/reducers/__tests__/grantQuery.spec.js +113 -0
  38. package/src/reducers/__tests__/grants.spec.js +102 -0
  39. package/src/reducers/grantActiveFilters.js +48 -0
  40. package/src/reducers/grantCount.js +20 -0
  41. package/src/reducers/grantDateFilter.js +31 -0
  42. package/src/reducers/grantFilters.js +19 -0
  43. package/src/reducers/grantLoading.js +16 -0
  44. package/src/reducers/grantQuery.js +62 -0
  45. package/src/reducers/grantSelectedFilter.js +34 -0
  46. package/src/reducers/grants.js +24 -0
  47. package/src/reducers/grantsFilters.js +19 -0
  48. package/src/reducers/grantsPageSize.js +15 -0
  49. package/src/reducers/index.js +18 -0
  50. package/src/reducers/structureDateFilter.js +2 -2
  51. package/src/reducers/structureQuery.js +2 -2
  52. package/src/routines.js +20 -0
  53. package/src/sagas/__tests__/fetchGrantFilters.spec.js +97 -0
  54. package/src/sagas/__tests__/fetchGrants.spec.js +86 -0
  55. package/src/sagas/fetchGrantFilters.js +31 -0
  56. package/src/sagas/fetchGrants.js +26 -0
  57. package/src/sagas/index.js +6 -0
  58. package/src/selectors/__tests__/__snapshots__/getGrantsColumns.spec.js.snap +10 -0
  59. package/src/selectors/__tests__/getGrantAvailableFilters.spec.js +15 -0
  60. package/src/selectors/__tests__/getGrantSelectedFilterActiveValues.spec.js +16 -0
  61. package/src/selectors/__tests__/getGrantSelectedFilterValues.spec.js +15 -0
  62. package/src/selectors/__tests__/getGrantSelectedFilters.spec.js +15 -0
  63. package/src/selectors/__tests__/getGrantsColumns.spec.js +40 -0
  64. package/src/selectors/__tests__/getTabVisibility.spec.js +30 -30
  65. package/src/selectors/getGrantAvailableFilters.js +17 -0
  66. package/src/selectors/getGrantSelectedFilterActiveValues.js +8 -0
  67. package/src/selectors/getGrantSelectedFilterValues.js +13 -0
  68. package/src/selectors/getGrantSelectedFilters.js +7 -0
  69. package/src/selectors/getGrantsColumns.js +84 -8
  70. package/src/selectors/getStructureSelectedFilterValues.js +5 -3
  71. package/src/selectors/getTabVisibility.js +7 -7
  72. package/src/selectors/index.js +4 -0
@@ -42,6 +42,16 @@ exports[`GrantStructureDecorator matches the latest snapshot when structure is n
42
42
  </div>
43
43
  `;
44
44
 
45
+ exports[`GrantTableStructureDecorator matches the latest snapshot when structure is direct 1`] = `
46
+ <div>
47
+ <a
48
+ href="/structures/1"
49
+ >
50
+ foo
51
+ </a>
52
+ </div>
53
+ `;
54
+
45
55
  exports[`GrantUserDecorator matches the latest snapshot 1`] = `
46
56
  <div>
47
57
  <h4
@@ -0,0 +1,15 @@
1
+ import { getGrantAvailableFilters } from "..";
2
+
3
+ const foo = ["foo1", "foo2"];
4
+ const bar = ["bar1", "bar2"];
5
+ const baz = ["baz1", "baz2"];
6
+
7
+ describe("selectors: getGrantAvailableFilters", () => {
8
+ const grantFilters = { foo, bar, baz };
9
+ const grantActiveFilters = { baz: [] };
10
+ const state = { grantFilters, grantActiveFilters };
11
+
12
+ it("should return the keys of the grant filters which are not currently active", () => {
13
+ expect(getGrantAvailableFilters(state)).toEqual(["foo", "bar"]);
14
+ });
15
+ });
@@ -0,0 +1,16 @@
1
+ import { getGrantSelectedFilterActiveValues } from "..";
2
+
3
+ const foo = ["foo1", "foo2"];
4
+ const bar = ["bar1", "bar2"];
5
+ const baz = ["baz1", "baz2"];
6
+
7
+ describe("selectors: getGrantSelectedFilterActiveValues", () => {
8
+ const grantFilters = { foo, bar, baz };
9
+ const grantActiveFilters = { foo: ["foo1"] };
10
+ const grantSelectedFilter = "foo";
11
+ const state = { grantFilters, grantActiveFilters, grantSelectedFilter };
12
+
13
+ it("should return the active values of the currently selected grant filters", () => {
14
+ expect(getGrantSelectedFilterActiveValues(state)).toEqual(["foo1"]);
15
+ });
16
+ });
@@ -0,0 +1,15 @@
1
+ import { getGrantSelectedFilterValues } from "..";
2
+
3
+ const foo = ["foo1", "foo2"];
4
+ const bar = ["bar1", "bar2"];
5
+ const baz = ["baz1", "baz2"];
6
+
7
+ describe("selectors: getGrantSelectedFilterValues", () => {
8
+ const grantFilters = { foo, bar, baz };
9
+ const grantSelectedFilter = "foo";
10
+ const state = { grantFilters, grantSelectedFilter };
11
+
12
+ it("should return the values of the currently selected grant filters", () => {
13
+ expect(getGrantSelectedFilterValues(state)).toEqual(foo);
14
+ });
15
+ });
@@ -0,0 +1,15 @@
1
+ import { getGrantSelectedFilters } from "..";
2
+
3
+ const foo = ["foo1", "foo2"];
4
+ const bar = ["bar1", "bar2"];
5
+ const baz = ["baz1", "baz2"];
6
+
7
+ describe("selectors: getStructureAvailableFilters", () => {
8
+ const grantFilters = { foo, bar, baz };
9
+ const grantActiveFilters = { baz: [] };
10
+ const state = { grantFilters, grantActiveFilters };
11
+
12
+ it("should return the keys of the grant filters which are currently active", () => {
13
+ expect(getGrantSelectedFilters(state)).toEqual(["baz"]);
14
+ });
15
+ });
@@ -3,9 +3,12 @@ import React from "react";
3
3
  import { render } from "@truedat/test/render";
4
4
  import {
5
5
  defaultGrantsColumns,
6
+ defaultGrantsTableColumns,
6
7
  getGrantsColumns,
8
+ getGrantsTableColumns,
7
9
  GrantUserDecorator,
8
10
  GrantStructureDecorator,
11
+ GrantTableStructureDecorator,
9
12
  StartDateDecorator,
10
13
  EndDateDecorator,
11
14
  } from "..";
@@ -49,6 +52,30 @@ describe("selectors: getGrantsColumns", () => {
49
52
  });
50
53
  });
51
54
 
55
+ describe("selectors: getGrantsTableColumns", () => {
56
+ const state = {
57
+ authentication,
58
+ };
59
+
60
+ it("get default grant columns", () => {
61
+ const columns = getGrantsTableColumns(state);
62
+ expect(_.map("name")(columns)).toEqual(
63
+ _.map("name")(defaultGrantsTableColumns)
64
+ );
65
+ });
66
+
67
+ it("get specified columns in reducer", () => {
68
+ const grantsColumns = [
69
+ {
70
+ name: "foo",
71
+ fieldDecorator: _.identity,
72
+ },
73
+ ];
74
+ const columns = getGrantsTableColumns({ ...state, grantsColumns });
75
+ expect(columns).toStrictEqual(grantsColumns);
76
+ });
77
+ });
78
+
52
79
  describe("GrantUserDecorator", () => {
53
80
  it("matches the latest snapshot", () => {
54
81
  const props = {
@@ -91,6 +118,19 @@ describe("GrantStructureDecorator", () => {
91
118
  });
92
119
  });
93
120
 
121
+ describe("GrantTableStructureDecorator", () => {
122
+ it("matches the latest snapshot when structure is direct", () => {
123
+ const props = {
124
+ data_structure_version: { data_structure_id: 1, name: "foo" },
125
+ };
126
+ const { container } = render(
127
+ <GrantTableStructureDecorator {...props} />,
128
+ renderOpts
129
+ );
130
+ expect(container).toMatchSnapshot();
131
+ });
132
+ });
133
+
94
134
  describe("StartDateDecorator", () => {
95
135
  it("matches the latest snapshot", () => {
96
136
  const props = {
@@ -3,10 +3,10 @@ import { getTabVisibility } from "../getTabVisibility";
3
3
  describe("selectors: getTabVisibility", () => {
4
4
  it("should include fields iff structureFields is not empty", () => {
5
5
  expect(getTabVisibility({ structureFields: [1] })).toMatchObject({
6
- fields: true
6
+ fields: true,
7
7
  });
8
8
  expect(getTabVisibility({ structureFields: [] })).toMatchObject({
9
- fields: false
9
+ fields: false,
10
10
  });
11
11
  });
12
12
 
@@ -32,7 +32,7 @@ describe("selectors: getTabVisibility", () => {
32
32
  const structureFields = [{ profile: { foo: "foo" } }];
33
33
  const userPermissions = { view_profiling_permission: true };
34
34
  expect(getTabVisibility({ structureFields })).toMatchObject({
35
- profile: false
35
+ profile: false,
36
36
  });
37
37
  expect(
38
38
  getTabVisibility({ structureFields, userPermissions })
@@ -42,44 +42,44 @@ describe("selectors: getTabVisibility", () => {
42
42
  it("should include profile if permission is present and a structure has a profile", () => {
43
43
  const userPermissions = { view_profiling_permission: true };
44
44
  expect(getTabVisibility({ structure: {} })).toMatchObject({
45
- profile: false
45
+ profile: false,
46
46
  });
47
47
  expect(
48
48
  getTabVisibility({
49
49
  structure: { profile: { foo: "foo" } },
50
- userPermissions
50
+ userPermissions,
51
51
  })
52
52
  ).toMatchObject({ profile: false });
53
53
  expect(
54
54
  getTabVisibility({
55
55
  structureProfile: { patterns: "foo" },
56
- userPermissions
56
+ userPermissions,
57
57
  })
58
58
  ).toMatchObject({ profile: true });
59
59
  expect(
60
60
  getTabVisibility({
61
61
  structureProfile: { most_frequent: "foo" },
62
- userPermissions
62
+ userPermissions,
63
63
  })
64
64
  ).toMatchObject({ profile: true });
65
65
  });
66
66
 
67
67
  it("should include links iff conceptCount is non-zero or structure has links", () => {
68
68
  expect(getTabVisibility({ conceptCount: 1 })).toMatchObject({
69
- links: true
69
+ links: true,
70
70
  });
71
71
  expect(getTabVisibility({ conceptCount: 0 })).toMatchObject({
72
- links: false
72
+ links: false,
73
73
  });
74
74
  expect(
75
75
  getTabVisibility({ structureLinks: [{ resource_type: "concept" }] })
76
76
  ).toMatchObject({
77
- links: true
77
+ links: true,
78
78
  });
79
79
  expect(
80
80
  getTabVisibility({ structureLinks: [{ resource_type: "foo" }] })
81
81
  ).toMatchObject({
82
- links: false
82
+ links: false,
83
83
  });
84
84
  });
85
85
 
@@ -88,17 +88,17 @@ describe("selectors: getTabVisibility", () => {
88
88
  const templates = [{ name: "foo" }];
89
89
  const structureTypes = [{ name: "foo", template: { id: 1, name: "n" } }];
90
90
  expect(getTabVisibility({ templatesLoading: true })).toMatchObject({
91
- notes: false
91
+ notes: false,
92
92
  });
93
93
  expect(
94
94
  getTabVisibility({
95
95
  structure,
96
96
  templates,
97
97
  structureTypes,
98
- structureTypesLoading: false
98
+ structureTypesLoading: false,
99
99
  })
100
100
  ).toMatchObject({
101
- notes: true
101
+ notes: true,
102
102
  });
103
103
  });
104
104
 
@@ -107,80 +107,80 @@ describe("selectors: getTabVisibility", () => {
107
107
  const templates = [{ name: "foo" }];
108
108
  const structureTypes = [{ name: "foo" }];
109
109
  expect(getTabVisibility({ templatesLoading: true })).toMatchObject({
110
- notes: false
110
+ notes: false,
111
111
  });
112
112
  expect(
113
113
  getTabVisibility({
114
114
  structure,
115
115
  templates,
116
116
  structureTypes,
117
- structureTypesLoading: false
117
+ structureTypesLoading: false,
118
118
  })
119
119
  ).toMatchObject({
120
- notes: false
120
+ notes: false,
121
121
  });
122
122
  });
123
123
 
124
124
  it("should include versions iff structureVersions is not empty", () => {
125
125
  expect(getTabVisibility({})).toMatchObject({ versions: false });
126
126
  expect(getTabVisibility({ structureVersions: [] })).toMatchObject({
127
- versions: false
127
+ versions: false,
128
128
  });
129
129
  expect(getTabVisibility({ structureVersions: [{}] })).toMatchObject({
130
- versions: true
130
+ versions: true,
131
131
  });
132
132
  });
133
133
 
134
134
  it("should include events iff structureVersion is empty", () => {
135
135
  expect(getTabVisibility({})).toMatchObject({ events: true });
136
136
  expect(getTabVisibility({ structureVersion: {} })).toMatchObject({
137
- events: true
137
+ events: true,
138
138
  });
139
139
  expect(getTabVisibility({ structureVersion: "whatever" })).toMatchObject({
140
- events: false
140
+ events: false,
141
141
  });
142
142
  });
143
143
 
144
144
  it("should include rules iff ruleImplementations is not empty", () => {
145
145
  expect(getTabVisibility({})).toMatchObject({ rules: false });
146
146
  expect(getTabVisibility({ ruleImplementations: [] })).toMatchObject({
147
- rules: false
147
+ rules: false,
148
148
  });
149
149
  expect(getTabVisibility({ ruleImplementations: [{}] })).toMatchObject({
150
- rules: true
150
+ rules: true,
151
151
  });
152
152
  });
153
153
 
154
154
  it("should include parents iff parentRelations is not empty", () => {
155
155
  expect(getTabVisibility({})).toMatchObject({ parents: false });
156
156
  expect(getTabVisibility({ parentRelations: [] })).toMatchObject({
157
- parents: false
157
+ parents: false,
158
158
  });
159
159
  expect(getTabVisibility({ parentRelations: [{}] })).toMatchObject({
160
- parents: true
160
+ parents: true,
161
161
  });
162
162
  });
163
163
 
164
164
  it("should include children iff childrenRelations is not empty", () => {
165
165
  expect(getTabVisibility({})).toMatchObject({ children: false });
166
166
  expect(getTabVisibility({ childrenRelations: [] })).toMatchObject({
167
- children: false
167
+ children: false,
168
168
  });
169
169
  expect(getTabVisibility({ childrenRelations: [{}] })).toMatchObject({
170
- children: true
170
+ children: true,
171
171
  });
172
172
  });
173
173
 
174
174
  it("should include grants if grants is not empty or nil", () => {
175
175
  expect(getTabVisibility({})).toMatchObject({ grants: false });
176
176
  expect(getTabVisibility({ structure: {} })).toMatchObject({
177
- grants: false
177
+ grants: false,
178
178
  });
179
179
  expect(getTabVisibility({ structure: { grants: [] } })).toMatchObject({
180
- grants: false
180
+ grants: false,
181
181
  });
182
182
  expect(getTabVisibility({ structure: { grants: [{}] } })).toMatchObject({
183
- grants: true
183
+ grants: true,
184
184
  });
185
185
  });
186
186
  });
@@ -0,0 +1,17 @@
1
+ import _ from "lodash/fp";
2
+ import { createSelector } from "reselect";
3
+ import { getGrantSelectedFilters } from "./getGrantSelectedFilters";
4
+
5
+ const getGrantFilters = _.propOr({}, "grantFilters");
6
+
7
+ export const getGrantAvailableFilters = createSelector(
8
+ getGrantFilters,
9
+ getGrantSelectedFilters,
10
+ (grantFilters, grantSelectedFilters) => {
11
+ return _.flow(
12
+ _.omitBy((values) => _.size(values) < 2),
13
+ _.keys,
14
+ _.without(grantSelectedFilters)
15
+ )(grantFilters);
16
+ }
17
+ );
@@ -0,0 +1,8 @@
1
+ import _ from "lodash/fp";
2
+ import { createSelector } from "reselect";
3
+
4
+ export const getGrantSelectedFilterActiveValues = createSelector(
5
+ [_.prop("grantSelectedFilter"), _.prop("grantActiveFilters")],
6
+ (grantSelectedFilter, grantActiveFilters) =>
7
+ _.propOr([], grantSelectedFilter)(grantActiveFilters)
8
+ );
@@ -0,0 +1,13 @@
1
+ import _ from "lodash/fp";
2
+ import { createSelector } from "reselect";
3
+ import { formatFilterValues } from "@truedat/core/services/filters";
4
+
5
+ export const getGrantSelectedFilterValues = createSelector(
6
+ [_.prop("grantSelectedFilter"), _.prop("grantFilters")],
7
+ (grantSelectedFilter, grantFilters) => {
8
+ return _.flow(
9
+ _.propOr([], grantSelectedFilter),
10
+ formatFilterValues(grantSelectedFilter)
11
+ )(grantFilters);
12
+ }
13
+ );
@@ -0,0 +1,7 @@
1
+ import _ from "lodash/fp";
2
+ import { createSelector } from "reselect";
3
+
4
+ export const getGrantSelectedFilters = createSelector(
5
+ [_.prop("grantActiveFilters")],
6
+ _.keys
7
+ );
@@ -7,6 +7,7 @@ import { linkTo } from "@truedat/core/routes";
7
7
  import { useIntl } from "react-intl";
8
8
  import Moment from "react-moment";
9
9
  import PropTypes from "prop-types";
10
+ import { findDOMNode } from "react-dom";
10
11
 
11
12
  export const GrantUserDecorator = ({ authentication, user }) => {
12
13
  const { formatMessage } = useIntl();
@@ -42,7 +43,7 @@ export const GrantStructureDecorator = ({
42
43
  data_structure,
43
44
  }) => {
44
45
  const { formatMessage } = useIntl();
45
- const direct = grant_structure.id === data_structure.id;
46
+ const direct = grant_structure?.id === data_structure?.id;
46
47
 
47
48
  const path =
48
49
  !direct &&
@@ -69,8 +70,36 @@ GrantStructureDecorator.propTypes = {
69
70
  grant_structure: PropTypes.object,
70
71
  };
71
72
 
72
- export const structureDecorator = (structure) => (props) =>
73
- GrantStructureDecorator({ grant_structure: structure, ...props });
73
+ export const structureDecorator = (structure) => (props) => {
74
+ return GrantStructureDecorator({ grant_structure: structure, ...props });
75
+ };
76
+
77
+ export const GrantTableStructureDecorator = ({ data_structure_version }) => {
78
+ return (
79
+ <Link
80
+ to={linkTo.STRUCTURE({ id: data_structure_version.data_structure_id })}
81
+ >
82
+ {data_structure_version.name}
83
+ </Link>
84
+ );
85
+ };
86
+
87
+ GrantTableStructureDecorator.propTypes = {
88
+ data_structure_version: PropTypes.object,
89
+ };
90
+
91
+ export const GenericObjectDecorator = ({
92
+ data_structure_version: { metadata },
93
+ }) =>
94
+ Object.entries(metadata).map(([k, v], i) => [
95
+ <div key={i}>
96
+ {k}: {v}
97
+ </div>,
98
+ ]);
99
+
100
+ GenericObjectDecorator.propTypes = {
101
+ metadata: PropTypes.object,
102
+ };
74
103
 
75
104
  export const StartDateDecorator = ({ start_date }) => {
76
105
  const { locale } = useIntl();
@@ -140,7 +169,7 @@ export const defaultGrantsColumns = [
140
169
  {
141
170
  name: "start_date",
142
171
  fieldSelector: _.pick(["start_date"]),
143
- fieldDecorator: StartDateDecorator,
172
+ fieldDecorator: (field) => field.start_date,
144
173
  },
145
174
  {
146
175
  name: "end_date",
@@ -154,12 +183,59 @@ export const getGrantsColumns = createSelector(
154
183
  (grantsColumns, structure, authentication) =>
155
184
  _.flow(
156
185
  _.defaultTo(defaultGrantsColumns),
157
- _.map((c) =>
158
- c.name === "data_structure"
186
+ _.map((c) => {
187
+ return c.name === "data_structure"
159
188
  ? { ...c, fieldDecorator: c.fieldDecorator(structure) }
160
189
  : c.name === "user"
161
190
  ? { ...c, fieldDecorator: c.fieldDecorator(authentication) }
162
- : c
163
- )
191
+ : c;
192
+ })
164
193
  )(grantsColumns)
165
194
  );
195
+
196
+ export const defaultGrantsTableColumns = [
197
+ {
198
+ name: "user",
199
+ sort: { name: "user.user_name.raw" },
200
+ fieldSelector: _.pick(["user"]),
201
+ fieldDecorator: userDecorator,
202
+ },
203
+ {
204
+ name: "data_structure_version",
205
+ sort: { name: "data_structure_version.name.raw" },
206
+ fieldSelector: _.pick(["data_structure", "data_structure_version"]),
207
+ fieldDecorator: GrantTableStructureDecorator,
208
+ },
209
+ {
210
+ name: "start_date",
211
+ sort: { name: "start_date" },
212
+ fieldSelector: _.pick(["start_date"]),
213
+ fieldDecorator: StartDateDecorator,
214
+ },
215
+ {
216
+ name: "end_date",
217
+ sort: { name: "end_date" },
218
+ fieldSelector: _.pick(["end_date"]),
219
+ fieldDecorator: EndDateDecorator,
220
+ },
221
+ {
222
+ name: "metadata",
223
+ fieldSelector: _.pick(["data_structure_version.metadata"]),
224
+ fieldDecorator: GenericObjectDecorator,
225
+ },
226
+ ];
227
+
228
+ export const getGrantsTableColumns = createSelector(
229
+ [_.prop("grantsColumns"), _.prop("authentication"), _.prop("onlyMyGrants")],
230
+ (grantsColumns, authentication, onlyMyGrants) => {
231
+ return _.flow(
232
+ _.defaultTo(defaultGrantsTableColumns),
233
+ _.reject((c) => (onlyMyGrants ? c.name === "user" : false)),
234
+ _.map((c) => {
235
+ return c.name === "user"
236
+ ? { ...c, fieldDecorator: c.fieldDecorator(authentication) }
237
+ : c;
238
+ })
239
+ )(grantsColumns);
240
+ }
241
+ );
@@ -4,9 +4,11 @@ import { formatFilterValues } from "@truedat/core/services/filters";
4
4
 
5
5
  export const getStructureSelectedFilterValues = createSelector(
6
6
  [_.prop("structureSelectedFilter"), _.prop("structureFilters")],
7
- (structureSelectedFilter, structureFilters) =>
8
- _.flow(
7
+ (structureSelectedFilter, structureFilters) => {
8
+ const result = _.flow(
9
9
  _.propOr([], structureSelectedFilter),
10
10
  formatFilterValues(structureSelectedFilter)
11
- )(structureFilters)
11
+ )(structureFilters);
12
+ return result;
13
+ }
12
14
  );
@@ -3,7 +3,7 @@ import { getStructureToConceptLinks } from "./getStructureLinks";
3
3
  import { metadataViewsSelector } from "./metadataViewsSelector";
4
4
 
5
5
  const notEmpty = _.negate(_.isEmpty);
6
- const notEmptyPath = path => _.flow(_.path(path), notEmpty);
6
+ const notEmptyPath = (path) => _.flow(_.path(path), notEmpty);
7
7
  const hasProfile = notEmptyPath("profile");
8
8
 
9
9
  const fieldsTabVisible = _.conformsTo({ structureFields: notEmpty });
@@ -11,14 +11,14 @@ const fieldsTabVisible = _.conformsTo({ structureFields: notEmpty });
11
11
  const profileTabVisible = ({
12
12
  userPermissions,
13
13
  structureFields,
14
- structureProfile
14
+ structureProfile,
15
15
  }) =>
16
16
  _.anyPass([_.prop("view_profiling_permission")])(userPermissions) &&
17
17
  (_.some(hasProfile)(structureFields) ||
18
18
  notEmpty(structureProfile?.most_frequent) ||
19
19
  notEmpty(structureProfile?.patterns));
20
20
 
21
- const linksTabVisible = state => {
21
+ const linksTabVisible = (state) => {
22
22
  const { conceptCount } = state;
23
23
  const structureLinks = getStructureToConceptLinks(state);
24
24
  return conceptCount > 0 || !_.isEmpty(structureLinks);
@@ -29,7 +29,7 @@ const notesTabVisible = ({
29
29
  templates,
30
30
  structure,
31
31
  structureTypes,
32
- structureTypesLoading
32
+ structureTypesLoading,
33
33
  }) =>
34
34
  !templatesLoading &&
35
35
  notEmpty(templates) &&
@@ -38,7 +38,7 @@ const notesTabVisible = ({
38
38
  notEmpty(structureTypes) &&
39
39
  _.flow(
40
40
  _.find({
41
- name: _.prop("type")(structure)
41
+ name: _.prop("type")(structure),
42
42
  }),
43
43
  _.get("template"),
44
44
  _.negate(_.isNil)
@@ -56,7 +56,7 @@ const grantsTabVisible = _.flow(
56
56
  _.negate(_.isEmpty)
57
57
  );
58
58
 
59
- export const getTabVisibility = state => ({
59
+ export const getTabVisibility = (state) => ({
60
60
  fields: fieldsTabVisible(state),
61
61
  profile: profileTabVisible(state),
62
62
  links: linksTabVisible(state),
@@ -69,5 +69,5 @@ export const getTabVisibility = state => ({
69
69
  impact: impactTabVisible(state),
70
70
  parents: parentsTabVisible(state),
71
71
  children: childrenTabVisible(state),
72
- grants: grantsTabVisible(state)
72
+ grants: grantsTabVisible(state),
73
73
  });
@@ -3,6 +3,10 @@ export {
3
3
  structureColumnsSelector,
4
4
  structureRowsSelector,
5
5
  } from "./structureColumnsSelector";
6
+ export { getGrantAvailableFilters } from "./getGrantAvailableFilters";
7
+ export { getGrantSelectedFilters } from "./getGrantSelectedFilters";
8
+ export { getGrantSelectedFilterValues } from "./getGrantSelectedFilterValues";
9
+ export { getGrantSelectedFilterActiveValues } from "./getGrantSelectedFilterActiveValues";
6
10
  export {
7
11
  defaultStructureProperties,
8
12
  getStructureProperties,