@truedat/dd 5.7.0 → 5.7.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 +6 -6
- package/src/components/StructuresDownloadOption.js +5 -1
- package/src/components/__tests__/StructureEvents.spec.js +6 -6
- package/src/components/__tests__/StructuresDownloadOption.spec.js +2 -11
- package/src/messages/en.js +3 -0
- package/src/messages/es.js +3 -0
- package/src/sagas/__tests__/downloadEditableStructures.spec.js +4 -1
- package/src/sagas/__tests__/downloadStructures.spec.js +6 -2
- package/src/sagas/downloadEditableStructures.js +18 -1
- package/src/sagas/downloadStructures.js +19 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@truedat/dd",
|
|
3
|
-
"version": "5.7.
|
|
3
|
+
"version": "5.7.1",
|
|
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.5",
|
|
35
35
|
"@testing-library/react": "^12.0.0",
|
|
36
36
|
"@testing-library/user-event": "^13.2.1",
|
|
37
|
-
"@truedat/test": "5.
|
|
37
|
+
"@truedat/test": "5.7.1",
|
|
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",
|
|
@@ -87,9 +87,9 @@
|
|
|
87
87
|
},
|
|
88
88
|
"dependencies": {
|
|
89
89
|
"@apollo/client": "^3.7.1",
|
|
90
|
-
"@truedat/auth": "5.
|
|
91
|
-
"@truedat/core": "5.
|
|
92
|
-
"@truedat/df": "5.
|
|
90
|
+
"@truedat/auth": "5.7.1",
|
|
91
|
+
"@truedat/core": "5.7.1",
|
|
92
|
+
"@truedat/df": "5.7.1",
|
|
93
93
|
"lodash": "^4.17.21",
|
|
94
94
|
"moment": "^2.29.4",
|
|
95
95
|
"path-to-regexp": "^1.7.0",
|
|
@@ -114,5 +114,5 @@
|
|
|
114
114
|
"react-dom": ">= 16.8.6 < 17",
|
|
115
115
|
"semantic-ui-react": ">= 2.0.3 < 2.2"
|
|
116
116
|
},
|
|
117
|
-
"gitHead": "
|
|
117
|
+
"gitHead": "88ae546acbe935babaa0b583fb6eb6950c86fd55"
|
|
118
118
|
}
|
|
@@ -8,7 +8,9 @@ import { downloadStructures } from "../routines";
|
|
|
8
8
|
|
|
9
9
|
const staticLabels = [
|
|
10
10
|
"type",
|
|
11
|
-
"
|
|
11
|
+
"tech_name",
|
|
12
|
+
"alias_name",
|
|
13
|
+
"link_to_structure",
|
|
12
14
|
"external_id",
|
|
13
15
|
"group",
|
|
14
16
|
"domain",
|
|
@@ -60,6 +62,8 @@ StructuresDownloadOption.propTypes = {
|
|
|
60
62
|
structuresDownloading: PropTypes.bool,
|
|
61
63
|
structuresLoading: PropTypes.bool,
|
|
62
64
|
downloadStructures: PropTypes.func,
|
|
65
|
+
structures: PropTypes.array,
|
|
66
|
+
hasFilterApplied: PropTypes.bool,
|
|
63
67
|
};
|
|
64
68
|
|
|
65
69
|
const mapStateToProps = (state) => ({
|
|
@@ -11,8 +11,8 @@ describe("<StructureEvents />", () => {
|
|
|
11
11
|
resource_id: 2,
|
|
12
12
|
payload: [
|
|
13
13
|
{ field: "Column", value: 5 },
|
|
14
|
-
{ field: "id", value: 6 }
|
|
15
|
-
]
|
|
14
|
+
{ field: "id", value: 6 },
|
|
15
|
+
],
|
|
16
16
|
},
|
|
17
17
|
{
|
|
18
18
|
id: 2,
|
|
@@ -20,13 +20,13 @@ describe("<StructureEvents />", () => {
|
|
|
20
20
|
resource_id: 2,
|
|
21
21
|
payload: [
|
|
22
22
|
{ field: "Column", value: 7 },
|
|
23
|
-
{ field: "id", value: 3 }
|
|
24
|
-
]
|
|
25
|
-
}
|
|
23
|
+
{ field: "id", value: 3 },
|
|
24
|
+
],
|
|
25
|
+
},
|
|
26
26
|
];
|
|
27
27
|
const structure = {
|
|
28
28
|
id: 1,
|
|
29
|
-
name: "s1"
|
|
29
|
+
name: "s1",
|
|
30
30
|
};
|
|
31
31
|
const replace = jest.fn();
|
|
32
32
|
const history = { replace };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { render } from "@truedat/test/render";
|
|
3
3
|
import { StructuresDownloadOption } from "../StructuresDownloadOption";
|
|
4
|
+
import en from "../../messages/en";
|
|
4
5
|
|
|
5
6
|
describe("<StructuresDownloadOption />", () => {
|
|
6
7
|
const downloadStructures = jest.fn();
|
|
@@ -8,19 +9,9 @@ describe("<StructuresDownloadOption />", () => {
|
|
|
8
9
|
const renderOpts = {
|
|
9
10
|
messages: {
|
|
10
11
|
en: {
|
|
12
|
+
...en,
|
|
11
13
|
"structures.actions.download.tooltip": "tooltip",
|
|
12
14
|
"structures.actions.download.popup": "popup",
|
|
13
|
-
"structures.props.type": "type",
|
|
14
|
-
"structures.props.metadata": "metadata",
|
|
15
|
-
"structures.props.name": "name",
|
|
16
|
-
"structures.props.external_id": "external id",
|
|
17
|
-
"structures.props.group": "group",
|
|
18
|
-
"structures.props.domain": "domain",
|
|
19
|
-
"structures.props.system": "system",
|
|
20
|
-
"structures.props.path": "path",
|
|
21
|
-
"structures.props.description": "description",
|
|
22
|
-
"structures.props.inserted_at": "updated at",
|
|
23
|
-
"structures.props.deleted_at": "deleted at",
|
|
24
15
|
},
|
|
25
16
|
},
|
|
26
17
|
};
|
package/src/messages/en.js
CHANGED
|
@@ -568,16 +568,19 @@ export default {
|
|
|
568
568
|
"structures.not_found.body":
|
|
569
569
|
"No structures have been found matching these filters.",
|
|
570
570
|
"structures.not_found.header": "Nothing found...",
|
|
571
|
+
"structures.props.alias_name": "Alias",
|
|
571
572
|
"structures.props.deleted_at": "Deleted",
|
|
572
573
|
"structures.props.description": "Description",
|
|
573
574
|
"structures.props.domain": "Domain",
|
|
574
575
|
"structures.props.external_id": "External Id",
|
|
575
576
|
"structures.props.group": "Group",
|
|
576
577
|
"structures.props.inserted_at": "Inserted",
|
|
578
|
+
"structures.props.link_to_structure": "Link to structure",
|
|
577
579
|
"structures.props.metadata": "Metadata",
|
|
578
580
|
"structures.props.name": "Name",
|
|
579
581
|
"structures.props.path": "Path",
|
|
580
582
|
"structures.props.system": "System",
|
|
583
|
+
"structures.props.tech_name": "Technical Name",
|
|
581
584
|
"structures.props.type": "Type",
|
|
582
585
|
"structures.relation.new.header": "Link to Concept",
|
|
583
586
|
"structures.retrieved.results": "{count} structures found",
|
package/src/messages/es.js
CHANGED
|
@@ -584,16 +584,19 @@ export default {
|
|
|
584
584
|
"structures.not_found.body":
|
|
585
585
|
"No existe ningún elemento para la búsqueda aplicada",
|
|
586
586
|
"structures.not_found.header": "Ningún resultado encontrado",
|
|
587
|
+
"structures.props.alias_name": "Alias",
|
|
587
588
|
"structures.props.deleted_at": "Borrado",
|
|
588
589
|
"structures.props.description": "Descripción",
|
|
589
590
|
"structures.props.domain": "Dominio",
|
|
590
591
|
"structures.props.external_id": "Id Externo",
|
|
591
592
|
"structures.props.group": "Grupo",
|
|
592
593
|
"structures.props.inserted_at": "Insertado",
|
|
594
|
+
"structures.props.link_to_structure": "Link a la estructura",
|
|
593
595
|
"structures.props.metadata": "Metadata",
|
|
594
596
|
"structures.props.name": "Nombre",
|
|
595
597
|
"structures.props.path": "Ruta",
|
|
596
598
|
"structures.props.system": "Sistema",
|
|
599
|
+
"structures.props.tech_name": "Nombre Técnico",
|
|
597
600
|
"structures.props.type": "Tipo",
|
|
598
601
|
"structures.relation.new.header":
|
|
599
602
|
"Vas a vincular este campo a un término del glosario",
|
|
@@ -34,7 +34,10 @@ describe("sagas: downloadEditableStructuresRequestSaga", () => {
|
|
|
34
34
|
|
|
35
35
|
describe("sagas: downloadEditableStructuresSaga", () => {
|
|
36
36
|
const query = { filters: {} };
|
|
37
|
-
const body =
|
|
37
|
+
const body = {
|
|
38
|
+
structure_url_schema: "http:localhost:/structures/:id",
|
|
39
|
+
...query,
|
|
40
|
+
};
|
|
38
41
|
const data = "SOME CSV DATA";
|
|
39
42
|
|
|
40
43
|
it("should put a success action when a response is returned", () => {
|
|
@@ -3,7 +3,7 @@ import { apiJsonPost, JSON_OPTS } from "@truedat/core/services/api";
|
|
|
3
3
|
import {
|
|
4
4
|
downloadStructuresRequestSaga,
|
|
5
5
|
downloadStructuresSaga,
|
|
6
|
-
saveFile
|
|
6
|
+
saveFile,
|
|
7
7
|
} from "../downloadStructures";
|
|
8
8
|
import { downloadStructures } from "../../routines";
|
|
9
9
|
import { API_DATA_STRUCTURES_CSV } from "../../api";
|
|
@@ -36,7 +36,11 @@ describe("sagas: downloadStructuresSaga", () => {
|
|
|
36
36
|
const query = { filters: {} };
|
|
37
37
|
const data = "SOME CSV DATA";
|
|
38
38
|
|
|
39
|
-
const body = {
|
|
39
|
+
const body = {
|
|
40
|
+
header_labels: headerLabels,
|
|
41
|
+
structure_url_schema: "http:localhost:/structures/:id",
|
|
42
|
+
...query,
|
|
43
|
+
};
|
|
40
44
|
|
|
41
45
|
it("should put a success action when a response is returned", () => {
|
|
42
46
|
expect(() => {
|
|
@@ -2,6 +2,7 @@ import _ from "lodash/fp";
|
|
|
2
2
|
import FileSaver from "file-saver";
|
|
3
3
|
import { call, put, select, takeLatest } from "redux-saga/effects";
|
|
4
4
|
import { apiJsonPost, JSON_OPTS } from "@truedat/core/services/api";
|
|
5
|
+
import { STRUCTURE } from "@truedat/core/routes";
|
|
5
6
|
import { downloadEditableStructures } from "../routines";
|
|
6
7
|
import { getPreviousStructureQuery } from "../selectors";
|
|
7
8
|
import { API_DATA_STRUCTURES_EDITABLE_CSV } from "../api";
|
|
@@ -17,7 +18,11 @@ export function saveFile(data) {
|
|
|
17
18
|
|
|
18
19
|
export function* downloadEditableStructuresSaga() {
|
|
19
20
|
try {
|
|
20
|
-
const
|
|
21
|
+
const query = yield select(getPreviousStructureQuery);
|
|
22
|
+
const body = {
|
|
23
|
+
structure_url_schema: getStructureUrlSchema(),
|
|
24
|
+
...query,
|
|
25
|
+
};
|
|
21
26
|
const url = API_DATA_STRUCTURES_EDITABLE_CSV;
|
|
22
27
|
yield put(downloadEditableStructures.request(body));
|
|
23
28
|
const { data } = yield call(apiJsonPost, url, body, JSON_OPTS);
|
|
@@ -41,3 +46,15 @@ export function* downloadEditableStructuresRequestSaga() {
|
|
|
41
46
|
downloadEditableStructuresSaga
|
|
42
47
|
);
|
|
43
48
|
}
|
|
49
|
+
|
|
50
|
+
function getStructureUrlSchema() {
|
|
51
|
+
const defaultWebPorts = [80, 443];
|
|
52
|
+
|
|
53
|
+
return defaultWebPorts.includes(window.location.port)
|
|
54
|
+
? window.location.protocol + window.location.hostname + STRUCTURE
|
|
55
|
+
: window.location.protocol +
|
|
56
|
+
window.location.hostname +
|
|
57
|
+
":" +
|
|
58
|
+
window.location.port +
|
|
59
|
+
STRUCTURE;
|
|
60
|
+
}
|
|
@@ -2,6 +2,7 @@ import _ from "lodash/fp";
|
|
|
2
2
|
import FileSaver from "file-saver";
|
|
3
3
|
import { call, put, select, takeLatest } from "redux-saga/effects";
|
|
4
4
|
import { apiJsonPost, JSON_OPTS } from "@truedat/core/services/api";
|
|
5
|
+
import { STRUCTURE } from "@truedat/core/routes";
|
|
5
6
|
import { downloadStructures } from "../routines";
|
|
6
7
|
import { getPreviousStructureQuery } from "../selectors";
|
|
7
8
|
import { API_DATA_STRUCTURES_CSV } from "../api";
|
|
@@ -9,7 +10,7 @@ import { API_DATA_STRUCTURES_CSV } from "../api";
|
|
|
9
10
|
export function saveFile(data) {
|
|
10
11
|
if (!_.isEmpty(data)) {
|
|
11
12
|
const blob = new Blob([String.fromCharCode(0xfeff), data], {
|
|
12
|
-
type: "text/csv;charset=utf-8"
|
|
13
|
+
type: "text/csv;charset=utf-8",
|
|
13
14
|
});
|
|
14
15
|
FileSaver.saveAs(blob, "structures.csv");
|
|
15
16
|
}
|
|
@@ -19,7 +20,11 @@ export function* downloadStructuresSaga({ payload }) {
|
|
|
19
20
|
try {
|
|
20
21
|
const headerLabels = _.propOr({}, "headerLabels")(payload);
|
|
21
22
|
const query = yield select(getPreviousStructureQuery);
|
|
22
|
-
const body = {
|
|
23
|
+
const body = {
|
|
24
|
+
header_labels: headerLabels,
|
|
25
|
+
structure_url_schema: getStructureUrlSchema(),
|
|
26
|
+
...query,
|
|
27
|
+
};
|
|
23
28
|
const url = API_DATA_STRUCTURES_CSV;
|
|
24
29
|
yield put(downloadStructures.request(body));
|
|
25
30
|
const { data } = yield call(apiJsonPost, url, body, JSON_OPTS);
|
|
@@ -40,3 +45,15 @@ export function* downloadStructuresSaga({ payload }) {
|
|
|
40
45
|
export function* downloadStructuresRequestSaga() {
|
|
41
46
|
yield takeLatest(downloadStructures.TRIGGER, downloadStructuresSaga);
|
|
42
47
|
}
|
|
48
|
+
|
|
49
|
+
function getStructureUrlSchema() {
|
|
50
|
+
const defaultWebPorts = [80, 443];
|
|
51
|
+
|
|
52
|
+
return defaultWebPorts.includes(window.location.port)
|
|
53
|
+
? window.location.protocol + window.location.hostname + STRUCTURE
|
|
54
|
+
: window.location.protocol +
|
|
55
|
+
window.location.hostname +
|
|
56
|
+
":" +
|
|
57
|
+
window.location.port +
|
|
58
|
+
STRUCTURE;
|
|
59
|
+
}
|