@truedat/dq 4.54.11 → 4.54.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,16 @@
1
1
  # Changelog
2
2
 
3
+ ## [4.54.12] 2022-11-14
4
+
5
+ ### Added
6
+
7
+ - [TD-5246] Show "referenced in" filters in ConditionSummary
8
+
9
+ ### Fixed
10
+
11
+ - [TD-5246] "referenced in" filter field empty dropdown
12
+ - [TD-5192] "referenced in" structure not displayed
13
+
3
14
  ## [4.54.9] 2022-10-28
4
15
 
5
16
  ### Changed
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@truedat/dq",
3
- "version": "4.54.11",
3
+ "version": "4.54.12",
4
4
  "description": "Truedat Web Data Quality Module",
5
5
  "sideEffects": false,
6
6
  "jsnext:main": "src/index.js",
@@ -34,7 +34,7 @@
34
34
  "@testing-library/jest-dom": "^5.16.4",
35
35
  "@testing-library/react": "^12.0.0",
36
36
  "@testing-library/user-event": "^13.2.1",
37
- "@truedat/test": "4.54.11",
37
+ "@truedat/test": "4.54.12",
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",
@@ -93,8 +93,8 @@
93
93
  },
94
94
  "dependencies": {
95
95
  "@apollo/client": "^3.7.0",
96
- "@truedat/core": "4.54.11",
97
- "@truedat/df": "4.54.11",
96
+ "@truedat/core": "4.54.12",
97
+ "@truedat/df": "4.54.12",
98
98
  "graphql": "^15.5.3",
99
99
  "path-to-regexp": "^1.7.0",
100
100
  "prop-types": "^15.8.1",
@@ -114,5 +114,5 @@
114
114
  "react-dom": ">= 16.8.6 < 17",
115
115
  "semantic-ui-react": ">= 0.88.2 < 2.1"
116
116
  },
117
- "gitHead": "72603ee10a5ad665f0c742e33a6014de94c4ba53"
117
+ "gitHead": "98b0eb7a9b7818b4c3879809fde0916f9b5f4ec9"
118
118
  }
@@ -124,7 +124,7 @@ OperatorMessage.propTypes = {
124
124
  operator: PropTypes.object,
125
125
  };
126
126
 
127
- const ConditionCell = ({ row, alias }) => {
127
+ const ConditionCell = ({ row, alias, validationPopulationCondition }) => {
128
128
  const alias_text = _.flow(
129
129
  _.find({ index: row.structure?.parent_index }),
130
130
  _.propOr(null, "text")
@@ -134,115 +134,136 @@ const ConditionCell = ({ row, alias }) => {
134
134
  const operator = _.prop("operator")(row);
135
135
  const { formatMessage } = useIntl();
136
136
  return (
137
- <Table.Row>
138
- <Table.Cell width={5}>
139
- {_.has("structure")(row) && (
140
- <>
141
- {_.path("structure.id")(row) ? (
142
- <Link
143
- to={linkTo.STRUCTURE({
144
- id: _.path("structure.id")(row),
145
- })}
146
- >
147
- <span className="highlighted">
148
- {alias_text && `(${alias_text}).`}{" "}
149
- {`"${_.pathOr("", "structure.name")(row)}"`}
137
+ <>
138
+ <Table.Row
139
+ className={
140
+ validationPopulationCondition ? "validation-population-condition" : ""
141
+ }
142
+ >
143
+ <Table.Cell width={5}>
144
+ {_.has("structure")(row) && (
145
+ <>
146
+ {_.path("structure.id")(row) ? (
147
+ <>
148
+ {validationPopulationCondition ? (
149
+ <Icon className="filter" />
150
+ ) : null}
151
+ <Link
152
+ to={linkTo.STRUCTURE({
153
+ id: _.path("structure.id")(row),
154
+ })}
155
+ >
156
+ <span className="highlighted">
157
+ {alias_text && `(${alias_text}).`}{" "}
158
+ {`"${_.pathOr("", "structure.name")(row)}"`}
159
+ </span>
160
+ </Link>
161
+ </>
162
+ ) : (
163
+ <span>{_.path("structure.name")(row)}</span>
164
+ )}
165
+ {row?.modifier && (
166
+ <>
167
+ <div className="smaller">
168
+ <FormattedMessage
169
+ id={`filtersGrid.field.modifier.${row.modifier.name}`}
170
+ defaultMessage={row.modifier.name}
171
+ />
172
+ </div>
173
+ {_.flow(
174
+ _.prop("modifier.params"),
175
+ _.toPairs,
176
+ _.map(([paramName, paramValue]) => (
177
+ <div key={paramName} className="smaller">
178
+ {`${formatMessage({
179
+ id: `filtersGrid.field.modifier.${row.modifier.name}.${paramName}`,
180
+ defaultMessage: paramName,
181
+ })}:`}
182
+ {_.isArray(paramValue)
183
+ ? paramValue.map((row, i) =>
184
+ _.isObject(row) ? (
185
+ _.path("data_structure_id")(row) ? (
186
+ <Link
187
+ key={i}
188
+ to={linkTo.STRUCTURE({
189
+ id: _.path("data_structure_id")(row),
190
+ })}
191
+ >
192
+ <span className="highlighted">
193
+ {alias_text && `(${alias_text}).`}{" "}
194
+ {`"${_.pathOr("", "name")(row)}"`}
195
+ </span>
196
+ </Link>
197
+ ) : (
198
+ <span key={i}>{_.path("name")(row)}</span>
199
+ )
200
+ ) : null
201
+ )
202
+ : `${paramValue}`}
203
+ </div>
204
+ ))
205
+ )(row)}
206
+ </>
207
+ )}
208
+ </>
209
+ )}
210
+ </Table.Cell>
211
+ <Table.Cell width={5}>
212
+ {operator && <OperatorMessage operator={operator} />}
213
+ </Table.Cell>
214
+ <Table.Cell width={5}>
215
+ {_.map.convert({ cap: false })((value, i) => (
216
+ <Fragment key={i}>
217
+ <FormattedLink value={value} operator={operator} />
218
+ {i + 1 < _.size(values) && (
219
+ <span>
220
+ {" "}
221
+ <FormattedMessage id="summary.link.and" />{" "}
150
222
  </span>
151
- </Link>
152
- ) : (
153
- <span>{_.path("structure.name")(row)}</span>
154
- )}
155
- {row?.modifier && (
156
- <>
157
- <div className="smaller">
158
- <FormattedMessage
159
- id={`filtersGrid.field.modifier.${row.modifier.name}`}
160
- defaultMessage={row.modifier.name}
161
- />
162
- </div>
163
- {_.flow(
164
- _.prop("modifier.params"),
165
- _.toPairs,
166
- _.map(([paramName, paramValue]) => (
167
- <div key={paramName} className="smaller">
168
- {`${formatMessage({
169
- id: `filtersGrid.field.modifier.${row.modifier.name}.${paramName}`,
170
- defaultMessage: paramName,
171
- })}:`}
172
- {_.isArray(paramValue)
173
- ? paramValue.map((row, i) =>
174
- _.isObject(row) ? (
175
- _.path("data_structure_id")(row) ? (
176
- <Link
177
- key={i}
178
- to={linkTo.STRUCTURE({
179
- id: _.path("data_structure_id")(row),
180
- })}
181
- >
182
- <span className="highlighted">
183
- {alias_text && `(${alias_text}).`}{" "}
184
- {`"${_.pathOr("", "name")(row)}"`}
185
- </span>
186
- </Link>
187
- ) : (
188
- <span key={i}>{_.path("name")(row)}</span>
189
- )
190
- ) : null
191
- )
192
- : `${paramValue}`}
193
- </div>
194
- ))
195
- )(row)}
196
- </>
197
- )}
198
- </>
199
- )}
200
- </Table.Cell>
201
- <Table.Cell width={5}>
202
- {operator && <OperatorMessage operator={operator} />}
203
- </Table.Cell>
204
- <Table.Cell width={5}>
205
- {_.map.convert({ cap: false })((value, i) => (
206
- <Fragment key={i}>
207
- <FormattedLink value={value} operator={operator} />
208
- {i + 1 < _.size(values) && (
209
- <span>
210
- {" "}
211
- <FormattedMessage id="summary.link.and" />{" "}
212
- </span>
213
- )}
214
- {value?.modifier && (
215
- <>
216
- <div className="smaller">
217
- <FormattedMessage
218
- id={`filtersGrid.field.modifier.${value.modifier.name}`}
219
- defaultMessage={value.modifier.name}
220
- />
221
- </div>
222
- {_.flow(
223
- _.prop("modifier.params"),
224
- _.toPairs,
225
- _.map(([paramName, paramValue]) => (
226
- <div key={paramName} className="smaller">
227
- {`${formatMessage({
228
- id: `filtersGrid.field.modifier.${value.modifier.name}.${paramName}`,
229
- defaultMessage: paramName,
230
- })}: ${paramValue}`}
231
- </div>
232
- ))
233
- )(value)}
234
- </>
235
- )}
236
- </Fragment>
237
- ))(values)}
238
- </Table.Cell>
239
- </Table.Row>
223
+ )}
224
+ {value?.modifier && (
225
+ <>
226
+ <div className="smaller">
227
+ <FormattedMessage
228
+ id={`filtersGrid.field.modifier.${value.modifier.name}`}
229
+ defaultMessage={value.modifier.name}
230
+ />
231
+ </div>
232
+ {_.flow(
233
+ _.prop("modifier.params"),
234
+ _.toPairs,
235
+ _.map(([paramName, paramValue]) => (
236
+ <div key={paramName} className="smaller">
237
+ {`${formatMessage({
238
+ id: `filtersGrid.field.modifier.${value.modifier.name}.${paramName}`,
239
+ defaultMessage: paramName,
240
+ })}: ${paramValue}`}
241
+ </div>
242
+ ))
243
+ )(value)}
244
+ </>
245
+ )}
246
+ </Fragment>
247
+ ))(values)}
248
+ </Table.Cell>
249
+ </Table.Row>
250
+ {row?.population
251
+ ? row.population.map((validationPopulationCondition, i) => (
252
+ <ConditionCell
253
+ validationPopulationCondition
254
+ row={validationPopulationCondition}
255
+ key={i}
256
+ />
257
+ ))
258
+ : null}
259
+ </>
240
260
  );
241
261
  };
242
262
 
243
263
  ConditionCell.propTypes = {
244
264
  row: PropTypes.object,
245
265
  alias: PropTypes.array,
266
+ validationPopulationCondition: PropTypes.bool,
246
267
  };
247
268
 
248
269
  export const ConditionSummary = ({ rows, type, icon, alias }) => {
@@ -268,7 +289,7 @@ export const ConditionSummary = ({ rows, type, icon, alias }) => {
268
289
  {wrappedRows.map((rows, i) => (
269
290
  <Fragment key={i}>
270
291
  <Segment>
271
- <Table basic="very">
292
+ <Table basic="very" className="condition-summary">
272
293
  <Table.Header>
273
294
  <Table.Row>
274
295
  <Table.HeaderCell>
@@ -19,7 +19,7 @@ exports[`<ConditionSummary /> matches the latest snapshot 1`] = `
19
19
  class="ui segment"
20
20
  >
21
21
  <table
22
- class="ui very basic table"
22
+ class="ui very basic table condition-summary"
23
23
  >
24
24
  <thead
25
25
  class=""
@@ -165,7 +165,7 @@ exports[`<ImplementationSummary /> displays correctly validations values of list
165
165
  class="ui segment"
166
166
  >
167
167
  <table
168
- class="ui very basic table"
168
+ class="ui very basic table condition-summary"
169
169
  >
170
170
  <thead
171
171
  class=""
@@ -226,7 +226,7 @@ exports[`<ImplementationSummary /> displays correctly validations values of list
226
226
  class="ui segment"
227
227
  >
228
228
  <table
229
- class="ui very basic table"
229
+ class="ui very basic table condition-summary"
230
230
  >
231
231
  <thead
232
232
  class=""
@@ -570,7 +570,7 @@ exports[`<NewRuleImplementation /> calculate aliases when not informed 1`] = `
570
570
  class="ui segment"
571
571
  >
572
572
  <table
573
- class="ui very basic table"
573
+ class="ui very basic table condition-summary"
574
574
  >
575
575
  <thead
576
576
  class=""
@@ -660,7 +660,7 @@ exports[`<NewRuleImplementation /> calculate aliases when not informed 1`] = `
660
660
  class="ui segment"
661
661
  >
662
662
  <table
663
- class="ui very basic table"
663
+ class="ui very basic table condition-summary"
664
664
  >
665
665
  <thead
666
666
  class=""
@@ -1387,7 +1387,7 @@ exports[`<NewRuleImplementation /> matches the latest snapshot 1`] = `
1387
1387
  class="ui segment"
1388
1388
  >
1389
1389
  <table
1390
- class="ui very basic table"
1390
+ class="ui very basic table condition-summary"
1391
1391
  >
1392
1392
  <thead
1393
1393
  class=""
@@ -121,7 +121,7 @@ export const FiltersField = ({
121
121
  setActive(false);
122
122
  }}
123
123
  onDelete={() => onChange(null, null)}
124
- selectedStructure={value}
124
+ selectedStructure={{ structure: value }}
125
125
  onClick={() => setActive(!active)}
126
126
  structureSelectorOverwriteColumns={reducedStructureColumns}
127
127
  fieldWidth={15}
@@ -17,7 +17,9 @@ exports[`<FiltersField /> matches the latest snapshot 1`] = `
17
17
  onDelete={[Function]}
18
18
  selectedStructure={
19
19
  Object {
20
- "structure": "1",
20
+ "structure": Object {
21
+ "structure": "1",
22
+ },
21
23
  }
22
24
  }
23
25
  structureSelectorOverwriteColumns={
@@ -5,44 +5,48 @@ import {
5
5
 
6
6
  const ruleImplementation = {
7
7
  dataset: [{ structure: { id: 1 } }, { structure: { id: 2 } }],
8
+ /* validations is an array of arrays
9
+ first level: OR ("add validation" button)
10
+ second level: AND (plus icon button) */
8
11
  validations: [
9
- {
10
- structure: { id: 4 },
11
- operator: { value_type: "field", value_type_filter: "any" },
12
- value: [{ id: 6 }, { raw: "baz" }],
13
- },
12
+ [
13
+ {
14
+ structure: { id: 4 },
15
+ operator: { value_type: "field", value_type_filter: "any" },
16
+ value: [{ id: 6 }, { raw: "baz" }],
17
+ },
18
+ ],
14
19
  ],
15
20
  };
16
21
 
17
22
  const structuresSiblings = { 1: [], 2: [] };
18
- const structuresFields = { 3: [], 4: [] };
19
23
 
20
24
  describe("selectors: getImplementationStructures", () => {
21
25
  it("should return structures from implementation", () => {
22
26
  const res = getImplementationStructures({
23
27
  ruleImplementation,
24
28
  structuresSiblings,
25
- structuresFields,
29
+ structuresFields: {},
26
30
  });
27
31
  expect(res).toEqual([6, 1, 2]);
28
32
  });
29
33
  });
30
34
 
31
35
  describe("selectors: getImplementationStructuresLoaded", () => {
32
- it("sould return false if not all structures are loaded", () => {
36
+ it("sould return true if all structures are loaded", () => {
33
37
  const res = getImplementationStructuresLoaded({
34
38
  ruleImplementation,
35
39
  structuresSiblings,
36
- structuresFields: { ...structuresFields, 6: [] },
40
+ structuresFields: { 6: [] },
37
41
  });
38
42
  expect(res).toBeTruthy();
39
43
  });
40
44
 
41
- it("sould return true if all structures are loaded", () => {
45
+ it("sould return false if not all structures are loaded", () => {
42
46
  const res = getImplementationStructuresLoaded({
43
47
  ruleImplementation,
44
48
  structuresSiblings,
45
- structuresFields,
49
+ structuresFields: {},
46
50
  });
47
51
  expect(res).toBeFalsy();
48
52
  });
@@ -19,6 +19,9 @@ export const getValidationStructures = createSelector(
19
19
  [getRuleImplementation],
20
20
  _.flow(
21
21
  _.prop("validations"),
22
+ /* Validations array first level: OR ("add validation" button)
23
+ Validations array second level: AND (plus icon button) */
24
+ _.flatten,
22
25
  _.filter(
23
26
  (v) =>
24
27
  v?.operator?.value_type === "field" &&