@truedat/dd 4.52.4 → 4.52.6

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,9 @@
1
1
  # Changelog
2
2
 
3
+ ## [4.52.5] 2022-09-30
4
+
5
+ - [TD-2430] Add join type selection when defining an implementation dataset
6
+
3
7
  ## [4.52.3] 2022-09-22
4
8
 
5
9
  ### Removed
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@truedat/dd",
3
- "version": "4.52.4",
3
+ "version": "4.52.6",
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.4",
35
35
  "@testing-library/react": "^12.0.0",
36
36
  "@testing-library/user-event": "^13.2.1",
37
- "@truedat/test": "4.52.0",
37
+ "@truedat/test": "4.52.6",
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",
@@ -88,9 +88,9 @@
88
88
  },
89
89
  "dependencies": {
90
90
  "@apollo/client": "^3.6.4",
91
- "@truedat/auth": "4.52.4",
92
- "@truedat/core": "4.52.4",
93
- "@truedat/df": "4.52.4",
91
+ "@truedat/auth": "4.52.6",
92
+ "@truedat/core": "4.52.6",
93
+ "@truedat/df": "4.52.6",
94
94
  "lodash": "^4.17.21",
95
95
  "path-to-regexp": "^1.7.0",
96
96
  "prop-types": "^15.8.1",
@@ -112,5 +112,5 @@
112
112
  "react-dom": ">= 16.8.6 < 17",
113
113
  "semantic-ui-react": ">= 0.88.2 < 2.1"
114
114
  },
115
- "gitHead": "c8fb8bfae18f39f7925c46e45b7818d02a5bc070"
115
+ "gitHead": "14204211010d6329f9f22071c95e7d9d6ce6b0f7"
116
116
  }
@@ -1,11 +1,9 @@
1
1
  import _ from "lodash/fp";
2
2
  import React, { useState } from "react";
3
3
  import PropTypes from "prop-types";
4
-
5
4
  import { matchSorter } from "match-sorter";
6
5
  import { useIntl } from "react-intl";
7
6
  import { Container, Form, Dropdown, Icon } from "semantic-ui-react";
8
-
9
7
  import StructureSelectorInputFieldJoin from "./StructureSelectorInputFieldJoin";
10
8
 
11
9
  export const ReferenceDatasetSelectorInputField = ({
@@ -53,6 +51,9 @@ export const ReferenceDatasetSelectorInputField = ({
53
51
  const handleSelectField = (clauses) => {
54
52
  onChangeField({ ...selectedStructure, clauses });
55
53
  };
54
+ const handleSelectJoinType = (joinType) => {
55
+ onChangeField({ ...selectedStructure, join_type: joinType });
56
+ };
56
57
 
57
58
  return (
58
59
  <>
@@ -77,15 +78,11 @@ export const ReferenceDatasetSelectorInputField = ({
77
78
  {_.prop("structure")(selectedStructure) && (
78
79
  <Container style={{ paddingLeft: "8em" }}>
79
80
  <Form.Field>
80
- <label>
81
- {formatMessage({
82
- id: "structureSelector.union.criteria",
83
- })}
84
- </label>
85
81
  <StructureSelectorInputFieldJoin
86
82
  structures={structures}
87
83
  selectedStructure={selectedStructure}
88
84
  handleSelectField={handleSelectField}
85
+ handleSelectJoinType={handleSelectJoinType}
89
86
  />
90
87
  </Form.Field>
91
88
  </Container>
@@ -34,6 +34,10 @@ export const StructureSelectorInputField = ({
34
34
  onChangeField({ ...selectedStructure, clauses });
35
35
  };
36
36
 
37
+ const handleSelectJoinType = (joinType) => {
38
+ onChangeField({ ...selectedStructure, join_type: joinType });
39
+ };
40
+
37
41
  const aliasIsNeeded =
38
42
  _.flow(
39
43
  _.map(_.path("structure.id")),
@@ -106,13 +110,11 @@ export const StructureSelectorInputField = ({
106
110
  {joined && _.prop("structure")(selectedStructure) && (
107
111
  <Container style={{ paddingLeft: "8em" }}>
108
112
  <Form.Field>
109
- <label>
110
- {formatMessage({ id: "structureSelector.union.criteria" })}
111
- </label>
112
113
  <StructureSelectorInputFieldJoin
113
114
  structures={structures}
114
115
  selectedStructure={selectedStructure}
115
116
  handleSelectField={handleSelectField}
117
+ handleSelectJoinType={handleSelectJoinType}
116
118
  />
117
119
  </Form.Field>
118
120
  </Container>
@@ -2,10 +2,14 @@ import _ from "lodash/fp";
2
2
  import React from "react";
3
3
  import PropTypes from "prop-types";
4
4
  import { useIntl } from "react-intl";
5
- import { Grid, Icon, Popup } from "semantic-ui-react";
5
+ import { Dropdown, Grid, Icon, Popup } from "semantic-ui-react";
6
6
  import { getStructureFieldOptionValue } from "../selectors/getStructureFieldOptionValue";
7
7
  import StructureFieldsDropdown from "./StructureFieldsDropdown";
8
8
 
9
+ const JoinTypeIcon = React.lazy(() =>
10
+ import("@truedat/dq/components/JoinTypeIcon")
11
+ );
12
+
9
13
  const getClauses = (selectedStructure) => {
10
14
  const clauses = _.getOr([], "clauses")(selectedStructure);
11
15
  return _.isEmpty(clauses) ? [{}] : clauses;
@@ -113,7 +117,9 @@ export const StructureSelectorInputFieldJoin = ({
113
117
  structures,
114
118
  selectedStructure,
115
119
  handleSelectField,
120
+ handleSelectJoinType,
116
121
  }) => {
122
+ const { formatMessage } = useIntl();
117
123
  const clauses = getClauses(selectedStructure);
118
124
  const parentStructures = getParentStructures(structures, selectedStructure);
119
125
  const createClause = () => handleSelectField([...clauses, {}]);
@@ -135,22 +141,58 @@ export const StructureSelectorInputFieldJoin = ({
135
141
  const newClauses = _.set(`[${idx}]`, newClause)(clauses);
136
142
  handleSelectField(newClauses);
137
143
  };
144
+
145
+ const joinTypes = ["inner", "left", "right", "full_outer"];
146
+
147
+ const trigger = <JoinTypeIcon type={selectedStructure.join_type} />;
148
+
138
149
  return (
139
- <div style={{ marginBottom: "1em" }}>
140
- {clauses.map(({ left, right }, idx) => (
141
- <JoinClause
142
- key={idx}
143
- idx={idx}
144
- createClause={createClause}
145
- deleteClause={deleteClause}
146
- handleChange={handleChange}
147
- left={left}
148
- parentStructures={parentStructures}
149
- right={right}
150
- selectedStructure={selectedStructure}
151
- />
152
- ))}
153
- </div>
150
+ <>
151
+ <label>{formatMessage({ id: "structureSelector.union.type" })}</label>
152
+ <Grid>
153
+ <Grid.Column width={4}>
154
+ <Dropdown trigger={trigger}>
155
+ <Dropdown.Menu>
156
+ {_.map.convert({ cap: false })((value, key) => (
157
+ <Dropdown.Item
158
+ key={key}
159
+ onClick={() => handleSelectJoinType(value)}
160
+ selected={value === selectedStructure.join_type}
161
+ >
162
+ <Grid verticalAlign="middle">
163
+ <Grid.Column width={4}>
164
+ <JoinTypeIcon type={value} />
165
+ </Grid.Column>
166
+ <Grid.Column>
167
+ {formatMessage({
168
+ id: `joinType.${value}`,
169
+ })}
170
+ </Grid.Column>
171
+ </Grid>
172
+ </Dropdown.Item>
173
+ ))(joinTypes)}
174
+ </Dropdown.Menu>
175
+ </Dropdown>
176
+ </Grid.Column>
177
+ </Grid>
178
+
179
+ <label>{formatMessage({ id: "structureSelector.union.criteria" })}</label>
180
+ <div style={{ marginBottom: "1em" }}>
181
+ {clauses.map(({ left, right }, idx) => (
182
+ <JoinClause
183
+ key={idx}
184
+ idx={idx}
185
+ createClause={createClause}
186
+ deleteClause={deleteClause}
187
+ handleChange={handleChange}
188
+ left={left}
189
+ parentStructures={parentStructures}
190
+ right={right}
191
+ selectedStructure={selectedStructure}
192
+ />
193
+ ))}
194
+ </div>
195
+ </>
154
196
  );
155
197
  };
156
198
 
@@ -158,6 +200,7 @@ StructureSelectorInputFieldJoin.propTypes = {
158
200
  structures: PropTypes.array,
159
201
  selectedStructure: PropTypes.object,
160
202
  handleSelectField: PropTypes.func,
203
+ handleSelectJoinType: PropTypes.func,
161
204
  };
162
205
 
163
206
  export default StructureSelectorInputFieldJoin;
@@ -87,118 +87,346 @@ exports[`<StructureSelectorInputFieldJoin /> matches the latest JoinClause snaps
87
87
  `;
88
88
 
89
89
  exports[`<StructureSelectorInputFieldJoin /> matches the latest snapshot 1`] = `
90
- <div
91
- style={
92
- Object {
93
- "marginBottom": "1em",
94
- }
95
- }
96
- >
97
- <JoinClause
98
- createClause={[Function]}
99
- deleteClause={[Function]}
100
- handleChange={[Function]}
101
- idx={0}
102
- key="0"
103
- parentStructures={Array []}
104
- selectedStructure={
90
+ <Fragment>
91
+ <label>
92
+ structureSelector.union.type
93
+ </label>
94
+ <Grid>
95
+ <GridColumn
96
+ width={4}
97
+ >
98
+ <Dropdown
99
+ additionLabel="Add "
100
+ additionPosition="top"
101
+ closeOnBlur={true}
102
+ closeOnEscape={true}
103
+ deburr={false}
104
+ icon="dropdown"
105
+ minCharacters={1}
106
+ noResultsMessage="No results found."
107
+ openOnFocus={true}
108
+ renderLabel={[Function]}
109
+ searchInput="text"
110
+ selectOnBlur={true}
111
+ selectOnNavigation={true}
112
+ trigger={<UNDEFINED />}
113
+ wrapSelection={true}
114
+ >
115
+ <DropdownMenu>
116
+ <DropdownItem
117
+ key="0"
118
+ onClick={[Function]}
119
+ selected={false}
120
+ >
121
+ <Grid
122
+ verticalAlign="middle"
123
+ >
124
+ <GridColumn
125
+ width={4}
126
+ >
127
+ <lazy
128
+ type="inner"
129
+ />
130
+ </GridColumn>
131
+ <GridColumn>
132
+ joinType.inner
133
+ </GridColumn>
134
+ </Grid>
135
+ </DropdownItem>
136
+ <DropdownItem
137
+ key="1"
138
+ onClick={[Function]}
139
+ selected={false}
140
+ >
141
+ <Grid
142
+ verticalAlign="middle"
143
+ >
144
+ <GridColumn
145
+ width={4}
146
+ >
147
+ <lazy
148
+ type="left"
149
+ />
150
+ </GridColumn>
151
+ <GridColumn>
152
+ joinType.left
153
+ </GridColumn>
154
+ </Grid>
155
+ </DropdownItem>
156
+ <DropdownItem
157
+ key="2"
158
+ onClick={[Function]}
159
+ selected={false}
160
+ >
161
+ <Grid
162
+ verticalAlign="middle"
163
+ >
164
+ <GridColumn
165
+ width={4}
166
+ >
167
+ <lazy
168
+ type="right"
169
+ />
170
+ </GridColumn>
171
+ <GridColumn>
172
+ joinType.right
173
+ </GridColumn>
174
+ </Grid>
175
+ </DropdownItem>
176
+ <DropdownItem
177
+ key="3"
178
+ onClick={[Function]}
179
+ selected={false}
180
+ >
181
+ <Grid
182
+ verticalAlign="middle"
183
+ >
184
+ <GridColumn
185
+ width={4}
186
+ >
187
+ <lazy
188
+ type="full_outer"
189
+ />
190
+ </GridColumn>
191
+ <GridColumn>
192
+ joinType.full_outer
193
+ </GridColumn>
194
+ </Grid>
195
+ </DropdownItem>
196
+ </DropdownMenu>
197
+ </Dropdown>
198
+ </GridColumn>
199
+ </Grid>
200
+ <label>
201
+ structureSelector.union.criteria
202
+ </label>
203
+ <div
204
+ style={
105
205
  Object {
106
- "id": "456",
206
+ "marginBottom": "1em",
107
207
  }
108
208
  }
109
- />
110
- </div>
209
+ >
210
+ <JoinClause
211
+ createClause={[Function]}
212
+ deleteClause={[Function]}
213
+ handleChange={[Function]}
214
+ idx={0}
215
+ key="0"
216
+ parentStructures={Array []}
217
+ selectedStructure={
218
+ Object {
219
+ "id": "456",
220
+ }
221
+ }
222
+ />
223
+ </div>
224
+ </Fragment>
111
225
  `;
112
226
 
113
227
  exports[`<StructureSelectorInputFieldJoin /> matches the latest snapshot with various clauses 1`] = `
114
- <div
115
- style={
116
- Object {
117
- "marginBottom": "1em",
118
- }
119
- }
120
- >
121
- <JoinClause
122
- createClause={[Function]}
123
- deleteClause={[Function]}
124
- handleChange={[Function]}
125
- idx={0}
126
- key="0"
127
- left={
228
+ <Fragment>
229
+ <label>
230
+ structureSelector.union.type
231
+ </label>
232
+ <Grid>
233
+ <GridColumn
234
+ width={4}
235
+ >
236
+ <Dropdown
237
+ additionLabel="Add "
238
+ additionPosition="top"
239
+ closeOnBlur={true}
240
+ closeOnEscape={true}
241
+ deburr={false}
242
+ icon="dropdown"
243
+ minCharacters={1}
244
+ noResultsMessage="No results found."
245
+ openOnFocus={true}
246
+ renderLabel={[Function]}
247
+ searchInput="text"
248
+ selectOnBlur={true}
249
+ selectOnNavigation={true}
250
+ trigger={<UNDEFINED />}
251
+ wrapSelection={true}
252
+ >
253
+ <DropdownMenu>
254
+ <DropdownItem
255
+ key="0"
256
+ onClick={[Function]}
257
+ selected={false}
258
+ >
259
+ <Grid
260
+ verticalAlign="middle"
261
+ >
262
+ <GridColumn
263
+ width={4}
264
+ >
265
+ <lazy
266
+ type="inner"
267
+ />
268
+ </GridColumn>
269
+ <GridColumn>
270
+ joinType.inner
271
+ </GridColumn>
272
+ </Grid>
273
+ </DropdownItem>
274
+ <DropdownItem
275
+ key="1"
276
+ onClick={[Function]}
277
+ selected={false}
278
+ >
279
+ <Grid
280
+ verticalAlign="middle"
281
+ >
282
+ <GridColumn
283
+ width={4}
284
+ >
285
+ <lazy
286
+ type="left"
287
+ />
288
+ </GridColumn>
289
+ <GridColumn>
290
+ joinType.left
291
+ </GridColumn>
292
+ </Grid>
293
+ </DropdownItem>
294
+ <DropdownItem
295
+ key="2"
296
+ onClick={[Function]}
297
+ selected={false}
298
+ >
299
+ <Grid
300
+ verticalAlign="middle"
301
+ >
302
+ <GridColumn
303
+ width={4}
304
+ >
305
+ <lazy
306
+ type="right"
307
+ />
308
+ </GridColumn>
309
+ <GridColumn>
310
+ joinType.right
311
+ </GridColumn>
312
+ </Grid>
313
+ </DropdownItem>
314
+ <DropdownItem
315
+ key="3"
316
+ onClick={[Function]}
317
+ selected={false}
318
+ >
319
+ <Grid
320
+ verticalAlign="middle"
321
+ >
322
+ <GridColumn
323
+ width={4}
324
+ >
325
+ <lazy
326
+ type="full_outer"
327
+ />
328
+ </GridColumn>
329
+ <GridColumn>
330
+ joinType.full_outer
331
+ </GridColumn>
332
+ </Grid>
333
+ </DropdownItem>
334
+ </DropdownMenu>
335
+ </Dropdown>
336
+ </GridColumn>
337
+ </Grid>
338
+ <label>
339
+ structureSelector.union.criteria
340
+ </label>
341
+ <div
342
+ style={
128
343
  Object {
129
- "id": "5",
344
+ "marginBottom": "1em",
130
345
  }
131
346
  }
132
- parentStructures={Array []}
133
- right={
134
- Object {
135
- "id": "6",
347
+ >
348
+ <JoinClause
349
+ createClause={[Function]}
350
+ deleteClause={[Function]}
351
+ handleChange={[Function]}
352
+ idx={0}
353
+ key="0"
354
+ left={
355
+ Object {
356
+ "id": "5",
357
+ }
136
358
  }
137
- }
138
- selectedStructure={
139
- Object {
140
- "clauses": Array [
141
- Object {
142
- "left": Object {
143
- "id": "5",
144
- },
145
- "right": Object {
146
- "id": "6",
147
- },
148
- },
149
- Object {
150
- "left": Object {
151
- "id": "7",
359
+ parentStructures={Array []}
360
+ right={
361
+ Object {
362
+ "id": "6",
363
+ }
364
+ }
365
+ selectedStructure={
366
+ Object {
367
+ "clauses": Array [
368
+ Object {
369
+ "left": Object {
370
+ "id": "5",
371
+ },
372
+ "right": Object {
373
+ "id": "6",
374
+ },
152
375
  },
153
- "right": Object {
154
- "id": "8",
376
+ Object {
377
+ "left": Object {
378
+ "id": "7",
379
+ },
380
+ "right": Object {
381
+ "id": "8",
382
+ },
155
383
  },
156
- },
157
- ],
158
- "id": "456",
384
+ ],
385
+ "id": "456",
386
+ }
159
387
  }
160
- }
161
- />
162
- <JoinClause
163
- createClause={[Function]}
164
- deleteClause={[Function]}
165
- handleChange={[Function]}
166
- idx={1}
167
- key="1"
168
- left={
169
- Object {
170
- "id": "7",
388
+ />
389
+ <JoinClause
390
+ createClause={[Function]}
391
+ deleteClause={[Function]}
392
+ handleChange={[Function]}
393
+ idx={1}
394
+ key="1"
395
+ left={
396
+ Object {
397
+ "id": "7",
398
+ }
171
399
  }
172
- }
173
- parentStructures={Array []}
174
- right={
175
- Object {
176
- "id": "8",
400
+ parentStructures={Array []}
401
+ right={
402
+ Object {
403
+ "id": "8",
404
+ }
177
405
  }
178
- }
179
- selectedStructure={
180
- Object {
181
- "clauses": Array [
182
- Object {
183
- "left": Object {
184
- "id": "5",
406
+ selectedStructure={
407
+ Object {
408
+ "clauses": Array [
409
+ Object {
410
+ "left": Object {
411
+ "id": "5",
412
+ },
413
+ "right": Object {
414
+ "id": "6",
415
+ },
185
416
  },
186
- "right": Object {
187
- "id": "6",
417
+ Object {
418
+ "left": Object {
419
+ "id": "7",
420
+ },
421
+ "right": Object {
422
+ "id": "8",
423
+ },
188
424
  },
189
- },
190
- Object {
191
- "left": Object {
192
- "id": "7",
193
- },
194
- "right": Object {
195
- "id": "8",
196
- },
197
- },
198
- ],
199
- "id": "456",
425
+ ],
426
+ "id": "456",
427
+ }
200
428
  }
201
- }
202
- />
203
- </div>
429
+ />
430
+ </div>
431
+ </Fragment>
204
432
  `;
@@ -130,6 +130,10 @@ export default {
130
130
  "graph.header.target_class": "Target Type",
131
131
  "graph.header.target_external_id": "Target External Id",
132
132
  "graph.header.target_name": "Target Name",
133
+ "joinType.inner": "inner join",
134
+ "joinType.left": "outer left",
135
+ "joinType.right": "outer right",
136
+ "joinType.full_outer": "full outer join",
133
137
  "lineage.events.header": "My graphs",
134
138
  "lineage.events.props.graph_data": "Graph",
135
139
  "lineage.events.props.inserted_at": "Date",
@@ -368,6 +372,7 @@ export default {
368
372
  "structureDomain.actions.update": "Update",
369
373
  "structureDomain.actions.update.inherit": "Apply on children",
370
374
  "structureSelector.union.criteria": "Union criteria",
375
+ "structureSelector.union.type": "Union type",
371
376
  "structureTag.comment": "Comments",
372
377
  "structureTag.comment.placeholder": "Introduce any comments",
373
378
  "structureTag.inherit": "Inherited by children",
@@ -135,6 +135,10 @@ export default {
135
135
  "graph.header.target_class": "Tipo Destino",
136
136
  "graph.header.target_external_id": "Id Externo Destino",
137
137
  "graph.header.target_name": "Nombre Destino",
138
+ "joinType.inner": "inner join",
139
+ "joinType.left": "outer left",
140
+ "joinType.right": "outer right",
141
+ "joinType.full_outer": "full outer join",
138
142
  "lineage.events.header": "Mis grafos",
139
143
  "lineage.events.props.graph_data": "Grafo",
140
144
  "lineage.events.props.inserted_at": "Fecha",
@@ -376,6 +380,7 @@ export default {
376
380
  "structureDomain.actions.update": "Actualizar",
377
381
  "structureDomain.actions.update.inherit": "Aplicar en hijos",
378
382
  "structureSelector.union.criteria": "Criterio de unión",
383
+ "structureSelector.union.type": "Tipo de unión",
379
384
  "structureTag.comment": "Comentario",
380
385
  "structureTag.comment.placeholder": "Introducir un comentario",
381
386
  "structureTag.inherit": "Heredar en cascada",