@truedat/dq 4.36.1 → 4.36.2

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,10 +1,10 @@
1
1
  # Changelog
2
2
 
3
- ## [4.36.1] 2022-01-13
3
+ ## [4.36.2] 2022-01-17
4
4
 
5
- ### Changed
5
+ ### Added
6
6
 
7
- - [TD-2564] Uses `has_field_child` default filter on Structure selection of ImplementationForm's DataSet
7
+ - [TD-3178] Show join details in implementation summary
8
8
 
9
9
  ## [4.35.8] 2022-01-07
10
10
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@truedat/dq",
3
- "version": "4.36.1",
3
+ "version": "4.36.2",
4
4
  "description": "Truedat Web Data Quality Module",
5
5
  "sideEffects": false,
6
6
  "jsnext:main": "src/index.js",
@@ -82,8 +82,8 @@
82
82
  },
83
83
  "dependencies": {
84
84
  "@apollo/client": "^3.4.10",
85
- "@truedat/core": "4.36.1",
86
- "@truedat/df": "4.36.1",
85
+ "@truedat/core": "4.36.2",
86
+ "@truedat/df": "4.36.2",
87
87
  "axios": "^0.19.2",
88
88
  "graphql": "^15.5.3",
89
89
  "path-to-regexp": "^1.7.0",
@@ -103,5 +103,5 @@
103
103
  "react-dom": ">= 16.8.6 < 17",
104
104
  "semantic-ui-react": ">= 0.88.2 < 2.1"
105
105
  },
106
- "gitHead": "236b538f0fa3671bc4f3dc3bcfb26ea6bb9bbaee"
106
+ "gitHead": "0f4c09d90582210ae7c98e945b8c0b7af0f9a61d"
107
107
  }
@@ -74,7 +74,12 @@ OperatorMessage.propTypes = {
74
74
  operator: PropTypes.object,
75
75
  };
76
76
 
77
- const ConditionCell = ({ row }) => {
77
+ const ConditionCell = ({ row, alias }) => {
78
+ const alias_text = _.flow(
79
+ _.find({ index: row.structure?.parent_index }),
80
+ _.propOr(null, "text")
81
+ )(alias);
82
+
78
83
  const values = getValues(row);
79
84
  const operator = _.prop("operator")(row);
80
85
  return (
@@ -87,10 +92,10 @@ const ConditionCell = ({ row }) => {
87
92
  id: _.path("structure.id")(row),
88
93
  })}
89
94
  >
90
- <span className="highlighted">{`"${_.pathOr(
91
- "",
92
- "structure.name"
93
- )(row)}"`}</span>
95
+ <span className="highlighted">
96
+ {alias_text && `(${alias_text}).`}{" "}
97
+ {`"${_.pathOr("", "structure.name")(row)}"`}
98
+ </span>
94
99
  </Link>
95
100
  {row?.modifier && (
96
101
  <>
@@ -155,9 +160,10 @@ const ConditionCell = ({ row }) => {
155
160
 
156
161
  ConditionCell.propTypes = {
157
162
  row: PropTypes.object,
163
+ alias: PropTypes.array,
158
164
  };
159
165
 
160
- export const ConditionSummary = ({ rows, type, icon }) =>
166
+ export const ConditionSummary = ({ rows, type, icon, alias }) =>
161
167
  empty(rows) ? null : (
162
168
  <>
163
169
  <Header as="h3">
@@ -185,7 +191,7 @@ export const ConditionSummary = ({ rows, type, icon }) =>
185
191
  </Table.Header>
186
192
  <Table.Body>
187
193
  {rows.map((row, i) => (
188
- <ConditionCell key={i} row={row} />
194
+ <ConditionCell key={i} row={row} alias={alias} />
189
195
  ))}
190
196
  </Table.Body>
191
197
  </Table>
@@ -1,12 +1,13 @@
1
1
  import _ from "lodash/fp";
2
2
  import React from "react";
3
3
  import PropTypes from "prop-types";
4
- import { Header, Icon, Table, Segment } from "semantic-ui-react";
4
+ import { Header, Icon, Table, Segment, List } from "semantic-ui-react";
5
5
  import { Link } from "react-router-dom";
6
6
  import { FormattedMessage } from "react-intl";
7
7
  import { linkTo } from "@truedat/core/routes";
8
8
  import ConditionSummary, { empty, path } from "./ConditionSummary";
9
9
  import InformationSummary from "./InformationSummary";
10
+ import "../styles/ImplementationSummary.less";
10
11
 
11
12
  const defaults = [
12
13
  "executable",
@@ -39,7 +40,45 @@ FormattedLink.propTypes = {
39
40
  operator: PropTypes.object,
40
41
  };
41
42
 
42
- const DatasetSummary = ({ rows }) =>
43
+ const AliasText = ({ alias, clause }) => {
44
+ const text = _.flow(
45
+ _.find({ index: clause?.parent_index }),
46
+ _.propOr(null, "text")
47
+ )(alias);
48
+ return _.isNull(text) ? clause?.name : `(${text}).${clause?.name}`;
49
+ };
50
+
51
+ AliasText.propTypes = {
52
+ alias: PropTypes.array,
53
+ clause: PropTypes.object,
54
+ };
55
+
56
+ const UnionSummary = ({ alias, row }) => {
57
+ return empty(row) || !(row?.clauses && _.size(row?.clauses) > 0) ? null : (
58
+ <List id="union-list">
59
+ <List.Item>
60
+ <List.Header>
61
+ <FormattedMessage id="structureSelector.union.criteria" />
62
+ </List.Header>
63
+ </List.Item>
64
+ {row.clauses.map((clause, k) =>
65
+ _.size(clause) > 0 ? (
66
+ <List.Item key={k}>
67
+ {clause.left && <AliasText alias={alias} clause={clause.left} />} ={" "}
68
+ {clause.right && <AliasText alias={alias} clause={clause.right} />}
69
+ </List.Item>
70
+ ) : null
71
+ )}
72
+ </List>
73
+ );
74
+ };
75
+
76
+ UnionSummary.propTypes = {
77
+ row: PropTypes.object,
78
+ alias: PropTypes.array,
79
+ };
80
+
81
+ const DatasetSummary = ({ rows, alias }) =>
43
82
  empty(rows) ? null : (
44
83
  <>
45
84
  <Header as="h3">
@@ -61,16 +100,19 @@ const DatasetSummary = ({ rows }) =>
61
100
  {rows.map((row, i) => (
62
101
  <Table.Row key={i}>
63
102
  {_.has("structure")(row) && (
64
- <Table.Cell key={i}>
103
+ <Table.Cell>
65
104
  <Link
66
105
  to={linkTo.STRUCTURE({
67
106
  id: _.pathOr("", "structure.id")(row),
68
107
  })}
69
108
  >
70
- <span key={i} className="highlighted">{`"${path(
109
+ <p className="highlighted">{`"${path(
71
110
  _.propOr({}, "structure")(row)
72
- )}"`}</span>
111
+ )}"`}</p>
73
112
  </Link>
113
+
114
+ {row.alias?.text && <span>({row.alias.text})</span>}
115
+ <UnionSummary alias={alias} row={row} />
74
116
  </Table.Cell>
75
117
  )}
76
118
  </Table.Row>
@@ -83,12 +125,14 @@ const DatasetSummary = ({ rows }) =>
83
125
 
84
126
  DatasetSummary.propTypes = {
85
127
  rows: PropTypes.array,
128
+ alias: PropTypes.array,
86
129
  };
87
130
 
88
131
  export const ImplementationSummary = ({ ruleImplementation, activeSteps }) => {
89
132
  const steps = _.isEmpty(activeSteps) ? defaults : activeSteps;
90
133
  const { dataset, population, validations } =
91
134
  _.pick(steps)(ruleImplementation);
135
+ const alias = _.map(_.propOr({}, "alias"))(dataset);
92
136
  return (
93
137
  <>
94
138
  {(_.includes("implementationKey")(steps) ||
@@ -96,16 +140,22 @@ export const ImplementationSummary = ({ ruleImplementation, activeSteps }) => {
96
140
  <InformationSummary ruleImplementation={ruleImplementation} />
97
141
  )}
98
142
  {dataset && _.includes("dataset")(steps) && (
99
- <DatasetSummary rows={dataset} />
143
+ <DatasetSummary rows={dataset} alias={alias} />
100
144
  )}
101
145
  {population && _.includes("population")(steps) && (
102
- <ConditionSummary type="population" icon="user" rows={population} />
146
+ <ConditionSummary
147
+ type="population"
148
+ icon="user"
149
+ rows={population}
150
+ alias={alias}
151
+ />
103
152
  )}
104
153
  {validations && _.includes("validations")(steps) && (
105
154
  <ConditionSummary
106
155
  type="validations"
107
156
  icon="setting"
108
157
  rows={validations}
158
+ alias={alias}
109
159
  />
110
160
  )}
111
161
  </>
@@ -42,6 +42,7 @@ const ruleImplementation = {
42
42
  id: 1,
43
43
  name: "Microstrategy",
44
44
  },
45
+ alias: [{ index: 0, text: "bar" }],
45
46
  },
46
47
  },
47
48
  ],
@@ -59,6 +59,7 @@ exports[`<ConditionSummary /> matches the latest snapshot 1`] = `
59
59
  <span
60
60
  class="highlighted"
61
61
  >
62
+
62
63
  "Mes"
63
64
  </span>
64
65
  </a>
@@ -133,11 +133,11 @@ exports[`<ImplementationSummary /> displays correctly validations values of list
133
133
  <a
134
134
  href="/structures/1915"
135
135
  >
136
- <span
136
+ <p
137
137
  class="highlighted"
138
138
  >
139
139
  "CMC &gt; Objetos Públicos &gt; 0. 0 Meses"
140
- </span>
140
+ </p>
141
141
  </a>
142
142
  </td>
143
143
  </tr>
@@ -201,6 +201,7 @@ exports[`<ImplementationSummary /> displays correctly validations values of list
201
201
  <span
202
202
  class="highlighted"
203
203
  >
204
+
204
205
  "Mes"
205
206
  </span>
206
207
  </a>
@@ -238,6 +239,12 @@ exports[`<ImplementationSummary /> matches the latest snapshot 1`] = `
238
239
  "dataset": Array [
239
240
  Object {
240
241
  "structure": Object {
242
+ "alias": Array [
243
+ Object {
244
+ "index": 0,
245
+ "text": "bar",
246
+ },
247
+ ],
241
248
  "id": 1915,
242
249
  "name": "0. 0 Meses",
243
250
  "path": Array [
@@ -293,10 +300,21 @@ exports[`<ImplementationSummary /> matches the latest snapshot 1`] = `
293
300
  }
294
301
  />
295
302
  <DatasetSummary
303
+ alias={
304
+ Array [
305
+ Object {},
306
+ ]
307
+ }
296
308
  rows={
297
309
  Array [
298
310
  Object {
299
311
  "structure": Object {
312
+ "alias": Array [
313
+ Object {
314
+ "index": 0,
315
+ "text": "bar",
316
+ },
317
+ ],
300
318
  "id": 1915,
301
319
  "name": "0. 0 Meses",
302
320
  "path": Array [
@@ -314,6 +332,11 @@ exports[`<ImplementationSummary /> matches the latest snapshot 1`] = `
314
332
  }
315
333
  />
316
334
  <ConditionSummary
335
+ alias={
336
+ Array [
337
+ Object {},
338
+ ]
339
+ }
317
340
  icon="user"
318
341
  rows={
319
342
  Array [
@@ -323,6 +346,11 @@ exports[`<ImplementationSummary /> matches the latest snapshot 1`] = `
323
346
  type="population"
324
347
  />
325
348
  <ConditionSummary
349
+ alias={
350
+ Array [
351
+ Object {},
352
+ ]
353
+ }
326
354
  icon="setting"
327
355
  rows={
328
356
  Array [
@@ -7,6 +7,7 @@ import { dropAt, replaceAt } from "@truedat/core/services/arrays";
7
7
  import { Button } from "semantic-ui-react";
8
8
  import { setImplementationFilterValues } from "../../routines";
9
9
  import { getRuleImplementationFormFilters } from "../../selectors";
10
+ import "../../styles/ruleImplementationForm/DatasetForm.less";
10
11
 
11
12
  const StructureSelectorInputField = React.lazy(() =>
12
13
  import("@truedat/dd/components/StructureSelectorInputField")
@@ -88,7 +89,7 @@ export const DatasetForm = ({
88
89
  };
89
90
 
90
91
  const buildDefaultFilters = (i) => {
91
- const defaultFilters = { "has_field_child.raw": ["true"] };
92
+ const defaultFilters = { "class.raw": [""] };
92
93
  return i == 0
93
94
  ? { defaultFilters }
94
95
  : { defaultFilters: { ...defaultFilters, ...customFilters } };
@@ -116,7 +117,9 @@ export const DatasetForm = ({
116
117
  systemRequired={false}
117
118
  />
118
119
  ))}
120
+
119
121
  <Button
122
+ id="add-structure-button"
120
123
  onClick={(e) => {
121
124
  e.preventDefault();
122
125
  setStructure({ value: { join_type: "inner" } });
@@ -20,8 +20,8 @@ describe("<DatasetForm />", () => {
20
20
  id: 1,
21
21
  name: "strcuture1",
22
22
  path: [],
23
- system: { name: "system" },
24
- },
23
+ system: { name: "system" }
24
+ }
25
25
  },
26
26
  {
27
27
  join_type: "inner",
@@ -29,10 +29,10 @@ describe("<DatasetForm />", () => {
29
29
  id: 2,
30
30
  name: "structure2",
31
31
  path: [],
32
- system: { name: "system" },
32
+ system: { name: "system" }
33
33
  },
34
- clauses: [{ id: 100 }, { id: 200 }],
35
- },
34
+ clauses: [{ id: 100 }, { id: 200 }]
35
+ }
36
36
  ];
37
37
 
38
38
  const customFilters = { "foo.bar": ["baz"] };
@@ -44,7 +44,7 @@ describe("<DatasetForm />", () => {
44
44
  setSelector,
45
45
  selector,
46
46
  setImplementationFilterValues,
47
- setImplementationKey,
47
+ setImplementationKey
48
48
  };
49
49
 
50
50
  it("matches the latest snapshot", () => {
@@ -63,14 +63,14 @@ describe("<DatasetForm />", () => {
63
63
  const selectors = wrapper.find("lazy");
64
64
  expect(selectors.first().prop("options")).toEqual({
65
65
  defaultFilters: {
66
- "has_field_child.raw": ["true"],
67
- },
66
+ "class.raw": [""]
67
+ }
68
68
  });
69
69
  expect(selectors.last().prop("options")).toEqual({
70
70
  defaultFilters: {
71
- "has_field_child.raw": ["true"],
72
- "foo.bar": ["baz"],
73
- },
71
+ "class.raw": [""],
72
+ "foo.bar": ["baz"]
73
+ }
74
74
  });
75
75
  });
76
76
  });
@@ -13,8 +13,8 @@ exports[`<DatasetForm /> matches the latest snapshot 1`] = `
13
13
  options={
14
14
  Object {
15
15
  "defaultFilters": Object {
16
- "has_field_child.raw": Array [
17
- "true",
16
+ "class.raw": Array [
17
+ "",
18
18
  ],
19
19
  },
20
20
  }
@@ -77,12 +77,12 @@ exports[`<DatasetForm /> matches the latest snapshot 1`] = `
77
77
  options={
78
78
  Object {
79
79
  "defaultFilters": Object {
80
+ "class.raw": Array [
81
+ "",
82
+ ],
80
83
  "foo.bar": Array [
81
84
  "baz",
82
85
  ],
83
- "has_field_child.raw": Array [
84
- "true",
85
- ],
86
86
  },
87
87
  }
88
88
  }
@@ -144,6 +144,7 @@ exports[`<DatasetForm /> matches the latest snapshot 1`] = `
144
144
  />
145
145
  <Button
146
146
  as="button"
147
+ id="add-structure-button"
147
148
  onClick={[Function]}
148
149
  >
149
150
  dataset.form.button.add_structure
@@ -543,6 +543,7 @@ export default {
543
543
  "Error uploading file. No rules have been created.",
544
544
  "rules.upload.failed.misssing_required_columns":
545
545
  "Missing required columns. Expected [{expected}]. Found [{found}].",
546
+ "structureSelector.union.criteria": "Union criteria",
546
547
  "structureFields.dropdown.label": "Select Field",
547
548
  "structureFields.dropdown.placeholder": "Fields",
548
549
  "summary.link.and": "and",
@@ -559,6 +559,7 @@ export default {
559
559
  "rules.upload.failed.misssing_required_columns":
560
560
  "Faltan columnas obligatorias en el fichero. Esperado [{expected}]. Recibido [{found}].",
561
561
  "ruleSubscription.actions.remove": "Eliminar",
562
+ "structureSelector.union.criteria": "Criterio de unión",
562
563
  "structureFields.dropdown.label": "Seleccionar Campo",
563
564
  "structureFields.dropdown.placeholder": "Campos",
564
565
  "summary.link.and": "y",
@@ -0,0 +1,3 @@
1
+ #union-list {
2
+ margin-top: 15px;
3
+ }
@@ -0,0 +1,3 @@
1
+ #add-structure-button {
2
+ margin-top: 12px;
3
+ }