@truedat/dd 4.48.7 → 4.48.10

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 (30) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/package.json +5 -5
  3. package/src/components/StructureChildrenRelations.js +6 -14
  4. package/src/components/StructureCrumbs.js +43 -25
  5. package/src/components/StructureFieldRow.js +12 -10
  6. package/src/components/StructureFields.js +7 -7
  7. package/src/components/StructureItem.js +2 -2
  8. package/src/components/StructureSummary.js +4 -6
  9. package/src/components/StructuresSearchResults.js +34 -29
  10. package/src/components/StructuresView.js +36 -14
  11. package/src/components/__tests__/StructureFieldRow.spec.js +37 -33
  12. package/src/components/__tests__/StructureFields.spec.js +26 -27
  13. package/src/components/__tests__/StructureItem.spec.js +1 -1
  14. package/src/components/__tests__/StructureItems.spec.js +1 -3
  15. package/src/components/__tests__/StructureSummary.spec.js +1 -4
  16. package/src/components/__tests__/__snapshots__/StructureFieldRow.spec.js.snap +71 -74
  17. package/src/components/__tests__/__snapshots__/StructureFields.spec.js.snap +132 -160
  18. package/src/components/__tests__/__snapshots__/StructuresSearchResults.spec.js.snap +7 -7
  19. package/src/components/__tests__/__snapshots__/StructuresView.spec.js.snap +37 -6
  20. package/src/messages/en.js +7 -6
  21. package/src/messages/es.js +7 -6
  22. package/src/reducers/structure.js +5 -5
  23. package/src/reducers/structures.js +2 -2
  24. package/src/reducers/structuresLoading.js +1 -3
  25. package/src/selectors/__tests__/getSortedFields.spec.js +11 -11
  26. package/src/selectors/__tests__/getStructureParent.spec.js +10 -10
  27. package/src/selectors/getStructureFieldColumns.js +29 -39
  28. package/src/selectors/getStructureParent.js +2 -7
  29. package/src/selectors/getStructureSortingCriteria.js +7 -5
  30. package/src/selectors/structureColumnsSelector.js +2 -6
@@ -234,18 +234,18 @@ export default {
234
234
  "structure.field.has_df_content": "Info adicional",
235
235
  "structure.field.links": "Términos",
236
236
  "structure.field.menu.link": "Vincular a concepto",
237
+ "structure.field.metadata.nullable": "Opcional",
238
+ "structure.field.metadata.nullable.false": "No",
239
+ "structure.field.metadata.nullable.true": "Sí",
240
+ "structure.field.metadata.optional": "Opcional",
241
+ "structure.field.metadata.precision": "Precisión",
242
+ "structure.field.metadata.type": "Tipo",
237
243
  "structure.field.name": "Campo",
238
- "structure.field.nullable": "Opcional",
239
- "structure.field.nullable.false": "No",
240
- "structure.field.nullable.true": "Sí",
241
- "structure.field.optional": "Opcional",
242
244
  "structure.field.patterns.count": "Conteo",
243
245
  "structure.field.patterns.frecuency": "Patrones más frecuentes",
244
246
  "structure.field.patterns.percentage": "Porcentaje",
245
247
  "structure.field.patterns.title": "Estás viendo los patrones del campo",
246
- "structure.field.precision": "Precisión",
247
248
  "structure.field.required": "Requerido",
248
- "structure.field.type": "Tipo",
249
249
  "structure.fields.empty":
250
250
  "No se dispone de información sobre los campos de esta estructura",
251
251
  "structure.filter.empty": "Vacío",
@@ -506,6 +506,7 @@ export default {
506
506
  "Rellenar únicamente los campos que se quieran actualizar",
507
507
  "structures.header.edit.bulk.structures_count":
508
508
  'Estructuras seleccionadas: "{structures_count}"',
509
+ "structures.loading.header": "Cargando estructuras...",
509
510
  "structures.not_found.body":
510
511
  "No existe ningún elemento para la búsqueda aplicada",
511
512
  "structures.not_found.header": "Ningún resultado encontrado",
@@ -7,8 +7,8 @@ const structureFields = (fn) =>
7
7
  _.flow(
8
8
  fn,
9
9
  _.pick([
10
+ "alias",
10
11
  "confidential",
11
- "latest_note",
12
12
  "domain_ids",
13
13
  "domains",
14
14
  "external_id",
@@ -25,17 +25,17 @@ const structureVersionFields = _.pick([
25
25
  "degree",
26
26
  "deleted_at",
27
27
  "description",
28
+ "grant",
29
+ "grants",
28
30
  "group",
29
31
  "implementations",
30
32
  "metadata",
31
33
  "name",
34
+ "note",
35
+ "siblings",
32
36
  "source",
33
37
  "system",
34
38
  "type",
35
- "grant",
36
- "grants",
37
- "siblings",
38
- "published_note",
39
39
  ]);
40
40
 
41
41
  const structure = (state = initialState, { type, payload }) => {
@@ -19,8 +19,8 @@ const pickFields = _.pick([
19
19
  "domain",
20
20
  "metadata",
21
21
  "mutable_metadata",
22
- "latest_note",
23
- "published_note",
22
+ "note",
23
+ "original_name",
24
24
  ]);
25
25
 
26
26
  const structures = (state = initialState, { type, payload }) => {
@@ -1,4 +1,4 @@
1
- import { fetchStructures, toggleStructureFilterValue } from "../routines";
1
+ import { fetchStructures, fetchStructureFilters } from "../routines";
2
2
 
3
3
  const structuresLoading = (state = false, { type }) => {
4
4
  switch (type) {
@@ -6,8 +6,6 @@ const structuresLoading = (state = false, { type }) => {
6
6
  return true;
7
7
  case fetchStructures.FULFILL:
8
8
  return false;
9
- case toggleStructureFilterValue.TRIGGER:
10
- return true;
11
9
  default:
12
10
  return state;
13
11
  }
@@ -2,36 +2,36 @@ import { getSortedFields } from "..";
2
2
 
3
3
  const projects = [
4
4
  { name: "foo2", type: "project" },
5
- { name: "foo1", type: "project" }
5
+ { name: "foo1", type: "project" },
6
6
  ];
7
7
  const schemas = [
8
- { name: "bar2", type: "schema", order: 1 },
9
- { name: "bar1", type: "schema", order: 1 }
8
+ { name: "bar2", type: "schema", metadata: { order: 1 } },
9
+ { name: "bar1", type: "schema", metadata: { order: 1 } },
10
10
  ];
11
11
  const documents = [
12
12
  { name: "baz1", type: "document" },
13
- { name: "baz2", type: "document" }
13
+ { name: "baz2", type: "document" },
14
14
  ];
15
15
  const others = [
16
- { name: "bay1", type: "other", order: "0" },
17
- { name: "bay2", type: "other", order: "0" }
16
+ { name: "bay1", type: "other", metadata: { order: "0" } },
17
+ { name: "bay2", type: "other", metadata: { order: "0" } },
18
18
  ];
19
19
 
20
20
  describe("selectors: getSortedFields", () => {
21
21
  const state = {
22
- structureFields: [...documents, ...projects, ...schemas, ...others]
22
+ structureFields: [...documents, ...projects, ...schemas, ...others],
23
23
  };
24
24
  const foo = [
25
25
  ...others,
26
26
  ...[
27
- { name: "bar1", type: "schema", order: 1 },
28
- { name: "bar2", type: "schema", order: 1 }
27
+ { name: "bar1", type: "schema", metadata: { order: 1 } },
28
+ { name: "bar2", type: "schema", metadata: { order: 1 } },
29
29
  ],
30
30
  ...[
31
31
  { name: "foo1", type: "project" },
32
- { name: "foo2", type: "project" }
32
+ { name: "foo2", type: "project" },
33
33
  ],
34
- ...documents
34
+ ...documents,
35
35
  ];
36
36
  it("get fields sorted by type criteria and name", () => {
37
37
  expect(getSortedFields(state)).toEqual(foo);
@@ -1,20 +1,20 @@
1
- import _ from "lodash/fp";
2
1
  import { getStructureParent } from "..";
3
2
 
4
3
  const structureParents = [
5
4
  {
5
+ alias: "alias",
6
6
  id: "1",
7
7
  name: "structure",
8
8
  type: "structure type",
9
- published_note: { alias: "alias" },
10
9
  },
11
10
  ];
11
+
12
12
  const system = { id: "1", name: "system", type: "system" };
13
13
 
14
14
  const structure = {
15
15
  id: "1",
16
16
  name: "structure",
17
- system: _.omit(["type"])(system),
17
+ system: { id: "1", name: "system" },
18
18
  };
19
19
 
20
20
  describe("selectors: getStructureParent", () => {
@@ -24,17 +24,17 @@ describe("selectors: getStructureParent", () => {
24
24
  };
25
25
 
26
26
  it("get structure parent from state when is not empty", () => {
27
- const reply = _.flow(
28
- _.head,
29
- _.set("name", ".."),
30
- _.omit("published_note")
31
- )(structureParents);
32
- expect(getStructureParent(state)).toEqual(reply);
27
+ expect(getStructureParent(state)).toEqual({
28
+ alias: "alias",
29
+ id: "1",
30
+ name: "..",
31
+ type: "structure type",
32
+ });
33
33
  });
34
34
 
35
35
  it("get system as parent when structureParents is empty", () => {
36
36
  const state = { structureParents: [], structure };
37
- expect(getStructureParent(state)).toEqual(_.set("name", "..")(system));
37
+ expect(getStructureParent(state)).toEqual({ ...system, name: ".." });
38
38
  });
39
39
 
40
40
  it("get empty list when no parents nor structure", () => {
@@ -16,27 +16,22 @@ const translateDecoratorWithDefault = (text, default_text) => (
16
16
  const typeDecorator = (field) =>
17
17
  translateDecoratorWithDefault(`structure.type.${field}`, field);
18
18
 
19
- const linkToStructureDecorator = ({
20
- data_structure_id: id,
21
- name,
22
- published_note,
23
- }) => (
24
- <Link to={linkTo.STRUCTURE({ id })}>
25
- {_.isEmpty(published_note?.alias) ? name : published_note.alias}
26
- </Link>
19
+ const linkToStructureDecorator = ({ data_structure_id: id, alias, name }) => (
20
+ <Link to={linkTo.STRUCTURE({ id })}>{_.defaultTo(name)(alias)}</Link>
27
21
  );
28
22
 
29
23
  const nullableDecorator = (field) =>
30
24
  field
31
- ? translateDecorator("structure.field.nullable.true")
32
- : translateDecorator("structure.field.nullable.false");
25
+ ? translateDecorator("structure.field.metadata.nullable.true")
26
+ : translateDecorator("structure.field.metadata.nullable.false");
33
27
 
34
28
  const hasDfContentDecorator = (has_df_content) =>
35
- has_df_content && translateDecorator("structure.field.nullable.true");
29
+ has_df_content
30
+ ? translateDecorator("structure.field.metadata.nullable.true")
31
+ : null;
36
32
 
37
33
  const lineageLinkDecorator = ({ degree, data_structure_id: id }) =>
38
- id &&
39
- degree && (
34
+ id && degree ? (
40
35
  <Link
41
36
  to={
42
37
  degree.in
@@ -46,44 +41,39 @@ const lineageLinkDecorator = ({ degree, data_structure_id: id }) =>
46
41
  >
47
42
  <Icon name="share alternate" />
48
43
  </Link>
49
- );
44
+ ) : null;
50
45
 
51
46
  export const linksDecorator = (links) => {
52
47
  const sortedLinks = _.sortBy(accentInsensitivePathOrder("name"))(links);
53
- return (
54
- !_.isEmpty(sortedLinks) && (
55
- <List>
56
- {sortedLinks.map((resource, i) => (
57
- <List.Item key={i}>
58
- <Link
59
- to={linkTo.CONCEPT_VERSION({
60
- business_concept_id: resource.resource_id,
61
- id: "current",
62
- })}
63
- >
64
- {resource.name}
65
- </Link>
66
- </List.Item>
67
- ))}
68
- </List>
69
- )
48
+ return _.isEmpty(sortedLinks) ? null : (
49
+ <List>
50
+ {sortedLinks.map((resource, i) => (
51
+ <List.Item key={i}>
52
+ <Link
53
+ to={linkTo.CONCEPT_VERSION({
54
+ business_concept_id: resource.resource_id,
55
+ id: "current",
56
+ })}
57
+ >
58
+ {resource.name}
59
+ </Link>
60
+ </List.Item>
61
+ ))}
62
+ </List>
70
63
  );
71
64
  };
72
65
 
73
66
  export const defaultStructureFieldColumns = [
74
67
  {
75
68
  name: "name",
76
- fieldSelector: _.pick(["data_structure_id", "name", "published_note"]),
69
+ fieldSelector: _.pick(["data_structure_id", "name", "alias"]),
77
70
  fieldDecorator: linkToStructureDecorator,
78
71
  },
79
- { name: "type", fieldDecorator: typeDecorator },
80
- { name: "precision" },
81
- { name: "nullable", fieldDecorator: nullableDecorator },
72
+ { name: "metadata.type", fieldDecorator: typeDecorator },
73
+ { name: "metadata.precision" },
74
+ { name: "metadata.nullable", fieldDecorator: nullableDecorator },
82
75
  { name: "description" },
83
- {
84
- name: "has_df_content",
85
- fieldDecorator: hasDfContentDecorator,
86
- },
76
+ { name: "has_df_content", fieldDecorator: hasDfContentDecorator },
87
77
  {
88
78
  name: "degree",
89
79
  fieldSelector: _.pick(["degree", "data_structure_id"]),
@@ -8,16 +8,11 @@ const systemNavItem = (structure) =>
8
8
  _.propOr({}, "system"),
9
9
  _.pick(["id", "name"]),
10
10
  _.set("type", "system"),
11
- _.set("name", defaultName),
12
- _.omit(["published_note"])
11
+ _.set("name", defaultName)
13
12
  )(structure);
14
13
 
15
14
  const structureNavItem = (structures) =>
16
- _.flow(
17
- _.head,
18
- _.set("name", defaultName),
19
- _.omit(["published_note"])
20
- )(structures);
15
+ _.flow(_.head, _.set("name", defaultName))(structures);
21
16
 
22
17
  export const getStructureParent = createSelector(
23
18
  [_.propOr({}, "structure"), _.propOr([], "structureParents")],
@@ -25,7 +25,7 @@ const typeList = [
25
25
  "attribute",
26
26
  "metric",
27
27
  "column",
28
- "field"
28
+ "field",
29
29
  ];
30
30
 
31
31
  const toWeightedMap = () => {
@@ -34,9 +34,11 @@ const toWeightedMap = () => {
34
34
  };
35
35
 
36
36
  const mapWeights = toWeightedMap();
37
- const weightFromMap = type => _.prop(type)(mapWeights);
38
- const weightOrDefault = weight => (_.isNil(weight) ? _.size(typeList) : weight);
39
- const orderCriteria = ({ order }) => order && _.toInteger(order);
37
+ const weightFromMap = (type) => _.prop(type)(mapWeights);
38
+ const weightOrDefault = (weight) =>
39
+ _.isNil(weight) ? _.size(typeList) : weight;
40
+ const orderCriteria = ({ metadata }) =>
41
+ metadata?.order && _.toInteger(metadata?.order);
40
42
  const typeCriteria = ({ type }) =>
41
43
  _.flow(lowerDeburr, weightFromMap, weightOrDefault)(type);
42
44
  const nameCriteria = ({ name }) => name && lowerDeburr(name).trim();
@@ -44,7 +46,7 @@ const nameCriteria = ({ name }) => name && lowerDeburr(name).trim();
44
46
  const defaultStructureSortingCriteria = [
45
47
  orderCriteria,
46
48
  typeCriteria,
47
- nameCriteria
49
+ nameCriteria,
48
50
  ];
49
51
 
50
52
  export const getStructureSortingCriteria = createSelector(
@@ -14,12 +14,10 @@ const typeTranslateDecorator = ({ type, data_structure_type }) => (
14
14
  const dateDecorator = (date) => (
15
15
  <Moment locale="es" date={date} format="YYYY-MM-DD HH:mm" />
16
16
  );
17
- const nameFieldSelector = ({ name, published_note }) =>
18
- _.isEmpty(published_note?.alias) ? name : published_note.alias;
17
+
19
18
  export const defaultStructureColumns = [
20
19
  {
21
20
  name: "name",
22
- fieldSelector: nameFieldSelector,
23
21
  sort: { name: "name.sort" },
24
22
  width: 2,
25
23
  },
@@ -88,7 +86,5 @@ export const structureRowsSelector = createSelector(
88
86
  getStructures,
89
87
  getStructureColumnNames,
90
88
  (structures, columnNames) =>
91
- _.map(_.pick([...columnNames, "id", "domain_id", "published_note"]))(
92
- structures
93
- )
89
+ _.map(_.pick([...columnNames, "id", "domain_id", "note"]))(structures)
94
90
  );