@truedat/dd 4.40.11 → 4.40.14
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 +6 -0
- package/package.json +6 -6
- package/src/components/DictionaryRoutes.js +17 -1
- package/src/components/PendingStructureNoteRow.js +45 -0
- package/src/components/PendingStructureNotes.js +149 -0
- package/src/components/PendingStructureNotesTable.js +73 -0
- package/src/components/__tests__/PendingStructureNoteRow.spec.js +48 -0
- package/src/components/__tests__/PendingStructureNotes.spec.js +102 -0
- package/src/components/__tests__/PendingStructureNotesTable.spec.js +82 -0
- package/src/components/__tests__/__snapshots__/DictionaryRoutes.spec.js.snap +4 -0
- package/src/components/__tests__/__snapshots__/PendingStructureNoteRow.spec.js.snap +35 -0
- package/src/components/__tests__/__snapshots__/PendingStructureNotes.spec.js.snap +126 -0
- package/src/components/__tests__/__snapshots__/PendingStructureNotesTable.spec.js.snap +123 -0
- package/src/messages/en.js +9 -0
- package/src/messages/es.js +10 -0
package/CHANGELOG.md
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@truedat/dd",
|
|
3
|
-
"version": "4.40.
|
|
3
|
+
"version": "4.40.14",
|
|
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.14.1",
|
|
35
35
|
"@testing-library/react": "^12.0.0",
|
|
36
36
|
"@testing-library/user-event": "^13.2.1",
|
|
37
|
-
"@truedat/test": "4.40.
|
|
37
|
+
"@truedat/test": "4.40.14",
|
|
38
38
|
"babel-jest": "^27.0.6",
|
|
39
39
|
"babel-plugin-dynamic-import-node": "^2.3.3",
|
|
40
40
|
"babel-plugin-lodash": "^3.3.4",
|
|
@@ -84,9 +84,9 @@
|
|
|
84
84
|
]
|
|
85
85
|
},
|
|
86
86
|
"dependencies": {
|
|
87
|
-
"@truedat/auth": "4.40.
|
|
88
|
-
"@truedat/core": "4.40.
|
|
89
|
-
"@truedat/df": "4.40.
|
|
87
|
+
"@truedat/auth": "4.40.14",
|
|
88
|
+
"@truedat/core": "4.40.14",
|
|
89
|
+
"@truedat/df": "4.40.14",
|
|
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": "
|
|
110
|
+
"gitHead": "11d6d5749f624fd3db6005f79f0df6ce05bc7793"
|
|
111
111
|
}
|
|
@@ -2,13 +2,15 @@ import React from "react";
|
|
|
2
2
|
import { Route, Switch } from "react-router-dom";
|
|
3
3
|
import { useActiveRoute } from "@truedat/core/hooks";
|
|
4
4
|
import {
|
|
5
|
+
PENDING_STRUCTURE_NOTES,
|
|
5
6
|
PROFILE_EXECUTION,
|
|
6
7
|
PROFILE_GROUP,
|
|
7
|
-
STRUCTURES,
|
|
8
8
|
STRUCTURE_TAGS,
|
|
9
9
|
STRUCTURE_TYPES,
|
|
10
|
+
STRUCTURES,
|
|
10
11
|
SYSTEMS,
|
|
11
12
|
} from "@truedat/core/routes";
|
|
13
|
+
import PendingStructureNotes from "./PendingStructureNotes";
|
|
12
14
|
import ProfileExecution from "./ProfileExecution";
|
|
13
15
|
import ProfileExecutionBreadcrumbs from "./ProfileExecutionBreadcrumbs";
|
|
14
16
|
import ProfileExecutionLoader from "./ProfileExecutionLoader";
|
|
@@ -27,6 +29,10 @@ const TemplatesLoader = React.lazy(() =>
|
|
|
27
29
|
import("@truedat/df/templates/components/TemplatesLoader")
|
|
28
30
|
);
|
|
29
31
|
|
|
32
|
+
const DomainsLoader = React.lazy(() =>
|
|
33
|
+
import("@truedat/bg/taxonomy/components/DomainsLoader")
|
|
34
|
+
);
|
|
35
|
+
|
|
30
36
|
const Loaders = () => (
|
|
31
37
|
<>
|
|
32
38
|
<StructuresLoader />
|
|
@@ -82,6 +88,16 @@ export const DictionaryRoutes = () => {
|
|
|
82
88
|
</>
|
|
83
89
|
)}
|
|
84
90
|
/>
|
|
91
|
+
<Route
|
|
92
|
+
path={PENDING_STRUCTURE_NOTES}
|
|
93
|
+
render={() => (
|
|
94
|
+
<>
|
|
95
|
+
<SystemsLoader />
|
|
96
|
+
<DomainsLoader />
|
|
97
|
+
<PendingStructureNotes />
|
|
98
|
+
</>
|
|
99
|
+
)}
|
|
100
|
+
/>
|
|
85
101
|
<Route
|
|
86
102
|
path={PROFILE_GROUP}
|
|
87
103
|
render={() => (
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import _ from "lodash/fp";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import PropTypes from "prop-types";
|
|
4
|
+
import { Table } from "semantic-ui-react";
|
|
5
|
+
import { useIntl } from "react-intl";
|
|
6
|
+
import { useHistory } from "react-router-dom";
|
|
7
|
+
import { linkTo } from "@truedat/core/routes";
|
|
8
|
+
|
|
9
|
+
const PendingStructureNoteRow = ({ structureNote }) => {
|
|
10
|
+
const { formatMessage } = useIntl();
|
|
11
|
+
const history = useHistory();
|
|
12
|
+
const dataStructure = _.prop("data_structure")(structureNote);
|
|
13
|
+
const path = _.propOr(
|
|
14
|
+
[],
|
|
15
|
+
"data_structure.current_version.path"
|
|
16
|
+
)(structureNote);
|
|
17
|
+
const name = _.prop("data_structure.current_version.name")(structureNote);
|
|
18
|
+
const system = _.prop("data_structure.system.name")(structureNote);
|
|
19
|
+
const domainsNames = _.flow(
|
|
20
|
+
_.prop("data_structure.domains"),
|
|
21
|
+
_.map("name")
|
|
22
|
+
)(structureNote);
|
|
23
|
+
|
|
24
|
+
return (
|
|
25
|
+
<Table.Row
|
|
26
|
+
onClick={() => history.push(linkTo.STRUCTURE_NOTES(dataStructure))}
|
|
27
|
+
>
|
|
28
|
+
<Table.Cell content={name} />
|
|
29
|
+
<Table.Cell
|
|
30
|
+
content={formatMessage({
|
|
31
|
+
id: `structure.notes.status.${structureNote.status}`,
|
|
32
|
+
})}
|
|
33
|
+
/>
|
|
34
|
+
<Table.Cell content={system} />
|
|
35
|
+
<Table.Cell content={domainsNames.join(", ")} />
|
|
36
|
+
<Table.Cell content={path.join(" > ")} />
|
|
37
|
+
</Table.Row>
|
|
38
|
+
);
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
PendingStructureNoteRow.propTypes = {
|
|
42
|
+
structureNote: PropTypes.object,
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
export default PendingStructureNoteRow;
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import _ from "lodash/fp";
|
|
2
|
+
import React, { useState } from "react";
|
|
3
|
+
import { useSelector } from "react-redux";
|
|
4
|
+
import { FormattedMessage, useIntl } from "react-intl";
|
|
5
|
+
import { gql, useQuery } from "@apollo/client";
|
|
6
|
+
import { Checkbox, Form, Header, Icon, Segment } from "semantic-ui-react";
|
|
7
|
+
import { useForm, Controller } from "react-hook-form";
|
|
8
|
+
import PendingStructureNotesTable from "./PendingStructureNotesTable";
|
|
9
|
+
|
|
10
|
+
const DomainDropdownSelector = React.lazy(() =>
|
|
11
|
+
import("@truedat/bg/taxonomy/components/DomainDropdownSelector")
|
|
12
|
+
);
|
|
13
|
+
|
|
14
|
+
export const STRUCTURE_NOTES = gql`
|
|
15
|
+
query STRUCTURE_NOTES($filter: StructureNotesFilter) {
|
|
16
|
+
structure_notes(filter: $filter) {
|
|
17
|
+
id
|
|
18
|
+
status
|
|
19
|
+
data_structure {
|
|
20
|
+
id
|
|
21
|
+
current_version {
|
|
22
|
+
id
|
|
23
|
+
name
|
|
24
|
+
path
|
|
25
|
+
version
|
|
26
|
+
}
|
|
27
|
+
system {
|
|
28
|
+
name
|
|
29
|
+
}
|
|
30
|
+
domains {
|
|
31
|
+
name
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
`;
|
|
37
|
+
|
|
38
|
+
const STATUS = ["pending_approval", "draft", "rejected"];
|
|
39
|
+
|
|
40
|
+
export const PendingStructureNotes = () => {
|
|
41
|
+
const { formatMessage } = useIntl();
|
|
42
|
+
const { systems } = useSelector(_.pick(["systems"]));
|
|
43
|
+
const [filter, setFilter] = useState({
|
|
44
|
+
statuses: STATUS,
|
|
45
|
+
});
|
|
46
|
+
const { loading, error, data } = useQuery(STRUCTURE_NOTES, {
|
|
47
|
+
variables: { filter },
|
|
48
|
+
fetchPolicy: "network-only",
|
|
49
|
+
});
|
|
50
|
+
const items = loading || error ? [] : data?.structure_notes;
|
|
51
|
+
const { control } = useForm({
|
|
52
|
+
mode: "all",
|
|
53
|
+
defaultValues: {
|
|
54
|
+
status: STATUS,
|
|
55
|
+
},
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
return (
|
|
59
|
+
<Segment>
|
|
60
|
+
<Header as="h2">
|
|
61
|
+
<Icon name="sticky note outline" circular />
|
|
62
|
+
<Header.Content>
|
|
63
|
+
<FormattedMessage id="pendingStructureNotes.header" />
|
|
64
|
+
<Header.Subheader>
|
|
65
|
+
<FormattedMessage id="pendingStructureNotes.subheader" />
|
|
66
|
+
</Header.Subheader>
|
|
67
|
+
</Header.Content>
|
|
68
|
+
</Header>
|
|
69
|
+
<Form>
|
|
70
|
+
<Header
|
|
71
|
+
as="h5"
|
|
72
|
+
content={formatMessage({ id: "pendingStructureNotes.filters" })}
|
|
73
|
+
/>
|
|
74
|
+
<Controller
|
|
75
|
+
control={control}
|
|
76
|
+
name="status"
|
|
77
|
+
render={({ onBlur, onChange, value }) => (
|
|
78
|
+
<Form.Field className="subscriptions-checkbox-filters">
|
|
79
|
+
<label>
|
|
80
|
+
{formatMessage({ id: "pendingStructureNotes.props.status" })}
|
|
81
|
+
</label>
|
|
82
|
+
{STATUS.map((type, idx) => (
|
|
83
|
+
<Checkbox
|
|
84
|
+
onBlur={onBlur}
|
|
85
|
+
key={idx}
|
|
86
|
+
label={
|
|
87
|
+
<label>
|
|
88
|
+
{formatMessage({ id: `structure.notes.status.${type}` })}
|
|
89
|
+
</label>
|
|
90
|
+
}
|
|
91
|
+
onChange={() => {
|
|
92
|
+
const statuses = _.includes(type)(value)
|
|
93
|
+
? _.filter((t) => t !== type)(value)
|
|
94
|
+
: [...value, type];
|
|
95
|
+
setFilter({ ...filter, statuses });
|
|
96
|
+
onChange(statuses);
|
|
97
|
+
}}
|
|
98
|
+
checked={_.includes(type)(value)}
|
|
99
|
+
/>
|
|
100
|
+
))}
|
|
101
|
+
</Form.Field>
|
|
102
|
+
)}
|
|
103
|
+
/>
|
|
104
|
+
<Controller
|
|
105
|
+
control={control}
|
|
106
|
+
name="system_ids"
|
|
107
|
+
render={({ onBlur, onChange, value }) => (
|
|
108
|
+
<Form.Dropdown
|
|
109
|
+
label={formatMessage({
|
|
110
|
+
id: "pendingStructureNotes.props.system",
|
|
111
|
+
})}
|
|
112
|
+
onBlur={onBlur}
|
|
113
|
+
onChange={(e, { value }) => {
|
|
114
|
+
setFilter({ ...filter, system_ids: value });
|
|
115
|
+
onChange(value);
|
|
116
|
+
}}
|
|
117
|
+
options={systems.map(({ name, id }) => ({
|
|
118
|
+
text: name,
|
|
119
|
+
key: id,
|
|
120
|
+
value: id,
|
|
121
|
+
}))}
|
|
122
|
+
selection
|
|
123
|
+
clearable
|
|
124
|
+
multiple
|
|
125
|
+
value={value || []}
|
|
126
|
+
/>
|
|
127
|
+
)}
|
|
128
|
+
/>
|
|
129
|
+
<Controller
|
|
130
|
+
control={control}
|
|
131
|
+
name="domain_ids"
|
|
132
|
+
render={({ onChange, value }) => (
|
|
133
|
+
<DomainDropdownSelector
|
|
134
|
+
value={value}
|
|
135
|
+
onChange={(_e, { value }) => {
|
|
136
|
+
const domain_ids = _.isNumber(value) ? [value] : [];
|
|
137
|
+
setFilter({ ...filter, domain_ids });
|
|
138
|
+
onChange(value);
|
|
139
|
+
}}
|
|
140
|
+
/>
|
|
141
|
+
)}
|
|
142
|
+
/>
|
|
143
|
+
</Form>
|
|
144
|
+
<PendingStructureNotesTable structureNotes={items} loading={loading} />
|
|
145
|
+
</Segment>
|
|
146
|
+
);
|
|
147
|
+
};
|
|
148
|
+
|
|
149
|
+
export default PendingStructureNotes;
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import _ from "lodash/fp";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import PropTypes from "prop-types";
|
|
4
|
+
import { FormattedMessage } from "react-intl";
|
|
5
|
+
import { Table, Header, Icon } from "semantic-ui-react";
|
|
6
|
+
import PendingStructureNoteRow from "./PendingStructureNoteRow";
|
|
7
|
+
|
|
8
|
+
const PendingStructureNotesTable = ({ structureNotes, loading }) => {
|
|
9
|
+
return (
|
|
10
|
+
<>
|
|
11
|
+
{!_.isEmpty(structureNotes) && (
|
|
12
|
+
<Table selectable>
|
|
13
|
+
<Table.Header>
|
|
14
|
+
<Table.Row>
|
|
15
|
+
<Table.HeaderCell
|
|
16
|
+
content={
|
|
17
|
+
<FormattedMessage
|
|
18
|
+
id={"pendingStructureNotes.props.structure"}
|
|
19
|
+
/>
|
|
20
|
+
}
|
|
21
|
+
/>
|
|
22
|
+
<Table.HeaderCell
|
|
23
|
+
content={
|
|
24
|
+
<FormattedMessage id={"pendingStructureNotes.props.status"} />
|
|
25
|
+
}
|
|
26
|
+
/>
|
|
27
|
+
<Table.HeaderCell
|
|
28
|
+
content={
|
|
29
|
+
<FormattedMessage id={"pendingStructureNotes.props.system"} />
|
|
30
|
+
}
|
|
31
|
+
/>
|
|
32
|
+
<Table.HeaderCell
|
|
33
|
+
content={
|
|
34
|
+
<FormattedMessage
|
|
35
|
+
id={"pendingStructureNotes.props.domains"}
|
|
36
|
+
/>
|
|
37
|
+
}
|
|
38
|
+
/>
|
|
39
|
+
<Table.HeaderCell
|
|
40
|
+
content={
|
|
41
|
+
<FormattedMessage id={"pendingStructureNotes.props.path"} />
|
|
42
|
+
}
|
|
43
|
+
/>
|
|
44
|
+
</Table.Row>
|
|
45
|
+
</Table.Header>
|
|
46
|
+
<Table.Body>
|
|
47
|
+
{structureNotes.map((structureNote, key) => (
|
|
48
|
+
<PendingStructureNoteRow
|
|
49
|
+
key={key}
|
|
50
|
+
structureNote={structureNote}
|
|
51
|
+
/>
|
|
52
|
+
))}
|
|
53
|
+
</Table.Body>
|
|
54
|
+
</Table>
|
|
55
|
+
)}
|
|
56
|
+
{_.isEmpty(structureNotes) && !loading && (
|
|
57
|
+
<Header as="h4">
|
|
58
|
+
<Icon name="search" />
|
|
59
|
+
<Header.Content>
|
|
60
|
+
<FormattedMessage id="pendingStructureNotes.search.results.empty" />
|
|
61
|
+
</Header.Content>
|
|
62
|
+
</Header>
|
|
63
|
+
)}
|
|
64
|
+
</>
|
|
65
|
+
);
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
PendingStructureNotesTable.propTypes = {
|
|
69
|
+
structureNotes: PropTypes.array,
|
|
70
|
+
loading: PropTypes.bool,
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
export default PendingStructureNotesTable;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { waitFor } from "@testing-library/react";
|
|
3
|
+
import { render } from "@truedat/test/render";
|
|
4
|
+
import PendingStructureNoteRow from "../PendingStructureNoteRow";
|
|
5
|
+
|
|
6
|
+
const renderOpts = {
|
|
7
|
+
messages: {
|
|
8
|
+
en: {
|
|
9
|
+
"pendingStructureNotes.search.results.empty": "Empty",
|
|
10
|
+
"pendingStructureNotes.props.structure": "Structure",
|
|
11
|
+
"pendingStructureNotes.props.status": "Status",
|
|
12
|
+
"pendingStructureNotes.props.system": "System",
|
|
13
|
+
"pendingStructureNotes.props.domains": "Domains",
|
|
14
|
+
"structure.notes.status.deprecated": "Deprecated",
|
|
15
|
+
"structure.notes.status.draft": "Draft",
|
|
16
|
+
"structure.notes.status.rejected": "Rejected",
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
const props = {
|
|
22
|
+
structureNote: {
|
|
23
|
+
id: "7207",
|
|
24
|
+
status: "draft",
|
|
25
|
+
data_structure: {
|
|
26
|
+
current_version: {
|
|
27
|
+
name: "bar",
|
|
28
|
+
path: ["bar rute"],
|
|
29
|
+
},
|
|
30
|
+
domains: [{ name: "bar domain" }],
|
|
31
|
+
system: { name: "bar system" },
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
describe("<PendingStructureNoteRow />", () => {
|
|
37
|
+
it("matches the latest snapshot", async () => {
|
|
38
|
+
const { container, queryByText } = render(
|
|
39
|
+
<PendingStructureNoteRow {...props} />,
|
|
40
|
+
renderOpts
|
|
41
|
+
);
|
|
42
|
+
expect(container).toMatchSnapshot();
|
|
43
|
+
|
|
44
|
+
await waitFor(() => {
|
|
45
|
+
expect(queryByText(/bar system/)).toBeTruthy();
|
|
46
|
+
});
|
|
47
|
+
});
|
|
48
|
+
});
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import React, { Suspense } from "react";
|
|
2
|
+
import { waitFor } from "@testing-library/react";
|
|
3
|
+
import { render } from "@truedat/test/render";
|
|
4
|
+
import {
|
|
5
|
+
PendingStructureNotes,
|
|
6
|
+
STRUCTURE_NOTES,
|
|
7
|
+
} from "../PendingStructureNotes";
|
|
8
|
+
|
|
9
|
+
jest.mock("react-redux", () => ({
|
|
10
|
+
...jest.requireActual("react-redux"),
|
|
11
|
+
useSelector: jest.fn((selector) =>
|
|
12
|
+
selector({
|
|
13
|
+
systems: [
|
|
14
|
+
{ external_id: "some_external_id", id: 10, name: "some system" },
|
|
15
|
+
],
|
|
16
|
+
})
|
|
17
|
+
),
|
|
18
|
+
}));
|
|
19
|
+
|
|
20
|
+
const domains = [
|
|
21
|
+
{ id: 1, name: "Domain 1", level: 0 },
|
|
22
|
+
{ id: 2, name: "Domain 2", level: 0 },
|
|
23
|
+
];
|
|
24
|
+
|
|
25
|
+
const messages = {
|
|
26
|
+
en: {
|
|
27
|
+
"structure.notes.status.pending_approval": "Empty",
|
|
28
|
+
"pendingStructureNotes.filters": "Filters",
|
|
29
|
+
"pendingStructureNotes.props.status": "Status",
|
|
30
|
+
"pendingStructureNotes.props.system": "System",
|
|
31
|
+
"pendingStructureNotes.props.domains": "Domains",
|
|
32
|
+
"structure.notes.status.draft": "Draft",
|
|
33
|
+
"structure.notes.status.rejected": "Rejected",
|
|
34
|
+
"pendingStructureNotes.header": "Header",
|
|
35
|
+
"pendingStructureNotes.subheader": "Sub header",
|
|
36
|
+
"pendingStructureNotes.search.results.empty": "Serch Empty",
|
|
37
|
+
"domain.selector.placeholder": "Place Holder",
|
|
38
|
+
"domain.selector.label": "label",
|
|
39
|
+
"template.form.validation.empty_required": "empty required",
|
|
40
|
+
},
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
const structureNotes = {
|
|
44
|
+
loading: false,
|
|
45
|
+
structureNotes: [
|
|
46
|
+
{
|
|
47
|
+
id: "7207",
|
|
48
|
+
status: "draft",
|
|
49
|
+
data_structure: {
|
|
50
|
+
current_version: {
|
|
51
|
+
name: "bar",
|
|
52
|
+
path: ["bar rute"],
|
|
53
|
+
},
|
|
54
|
+
domains: [{ name: "bar domain" }],
|
|
55
|
+
system: { name: "bar system" },
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
id: "665214",
|
|
60
|
+
status: "rejected",
|
|
61
|
+
data_structure: {
|
|
62
|
+
current_version: {
|
|
63
|
+
name: "foo",
|
|
64
|
+
path: ["foo rute", "other route"],
|
|
65
|
+
},
|
|
66
|
+
domains: [{ name: "foo domain 1" }, { name: "foo domain 2" }],
|
|
67
|
+
system: { name: "foo system" },
|
|
68
|
+
},
|
|
69
|
+
},
|
|
70
|
+
],
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
const StructureNotesMock = {
|
|
74
|
+
request: { query: STRUCTURE_NOTES },
|
|
75
|
+
result: { data: { structureNotes } },
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
const renderOpts = {
|
|
79
|
+
mocks: [StructureNotesMock],
|
|
80
|
+
messages,
|
|
81
|
+
state: { domains },
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
describe("<PendingStructureNotes />", () => {
|
|
85
|
+
it("matches the latest snapshot", async () => {
|
|
86
|
+
const { container, queryByText } = render(
|
|
87
|
+
<Suspense fallback={null}>
|
|
88
|
+
<PendingStructureNotes />
|
|
89
|
+
</Suspense>,
|
|
90
|
+
renderOpts
|
|
91
|
+
);
|
|
92
|
+
expect(container).toMatchSnapshot();
|
|
93
|
+
|
|
94
|
+
await waitFor(() => {
|
|
95
|
+
expect(queryByText(/some system/)).toBeTruthy();
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
await waitFor(() => {
|
|
99
|
+
expect(queryByText(/Domain 1/)).toBeTruthy();
|
|
100
|
+
});
|
|
101
|
+
});
|
|
102
|
+
});
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { waitFor } from "@testing-library/react";
|
|
3
|
+
import { render } from "@truedat/test/render";
|
|
4
|
+
import PendingStructureNotesTable from "../PendingStructureNotesTable";
|
|
5
|
+
|
|
6
|
+
const renderOpts = {
|
|
7
|
+
messages: {
|
|
8
|
+
en: {
|
|
9
|
+
"pendingStructureNotes.search.results.empty": "Empty",
|
|
10
|
+
"pendingStructureNotes.props.structure": "Structure",
|
|
11
|
+
"pendingStructureNotes.props.status": "Status",
|
|
12
|
+
"pendingStructureNotes.props.system": "System",
|
|
13
|
+
"pendingStructureNotes.props.domains": "Domains",
|
|
14
|
+
"structure.notes.status.draft": "Draft",
|
|
15
|
+
"structure.notes.status.rejected": "Rejected",
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
const props = {
|
|
21
|
+
loading: false,
|
|
22
|
+
structureNotes: [
|
|
23
|
+
{
|
|
24
|
+
id: "7207",
|
|
25
|
+
status: "draft",
|
|
26
|
+
data_structure: {
|
|
27
|
+
current_version: {
|
|
28
|
+
name: "bar",
|
|
29
|
+
path: ["bar rute"],
|
|
30
|
+
},
|
|
31
|
+
domains: [{ name: "bar domain" }],
|
|
32
|
+
system: { name: "bar system" },
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
id: "665214",
|
|
37
|
+
status: "rejected",
|
|
38
|
+
data_structure: {
|
|
39
|
+
current_version: {
|
|
40
|
+
name: "foo",
|
|
41
|
+
path: ["foo rute", "other route"],
|
|
42
|
+
},
|
|
43
|
+
domains: [{ name: "foo domain 1" }, { name: "foo domain 2" }],
|
|
44
|
+
system: { name: "foo system" },
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
],
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
describe("<PendingStructureNotesTable />", () => {
|
|
51
|
+
it("matches the latest snapshot", async () => {
|
|
52
|
+
const { container, queryByText } = render(
|
|
53
|
+
<PendingStructureNotesTable {...props} />,
|
|
54
|
+
renderOpts
|
|
55
|
+
);
|
|
56
|
+
expect(container).toMatchSnapshot();
|
|
57
|
+
|
|
58
|
+
await waitFor(() => {
|
|
59
|
+
expect(queryByText(/Draft/)).toBeTruthy();
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
await waitFor(() => {
|
|
63
|
+
expect(queryByText(/Rejected/)).toBeTruthy();
|
|
64
|
+
});
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
it("matches when StructureNotes are empty and not loading", async () => {
|
|
68
|
+
const props = {
|
|
69
|
+
loading: false,
|
|
70
|
+
structureNotes: [],
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
const { container, queryByText } = render(
|
|
74
|
+
<PendingStructureNotesTable {...props} />,
|
|
75
|
+
renderOpts
|
|
76
|
+
);
|
|
77
|
+
expect(container).toMatchSnapshot();
|
|
78
|
+
await waitFor(() => {
|
|
79
|
+
expect(queryByText(/Empty/)).toBeTruthy();
|
|
80
|
+
});
|
|
81
|
+
});
|
|
82
|
+
});
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
+
|
|
3
|
+
exports[`<PendingStructureNoteRow /> matches the latest snapshot 1`] = `
|
|
4
|
+
<div>
|
|
5
|
+
<tr
|
|
6
|
+
class=""
|
|
7
|
+
>
|
|
8
|
+
<td
|
|
9
|
+
class=""
|
|
10
|
+
>
|
|
11
|
+
bar
|
|
12
|
+
</td>
|
|
13
|
+
<td
|
|
14
|
+
class=""
|
|
15
|
+
>
|
|
16
|
+
Draft
|
|
17
|
+
</td>
|
|
18
|
+
<td
|
|
19
|
+
class=""
|
|
20
|
+
>
|
|
21
|
+
bar system
|
|
22
|
+
</td>
|
|
23
|
+
<td
|
|
24
|
+
class=""
|
|
25
|
+
>
|
|
26
|
+
bar domain
|
|
27
|
+
</td>
|
|
28
|
+
<td
|
|
29
|
+
class=""
|
|
30
|
+
>
|
|
31
|
+
bar rute
|
|
32
|
+
</td>
|
|
33
|
+
</tr>
|
|
34
|
+
</div>
|
|
35
|
+
`;
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
+
|
|
3
|
+
exports[`<PendingStructureNotes /> matches the latest snapshot 1`] = `
|
|
4
|
+
<div>
|
|
5
|
+
<div
|
|
6
|
+
class="ui segment"
|
|
7
|
+
style="display: none;"
|
|
8
|
+
>
|
|
9
|
+
<h2
|
|
10
|
+
class="ui header"
|
|
11
|
+
>
|
|
12
|
+
<i
|
|
13
|
+
aria-hidden="true"
|
|
14
|
+
class="sticky note outline circular icon"
|
|
15
|
+
/>
|
|
16
|
+
<div
|
|
17
|
+
class="content"
|
|
18
|
+
>
|
|
19
|
+
Header
|
|
20
|
+
<div
|
|
21
|
+
class="sub header"
|
|
22
|
+
>
|
|
23
|
+
Sub header
|
|
24
|
+
</div>
|
|
25
|
+
</div>
|
|
26
|
+
</h2>
|
|
27
|
+
<form
|
|
28
|
+
class="ui form"
|
|
29
|
+
>
|
|
30
|
+
<h5
|
|
31
|
+
class="ui header"
|
|
32
|
+
>
|
|
33
|
+
Filters
|
|
34
|
+
</h5>
|
|
35
|
+
<div
|
|
36
|
+
class="field subscriptions-checkbox-filters"
|
|
37
|
+
>
|
|
38
|
+
<label>
|
|
39
|
+
Status
|
|
40
|
+
</label>
|
|
41
|
+
<div
|
|
42
|
+
class="ui checked checkbox"
|
|
43
|
+
>
|
|
44
|
+
<input
|
|
45
|
+
checked=""
|
|
46
|
+
class="hidden"
|
|
47
|
+
readonly=""
|
|
48
|
+
tabindex="0"
|
|
49
|
+
type="checkbox"
|
|
50
|
+
value=""
|
|
51
|
+
/>
|
|
52
|
+
<label>
|
|
53
|
+
Empty
|
|
54
|
+
</label>
|
|
55
|
+
</div>
|
|
56
|
+
<div
|
|
57
|
+
class="ui checked checkbox"
|
|
58
|
+
>
|
|
59
|
+
<input
|
|
60
|
+
checked=""
|
|
61
|
+
class="hidden"
|
|
62
|
+
readonly=""
|
|
63
|
+
tabindex="0"
|
|
64
|
+
type="checkbox"
|
|
65
|
+
value=""
|
|
66
|
+
/>
|
|
67
|
+
<label>
|
|
68
|
+
Draft
|
|
69
|
+
</label>
|
|
70
|
+
</div>
|
|
71
|
+
<div
|
|
72
|
+
class="ui checked checkbox"
|
|
73
|
+
>
|
|
74
|
+
<input
|
|
75
|
+
checked=""
|
|
76
|
+
class="hidden"
|
|
77
|
+
readonly=""
|
|
78
|
+
tabindex="0"
|
|
79
|
+
type="checkbox"
|
|
80
|
+
value=""
|
|
81
|
+
/>
|
|
82
|
+
<label>
|
|
83
|
+
Rejected
|
|
84
|
+
</label>
|
|
85
|
+
</div>
|
|
86
|
+
</div>
|
|
87
|
+
<div
|
|
88
|
+
class="field"
|
|
89
|
+
>
|
|
90
|
+
<label>
|
|
91
|
+
System
|
|
92
|
+
</label>
|
|
93
|
+
<div
|
|
94
|
+
aria-expanded="false"
|
|
95
|
+
aria-multiselectable="true"
|
|
96
|
+
class="ui multiple selection dropdown"
|
|
97
|
+
role="listbox"
|
|
98
|
+
tabindex="0"
|
|
99
|
+
>
|
|
100
|
+
<i
|
|
101
|
+
aria-hidden="true"
|
|
102
|
+
class="dropdown icon"
|
|
103
|
+
/>
|
|
104
|
+
<div
|
|
105
|
+
class="menu transition"
|
|
106
|
+
>
|
|
107
|
+
<div
|
|
108
|
+
aria-checked="false"
|
|
109
|
+
aria-selected="true"
|
|
110
|
+
class="selected item"
|
|
111
|
+
role="option"
|
|
112
|
+
style="pointer-events: all;"
|
|
113
|
+
>
|
|
114
|
+
<span
|
|
115
|
+
class="text"
|
|
116
|
+
>
|
|
117
|
+
some system
|
|
118
|
+
</span>
|
|
119
|
+
</div>
|
|
120
|
+
</div>
|
|
121
|
+
</div>
|
|
122
|
+
</div>
|
|
123
|
+
</form>
|
|
124
|
+
</div>
|
|
125
|
+
</div>
|
|
126
|
+
`;
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
+
|
|
3
|
+
exports[`<PendingStructureNotesTable /> matches the latest snapshot 1`] = `
|
|
4
|
+
<div>
|
|
5
|
+
<table
|
|
6
|
+
class="ui selectable table"
|
|
7
|
+
>
|
|
8
|
+
<thead
|
|
9
|
+
class=""
|
|
10
|
+
>
|
|
11
|
+
<tr
|
|
12
|
+
class=""
|
|
13
|
+
>
|
|
14
|
+
<th
|
|
15
|
+
class=""
|
|
16
|
+
>
|
|
17
|
+
Structure
|
|
18
|
+
</th>
|
|
19
|
+
<th
|
|
20
|
+
class=""
|
|
21
|
+
>
|
|
22
|
+
Status
|
|
23
|
+
</th>
|
|
24
|
+
<th
|
|
25
|
+
class=""
|
|
26
|
+
>
|
|
27
|
+
System
|
|
28
|
+
</th>
|
|
29
|
+
<th
|
|
30
|
+
class=""
|
|
31
|
+
>
|
|
32
|
+
Domains
|
|
33
|
+
</th>
|
|
34
|
+
<th
|
|
35
|
+
class=""
|
|
36
|
+
>
|
|
37
|
+
pendingStructureNotes.props.path
|
|
38
|
+
</th>
|
|
39
|
+
</tr>
|
|
40
|
+
</thead>
|
|
41
|
+
<tbody
|
|
42
|
+
class=""
|
|
43
|
+
>
|
|
44
|
+
<tr
|
|
45
|
+
class=""
|
|
46
|
+
>
|
|
47
|
+
<td
|
|
48
|
+
class=""
|
|
49
|
+
>
|
|
50
|
+
bar
|
|
51
|
+
</td>
|
|
52
|
+
<td
|
|
53
|
+
class=""
|
|
54
|
+
>
|
|
55
|
+
Draft
|
|
56
|
+
</td>
|
|
57
|
+
<td
|
|
58
|
+
class=""
|
|
59
|
+
>
|
|
60
|
+
bar system
|
|
61
|
+
</td>
|
|
62
|
+
<td
|
|
63
|
+
class=""
|
|
64
|
+
>
|
|
65
|
+
bar domain
|
|
66
|
+
</td>
|
|
67
|
+
<td
|
|
68
|
+
class=""
|
|
69
|
+
>
|
|
70
|
+
bar rute
|
|
71
|
+
</td>
|
|
72
|
+
</tr>
|
|
73
|
+
<tr
|
|
74
|
+
class=""
|
|
75
|
+
>
|
|
76
|
+
<td
|
|
77
|
+
class=""
|
|
78
|
+
>
|
|
79
|
+
foo
|
|
80
|
+
</td>
|
|
81
|
+
<td
|
|
82
|
+
class=""
|
|
83
|
+
>
|
|
84
|
+
Rejected
|
|
85
|
+
</td>
|
|
86
|
+
<td
|
|
87
|
+
class=""
|
|
88
|
+
>
|
|
89
|
+
foo system
|
|
90
|
+
</td>
|
|
91
|
+
<td
|
|
92
|
+
class=""
|
|
93
|
+
>
|
|
94
|
+
foo domain 1, foo domain 2
|
|
95
|
+
</td>
|
|
96
|
+
<td
|
|
97
|
+
class=""
|
|
98
|
+
>
|
|
99
|
+
foo rute > other route
|
|
100
|
+
</td>
|
|
101
|
+
</tr>
|
|
102
|
+
</tbody>
|
|
103
|
+
</table>
|
|
104
|
+
</div>
|
|
105
|
+
`;
|
|
106
|
+
|
|
107
|
+
exports[`<PendingStructureNotesTable /> matches when StructureNotes are empty and not loading 1`] = `
|
|
108
|
+
<div>
|
|
109
|
+
<h4
|
|
110
|
+
class="ui header"
|
|
111
|
+
>
|
|
112
|
+
<i
|
|
113
|
+
aria-hidden="true"
|
|
114
|
+
class="search icon"
|
|
115
|
+
/>
|
|
116
|
+
<div
|
|
117
|
+
class="content"
|
|
118
|
+
>
|
|
119
|
+
Empty
|
|
120
|
+
</div>
|
|
121
|
+
</h4>
|
|
122
|
+
</div>
|
|
123
|
+
`;
|
package/src/messages/en.js
CHANGED
|
@@ -150,6 +150,15 @@ export default {
|
|
|
150
150
|
"navigation.lineage.view": "View in Data Catalog",
|
|
151
151
|
"navigation.profile.executions": "Executions",
|
|
152
152
|
"navigation.profile.executions.detail": "Detail",
|
|
153
|
+
"pendingStructureNotes.header": "Pending Notes",
|
|
154
|
+
"pendingStructureNotes.subheader": "Structure notes pending some action",
|
|
155
|
+
"pendingStructureNotes.props.structure": "Data Structure",
|
|
156
|
+
"pendingStructureNotes.props.status": "Status",
|
|
157
|
+
"pendingStructureNotes.props.system": "System",
|
|
158
|
+
"pendingStructureNotes.props.domains": "Domains",
|
|
159
|
+
"pendingStructureNotes.props.path": "Path",
|
|
160
|
+
"pendingStructureNotes.search.results.empty": "No structure notes found",
|
|
161
|
+
"pendingStructureNotes.filters": "Filters",
|
|
153
162
|
"profile.completed.content": "{count} profiles completed.",
|
|
154
163
|
"profile.completed.header": "Profiles completed.",
|
|
155
164
|
"profile.pending.content":
|
package/src/messages/es.js
CHANGED
|
@@ -153,6 +153,16 @@ export default {
|
|
|
153
153
|
"navigation.lineage.view": "Ver detalle",
|
|
154
154
|
"navigation.profile.executions": "Ejecuciones",
|
|
155
155
|
"navigation.profile.executions.detail": "Detalle",
|
|
156
|
+
"pendingStructureNotes.header": "Notas pendientes",
|
|
157
|
+
"pendingStructureNotes.subheader":
|
|
158
|
+
"Notas de estructuras pendientes de acción",
|
|
159
|
+
"pendingStructureNotes.props.structure": "Estructura",
|
|
160
|
+
"pendingStructureNotes.props.status": "Estado",
|
|
161
|
+
"pendingStructureNotes.props.system": "Sistema",
|
|
162
|
+
"pendingStructureNotes.props.domains": "Dominios",
|
|
163
|
+
"pendingStructureNotes.props.path": "Ruta",
|
|
164
|
+
"pendingStructureNotes.search.results.empty": "Ninguna nota encontrada",
|
|
165
|
+
"pendingStructureNotes.filters": "Filtros",
|
|
156
166
|
"profile.completed.content": "Se han ejecutado {count} perfilados.",
|
|
157
167
|
"profile.completed.header": "Ejecuciones finalizadas",
|
|
158
168
|
"profile.pending.content":
|