@truedat/ie 7.5.7 → 7.5.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.
- package/package.json +42 -67
- package/src/ingests/components/EventRow.js +1 -2
- package/src/ingests/components/Events.js +3 -4
- package/src/ingests/components/FieldGroupTable.js +1 -2
- package/src/ingests/components/Ingest.js +1 -2
- package/src/ingests/components/IngestActions.js +1 -2
- package/src/ingests/components/IngestArchive.js +2 -3
- package/src/ingests/components/IngestArchiveLoader.js +16 -38
- package/src/ingests/components/IngestArchiveRow.js +5 -6
- package/src/ingests/components/IngestCompleteness.js +0 -1
- package/src/ingests/components/IngestCrumbs.js +2 -4
- package/src/ingests/components/IngestDetails.js +3 -3
- package/src/ingests/components/IngestDuplicate.js +5 -8
- package/src/ingests/components/IngestEdit.js +5 -8
- package/src/ingests/components/IngestExecutions.js +7 -7
- package/src/ingests/components/IngestExecutionsLoader.js +2 -2
- package/src/ingests/components/IngestFilters.js +5 -6
- package/src/ingests/components/IngestForm.js +4 -5
- package/src/ingests/components/IngestHeader.js +0 -1
- package/src/ingests/components/IngestLoader.js +16 -58
- package/src/ingests/components/IngestRoutes.js +272 -231
- package/src/ingests/components/IngestRow.js +4 -5
- package/src/ingests/components/IngestSelectedFilters.js +10 -10
- package/src/ingests/components/IngestSummary.js +0 -2
- package/src/ingests/components/IngestTabs.js +13 -13
- package/src/ingests/components/Ingests.js +0 -1
- package/src/ingests/components/IngestsActions.js +1 -2
- package/src/ingests/components/IngestsLabelResults.js +1 -2
- package/src/ingests/components/IngestsLoader.js +1 -1
- package/src/ingests/components/IngestsSearch.js +0 -1
- package/src/ingests/components/IngestsSelector.js +0 -1
- package/src/ingests/components/IngestsTable.js +85 -94
- package/src/ingests/components/IngestsTabs.js +2 -3
- package/src/ingests/components/__tests__/Events.spec.js +10 -10
- package/src/ingests/components/__tests__/Ingest.spec.js +16 -5
- package/src/ingests/components/__tests__/IngestActions.spec.js +7 -7
- package/src/ingests/components/__tests__/IngestArchive.spec.js +7 -7
- package/src/ingests/components/__tests__/IngestArchiveLoader.spec.js +70 -69
- package/src/ingests/components/__tests__/IngestArchiveRow.spec.js +10 -12
- package/src/ingests/components/__tests__/IngestCompleteness.spec.js +0 -1
- package/src/ingests/components/__tests__/IngestDetails.spec.js +10 -10
- package/src/ingests/components/__tests__/IngestExecutions.spec.js +7 -7
- package/src/ingests/components/__tests__/IngestExecutionsLoader.spec.js +38 -47
- package/src/ingests/components/__tests__/IngestFilters.spec.js +0 -1
- package/src/ingests/components/__tests__/IngestForm.spec.js +18 -40
- package/src/ingests/components/__tests__/IngestHeader.spec.js +9 -9
- package/src/ingests/components/__tests__/IngestLabelResults.spec.js +0 -1
- package/src/ingests/components/__tests__/IngestLoader.spec.js +70 -41
- package/src/ingests/components/__tests__/IngestRoutes.spec.js +176 -0
- package/src/ingests/components/__tests__/IngestSelectedFilters.spec.js +33 -5
- package/src/ingests/components/__tests__/Ingests.spec.js +32 -6
- package/src/ingests/components/__tests__/IngestsActions.spec.js +5 -5
- package/src/ingests/components/__tests__/IngestsLoader.spec.js +65 -36
- package/src/ingests/components/__tests__/IngestsTable.spec.js +16 -7
- package/src/ingests/components/__tests__/__snapshots__/Events.spec.js.snap +83 -43
- package/src/ingests/components/__tests__/__snapshots__/Ingest.spec.js.snap +27 -14
- package/src/ingests/components/__tests__/__snapshots__/IngestActions.spec.js.snap +19 -20
- package/src/ingests/components/__tests__/__snapshots__/IngestArchive.spec.js.snap +79 -65
- package/src/ingests/components/__tests__/__snapshots__/IngestArchiveLoader.spec.js.snap +1 -1
- package/src/ingests/components/__tests__/__snapshots__/IngestArchiveRow.spec.js.snap +30 -30
- package/src/ingests/components/__tests__/__snapshots__/IngestDetails.spec.js.snap +30 -13
- package/src/ingests/components/__tests__/__snapshots__/IngestExecutions.spec.js.snap +121 -101
- package/src/ingests/components/__tests__/__snapshots__/IngestExecutionsLoader.spec.js.snap +1 -1
- package/src/ingests/components/__tests__/__snapshots__/IngestFilters.spec.js.snap +1 -1
- package/src/ingests/components/__tests__/__snapshots__/IngestForm.spec.js.snap +28 -27
- package/src/ingests/components/__tests__/__snapshots__/IngestHeader.spec.js.snap +21 -19
- package/src/ingests/components/__tests__/__snapshots__/IngestLabelResults.spec.js.snap +1 -1
- package/src/ingests/components/__tests__/__snapshots__/IngestLoader.spec.js.snap +1 -15
- package/src/ingests/components/__tests__/__snapshots__/IngestRoutes.spec.js.snap +243 -0
- package/src/ingests/components/__tests__/__snapshots__/IngestSelectedFilters.spec.js.snap +22 -16
- package/src/ingests/components/__tests__/__snapshots__/Ingests.spec.js.snap +50 -33
- package/src/ingests/components/__tests__/__snapshots__/IngestsActions.spec.js.snap +17 -50
- package/src/ingests/components/__tests__/__snapshots__/IngestsLoader.spec.js.snap +1 -21
- package/src/ingests/components/__tests__/__snapshots__/IngestsTable.spec.js.snap +15 -24
- package/src/ingests/components/index.js +1 -1
- package/src/ingests/constants/mappings.js +6 -6
- package/src/ingests/relations/components/IngestLinkActions.js +0 -1
- package/src/ingests/relations/components/IngestLinksActions.js +1 -2
- package/src/ingests/relations/components/IngestRelationsRoutes.js +67 -69
- package/src/ingests/relations/components/IngestToDataStructureRelations.js +2 -2
- package/src/ingests/relations/components/IngestToIngestForm.js +4 -4
- package/src/ingests/relations/components/IngestToIngestRelations.js +4 -4
- package/src/ingests/relations/components/IngestToStructureForm.js +6 -6
- package/src/ingests/relations/components/__tests__/IngestRelationsRoutes.spec.js +80 -4
- package/src/ingests/relations/components/__tests__/IngestToIngestForm.spec.js +24 -25
- package/src/ingests/relations/components/__tests__/IngestToStructureForm.spec.js +42 -23
- package/src/ingests/relations/components/__tests__/__snapshots__/IngestRelationsRoutes.spec.js.snap +49 -23
- package/src/ingests/relations/components/__tests__/__snapshots__/IngestToIngestForm.spec.js.snap +85 -27
- package/src/ingests/relations/components/__tests__/__snapshots__/IngestToStructureForm.spec.js.snap +30 -35
- package/src/ingests/relations/selectors/__tests__/getIngestLinks.spec.js +20 -20
- package/src/ingests/relations/selectors/__tests__/getRelations.spec.js +17 -17
- package/src/ingests/relations/selectors/getIngestLinks.js +1 -2
- package/src/ingests/relations/selectors/getRelations.js +6 -6
- package/src/ingests/sagas/fetchIngest.js +1 -1
- package/src/ingests/sagas/fetchIngestArchive.js +1 -1
- package/src/ingests/sagas/fetchIngestExecutions.js +1 -1
- package/src/ingests/selectors/getIngestColumns.js +12 -13
- package/src/ingests/selectors/getIngestTemplate.js +1 -1
- package/src/ingests/selectors/getParsedEvents.js +15 -15
- package/src/ingests/selectors/getTemplateFields.js +3 -3
- package/src/ingests/selectors/getTemplateGroups.js +1 -1
- package/src/ingests/utils/filterOptions.js +3 -2
- package/src/ingests/components/__tests__/IngestDuplicate.spec.js +0 -67
- package/src/ingests/components/__tests__/IngestEdit.spec.js +0 -79
- package/src/ingests/components/__tests__/__snapshots__/IngestDuplicate.spec.js.snap +0 -85
- package/src/ingests/components/__tests__/__snapshots__/IngestEdit.spec.js.snap +0 -80
|
@@ -2,56 +2,23 @@
|
|
|
2
2
|
|
|
3
3
|
exports[`<IngestsActions /> matches the latest snapshot 1`] = `
|
|
4
4
|
<div>
|
|
5
|
-
<
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
content={
|
|
21
|
-
<Memo(MemoizedFormattedMessage)
|
|
22
|
-
id="ingests.actions.create"
|
|
5
|
+
<div>
|
|
6
|
+
<a
|
|
7
|
+
class="ui primary right floated button"
|
|
8
|
+
data-discover="true"
|
|
9
|
+
href="/url/to/create/ingest"
|
|
10
|
+
role="button"
|
|
11
|
+
>
|
|
12
|
+
ingests.actions.create
|
|
13
|
+
</a>
|
|
14
|
+
<button
|
|
15
|
+
class="ui icon secondary right floated button"
|
|
16
|
+
>
|
|
17
|
+
<i
|
|
18
|
+
aria-hidden="true"
|
|
19
|
+
class="download icon"
|
|
23
20
|
/>
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
primary={true}
|
|
27
|
-
to="/url/to/create/ingest"
|
|
28
|
-
/>
|
|
29
|
-
<Popup
|
|
30
|
-
content={
|
|
31
|
-
<Memo(MemoizedFormattedMessage)
|
|
32
|
-
id="ingests.actions.download.tooltip"
|
|
33
|
-
/>
|
|
34
|
-
}
|
|
35
|
-
disabled={false}
|
|
36
|
-
eventsEnabled={true}
|
|
37
|
-
on={
|
|
38
|
-
[
|
|
39
|
-
"click",
|
|
40
|
-
"hover",
|
|
41
|
-
]
|
|
42
|
-
}
|
|
43
|
-
pinned={false}
|
|
44
|
-
popperModifiers={[]}
|
|
45
|
-
position="top left"
|
|
46
|
-
trigger={
|
|
47
|
-
<Button
|
|
48
|
-
as="button"
|
|
49
|
-
floated="right"
|
|
50
|
-
icon="download"
|
|
51
|
-
onClick={[Function]}
|
|
52
|
-
secondary={true}
|
|
53
|
-
/>
|
|
54
|
-
}
|
|
55
|
-
/>
|
|
21
|
+
</button>
|
|
22
|
+
</div>
|
|
56
23
|
</div>
|
|
57
24
|
`;
|
|
@@ -1,23 +1,3 @@
|
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
2
|
|
|
3
|
-
exports[`<IngestsLoader /> matches the latest snapshot 1`] =
|
|
4
|
-
<IngestsLoader
|
|
5
|
-
clearIngests={[MockFunction]}
|
|
6
|
-
fetchIngests={
|
|
7
|
-
[MockFunction] {
|
|
8
|
-
"calls": [
|
|
9
|
-
[
|
|
10
|
-
undefined,
|
|
11
|
-
],
|
|
12
|
-
],
|
|
13
|
-
"results": [
|
|
14
|
-
{
|
|
15
|
-
"type": "return",
|
|
16
|
-
"value": undefined,
|
|
17
|
-
},
|
|
18
|
-
],
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
loading={false}
|
|
22
|
-
/>
|
|
23
|
-
`;
|
|
3
|
+
exports[`<IngestsLoader /> matches the latest snapshot 1`] = `<div />`;
|
|
@@ -1,33 +1,24 @@
|
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
2
|
|
|
3
3
|
exports[`<IngestsTable /> matches the latest snapshot 1`] = `
|
|
4
|
-
<
|
|
5
|
-
<
|
|
6
|
-
|
|
7
|
-
selectable={true}
|
|
8
|
-
sortable={true}
|
|
4
|
+
<div>
|
|
5
|
+
<table
|
|
6
|
+
class="ui selectable sortable table"
|
|
9
7
|
>
|
|
10
|
-
<
|
|
11
|
-
|
|
8
|
+
<thead
|
|
9
|
+
class=""
|
|
12
10
|
>
|
|
13
|
-
<
|
|
14
|
-
|
|
15
|
-
cellAs="td"
|
|
11
|
+
<tr
|
|
12
|
+
class=""
|
|
16
13
|
/>
|
|
17
|
-
</
|
|
18
|
-
<
|
|
19
|
-
|
|
14
|
+
</thead>
|
|
15
|
+
<tbody
|
|
16
|
+
class=""
|
|
20
17
|
>
|
|
21
|
-
<
|
|
22
|
-
|
|
23
|
-
ingest={
|
|
24
|
-
{
|
|
25
|
-
"id": 1,
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
key="0"
|
|
18
|
+
<tr
|
|
19
|
+
class=""
|
|
29
20
|
/>
|
|
30
|
-
</
|
|
31
|
-
</
|
|
32
|
-
</
|
|
21
|
+
</tbody>
|
|
22
|
+
</table>
|
|
23
|
+
</div>
|
|
33
24
|
`;
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
export const mapActionProps = {
|
|
2
2
|
publish: {
|
|
3
|
-
primary: true
|
|
3
|
+
primary: true,
|
|
4
4
|
},
|
|
5
5
|
version: {
|
|
6
|
-
primary: true
|
|
6
|
+
primary: true,
|
|
7
7
|
},
|
|
8
8
|
send_for_approval: {
|
|
9
|
-
primary: true
|
|
9
|
+
primary: true,
|
|
10
10
|
},
|
|
11
11
|
reject: {
|
|
12
|
-
negative: true
|
|
13
|
-
}
|
|
12
|
+
negative: true,
|
|
13
|
+
},
|
|
14
14
|
};
|
|
15
15
|
|
|
16
16
|
export const mapStatusColor = {
|
|
@@ -19,5 +19,5 @@ export const mapStatusColor = {
|
|
|
19
19
|
pending_approval: "teal",
|
|
20
20
|
published: "green",
|
|
21
21
|
rejected: "red",
|
|
22
|
-
versioned: "yellow"
|
|
22
|
+
versioned: "yellow",
|
|
23
23
|
};
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import _ from "lodash/fp";
|
|
2
|
-
import React from "react";
|
|
3
2
|
import PropTypes from "prop-types";
|
|
4
3
|
import { connect } from "react-redux";
|
|
5
4
|
import { Button } from "semantic-ui-react";
|
|
6
|
-
import { Link } from "react-router
|
|
5
|
+
import { Link } from "react-router";
|
|
7
6
|
import { FormattedMessage } from "react-intl";
|
|
8
7
|
import { linkTo } from "@truedat/core/routes";
|
|
9
8
|
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import _ from "lodash/fp";
|
|
2
2
|
import React from "react";
|
|
3
3
|
import PropTypes from "prop-types";
|
|
4
|
-
import { Route,
|
|
4
|
+
import { Route, Routes } from "react-router";
|
|
5
5
|
import { connect } from "react-redux";
|
|
6
6
|
import {
|
|
7
7
|
INGEST_RELATIONS_INGESTS,
|
|
8
8
|
INGEST_RELATIONS_INGESTS_NEW,
|
|
9
9
|
INGEST_RELATIONS_STRUCTURES,
|
|
10
|
-
INGEST_RELATIONS_STRUCTURES_NEW
|
|
10
|
+
INGEST_RELATIONS_STRUCTURES_NEW,
|
|
11
11
|
} from "@truedat/core/routes";
|
|
12
12
|
import IngestsLoader from "../../components/IngestsLoader";
|
|
13
13
|
import IngestFiltersLoader from "../../components/IngestFiltersLoader";
|
|
@@ -16,84 +16,82 @@ import IngestToDataStructureRelations from "./IngestToDataStructureRelations";
|
|
|
16
16
|
import IngestToStructureForm from "./IngestToStructureForm";
|
|
17
17
|
import IngestToIngestForm from "./IngestToIngestForm";
|
|
18
18
|
|
|
19
|
-
const RelationsLoader = React.lazy(
|
|
20
|
-
import("@truedat/lm/components/RelationsLoader")
|
|
19
|
+
const RelationsLoader = React.lazy(
|
|
20
|
+
() => import("@truedat/lm/components/RelationsLoader")
|
|
21
21
|
);
|
|
22
22
|
|
|
23
|
-
const StructureTypesLoader = React.lazy(
|
|
24
|
-
import("@truedat/dd/components/StructureTypesLoader")
|
|
23
|
+
const StructureTypesLoader = React.lazy(
|
|
24
|
+
() => import("@truedat/dd/components/StructureTypesLoader")
|
|
25
25
|
);
|
|
26
26
|
|
|
27
|
-
export const IngestRelationsRoutes = ({ ingestId, ingestLoaded }) =>
|
|
28
|
-
|
|
29
|
-
<
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
path={INGEST_RELATIONS_INGESTS}
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
</Switch>
|
|
87
|
-
);
|
|
27
|
+
export const IngestRelationsRoutes = ({ ingestId, ingestLoaded }) =>
|
|
28
|
+
ingestLoaded ? (
|
|
29
|
+
<Routes>
|
|
30
|
+
<Route path={INGEST_RELATIONS_STRUCTURES}>
|
|
31
|
+
<Route
|
|
32
|
+
index
|
|
33
|
+
element={
|
|
34
|
+
<>
|
|
35
|
+
<RelationsLoader
|
|
36
|
+
resource_id={ingestId}
|
|
37
|
+
resource_type="ingest"
|
|
38
|
+
target_type="data_structure"
|
|
39
|
+
/>
|
|
40
|
+
<StructureTypesLoader />
|
|
41
|
+
<IngestToDataStructureRelations />
|
|
42
|
+
</>
|
|
43
|
+
}
|
|
44
|
+
/>
|
|
45
|
+
<Route path="new" element={<IngestToStructureForm />} />
|
|
46
|
+
</Route>
|
|
47
|
+
|
|
48
|
+
<Route path={INGEST_RELATIONS_INGESTS}>
|
|
49
|
+
<Route
|
|
50
|
+
index
|
|
51
|
+
element={
|
|
52
|
+
<>
|
|
53
|
+
<RelationsLoader
|
|
54
|
+
resource_id={ingestId}
|
|
55
|
+
resource_type="ingest"
|
|
56
|
+
target_type="ingest"
|
|
57
|
+
/>
|
|
58
|
+
<IngestToIngestRelations />
|
|
59
|
+
</>
|
|
60
|
+
}
|
|
61
|
+
/>
|
|
62
|
+
<Route
|
|
63
|
+
path="new"
|
|
64
|
+
element={
|
|
65
|
+
<>
|
|
66
|
+
<IngestsLoader
|
|
67
|
+
pageSize={7}
|
|
68
|
+
defaultFilters={{
|
|
69
|
+
current: [true],
|
|
70
|
+
status: [
|
|
71
|
+
"pending_approval",
|
|
72
|
+
"draft",
|
|
73
|
+
"rejected",
|
|
74
|
+
"published",
|
|
75
|
+
],
|
|
76
|
+
}}
|
|
77
|
+
/>
|
|
78
|
+
<IngestFiltersLoader />
|
|
79
|
+
<IngestToIngestForm targetType="ingest" />
|
|
80
|
+
</>
|
|
81
|
+
}
|
|
82
|
+
/>
|
|
83
|
+
</Route>
|
|
84
|
+
</Routes>
|
|
85
|
+
) : null;
|
|
88
86
|
|
|
89
87
|
IngestRelationsRoutes.propTypes = {
|
|
90
88
|
ingestId: PropTypes.number,
|
|
91
|
-
ingestLoaded: PropTypes.bool
|
|
89
|
+
ingestLoaded: PropTypes.bool,
|
|
92
90
|
};
|
|
93
91
|
|
|
94
92
|
const mapStateToProps = ({ ingest }) => ({
|
|
95
93
|
ingestLoaded: !_.isEmpty(ingest),
|
|
96
|
-
ingestId: _.prop("ingest_id")(ingest)
|
|
94
|
+
ingestId: _.prop("ingest_id")(ingest),
|
|
97
95
|
});
|
|
98
96
|
|
|
99
97
|
export default connect(mapStateToProps)(IngestRelationsRoutes);
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import _ from "lodash/fp";
|
|
2
|
-
import
|
|
2
|
+
import { lazy } from "react";
|
|
3
3
|
import PropTypes from "prop-types";
|
|
4
4
|
import { connect } from "react-redux";
|
|
5
5
|
import { Segment } from "semantic-ui-react";
|
|
6
6
|
import { getIngestLinks } from "../selectors";
|
|
7
7
|
import IngestLinksActions from "./IngestLinksActions";
|
|
8
8
|
|
|
9
|
-
const LinksPane =
|
|
9
|
+
const LinksPane = lazy(() => import("@truedat/lm/components/LinksPane"));
|
|
10
10
|
|
|
11
11
|
export const IngestStructureLinksPane = ({ groups }) => (
|
|
12
12
|
<Segment attached="bottom">
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import _ from "lodash/fp";
|
|
2
|
-
import
|
|
2
|
+
import { lazy, Component } from "react";
|
|
3
3
|
import PropTypes from "prop-types";
|
|
4
4
|
import { connect } from "react-redux";
|
|
5
5
|
import { Button, Divider } from "semantic-ui-react";
|
|
@@ -13,11 +13,11 @@ import { makeTagOptionsSelector } from "@truedat/core/selectors";
|
|
|
13
13
|
import { linkTo } from "@truedat/core/routes";
|
|
14
14
|
import IngestsSelector from "../../components/IngestsSelector";
|
|
15
15
|
|
|
16
|
-
const TagTypeSelector =
|
|
17
|
-
import("@truedat/lm/components/TagTypeSelector")
|
|
16
|
+
const TagTypeSelector = lazy(
|
|
17
|
+
() => import("@truedat/lm/components/TagTypeSelector")
|
|
18
18
|
);
|
|
19
19
|
|
|
20
|
-
export class IngestToIngestForm extends
|
|
20
|
+
export class IngestToIngestForm extends Component {
|
|
21
21
|
state = {
|
|
22
22
|
selectedIngest: null,
|
|
23
23
|
};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { lazy } from "react";
|
|
2
2
|
import { connect } from "react-redux";
|
|
3
3
|
import { getIngestRelations } from "../selectors/getRelations";
|
|
4
4
|
|
|
5
|
-
const Relations =
|
|
5
|
+
const Relations = lazy(() => import("@truedat/lm/components/Relations"));
|
|
6
6
|
|
|
7
|
-
const mapStateToProps = state => ({
|
|
7
|
+
const mapStateToProps = (state) => ({
|
|
8
8
|
relations: getIngestRelations(state),
|
|
9
|
-
relationsLoading: state.relationsLoading
|
|
9
|
+
relationsLoading: state.relationsLoading,
|
|
10
10
|
});
|
|
11
11
|
|
|
12
12
|
export default connect(mapStateToProps)(Relations);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import _ from "lodash/fp";
|
|
2
|
-
import
|
|
2
|
+
import { lazy, Component } from "react";
|
|
3
3
|
import PropTypes from "prop-types";
|
|
4
4
|
import { connect } from "react-redux";
|
|
5
5
|
import { Button, Divider } from "semantic-ui-react";
|
|
@@ -12,14 +12,14 @@ import {
|
|
|
12
12
|
} from "@truedat/core/routines";
|
|
13
13
|
import { makeTagOptionsSelector } from "@truedat/core/selectors";
|
|
14
14
|
|
|
15
|
-
const StructureSelector =
|
|
16
|
-
import("@truedat/dd/components/StructureSelector")
|
|
15
|
+
const StructureSelector = lazy(
|
|
16
|
+
() => import("@truedat/dd/components/StructureSelector")
|
|
17
17
|
);
|
|
18
|
-
const TagTypeSelector =
|
|
19
|
-
import("@truedat/lm/components/TagTypeSelector")
|
|
18
|
+
const TagTypeSelector = lazy(
|
|
19
|
+
() => import("@truedat/lm/components/TagTypeSelector")
|
|
20
20
|
);
|
|
21
21
|
|
|
22
|
-
export class IngestToStructureForm extends
|
|
22
|
+
export class IngestToStructureForm extends Component {
|
|
23
23
|
state = { selectedStructure: null };
|
|
24
24
|
handleStructureSelected = (selectedStructure) =>
|
|
25
25
|
this.setState({ selectedStructure });
|
|
@@ -1,10 +1,86 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import {
|
|
2
|
+
import { render, waitForLoad } from "@truedat/test/render";
|
|
3
3
|
import { IngestRelationsRoutes } from "../IngestRelationsRoutes";
|
|
4
|
+
import {
|
|
5
|
+
INGEST_RELATIONS_INGESTS,
|
|
6
|
+
INGEST_RELATIONS_INGESTS_NEW,
|
|
7
|
+
INGEST_RELATIONS_STRUCTURES,
|
|
8
|
+
INGEST_RELATIONS_STRUCTURES_NEW,
|
|
9
|
+
} from "@truedat/core/routes";
|
|
10
|
+
|
|
11
|
+
// Mock all child components
|
|
12
|
+
jest.mock("../../../components/IngestsLoader", () => () => (
|
|
13
|
+
<div>IngestsLoader</div>
|
|
14
|
+
));
|
|
15
|
+
jest.mock("../../../components/IngestFiltersLoader", () => () => (
|
|
16
|
+
<div>IngestFiltersLoader</div>
|
|
17
|
+
));
|
|
18
|
+
jest.mock("../IngestToIngestRelations", () => () => (
|
|
19
|
+
<div>IngestToIngestRelations</div>
|
|
20
|
+
));
|
|
21
|
+
jest.mock("../IngestToDataStructureRelations", () => () => (
|
|
22
|
+
<div>IngestToDataStructureRelations</div>
|
|
23
|
+
));
|
|
24
|
+
jest.mock("../IngestToStructureForm", () => () => (
|
|
25
|
+
<div>IngestToStructureForm</div>
|
|
26
|
+
));
|
|
27
|
+
jest.mock("../IngestToIngestForm", () => () => <div>IngestToIngestForm</div>);
|
|
28
|
+
jest.mock("@truedat/lm/components/RelationsLoader", () => () => (
|
|
29
|
+
<div>RelationsLoader</div>
|
|
30
|
+
));
|
|
31
|
+
jest.mock("@truedat/dd/components/StructureTypesLoader", () => () => (
|
|
32
|
+
<div>StructureTypesLoader</div>
|
|
33
|
+
));
|
|
4
34
|
|
|
5
35
|
describe("<IngestRelationsRoutes />", () => {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
36
|
+
const props = {
|
|
37
|
+
ingestId: 123,
|
|
38
|
+
ingestLoaded: true,
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
it("renders correctly with default route", async () => {
|
|
42
|
+
const rendered = render(<IngestRelationsRoutes {...props} />);
|
|
43
|
+
await waitForLoad(rendered);
|
|
44
|
+
expect(rendered.container).toMatchSnapshot();
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
it("renders correctly with structures route", async () => {
|
|
48
|
+
const rendered = render(<IngestRelationsRoutes {...props} />, {
|
|
49
|
+
routes: [INGEST_RELATIONS_STRUCTURES.replace(":id", "123")],
|
|
50
|
+
});
|
|
51
|
+
await waitForLoad(rendered);
|
|
52
|
+
expect(rendered.container).toMatchSnapshot();
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
it("renders correctly with structures/new route", async () => {
|
|
56
|
+
const rendered = render(<IngestRelationsRoutes {...props} />, {
|
|
57
|
+
routes: [INGEST_RELATIONS_STRUCTURES_NEW.replace(":id", "123")],
|
|
58
|
+
});
|
|
59
|
+
await waitForLoad(rendered);
|
|
60
|
+
expect(rendered.container).toMatchSnapshot();
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
it("renders correctly with ingests route", async () => {
|
|
64
|
+
const rendered = render(<IngestRelationsRoutes {...props} />, {
|
|
65
|
+
routes: [INGEST_RELATIONS_INGESTS.replace(":id", "123")],
|
|
66
|
+
});
|
|
67
|
+
await waitForLoad(rendered);
|
|
68
|
+
expect(rendered.container).toMatchSnapshot();
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
it("renders correctly with ingests/new route", async () => {
|
|
72
|
+
const rendered = render(<IngestRelationsRoutes {...props} />, {
|
|
73
|
+
routes: [INGEST_RELATIONS_INGESTS_NEW.replace(":id", "123")],
|
|
74
|
+
});
|
|
75
|
+
await waitForLoad(rendered);
|
|
76
|
+
expect(rendered.container).toMatchSnapshot();
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
it("renders nothing when ingest is not loaded", async () => {
|
|
80
|
+
const rendered = render(
|
|
81
|
+
<IngestRelationsRoutes ingestId={123} ingestLoaded={false} />
|
|
82
|
+
);
|
|
83
|
+
await waitForLoad(rendered);
|
|
84
|
+
expect(rendered.container).toMatchSnapshot();
|
|
9
85
|
});
|
|
10
86
|
});
|
|
@@ -1,37 +1,36 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { shallow } from "enzyme";
|
|
1
|
+
import { render, waitForLoad } from "@truedat/test/render";
|
|
3
2
|
import { IngestToIngestForm } from "../IngestToIngestForm";
|
|
4
3
|
|
|
5
4
|
describe("<IngestToIngestForm />", () => {
|
|
6
|
-
it("matches the latest snapshot", () => {
|
|
5
|
+
it("matches the latest snapshot", async () => {
|
|
7
6
|
const tagOptions = [];
|
|
8
7
|
const ingest = {};
|
|
9
|
-
const props = {
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
const props = {
|
|
9
|
+
tagOptions,
|
|
10
|
+
ingest,
|
|
11
|
+
clearSelectedRelationTags: jest.fn(),
|
|
12
|
+
createRelation: jest.fn(),
|
|
13
|
+
selectedRelationTags: [],
|
|
14
|
+
};
|
|
15
|
+
const rendered = render(<IngestToIngestForm {...props} />);
|
|
16
|
+
await waitForLoad(rendered);
|
|
17
|
+
expect(rendered.container).toMatchSnapshot();
|
|
12
18
|
});
|
|
13
19
|
|
|
14
|
-
it("
|
|
20
|
+
it("renders TagTypeSelector when tagOptions is not empty", async () => {
|
|
15
21
|
const tagOptions = [{ text: "some text", value: "some value" }];
|
|
16
22
|
const ingest = {};
|
|
17
23
|
const selectedRelationTags = [];
|
|
18
|
-
const props = {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
const
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
const selectedRelationTags = [];
|
|
30
|
-
const createRelation = jest.fn();
|
|
31
|
-
const props = { createRelation, tagOptions, ingest, selectedRelationTags };
|
|
32
|
-
const wrapper = shallow(<IngestToIngestForm {...props} />);
|
|
33
|
-
wrapper.setState({ selectedIngest });
|
|
34
|
-
wrapper.find({ primary: true }).simulate("click");
|
|
35
|
-
expect(createRelation.mock.calls.length).toEqual(1);
|
|
24
|
+
const props = {
|
|
25
|
+
tagOptions,
|
|
26
|
+
ingest,
|
|
27
|
+
selectedRelationTags,
|
|
28
|
+
clearSelectedRelationTags: jest.fn(),
|
|
29
|
+
createRelation: jest.fn(),
|
|
30
|
+
selectedRelationTags: [],
|
|
31
|
+
};
|
|
32
|
+
const rendered = render(<IngestToIngestForm {...props} />);
|
|
33
|
+
await waitForLoad(rendered);
|
|
34
|
+
expect(rendered.getByText("relations.relationType")).toBeInTheDocument();
|
|
36
35
|
});
|
|
37
36
|
});
|