@truedat/dd 4.36.2 → 4.36.3

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,11 @@
1
1
  # Changelog
2
2
 
3
+ ## [4.36.3] 2022-01-18
4
+
5
+ ### Added
6
+
7
+ - [TD-4100] Allow partial loads for notes in case that there are errors on the file
8
+
3
9
  ## [4.36.0] 2022-01-13
4
10
 
5
11
  ### Fixed
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@truedat/dd",
3
- "version": "4.36.2",
3
+ "version": "4.36.3",
4
4
  "description": "Truedat Web Data Dictionary",
5
5
  "sideEffects": false,
6
6
  "jsnext:main": "src/index.js",
@@ -84,9 +84,9 @@
84
84
  ]
85
85
  },
86
86
  "dependencies": {
87
- "@truedat/auth": "4.36.2",
88
- "@truedat/core": "4.36.2",
89
- "@truedat/df": "4.36.2",
87
+ "@truedat/auth": "4.36.3",
88
+ "@truedat/core": "4.36.3",
89
+ "@truedat/df": "4.36.3",
90
90
  "lodash": "^4.17.21",
91
91
  "path-to-regexp": "^1.7.0",
92
92
  "prop-types": "^15.7.2",
@@ -107,5 +107,5 @@
107
107
  "react-dom": ">= 16.8.6 < 17",
108
108
  "semantic-ui-react": ">= 0.88.2 < 2.1"
109
109
  },
110
- "gitHead": "0f4c09d90582210ae7c98e945b8c0b7af0f9a61d"
110
+ "gitHead": "ec1b0afc195462b78b1e9145cf705d9edd87a58b"
111
111
  }
@@ -366,7 +366,12 @@ export default {
366
366
  "structures.bulkUpdateStructures.no.structures.body":
367
367
  "No structures selected",
368
368
  "structures.bulkUpdateStructures.no.structures.header": "Empty Search",
369
- "structures.bulkUpdateStructures.success.header": "Succeded Bulk Update",
369
+ "structures.bulkUpdateStructures.success.header":
370
+ "Bulk update success! Loaded {count_ids} omitted {count_errors}",
371
+ "structures.bulkUpdateStructures.success.errors":
372
+ "Error in id {id}, in {name} attribute: {key} message: {message}",
373
+ "structures.bulkUploadStructures.success.errors":
374
+ "Error in line {row}, in {name} attribute: {key} message: {message}",
370
375
  "structures.bulkUpdateStructures.success.unchanged":
371
376
  "{unchanged} structures remained unchanged.",
372
377
  "structures.bulkUpdateStructures.success.updated":
@@ -370,7 +370,11 @@ export default {
370
370
  "Ninguna estructura seleccionada",
371
371
  "structures.bulkUpdateStructures.no.structures.header": "Búsqueda vacía",
372
372
  "structures.bulkUpdateStructures.success.header":
373
- "Actualización terminada con éxito",
373
+ "¡Actualización realizada correctamente! subidos {count_ids} errores {count_errors}",
374
+ "structures.bulkUpdateStructures.success.errors":
375
+ "Error en id {id}, en {name} atributo: {key} mensaje: {message}",
376
+ "structures.bulkUploadStructures.success.errors":
377
+ "Error en linea {row}, en {name} atributo: {key} mensaje: {message}",
374
378
  "structures.bulkUpdateStructures.success.unchanged":
375
379
  "{unchanged} se han mantenido sin cambios.",
376
380
  "structures.bulkUpdateStructures.success.updated":
@@ -12,27 +12,39 @@ const ddMessage = (state = initialState, { type, payload }) => {
12
12
  switch (type) {
13
13
  case dismissAlert.TRIGGER:
14
14
  return initialState;
15
+ case uploadStructures.SUCCESS:
15
16
  case bulkUpdateStructures.SUCCESS: {
16
- const { data, structureCount } = payload;
17
- const changedMessage = {
18
- id: "structures.bulkUpdateStructures.success.updated",
19
- fields: { changed: _.size(data.message) },
20
- };
21
- const unchangedMessage = {
22
- id: "structures.bulkUpdateStructures.success.unchanged",
23
- fields: { unchanged: structureCount - _.size(data.message) },
24
- };
25
- const messages =
26
- structureCount - _.size(data.message) > 0
27
- ? [changedMessage, unchangedMessage]
28
- : [changedMessage];
17
+ const messagesImp = _.has("errors")(payload.data)
18
+ ? _.flow(
19
+ _.propOr([], "errors"),
20
+ _.map((error) => ({
21
+ id:
22
+ type == bulkUpdateStructures.SUCCESS
23
+ ? "structures.bulkUpdateStructures.success.errors"
24
+ : "structures.bulkUploadStructures.success.errors",
25
+ fields: {
26
+ name: error.implementation_key,
27
+ key: Object.keys(error.message)[0],
28
+ message: error.message[Object.keys(error.message)[0]][0],
29
+ row: error.row,
30
+ id: error.id,
31
+ },
32
+ defaultMessage:
33
+ "structures.bulkUpdateStructures.success.errors.default",
34
+ }))
35
+ )(payload.data)
36
+ : "";
29
37
  return {
30
38
  error: false,
31
39
  header: "structures.bulkUpdateStructures.success.header",
32
40
  icon: "check",
33
- color: "green",
41
+ color: payload.data.errors.length >= 1 ? "orange" : "green",
34
42
  text: "",
35
- messages: messages,
43
+ messages: messagesImp,
44
+ fields: {
45
+ count_ids: payload.data.ids.length,
46
+ count_errors: payload.data.errors.length,
47
+ },
36
48
  };
37
49
  }
38
50
  case updateStructureType.SUCCESS:
@@ -42,25 +54,6 @@ const ddMessage = (state = initialState, { type, payload }) => {
42
54
  icon: "check",
43
55
  color: "green",
44
56
  };
45
- case uploadStructures.SUCCESS: {
46
- const { data } = payload;
47
- const count = _.flow(_.prop("message"), _.size)(data);
48
- const content =
49
- count === 0
50
- ? "structures.uploadStructures.success.content.any"
51
- : count === 1
52
- ? "structures.uploadStructures.success.content.single"
53
- : "structures.uploadStructures.success.content";
54
- return {
55
- error: false,
56
- header: "structures.uploadStructures.success.header",
57
- content,
58
- icon: "check",
59
- color: "green",
60
- text: "",
61
- fields: { count },
62
- };
63
- }
64
57
  case uploadStructures.FAILURE:
65
58
  if (payload.status != 500) {
66
59
  const { data } = payload;
@@ -55,7 +55,7 @@ describe("sagas: bulkUpdateStructuresSaga", () => {
55
55
  .next()
56
56
  .call(apiJsonPost, API_DATA_STRUCTURES_BULK_UPDATE, body, JSON_OPTS)
57
57
  .next({ data })
58
- .put(bulkUpdateStructures.success({ ...data, structureCount }))
58
+ .put(bulkUpdateStructures.success({ data }))
59
59
  .next()
60
60
  .put(bulkUpdateStructures.fulfill())
61
61
  .next()
@@ -2,7 +2,7 @@ import { testSaga } from "redux-saga-test-plan";
2
2
  import { apiJsonPost, UPLOAD_JSON_OPTS } from "@truedat/core/services/api";
3
3
  import {
4
4
  uploadStructuresRequestSaga,
5
- uploadStructuresSaga
5
+ uploadStructuresSaga,
6
6
  } from "../uploadStructures";
7
7
  import { uploadStructures } from "../../routines";
8
8
  import { API_STRUCTURES_UPLOAD } from "../../api";
@@ -39,7 +39,7 @@ describe("sagas: uploadStructuresSaga", () => {
39
39
  .next()
40
40
  .call(apiJsonPost, API_STRUCTURES_UPLOAD, body, UPLOAD_JSON_OPTS)
41
41
  .next({ data })
42
- .put(uploadStructures.success(data))
42
+ .put(uploadStructures.success({ data }))
43
43
  .next()
44
44
  .put(uploadStructures.fulfill())
45
45
  .next()
@@ -22,7 +22,7 @@ export function* bulkUpdateStructuresSaga({ payload }) {
22
22
  body,
23
23
  JSON_OPTS
24
24
  );
25
- yield put(bulkUpdateStructures.success({ ...data, structureCount }));
25
+ yield put(bulkUpdateStructures.success({ data }));
26
26
  } catch (error) {
27
27
  if (error.response) {
28
28
  const { status, data } = error.response;
@@ -14,7 +14,7 @@ export function* uploadStructuresSaga({ payload }) {
14
14
  UPLOAD_JSON_OPTS
15
15
  );
16
16
 
17
- yield put(uploadStructures.success(data));
17
+ yield put(uploadStructures.success({ data }));
18
18
  } catch (error) {
19
19
  if (error.response) {
20
20
  const { status, data } = error.response;