@truedat/dd 7.2.4 → 7.2.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/package.json +6 -6
- package/src/api.js +4 -2
- package/src/components/StructuresDownloadOption.js +23 -20
- package/src/components/StructuresEditableDownloadOption.js +23 -21
- package/src/components/StructuresOptions.js +27 -24
- package/src/components/StructuresUploadEventsTable.js +3 -2
- package/src/components/StructuresUploadOption.js +18 -23
- package/src/components/StructuresView.js +1 -1
- package/src/components/__tests__/StructuresDownloadOption.spec.js +12 -12
- package/src/components/__tests__/StructuresEditableDownloadOption.spec.js +8 -8
- package/src/components/__tests__/StructuresUploadEventsTable.spec.js +2 -2
- package/src/components/__tests__/StructuresUploadOption.spec.js +2 -5
- package/src/components/__tests__/__snapshots__/StructuresDownloadOption.spec.js.snap +2 -1
- package/src/components/__tests__/__snapshots__/StructuresEditableDownloadOption.spec.js.snap +2 -7
- package/src/components/__tests__/__snapshots__/StructuresOptions.spec.js.snap +3 -0
- package/src/components/__tests__/__snapshots__/StructuresUploadOption.spec.js.snap +2 -0
- package/src/hooks/useStructures.js +34 -1
- package/src/reducers/__tests__/structuresUploadEvents.spec.js +2 -2
- package/src/reducers/index.js +0 -6
- package/src/routines.js +0 -4
- package/src/sagas/__tests__/fetchStructuresUploadEvents.spec.js +2 -2
- package/src/sagas/index.js +0 -9
- package/src/reducers/__tests__/structuresDownloading.spec.js +0 -26
- package/src/reducers/__tests__/structuresEditableDownloading.spec.js +0 -32
- package/src/reducers/__tests__/uploadingStructuresFile.spec.js +0 -40
- package/src/reducers/structuresDownloading.js +0 -14
- package/src/reducers/structuresEditableDownloading.js +0 -14
- package/src/reducers/uploadingStructuresFile.js +0 -18
- package/src/sagas/__tests__/downloadEditableStructures.spec.js +0 -81
- package/src/sagas/__tests__/downloadStructures.spec.js +0 -82
- package/src/sagas/__tests__/uploadStructures.spec.js +0 -70
- package/src/sagas/downloadEditableStructures.js +0 -51
- package/src/sagas/downloadStructures.js +0 -51
- package/src/sagas/uploadStructures.js +0 -33
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@truedat/dd",
|
|
3
|
-
"version": "7.2.
|
|
3
|
+
"version": "7.2.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.5",
|
|
35
35
|
"@testing-library/react": "^12.0.0",
|
|
36
36
|
"@testing-library/user-event": "^13.2.1",
|
|
37
|
-
"@truedat/test": "7.2.
|
|
37
|
+
"@truedat/test": "7.2.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.7.1",
|
|
91
|
-
"@truedat/auth": "7.2.
|
|
92
|
-
"@truedat/core": "7.2.
|
|
93
|
-
"@truedat/df": "7.2.
|
|
91
|
+
"@truedat/auth": "7.2.6",
|
|
92
|
+
"@truedat/core": "7.2.6",
|
|
93
|
+
"@truedat/df": "7.2.6",
|
|
94
94
|
"lodash": "^4.17.21",
|
|
95
95
|
"moment": "^2.29.4",
|
|
96
96
|
"path-to-regexp": "^1.7.0",
|
|
@@ -115,5 +115,5 @@
|
|
|
115
115
|
"react-dom": ">= 16.8.6 < 17",
|
|
116
116
|
"semantic-ui-react": ">= 2.0.3 < 2.2"
|
|
117
117
|
},
|
|
118
|
-
"gitHead": "
|
|
118
|
+
"gitHead": "488b8216a78852f55db6e7e28a83c4d3fec0b890"
|
|
119
119
|
}
|
package/src/api.js
CHANGED
|
@@ -4,7 +4,8 @@ const API_BUCKET_STRUCTURE = "/api/buckets/structures/:id";
|
|
|
4
4
|
const API_DATA_STRUCTURE = "/api/data_structures/:id";
|
|
5
5
|
const API_DATA_STRUCTURES_BULK_UPDATE = "/api/data_structures/bulk_update";
|
|
6
6
|
const API_DATA_STRUCTURES_EDITABLE_CSV = "/api/data_structures/editable_csv";
|
|
7
|
-
const
|
|
7
|
+
const API_DATA_STRUCTURES_XLSX_DOWNLOAD = "/api/data_structures/xlsx/download";
|
|
8
|
+
const API_DATA_STRUCTURES_XLSX_UPLOAD = "/api/data_structures/xlsx/upload";
|
|
8
9
|
const API_DATA_STRUCTURES_SEARCH = "/api/data_structures/search";
|
|
9
10
|
const API_DATA_STRUCTURE_FILTERS_SEARCH = "/api/data_structure_filters/search";
|
|
10
11
|
const API_DATA_STRUCTURE_VERSION = "/api/data_structures/:id/versions/:version";
|
|
@@ -60,7 +61,8 @@ export {
|
|
|
60
61
|
API_DATA_STRUCTURE,
|
|
61
62
|
API_DATA_STRUCTURES_BULK_UPDATE,
|
|
62
63
|
API_DATA_STRUCTURES_EDITABLE_CSV,
|
|
63
|
-
|
|
64
|
+
API_DATA_STRUCTURES_XLSX_DOWNLOAD,
|
|
65
|
+
API_DATA_STRUCTURES_XLSX_UPLOAD,
|
|
64
66
|
API_DATA_STRUCTURES_SEARCH,
|
|
65
67
|
API_DATA_STRUCTURE_FILTERS_SEARCH,
|
|
66
68
|
API_DATA_STRUCTURE_VERSION,
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import _ from "lodash/fp";
|
|
2
|
-
import React from "react";
|
|
2
|
+
import React, { useEffect } from "react";
|
|
3
3
|
import PropTypes from "prop-types";
|
|
4
|
-
import { connect } from "react-redux";
|
|
5
4
|
import { Dropdown } from "semantic-ui-react";
|
|
6
5
|
import { useIntl } from "react-intl";
|
|
6
|
+
import { STRUCTURE } from "@truedat/core/routes";
|
|
7
7
|
import { useSearchContext } from "@truedat/core/search/SearchContext";
|
|
8
|
-
import {
|
|
8
|
+
import { useDataStructureDownload } from "../hooks/useStructures";
|
|
9
9
|
|
|
10
10
|
const staticLabels = [
|
|
11
11
|
"type",
|
|
@@ -23,18 +23,21 @@ const staticLabels = [
|
|
|
23
23
|
"deleted_at",
|
|
24
24
|
];
|
|
25
25
|
|
|
26
|
-
export const StructuresDownloadOption = ({
|
|
27
|
-
structuresDownloading,
|
|
28
|
-
downloadStructures,
|
|
29
|
-
hasFilterApplied,
|
|
30
|
-
}) => {
|
|
26
|
+
export const StructuresDownloadOption = ({ setDownloading }) => {
|
|
31
27
|
const { formatMessage, locale } = useIntl();
|
|
32
28
|
|
|
33
29
|
const {
|
|
34
30
|
searchData,
|
|
35
31
|
loading: structuresLoading,
|
|
36
32
|
filterParams: searchParams,
|
|
33
|
+
allActiveFilters: allActiveFilters,
|
|
37
34
|
} = useSearchContext();
|
|
35
|
+
const { trigger: triggerDownload, isMutating: structuresDownloading } =
|
|
36
|
+
useDataStructureDownload();
|
|
37
|
+
|
|
38
|
+
useEffect(() => {
|
|
39
|
+
setDownloading(structuresDownloading);
|
|
40
|
+
}, [setDownloading, structuresDownloading]);
|
|
38
41
|
|
|
39
42
|
const structures = searchData?.data;
|
|
40
43
|
|
|
@@ -42,7 +45,10 @@ export const StructuresDownloadOption = ({
|
|
|
42
45
|
_.map((l) => [l, formatMessage({ id: `structures.props.${l}` })]),
|
|
43
46
|
_.fromPairs
|
|
44
47
|
)(staticLabels);
|
|
45
|
-
|
|
48
|
+
|
|
49
|
+
const isDisabled =
|
|
50
|
+
_.isEmpty(structures) || _.isEmpty(_.path("type.raw")(allActiveFilters));
|
|
51
|
+
|
|
46
52
|
return !structuresLoading ? (
|
|
47
53
|
<Dropdown.Item
|
|
48
54
|
icon="download"
|
|
@@ -59,7 +65,12 @@ export const StructuresDownloadOption = ({
|
|
|
59
65
|
</>
|
|
60
66
|
}
|
|
61
67
|
onClick={() =>
|
|
62
|
-
|
|
68
|
+
triggerDownload({
|
|
69
|
+
header_labels: headerLabels,
|
|
70
|
+
lang: locale,
|
|
71
|
+
...searchParams,
|
|
72
|
+
structure_url_schema: window.location.origin + STRUCTURE,
|
|
73
|
+
})
|
|
63
74
|
}
|
|
64
75
|
disabled={isDisabled || structuresDownloading}
|
|
65
76
|
/>
|
|
@@ -67,15 +78,7 @@ export const StructuresDownloadOption = ({
|
|
|
67
78
|
};
|
|
68
79
|
|
|
69
80
|
StructuresDownloadOption.propTypes = {
|
|
70
|
-
|
|
71
|
-
downloadStructures: PropTypes.func,
|
|
72
|
-
hasFilterApplied: PropTypes.bool,
|
|
81
|
+
setDownloading: PropTypes.func,
|
|
73
82
|
};
|
|
74
83
|
|
|
75
|
-
|
|
76
|
-
structuresDownloading: state.structuresDownloading,
|
|
77
|
-
});
|
|
78
|
-
|
|
79
|
-
export default connect(mapStateToProps, { downloadStructures })(
|
|
80
|
-
StructuresDownloadOption
|
|
81
|
-
);
|
|
84
|
+
export default StructuresDownloadOption;
|
|
@@ -1,27 +1,32 @@
|
|
|
1
1
|
import _ from "lodash/fp";
|
|
2
|
-
import React from "react";
|
|
2
|
+
import React, { useEffect } from "react";
|
|
3
3
|
import PropTypes from "prop-types";
|
|
4
|
-
import {
|
|
4
|
+
import { STRUCTURE } from "@truedat/core/routes";
|
|
5
5
|
import { Dropdown } from "semantic-ui-react";
|
|
6
6
|
import { useIntl } from "react-intl";
|
|
7
7
|
import { useSearchContext } from "@truedat/core/search/SearchContext";
|
|
8
|
-
import {
|
|
8
|
+
import { useDataStructureDownload } from "../hooks/useStructures";
|
|
9
9
|
|
|
10
|
-
export const StructuresEditableDownloadOption = ({
|
|
11
|
-
structuresEditableDownloading,
|
|
12
|
-
downloadEditableStructures,
|
|
13
|
-
hasFilterApplied,
|
|
14
|
-
}) => {
|
|
10
|
+
export const StructuresEditableDownloadOption = ({ setDownloading }) => {
|
|
15
11
|
const { formatMessage, locale } = useIntl();
|
|
16
12
|
const {
|
|
17
13
|
searchData,
|
|
18
14
|
loading: structuresLoading,
|
|
19
15
|
filterParams: searchParams,
|
|
16
|
+
allActiveFilters: allActiveFilters,
|
|
20
17
|
} = useSearchContext();
|
|
18
|
+
const { trigger: triggerDownload, isMutating: structuresDownloading } =
|
|
19
|
+
useDataStructureDownload();
|
|
20
|
+
|
|
21
|
+
useEffect(() => {
|
|
22
|
+
setDownloading(structuresDownloading);
|
|
23
|
+
}, [setDownloading, structuresDownloading]);
|
|
21
24
|
|
|
22
25
|
const structures = searchData?.data;
|
|
23
26
|
|
|
24
|
-
const isDisabled =
|
|
27
|
+
const isDisabled =
|
|
28
|
+
_.isEmpty(structures) || _.isEmpty(_.path("type.raw")(allActiveFilters));
|
|
29
|
+
|
|
25
30
|
return (
|
|
26
31
|
!structuresLoading && (
|
|
27
32
|
<Dropdown.Item
|
|
@@ -41,24 +46,21 @@ export const StructuresEditableDownloadOption = ({
|
|
|
41
46
|
</>
|
|
42
47
|
}
|
|
43
48
|
onClick={() =>
|
|
44
|
-
|
|
49
|
+
triggerDownload({
|
|
50
|
+
lang: locale,
|
|
51
|
+
...searchParams,
|
|
52
|
+
structure_url_schema: window.location.origin + STRUCTURE,
|
|
53
|
+
download_type: "editable",
|
|
54
|
+
})
|
|
45
55
|
}
|
|
46
|
-
disabled={isDisabled ||
|
|
56
|
+
disabled={isDisabled || structuresDownloading}
|
|
47
57
|
/>
|
|
48
58
|
)
|
|
49
59
|
);
|
|
50
60
|
};
|
|
51
61
|
|
|
52
62
|
StructuresEditableDownloadOption.propTypes = {
|
|
53
|
-
|
|
54
|
-
downloadEditableStructures: PropTypes.func,
|
|
55
|
-
hasFilterApplied: PropTypes.bool,
|
|
63
|
+
setDownloading: PropTypes.func,
|
|
56
64
|
};
|
|
57
65
|
|
|
58
|
-
|
|
59
|
-
structuresEditableDownloading: state.structuresEditableDownloading,
|
|
60
|
-
});
|
|
61
|
-
|
|
62
|
-
export default connect(mapStateToProps, { downloadEditableStructures })(
|
|
63
|
-
StructuresEditableDownloadOption
|
|
64
|
-
);
|
|
66
|
+
export default StructuresEditableDownloadOption;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from "react";
|
|
1
|
+
import React, { useState } from "react";
|
|
2
2
|
import PropTypes from "prop-types";
|
|
3
3
|
import { Dropdown } from "semantic-ui-react";
|
|
4
4
|
import SystemCreateOption from "./SystemCreateOption";
|
|
@@ -12,34 +12,37 @@ export const StructuresOptions = ({
|
|
|
12
12
|
autoPublish,
|
|
13
13
|
bulkUpload,
|
|
14
14
|
bulkUploadDomains,
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
<
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
<
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
15
|
+
}) => {
|
|
16
|
+
const [downloading, setDownloading] = useState(false);
|
|
17
|
+
return (
|
|
18
|
+
<Dropdown
|
|
19
|
+
icon="ellipsis vertical"
|
|
20
|
+
className="button icon group-actions button-update"
|
|
21
|
+
direction="left"
|
|
22
|
+
floating
|
|
23
|
+
loading={downloading}
|
|
24
|
+
disabled={downloading}
|
|
25
|
+
>
|
|
26
|
+
<Dropdown.Menu>
|
|
27
|
+
<SystemCreateOption />
|
|
28
|
+
<Dropdown.Divider />
|
|
29
|
+
<StructuresDownloadOption setDownloading={setDownloading} />
|
|
30
|
+
<StructuresEditableDownloadOption setDownloading={setDownloading} />
|
|
31
|
+
{bulkUpload ? (
|
|
32
|
+
<StructuresUploadOption canAutoPublish={!!autoPublish} />
|
|
33
|
+
) : null}
|
|
34
|
+
{bulkUploadDomains ? <StructuresDomainsUploadOption /> : null}
|
|
35
|
+
<Dropdown.Divider />
|
|
36
|
+
<StructuresUpdateOption />
|
|
37
|
+
</Dropdown.Menu>
|
|
38
|
+
</Dropdown>
|
|
39
|
+
);
|
|
40
|
+
};
|
|
37
41
|
|
|
38
42
|
StructuresOptions.propTypes = {
|
|
39
43
|
autoPublish: PropTypes.object,
|
|
40
44
|
bulkUpload: PropTypes.object,
|
|
41
45
|
bulkUploadDomains: PropTypes.object,
|
|
42
|
-
hasFilterApplied: PropTypes.bool,
|
|
43
46
|
};
|
|
44
47
|
|
|
45
48
|
export default StructuresOptions;
|
|
@@ -36,6 +36,7 @@ export const StructuresUploadEventsTable = ({
|
|
|
36
36
|
_.map((error) => ({
|
|
37
37
|
id: `structures.bulkUpdateStructures.failed.note.${error.message}`,
|
|
38
38
|
fields: {
|
|
39
|
+
sheet: error.sheet,
|
|
39
40
|
row: error.row,
|
|
40
41
|
id: error.id,
|
|
41
42
|
field: error.field,
|
|
@@ -133,12 +134,12 @@ export const StructuresUploadEventsTable = ({
|
|
|
133
134
|
))
|
|
134
135
|
) : (
|
|
135
136
|
<Table.Cell colSpan={columns.length}>
|
|
136
|
-
{events[eventKey].
|
|
137
|
+
{events[eventKey].hash ? (
|
|
137
138
|
<>
|
|
138
139
|
<FormattedMessage
|
|
139
140
|
id={`structures.bulkUploadEvents.props.csv_hash`}
|
|
140
141
|
/>
|
|
141
|
-
: {events[eventKey].
|
|
142
|
+
: {events[eventKey].hash}
|
|
142
143
|
</>
|
|
143
144
|
) : null}
|
|
144
145
|
{columns.map((column, key) => (
|
|
@@ -1,24 +1,27 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import PropTypes from "prop-types";
|
|
3
|
-
import {
|
|
3
|
+
import { useDispatch } from "react-redux";
|
|
4
4
|
import { Dropdown } from "semantic-ui-react";
|
|
5
5
|
import { useIntl } from "react-intl";
|
|
6
6
|
import { UploadModal } from "@truedat/core/components";
|
|
7
7
|
import { uploadStructures } from "../routines";
|
|
8
|
+
import { useDataStructureUpload } from "../hooks/useStructures";
|
|
8
9
|
|
|
9
|
-
export const StructuresUploadOption = ({
|
|
10
|
-
uploadStructures,
|
|
11
|
-
loading,
|
|
12
|
-
canAutoPublish,
|
|
13
|
-
}) => {
|
|
10
|
+
export const StructuresUploadOption = ({ canAutoPublish }) => {
|
|
14
11
|
const { formatMessage, locale } = useIntl();
|
|
12
|
+
const { trigger: triggerUpload, isMutating: structuresUploading } =
|
|
13
|
+
useDataStructureUpload();
|
|
14
|
+
const dispatch = useDispatch();
|
|
15
15
|
const extraAction = {
|
|
16
16
|
key: "yesWithAutoPublish",
|
|
17
17
|
primary: true,
|
|
18
18
|
content: formatMessage({ id: "uploadModal.accept.publish" }),
|
|
19
19
|
onClick: (data) => {
|
|
20
20
|
data.append("auto_publish", canAutoPublish);
|
|
21
|
-
|
|
21
|
+
data.append("lang", locale);
|
|
22
|
+
triggerUpload(data).then(({ status, data }) => {
|
|
23
|
+
dispatch(uploadStructures.success({ status, data }));
|
|
24
|
+
});
|
|
22
25
|
},
|
|
23
26
|
};
|
|
24
27
|
|
|
@@ -30,7 +33,7 @@ export const StructuresUploadOption = ({
|
|
|
30
33
|
<Dropdown.Item
|
|
31
34
|
icon="upload"
|
|
32
35
|
text={formatMessage({ id: "structures.actions.upload.tooltip" })}
|
|
33
|
-
disabled={
|
|
36
|
+
disabled={structuresUploading}
|
|
34
37
|
/>
|
|
35
38
|
}
|
|
36
39
|
header={formatMessage({
|
|
@@ -40,26 +43,18 @@ export const StructuresUploadOption = ({
|
|
|
40
43
|
id: "structures.actions.upload.confirmation.content",
|
|
41
44
|
})}
|
|
42
45
|
param="structures"
|
|
43
|
-
handleSubmit={(data) =>
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
})
|
|
48
|
-
}
|
|
46
|
+
handleSubmit={(data) => {
|
|
47
|
+
data.append("lang", locale);
|
|
48
|
+
triggerUpload(data).then(({ status, data }) => {
|
|
49
|
+
dispatch(uploadStructures.success({ status, data }));
|
|
50
|
+
});
|
|
51
|
+
}}
|
|
49
52
|
/>
|
|
50
53
|
);
|
|
51
54
|
};
|
|
52
55
|
|
|
53
56
|
StructuresUploadOption.propTypes = {
|
|
54
|
-
uploadStructures: PropTypes.func,
|
|
55
|
-
loading: PropTypes.bool,
|
|
56
57
|
canAutoPublish: PropTypes.bool,
|
|
57
58
|
};
|
|
58
59
|
|
|
59
|
-
|
|
60
|
-
loading: uploadingStructuresFile,
|
|
61
|
-
});
|
|
62
|
-
|
|
63
|
-
export default connect(mapStateToProps, { uploadStructures })(
|
|
64
|
-
StructuresUploadOption
|
|
65
|
-
);
|
|
60
|
+
export default StructuresUploadOption;
|
|
@@ -74,7 +74,7 @@ export const StructuresViewContent = ({ embedded, customView }) => {
|
|
|
74
74
|
<>
|
|
75
75
|
{!customView ? (
|
|
76
76
|
<>
|
|
77
|
-
<StructuresOptions
|
|
77
|
+
<StructuresOptions {...actions} />
|
|
78
78
|
<SearchWidget dateFilter searchField="last_change_at" />
|
|
79
79
|
</>
|
|
80
80
|
) : null}
|
|
@@ -4,9 +4,9 @@ import SearchContextWrapper from "@truedat/core/components/common/SearchContextW
|
|
|
4
4
|
import { StructuresDownloadOption } from "../StructuresDownloadOption";
|
|
5
5
|
import en from "../../messages/en";
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
const downloadStructures = jest.fn();
|
|
7
|
+
const setDownloading = jest.fn();
|
|
9
8
|
|
|
9
|
+
describe("<StructuresDownloadOption />", () => {
|
|
10
10
|
const renderOpts = {
|
|
11
11
|
messages: {
|
|
12
12
|
en: {
|
|
@@ -18,41 +18,41 @@ describe("<StructuresDownloadOption />", () => {
|
|
|
18
18
|
};
|
|
19
19
|
|
|
20
20
|
it("matches the latest snapshot", () => {
|
|
21
|
-
const props = { downloadStructures };
|
|
22
21
|
const searchProps = {
|
|
23
22
|
loading: false,
|
|
24
23
|
searchParams: {},
|
|
25
24
|
searchData: { data: [{ id: 1 }] },
|
|
26
25
|
};
|
|
27
26
|
|
|
28
|
-
const { container } = render(
|
|
27
|
+
const { container, getByRole } = render(
|
|
29
28
|
<SearchContextWrapper props={searchProps}>
|
|
30
|
-
<StructuresDownloadOption {...
|
|
29
|
+
<StructuresDownloadOption {...{ setDownloading }} />
|
|
31
30
|
</SearchContextWrapper>,
|
|
32
31
|
renderOpts
|
|
33
32
|
);
|
|
33
|
+
expect(getByRole("option")).toHaveAttribute("aria-disabled", "true");
|
|
34
34
|
expect(container).toMatchSnapshot();
|
|
35
35
|
});
|
|
36
36
|
|
|
37
|
-
it("has filter applied", () => {
|
|
38
|
-
const props = { downloadStructures, hasFilterApplied: true };
|
|
37
|
+
it("has type filter applied", () => {
|
|
39
38
|
const searchProps = {
|
|
40
39
|
loading: false,
|
|
41
40
|
searchParams: {},
|
|
41
|
+
allActiveFilters: { "type.raw": ["foo"] },
|
|
42
42
|
searchData: { data: [{ id: 1 }] },
|
|
43
43
|
};
|
|
44
44
|
|
|
45
|
-
const { container } = render(
|
|
45
|
+
const { container, getByRole } = render(
|
|
46
46
|
<SearchContextWrapper props={searchProps}>
|
|
47
|
-
<StructuresDownloadOption {...
|
|
47
|
+
<StructuresDownloadOption {...{ setDownloading }} />
|
|
48
48
|
</SearchContextWrapper>,
|
|
49
49
|
renderOpts
|
|
50
50
|
);
|
|
51
|
+
expect(getByRole("option")).toHaveAttribute("aria-disabled", "false");
|
|
51
52
|
expect(container).toMatchSnapshot();
|
|
52
53
|
});
|
|
53
54
|
|
|
54
55
|
it("is disabled if there are no structures to be downloaded", () => {
|
|
55
|
-
const props = { downloadStructures };
|
|
56
56
|
const searchProps = {
|
|
57
57
|
loading: false,
|
|
58
58
|
searchData: { data: [] },
|
|
@@ -60,11 +60,11 @@ describe("<StructuresDownloadOption />", () => {
|
|
|
60
60
|
};
|
|
61
61
|
const { getByRole, queryByText } = render(
|
|
62
62
|
<SearchContextWrapper props={searchProps}>
|
|
63
|
-
<StructuresDownloadOption {...
|
|
63
|
+
<StructuresDownloadOption {...{ setDownloading }} />
|
|
64
64
|
</SearchContextWrapper>,
|
|
65
65
|
renderOpts
|
|
66
66
|
);
|
|
67
|
-
expect(getByRole("option")).toHaveAttribute("aria-disabled");
|
|
67
|
+
expect(getByRole("option")).toHaveAttribute("aria-disabled", "true");
|
|
68
68
|
expect(queryByText("popup")).toBeTruthy();
|
|
69
69
|
});
|
|
70
70
|
});
|
|
@@ -3,9 +3,9 @@ import { render } from "@truedat/test/render";
|
|
|
3
3
|
import SearchContextWrapper from "@truedat/core/components/common/SearchContextWrapper";
|
|
4
4
|
import { StructuresEditableDownloadOption } from "../StructuresEditableDownloadOption";
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
const downloadEditableStructures = jest.fn();
|
|
6
|
+
const setDownloading = jest.fn();
|
|
8
7
|
|
|
8
|
+
describe("<StructuresEditableDownloadOption />", () => {
|
|
9
9
|
const renderOpts = {
|
|
10
10
|
messages: {
|
|
11
11
|
en: {
|
|
@@ -19,20 +19,20 @@ describe("<StructuresEditableDownloadOption />", () => {
|
|
|
19
19
|
const searchProps = {
|
|
20
20
|
loading: false,
|
|
21
21
|
searchData: { data: [{ id: 1 }] },
|
|
22
|
+
allActiveFilters: { "type.raw": ["foo"] },
|
|
22
23
|
searchParams: {},
|
|
23
24
|
};
|
|
24
|
-
const
|
|
25
|
-
const { container } = render(
|
|
25
|
+
const { container, getByRole } = render(
|
|
26
26
|
<SearchContextWrapper props={searchProps}>
|
|
27
|
-
<StructuresEditableDownloadOption {...
|
|
27
|
+
<StructuresEditableDownloadOption {...{ setDownloading }} />
|
|
28
28
|
</SearchContextWrapper>,
|
|
29
29
|
renderOpts
|
|
30
30
|
);
|
|
31
31
|
expect(container).toMatchSnapshot();
|
|
32
|
+
expect(getByRole("option")).toHaveAttribute("aria-disabled", "false");
|
|
32
33
|
});
|
|
33
34
|
|
|
34
35
|
it("is disabled if there are no structures to be downloaded", () => {
|
|
35
|
-
const props = { downloadEditableStructures };
|
|
36
36
|
const searchProps = {
|
|
37
37
|
loading: false,
|
|
38
38
|
searchData: { data: [] },
|
|
@@ -41,11 +41,11 @@ describe("<StructuresEditableDownloadOption />", () => {
|
|
|
41
41
|
|
|
42
42
|
const { getByRole, queryByText } = render(
|
|
43
43
|
<SearchContextWrapper props={searchProps}>
|
|
44
|
-
<StructuresEditableDownloadOption {...
|
|
44
|
+
<StructuresEditableDownloadOption {...{ setDownloading }} />
|
|
45
45
|
</SearchContextWrapper>,
|
|
46
46
|
renderOpts
|
|
47
47
|
);
|
|
48
|
-
expect(getByRole("option")).toHaveAttribute("aria-disabled");
|
|
48
|
+
expect(getByRole("option")).toHaveAttribute("aria-disabled", "true");
|
|
49
49
|
expect(queryByText("popup")).toBeTruthy();
|
|
50
50
|
});
|
|
51
51
|
});
|
|
@@ -5,7 +5,7 @@ import StructuresUploadEventsTable from "../StructuresUploadEventsTable";
|
|
|
5
5
|
|
|
6
6
|
const events = [
|
|
7
7
|
{
|
|
8
|
-
|
|
8
|
+
hash: "99E400B91D164F8F0A39F400CA323C8F",
|
|
9
9
|
inserted_at: "2022-04-23T15:53:24.638484Z",
|
|
10
10
|
message: null,
|
|
11
11
|
response: {
|
|
@@ -17,7 +17,7 @@ const events = [
|
|
|
17
17
|
user_id: 467,
|
|
18
18
|
},
|
|
19
19
|
{
|
|
20
|
-
|
|
20
|
+
hash: "47D90FDF1AD967BD7DBBDAE28664278E",
|
|
21
21
|
inserted_at: "2022-04-23T15:14:48.770275Z",
|
|
22
22
|
message: null,
|
|
23
23
|
response: {
|
|
@@ -18,7 +18,7 @@ describe("<StructuresUploadOption />", () => {
|
|
|
18
18
|
|
|
19
19
|
it("matches the latest snapshot", () => {
|
|
20
20
|
const props = {
|
|
21
|
-
|
|
21
|
+
canAutoPublish: false,
|
|
22
22
|
};
|
|
23
23
|
const { container } = render(
|
|
24
24
|
<StructuresUploadOption {...props} />,
|
|
@@ -28,10 +28,7 @@ describe("<StructuresUploadOption />", () => {
|
|
|
28
28
|
});
|
|
29
29
|
|
|
30
30
|
it("matches the latest snapshot with auto publish", () => {
|
|
31
|
-
const props = {
|
|
32
|
-
uploadStructures: jest.fn(),
|
|
33
|
-
canAutoPublish: true,
|
|
34
|
-
};
|
|
31
|
+
const props = { canAutoPublish: true };
|
|
35
32
|
const { container } = render(
|
|
36
33
|
<StructuresUploadOption {...props} />,
|
|
37
34
|
renderOpts
|
package/src/components/__tests__/__snapshots__/StructuresEditableDownloadOption.spec.js.snap
CHANGED
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
exports[`<StructuresEditableDownloadOption /> matches the latest snapshot 1`] = `
|
|
4
4
|
<div>
|
|
5
5
|
<div
|
|
6
|
-
aria-disabled="
|
|
7
|
-
class="
|
|
6
|
+
aria-disabled="false"
|
|
7
|
+
class="item"
|
|
8
8
|
role="option"
|
|
9
9
|
>
|
|
10
10
|
<i
|
|
@@ -14,11 +14,6 @@ exports[`<StructuresEditableDownloadOption /> matches the latest snapshot 1`] =
|
|
|
14
14
|
<span>
|
|
15
15
|
tooltip
|
|
16
16
|
</span>
|
|
17
|
-
<p
|
|
18
|
-
class="menu-item-description"
|
|
19
|
-
>
|
|
20
|
-
popup
|
|
21
|
-
</p>
|
|
22
17
|
</div>
|
|
23
18
|
</div>
|
|
24
19
|
`;
|
|
@@ -3,6 +3,8 @@
|
|
|
3
3
|
exports[`<StructuresOptions /> matches the latest snapshot 1`] = `
|
|
4
4
|
<div>
|
|
5
5
|
<div
|
|
6
|
+
aria-busy="false"
|
|
7
|
+
aria-disabled="false"
|
|
6
8
|
aria-expanded="false"
|
|
7
9
|
class="ui floating dropdown button icon group-actions button-update"
|
|
8
10
|
role="listbox"
|
|
@@ -55,6 +57,7 @@ exports[`<StructuresOptions /> matches the latest snapshot 1`] = `
|
|
|
55
57
|
</p>
|
|
56
58
|
</div>
|
|
57
59
|
<div
|
|
60
|
+
aria-disabled="false"
|
|
58
61
|
class="item"
|
|
59
62
|
role="option"
|
|
60
63
|
>
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
exports[`<StructuresUploadOption /> matches the latest snapshot 1`] = `
|
|
4
4
|
<div>
|
|
5
5
|
<div
|
|
6
|
+
aria-disabled="false"
|
|
6
7
|
class="item"
|
|
7
8
|
role="option"
|
|
8
9
|
>
|
|
@@ -22,6 +23,7 @@ exports[`<StructuresUploadOption /> matches the latest snapshot 1`] = `
|
|
|
22
23
|
exports[`<StructuresUploadOption /> matches the latest snapshot with auto publish 1`] = `
|
|
23
24
|
<div>
|
|
24
25
|
<div
|
|
26
|
+
aria-disabled="false"
|
|
25
27
|
class="item"
|
|
26
28
|
role="option"
|
|
27
29
|
>
|