@truedat/dd 8.3.0 → 8.3.1
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@truedat/dd",
|
|
3
|
-
"version": "8.3.
|
|
3
|
+
"version": "8.3.1",
|
|
4
4
|
"description": "Truedat Web Data Dictionary",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"module": "src/index.js",
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"@testing-library/jest-dom": "^6.6.3",
|
|
49
49
|
"@testing-library/react": "^16.3.0",
|
|
50
50
|
"@testing-library/user-event": "^14.6.1",
|
|
51
|
-
"@truedat/test": "8.3.
|
|
51
|
+
"@truedat/test": "8.3.1",
|
|
52
52
|
"identity-obj-proxy": "^3.0.0",
|
|
53
53
|
"jest": "^29.7.0",
|
|
54
54
|
"redux-saga-test-plan": "^4.0.6"
|
|
@@ -83,5 +83,5 @@
|
|
|
83
83
|
"svg-pan-zoom": "^3.6.2",
|
|
84
84
|
"swr": "^2.3.3"
|
|
85
85
|
},
|
|
86
|
-
"gitHead": "
|
|
86
|
+
"gitHead": "59c8197b9eab936607c7d205ac25a378e6dd073e"
|
|
87
87
|
}
|
package/src/messages/en.js
CHANGED
|
@@ -514,6 +514,14 @@ export default {
|
|
|
514
514
|
"External id: {externalId} The field <{field}> does not have a permitted value",
|
|
515
515
|
"structures.bulkUpdateStructures.failed.note.df_content.required":
|
|
516
516
|
"External id: {externalId} The field <{field}> is required",
|
|
517
|
+
"structures.bulkUpdateStructures.failed.note.content_unchanged":
|
|
518
|
+
"Content unchanged for external id {externalId}",
|
|
519
|
+
"structures.bulkUpdateStructures.failed.note.invalid_transition":
|
|
520
|
+
"Invalid note transition for external id {externalId}",
|
|
521
|
+
"structures.bulkUpdateStructures.failed.note.conflict":
|
|
522
|
+
"Note conflict for external id {externalId}",
|
|
523
|
+
"structures.bulkUpdateStructures.failed.note.only_draft_are_editable":
|
|
524
|
+
"The note for external id {externalId} must be in draft status to be edited",
|
|
517
525
|
"structures.bulkUpdateStructures.no.structures.body":
|
|
518
526
|
"No structures selected",
|
|
519
527
|
"structures.bulkUpdateStructures.no.structures.header": "Empty Search",
|
|
@@ -635,6 +643,12 @@ export default {
|
|
|
635
643
|
"Insufficient permissions to edit the structure in row {row}",
|
|
636
644
|
"structures.uploadStructures.failed.note.only_draft_are_editable":
|
|
637
645
|
"The note in row {row} need to be on draft status",
|
|
646
|
+
"structures.uploadStructures.failed.note.content_unchanged":
|
|
647
|
+
"Content unchanged",
|
|
648
|
+
"structures.uploadStructures.failed.note.invalid_transition":
|
|
649
|
+
"Invalid note transition",
|
|
650
|
+
"structures.uploadStructures.failed.note.conflict":
|
|
651
|
+
"Note conflict",
|
|
638
652
|
"structures.uploadStructures.success.content":
|
|
639
653
|
"Updated extra info of {count} structures",
|
|
640
654
|
"structures.uploadStructures.success.content.any":
|
package/src/messages/es.js
CHANGED
|
@@ -528,6 +528,14 @@ export default {
|
|
|
528
528
|
"External id: {externalId} El campo <{field}> no tiene un valor permitido",
|
|
529
529
|
"structures.bulkUpdateStructures.failed.note.df_content.required":
|
|
530
530
|
"External id: {externalId} El campo <{field}> es necesario",
|
|
531
|
+
"structures.bulkUpdateStructures.failed.note.content_unchanged":
|
|
532
|
+
"Contenido sin cambios para external id {externalId}",
|
|
533
|
+
"structures.bulkUpdateStructures.failed.note.invalid_transition":
|
|
534
|
+
"Transición de nota no válida para external id {externalId}",
|
|
535
|
+
"structures.bulkUpdateStructures.failed.note.conflict":
|
|
536
|
+
"Conflicto de nota para external id {externalId}",
|
|
537
|
+
"structures.bulkUpdateStructures.failed.note.only_draft_are_editable":
|
|
538
|
+
"La nota del external id {externalId} debe estar en borrador para poder editar",
|
|
531
539
|
"structures.bulkUpdateStructures.no.structures.header": "Búsqueda vacía",
|
|
532
540
|
"structures.bulkUpdateStructures.success.header":
|
|
533
541
|
"¡Actualización finalizada! subidos {count_ids} errores {count_errors}",
|
|
@@ -655,6 +663,12 @@ export default {
|
|
|
655
663
|
"No tiene los permisos suficientes para editar la estructura de la fila {row}",
|
|
656
664
|
"structures.uploadStructures.failed.note.only_draft_are_editable":
|
|
657
665
|
"La nota de la fila {row} debe estar en estado borrador para poder ser editada",
|
|
666
|
+
"structures.uploadStructures.failed.note.content_unchanged":
|
|
667
|
+
"Contenido sin cambios",
|
|
668
|
+
"structures.uploadStructures.failed.note.invalid_transition":
|
|
669
|
+
"Transición de nota no válida",
|
|
670
|
+
"structures.uploadStructures.failed.note.conflict":
|
|
671
|
+
"Conflicto de nota",
|
|
658
672
|
"structures.uploadStructures.success.content":
|
|
659
673
|
"Se ha actualizado la información adicional de {count} estructuras",
|
|
660
674
|
"structures.uploadStructures.success.content.any":
|
|
@@ -8,6 +8,7 @@ import {
|
|
|
8
8
|
updateReferenceDataset,
|
|
9
9
|
updateStructureType,
|
|
10
10
|
uploadStructuresDomains,
|
|
11
|
+
doStructureNoteAction,
|
|
11
12
|
} from "../routines";
|
|
12
13
|
|
|
13
14
|
export const initialState = null;
|
|
@@ -21,23 +22,23 @@ const ddMessage = (state = initialState, { type, payload }) => {
|
|
|
21
22
|
case uploadStructuresDomains.SUCCESS: {
|
|
22
23
|
const messagesImp = _.has("errors")(payload.data)
|
|
23
24
|
? _.flow(
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
25
|
+
_.propOr([], "errors"),
|
|
26
|
+
_.map((error) => {
|
|
27
|
+
const errorMessage = Object.entries(error.message)
|
|
28
|
+
.map(([field, messages]) => `${field}: ${messages.join(", ")}`)
|
|
29
|
+
.join(" | ");
|
|
30
|
+
return {
|
|
31
|
+
id: `structures.bulkUploadStructuresDomains.success.errors.${errorMessage}`,
|
|
32
|
+
fields: {
|
|
33
|
+
row: error.row,
|
|
34
|
+
id: error.id,
|
|
35
|
+
field: error.field,
|
|
36
|
+
externalId: error.external_id,
|
|
37
|
+
message: errorMessage,
|
|
38
|
+
},
|
|
39
|
+
};
|
|
40
|
+
})
|
|
41
|
+
)(payload.data)
|
|
41
42
|
: "";
|
|
42
43
|
return {
|
|
43
44
|
error: false,
|
|
@@ -59,12 +60,12 @@ const ddMessage = (state = initialState, { type, payload }) => {
|
|
|
59
60
|
return payload.status !== 422
|
|
60
61
|
? state
|
|
61
62
|
: {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
63
|
+
error: true,
|
|
64
|
+
header: "structures.uploadStructuresDomains.failed.header",
|
|
65
|
+
icon: "attention",
|
|
66
|
+
content: payload?.data?.error?.message,
|
|
67
|
+
initialMaxListItems: 5,
|
|
68
|
+
};
|
|
68
69
|
|
|
69
70
|
case updateStructureType.SUCCESS:
|
|
70
71
|
return {
|
|
@@ -94,6 +95,13 @@ const ddMessage = (state = initialState, { type, payload }) => {
|
|
|
94
95
|
icon: "check",
|
|
95
96
|
color: "green",
|
|
96
97
|
};
|
|
98
|
+
case doStructureNoteAction.FAILURE:
|
|
99
|
+
return {
|
|
100
|
+
error: true,
|
|
101
|
+
header: "alert.doStructureNoteAction.failed.header",
|
|
102
|
+
icon: "attention",
|
|
103
|
+
content: payload?.data?.error,
|
|
104
|
+
};
|
|
97
105
|
default:
|
|
98
106
|
return state;
|
|
99
107
|
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { getUploadAlertMessage } from "../messages";
|
|
2
|
+
|
|
3
|
+
describe("selectors: getUploadAlertMessage", () => {
|
|
4
|
+
it("returns uploadAccepted when status is 202", () => {
|
|
5
|
+
const result = getUploadAlertMessage({ status: 202, data: {} });
|
|
6
|
+
expect(result.anchor).toBeDefined();
|
|
7
|
+
expect(result.anchor.reference).toBeDefined();
|
|
8
|
+
expect(result.header).toBe(
|
|
9
|
+
"structures.bulkUpdateStructures.success.accepted.header"
|
|
10
|
+
);
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
it("returns uploadWithErrors when status is 200 and data has errors with workflow message ids", () => {
|
|
14
|
+
const data = {
|
|
15
|
+
ids: [1],
|
|
16
|
+
errors: [
|
|
17
|
+
{
|
|
18
|
+
message: "content_unchanged",
|
|
19
|
+
row: 2,
|
|
20
|
+
external_id: "EXT-001",
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
message: "invalid_transition",
|
|
24
|
+
row: 3,
|
|
25
|
+
external_id: "EXT-002",
|
|
26
|
+
},
|
|
27
|
+
],
|
|
28
|
+
};
|
|
29
|
+
const result = getUploadAlertMessage({ status: 200, data });
|
|
30
|
+
expect(result.messages).toHaveLength(2);
|
|
31
|
+
expect(result.messages[0].id).toBe(
|
|
32
|
+
"structures.bulkUpdateStructures.failed.note.content_unchanged"
|
|
33
|
+
);
|
|
34
|
+
expect(result.messages[1].id).toBe(
|
|
35
|
+
"structures.bulkUpdateStructures.failed.note.invalid_transition"
|
|
36
|
+
);
|
|
37
|
+
expect(result.fields.count_errors).toBe(2);
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
it("returns uploadWithErrors when status is 200 and data has errors with only_draft_are_editable", () => {
|
|
41
|
+
const data = {
|
|
42
|
+
ids: [],
|
|
43
|
+
errors: [
|
|
44
|
+
{
|
|
45
|
+
message: "only_draft_are_editable",
|
|
46
|
+
row: 1,
|
|
47
|
+
external_id: "EXT-001",
|
|
48
|
+
},
|
|
49
|
+
],
|
|
50
|
+
};
|
|
51
|
+
const result = getUploadAlertMessage({ status: 200, data });
|
|
52
|
+
expect(result.messages[0].id).toBe(
|
|
53
|
+
"structures.bulkUpdateStructures.failed.note.only_draft_are_editable"
|
|
54
|
+
);
|
|
55
|
+
});
|
|
56
|
+
});
|
|
@@ -16,7 +16,9 @@ const transformNotesPayloadFormat = (payload) => {
|
|
|
16
16
|
|
|
17
17
|
const addedFields = payload.content.added
|
|
18
18
|
? payload.content.added
|
|
19
|
-
: payload.content.
|
|
19
|
+
: payload.content.removed
|
|
20
|
+
? payload.content.removed
|
|
21
|
+
: payload.content.changed;
|
|
20
22
|
|
|
21
23
|
const fieldsArray = Object.keys(addedFields).reduce((acc, field) => {
|
|
22
24
|
if (!_.isEmpty(addedFields[field])) acc.push(field);
|
|
@@ -1,58 +1,58 @@
|
|
|
1
|
-
|
|
1
|
+
import _ from "lodash/fp";
|
|
2
2
|
import { STRUCTURE_NOTES_UPLOAD_JOBS } from "@truedat/core/routes";
|
|
3
3
|
|
|
4
4
|
const uploadWithErrors = (data) => {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
5
|
+
const messagesImp = _.has("errors")(data)
|
|
6
|
+
? _.flow(
|
|
7
|
+
_.propOr([], "errors"),
|
|
8
|
+
_.map((error) => ({
|
|
9
|
+
id: `structures.bulkUpdateStructures.failed.note.${error.message}`,
|
|
10
|
+
fields: {
|
|
11
|
+
row: error.row,
|
|
12
|
+
id: error.id,
|
|
13
|
+
field: error.field,
|
|
14
|
+
externalId: error.external_id,
|
|
15
|
+
message: error.message,
|
|
16
|
+
},
|
|
17
|
+
defaultMessage: "structures.bulkUploadStructures.success.errors",
|
|
18
|
+
}))
|
|
19
|
+
)(data)
|
|
20
|
+
: "";
|
|
21
|
+
return {
|
|
22
|
+
error: false,
|
|
23
|
+
header: "structures.bulkUpdateStructures.success.header",
|
|
24
|
+
icon: "check",
|
|
25
|
+
color: data.errors.length >= 1 ? "orange" : "green",
|
|
26
|
+
text: "",
|
|
27
|
+
messages: messagesImp,
|
|
28
|
+
fields: {
|
|
29
|
+
count_ids: data.ids.length,
|
|
30
|
+
count_errors: data.errors.length,
|
|
31
|
+
},
|
|
32
|
+
downloadable: true,
|
|
33
|
+
initialMaxListItems: 5,
|
|
34
|
+
};
|
|
35
35
|
};
|
|
36
36
|
|
|
37
37
|
const uploadAccepted = () => {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
38
|
+
return {
|
|
39
|
+
error: false,
|
|
40
|
+
header: "structures.bulkUpdateStructures.success.accepted.header",
|
|
41
|
+
icon: "check",
|
|
42
|
+
color: "blue",
|
|
43
|
+
text: "",
|
|
44
|
+
anchor: {
|
|
45
|
+
reference: STRUCTURE_NOTES_UPLOAD_JOBS,
|
|
46
|
+
label: "sidemenu.structures_upload_events",
|
|
47
|
+
},
|
|
48
|
+
};
|
|
49
49
|
};
|
|
50
50
|
|
|
51
51
|
export const getUploadAlertMessage = ({ status, data }) => {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
};
|
|
52
|
+
if (status === 202) {
|
|
53
|
+
return uploadAccepted();
|
|
54
|
+
}
|
|
55
|
+
if (status === 200) {
|
|
56
|
+
return uploadWithErrors(data);
|
|
57
|
+
}
|
|
58
|
+
};
|