@truedat/dd 4.51.2 → 4.51.4

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.
Files changed (45) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/package.json +6 -6
  3. package/src/api/queries.js +24 -0
  4. package/src/api.js +0 -2
  5. package/src/components/DictionaryRoutes.js +0 -5
  6. package/src/components/EditDomainForm.js +15 -20
  7. package/src/components/GrantRequest.js +12 -0
  8. package/src/components/GrantRequests.js +24 -15
  9. package/src/components/LineageForm.js +23 -34
  10. package/src/components/PendingStructureNoteRow.js +5 -8
  11. package/src/components/PendingStructureNotes.js +25 -46
  12. package/src/components/PendingStructureNotesTable.js +46 -57
  13. package/src/components/StructureGrantCartCheckout.js +7 -6
  14. package/src/components/{StructureGrantCartTemplate.js → StructureGrantCartInformation.js} +15 -5
  15. package/src/components/StructureGrantCartUserSelector.js +93 -0
  16. package/src/components/StructureGrantDropdown.js +45 -18
  17. package/src/components/StructureGrantRequestAddCart.js +26 -0
  18. package/src/components/StructuresRoutes.js +1 -11
  19. package/src/components/__tests__/EditDomainForm.spec.js +31 -46
  20. package/src/components/__tests__/LineageForm.spec.js +37 -122
  21. package/src/components/__tests__/MyGrantRequests.spec.js +14 -2
  22. package/src/components/__tests__/PendingStructureNoteRow.spec.js +2 -2
  23. package/src/components/__tests__/PendingStructureNotes.spec.js +13 -15
  24. package/src/components/__tests__/{StructureGrantCartTemplate.spec.js → StructureGrantCartInformation.spec.js} +3 -3
  25. package/src/components/__tests__/StructureGrantCartUserSelector.js +21 -0
  26. package/src/components/__tests__/__snapshots__/EditDomainForm.spec.js.snap +2 -71
  27. package/src/components/__tests__/__snapshots__/LineageForm.spec.js.snap +13 -14
  28. package/src/components/__tests__/__snapshots__/MyGrantRequests.spec.js.snap +1 -1
  29. package/src/components/__tests__/__snapshots__/PendingStructureNotes.spec.js.snap +1 -2
  30. package/src/components/__tests__/__snapshots__/PendingStructureNotesTable.spec.js.snap +8 -16
  31. package/src/components/__tests__/__snapshots__/{StructureGrantCartTemplate.spec.js.snap → StructureGrantCartInformation.spec.js.snap} +2 -2
  32. package/src/components/__tests__/__snapshots__/StructureGrantCartUserSelector.js.snap +74 -0
  33. package/src/messages/en.js +3 -1
  34. package/src/messages/es.js +3 -0
  35. package/src/reducers/grantRequestsCart.js +10 -0
  36. package/src/reducers/index.js +0 -2
  37. package/src/routines.js +1 -1
  38. package/src/sagas/index.js +0 -3
  39. package/src/selectors/index.js +0 -1
  40. package/src/reducers/__tests__/unitDomains.spec.js +0 -27
  41. package/src/reducers/unitDomains.js +0 -16
  42. package/src/sagas/__tests__/fetchUnitDomains.spec.js +0 -91
  43. package/src/sagas/fetchUnitDomains.js +0 -29
  44. package/src/selectors/__tests__/getDomainOptions.spec.js +0 -32
  45. package/src/selectors/getDomainOptions.js +0 -17
package/CHANGELOG.md CHANGED
@@ -1,5 +1,18 @@
1
1
  # Changelog
2
2
 
3
+ ## [4.51.4] 2022-09-16
4
+
5
+ ## Added
6
+
7
+ - [TD-5133] Support for creating grant requests for third parties
8
+
9
+ ## [4.51.3] 2022-09-16
10
+
11
+ ### Changed
12
+
13
+ - [TD-4794] Replace `DomainDropdownSelector` and `DomainMenuSelector` with
14
+ common `DomainSelector`
15
+
3
16
  ## [4.50.4] 2022-08-31
4
17
 
5
18
  ### Added
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@truedat/dd",
3
- "version": "4.51.2",
3
+ "version": "4.51.4",
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.4",
35
35
  "@testing-library/react": "^12.0.0",
36
36
  "@testing-library/user-event": "^13.2.1",
37
- "@truedat/test": "4.47.9",
37
+ "@truedat/test": "4.51.4",
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.6.4",
91
- "@truedat/auth": "4.51.2",
92
- "@truedat/core": "4.51.2",
93
- "@truedat/df": "4.51.2",
91
+ "@truedat/auth": "4.51.4",
92
+ "@truedat/core": "4.51.4",
93
+ "@truedat/df": "4.51.4",
94
94
  "lodash": "^4.17.21",
95
95
  "path-to-regexp": "^1.7.0",
96
96
  "prop-types": "^15.8.1",
@@ -112,5 +112,5 @@
112
112
  "react-dom": ">= 16.8.6 < 17",
113
113
  "semantic-ui-react": ">= 0.88.2 < 2.1"
114
114
  },
115
- "gitHead": "9bdc76f3ee59a6e28fb2312e26d0cba2807f069b"
115
+ "gitHead": "d3e3af905c2330f5e4aaeeefc3549acaa19575f7"
116
116
  }
@@ -95,3 +95,27 @@ export const LATEST_GRANT_REQUEST_QUERY = gql`
95
95
  }
96
96
  }
97
97
  `;
98
+
99
+ export const STRUCTURE_NOTES_QUERY = gql`
100
+ query StructureNotes($filter: StructureNotesFilter) {
101
+ structureNotes(filter: $filter) {
102
+ id
103
+ status
104
+ dataStructure {
105
+ id
106
+ currentVersion {
107
+ id
108
+ name
109
+ path
110
+ version
111
+ }
112
+ system {
113
+ name
114
+ }
115
+ domains {
116
+ name
117
+ }
118
+ }
119
+ }
120
+ }
121
+ `;
package/src/api.js CHANGED
@@ -43,7 +43,6 @@ const API_STRUCTURES_UPLOAD_EVENTS =
43
43
  "/api/data_structures/bulk_update_template_content_events";
44
44
  const API_STRUCTURE_NOTE = "/api/data_structures/:data_structure_id/notes/:id";
45
45
  const API_STRUCTURE_NOTES = "/api/data_structures/:data_structure_id/notes";
46
- const API_UNIT_DOMAINS = "/api/unit_domains";
47
46
 
48
47
  export {
49
48
  API_DATA_STRUCTURE,
@@ -88,5 +87,4 @@ export {
88
87
  API_STRUCTURES_UPLOAD_EVENTS,
89
88
  API_STRUCTURE_NOTE,
90
89
  API_STRUCTURE_NOTES,
91
- API_UNIT_DOMAINS,
92
90
  };
@@ -33,10 +33,6 @@ const TemplatesLoader = React.lazy(() =>
33
33
  import("@truedat/df/templates/components/TemplatesLoader")
34
34
  );
35
35
 
36
- const DomainsLoader = React.lazy(() =>
37
- import("@truedat/bg/taxonomy/components/DomainsLoader")
38
- );
39
-
40
36
  const Loaders = () => (
41
37
  <>
42
38
  <StructuresLoader />
@@ -93,7 +89,6 @@ export const DictionaryRoutes = () => {
93
89
  render={() => (
94
90
  <>
95
91
  <SystemsLoader />
96
- <DomainsLoader />
97
92
  <PendingStructureNotes />
98
93
  </>
99
94
  )}
@@ -12,8 +12,7 @@ import { linkTo } from "@truedat/core/routes";
12
12
  import PropTypes from "prop-types";
13
13
  import { useIntl } from "react-intl";
14
14
  import { connect } from "react-redux";
15
- import { DomainMenuSelector } from "@truedat/bg/taxonomy/components/DomainMenuSelector";
16
- import { getDomainSelectorOptions } from "@truedat/bg/taxonomy/selectors";
15
+ import { DomainSelector } from "@truedat/core/components";
17
16
  import { updateStructure } from "../routines";
18
17
 
19
18
  export const EditDomainForm = ({
@@ -21,9 +20,9 @@ export const EditDomainForm = ({
21
20
  title,
22
21
  updateStructure,
23
22
  structure,
24
- domainOptions,
25
23
  }) => {
26
24
  const { formatMessage } = useIntl();
25
+ const [loading, setLoading] = useState(true);
27
26
  const [domainIds, setDomainIds] = useState(structure?.domain_ids || []);
28
27
  const [inherit, setInherit] = useState(true);
29
28
 
@@ -34,23 +33,22 @@ export const EditDomainForm = ({
34
33
  updateStructure({ data_structure, inherit, redirect });
35
34
  };
36
35
 
37
- const handleDomainSelected = (e, { value }) => {
38
- setDomainIds(value);
39
- };
40
-
41
36
  return (
42
37
  <Container style={{ width: "400px" }}>
43
38
  <Header as="h2" content={title} />
44
39
 
45
40
  <Form onSubmit={saving ? null : onSubmit}>
46
- <Segment>
47
- <DomainMenuSelector
48
- domainOptions={domainOptions}
49
- onChange={handleDomainSelected}
41
+ <Segment loading={loading}>
42
+ <DomainSelector
43
+ action="manageStructuresDomain"
44
+ label={formatMessage({ id: "domain.multiple.placeholder" })}
45
+ labels
46
+ multiple
47
+ onChange={(_e, { value }) => setDomainIds(value)}
48
+ onLoad={() => setLoading(false)}
50
49
  value={domainIds}
51
50
  />
52
51
  </Segment>
53
-
54
52
  <Checkbox
55
53
  label={formatMessage({
56
54
  id: "structureDomain.actions.update.inherit",
@@ -66,6 +64,7 @@ export const EditDomainForm = ({
66
64
  type="submit"
67
65
  loading={saving}
68
66
  disabled={
67
+ loading ||
69
68
  saving ||
70
69
  _.isEmpty(domainIds) ||
71
70
  domainIds == [structure?.domain_ids]
@@ -80,19 +79,15 @@ export const EditDomainForm = ({
80
79
  };
81
80
 
82
81
  EditDomainForm.propTypes = {
83
- domainOptions: PropTypes.array,
84
82
  structure: PropTypes.object,
85
83
  updateStructure: PropTypes.func,
86
84
  title: PropTypes.string,
87
85
  saving: PropTypes.bool,
88
86
  };
89
87
 
90
- const mapStateToProps = (state) => {
91
- return {
92
- structure: _.pick(["id", "domain_ids"])(state.structure),
93
- saving: state.structureUpdating,
94
- domainOptions: getDomainSelectorOptions(state),
95
- };
96
- };
88
+ const mapStateToProps = ({ structure, structureUpdating }) => ({
89
+ structure: _.pick(["id", "domain_ids"])(structure),
90
+ saving: structureUpdating,
91
+ });
97
92
 
98
93
  export default connect(mapStateToProps, { updateStructure })(EditDomainForm);
@@ -30,6 +30,8 @@ export const GrantRequest = ({ grantRequest, template }) => {
30
30
  )(data_structure?.path);
31
31
  const rows = grantRequest?.filters?.rows;
32
32
  const user = grantRequest?._embedded?.group?._embedded?.user?.user_name;
33
+ const createdBy =
34
+ grantRequest?._embedded?.group?._embedded?.created_by?.user_name;
33
35
  return (
34
36
  <>
35
37
  <GrantRequestCrumbs
@@ -75,6 +77,16 @@ export const GrantRequest = ({ grantRequest, template }) => {
75
77
  </List.Description>
76
78
  </List.Item>
77
79
  )}
80
+ {createdBy && createdBy !== user && (
81
+ <List.Item>
82
+ <List.Header>
83
+ {formatMessage({ id: "grantRequest.header.createdBy" })}
84
+ </List.Header>
85
+ <List.Description>
86
+ <Label>{createdBy}</Label>
87
+ </List.Description>
88
+ </List.Item>
89
+ )}
78
90
  <List.Item>
79
91
  <List.Header>
80
92
  {formatMessage({ id: "grantRequest.header.status" })}
@@ -15,6 +15,7 @@ export const GrantRequests = ({
15
15
  }) => {
16
16
  const { formatMessage } = useIntl();
17
17
  const history = useHistory();
18
+
18
19
  return (
19
20
  <Segment attached="bottom">
20
21
  {!_.isEmpty(grantRequests) && (
@@ -36,21 +37,29 @@ export const GrantRequests = ({
36
37
  </Table.Row>
37
38
  </Table.Header>
38
39
  <Table.Body>
39
- {grantRequests.map((grantRequest, i) => (
40
- <Table.Row key={i}>
41
- {columns &&
42
- columns.map((column, key) => (
43
- <Table.Cell
44
- key={key}
45
- textAlign={column.textAlign}
46
- onClick={() =>
47
- history.push(linkTo.GRANT_REQUEST(grantRequest))
48
- }
49
- content={columnDecoratorComponent(column)(grantRequest)}
50
- />
51
- ))}
52
- </Table.Row>
53
- ))}
40
+ {grantRequests.map((grantRequest, i) => {
41
+ const createdById = _.path("_embedded.group.created_by_id")(
42
+ grantRequest
43
+ );
44
+ const userId = _.path("_embedded.group._embedded.user.id")(
45
+ grantRequest
46
+ );
47
+ return (
48
+ <Table.Row key={i} warning={createdById !== userId}>
49
+ {columns &&
50
+ columns.map((column, key) => (
51
+ <Table.Cell
52
+ key={key}
53
+ textAlign={column.textAlign}
54
+ onClick={() =>
55
+ history.push(linkTo.GRANT_REQUEST(grantRequest))
56
+ }
57
+ content={columnDecoratorComponent(column)(grantRequest)}
58
+ />
59
+ ))}
60
+ </Table.Row>
61
+ );
62
+ })}
54
63
  </Table.Body>
55
64
  </Table>
56
65
  )}
@@ -11,16 +11,15 @@ import {
11
11
  Header,
12
12
  Button,
13
13
  } from "semantic-ui-react";
14
+ import { DomainSelector } from "@truedat/core/components";
14
15
  import {
15
16
  clearNodes,
16
17
  selectGroup,
17
18
  fetchNodes,
18
- fetchUnitDomains,
19
19
  createGraph,
20
20
  selectResources,
21
21
  } from "../routines";
22
22
  import {
23
- getDomainOptions,
24
23
  groupOptionsSelector,
25
24
  resourceOptionsSelector,
26
25
  levelsSelection,
@@ -28,17 +27,10 @@ import {
28
27
  } from "../selectors";
29
28
  import LineageDownloadButton from "./LineageDownloadButton";
30
29
 
31
- const DomainDropdownSelector = React.lazy(() =>
32
- import("@truedat/bg/taxonomy/components/DomainDropdownSelector")
33
- );
34
-
35
30
  export const LineageForm = ({
36
- domain,
37
- domainOptions,
38
31
  createGraph,
39
32
  clearNodes,
40
33
  fetchNodes,
41
- fetchUnitDomains,
42
34
  graph,
43
35
  graphLoading,
44
36
  groupOptions,
@@ -51,6 +43,7 @@ export const LineageForm = ({
51
43
  selectedGroups,
52
44
  selectedResources,
53
45
  }) => {
46
+ const [domainId, setDomainId] = useState(null);
54
47
  const [open, setOpen] = useState(true);
55
48
  const [selectLevels, setSelectLevels] = useState(levelsSelection);
56
49
  const [levels, setLevels] = useState(lineageLevels);
@@ -67,11 +60,8 @@ export const LineageForm = ({
67
60
  selectLevels === "all" && setLevels();
68
61
  }, [selectLevels]);
69
62
  useEffect(() => {
70
- _.isEmpty(groupOptions) && fetchUnitDomains();
71
- }, [fetchUnitDomains, groupOptions]);
72
- useEffect(() => {
73
- domain && _.isEmpty(groupOptions) && fetchNodes({ domain_id: domain.id });
74
- }, [domain, fetchNodes, groupOptions]);
63
+ domainId && _.isEmpty(groupOptions) && fetchNodes({ domain_id: domainId });
64
+ }, [domainId, fetchNodes, groupOptions]);
75
65
  useEffect(() => {
76
66
  return () => {
77
67
  clearNodes();
@@ -86,11 +76,15 @@ export const LineageForm = ({
86
76
  _.isInteger(intValue) && setLevels(intValue);
87
77
  _.isEmpty(value) && setLevels();
88
78
  };
89
- const onDomainChange = (e, { value }) => {
79
+
80
+ const handleDomainChange = (e, { value }) => {
90
81
  e && e.preventDefault();
91
82
  e && e.stopPropagation();
92
- _.isNumber(value) && fetchNodes({ domain_id: value });
93
- _.isString(value) && _.isEmpty(value) && clearNodes();
83
+ if (_.isEmpty(value)) {
84
+ clearNodes();
85
+ } else {
86
+ fetchNodes({ domain_id: value });
87
+ }
94
88
  };
95
89
 
96
90
  const handleKeyDown = (e) => {
@@ -99,6 +93,12 @@ export const LineageForm = ({
99
93
  }
100
94
  };
101
95
 
96
+ const handleDomainsLoaded = ({ domains }) => {
97
+ if (domains?.length == 1) {
98
+ setDomainId(domains[0].id);
99
+ }
100
+ };
101
+
102
102
  return (
103
103
  <Segment>
104
104
  <Accordion>
@@ -117,13 +117,12 @@ export const LineageForm = ({
117
117
  </Accordion.Title>
118
118
  <Accordion.Content active={open}>
119
119
  <Form size="small" loading={loading}>
120
- {!domain && (
121
- <DomainDropdownSelector
122
- domainOptions={domainOptions}
123
- hideLabel
124
- onChange={onDomainChange}
125
- />
126
- )}
120
+ <DomainSelector
121
+ action="viewLineage"
122
+ labels
123
+ onChange={handleDomainChange}
124
+ onLoad={handleDomainsLoaded}
125
+ />
127
126
  {_.map.convert({ cap: false })((options, level) => (
128
127
  <Form.Dropdown
129
128
  key={level}
@@ -254,12 +253,9 @@ export const LineageForm = ({
254
253
  };
255
254
 
256
255
  LineageForm.propTypes = {
257
- domain: PropTypes.object,
258
- domainOptions: PropTypes.array,
259
256
  clearNodes: PropTypes.func.isRequired,
260
257
  createGraph: PropTypes.func.isRequired,
261
258
  fetchNodes: PropTypes.func,
262
- fetchUnitDomains: PropTypes.func,
263
259
  graph: PropTypes.object,
264
260
  graphLoading: PropTypes.bool,
265
261
  groupOptions: PropTypes.array,
@@ -273,13 +269,7 @@ LineageForm.propTypes = {
273
269
  selectedResources: PropTypes.array,
274
270
  };
275
271
 
276
- const getDefaultDomain = (domains) => {
277
- const filtered = _.filter((d) => !_.isNil(d.unit))(domains);
278
- return _.size(filtered) == 1 && _.head(filtered);
279
- };
280
272
  const mapStateToProps = (state) => ({
281
- domain: getDefaultDomain(state.unitDomains),
282
- domainOptions: getDomainOptions(state),
283
273
  groupOptions: groupOptionsSelector(state),
284
274
  resourceOptions: resourceOptionsSelector(state),
285
275
  levelsSelection: levelsSelection(state),
@@ -295,7 +285,6 @@ export default connect(mapStateToProps, {
295
285
  clearNodes,
296
286
  createGraph,
297
287
  fetchNodes,
298
- fetchUnitDomains,
299
288
  selectGroup,
300
289
  selectResources,
301
290
  })(LineageForm);
@@ -9,15 +9,12 @@ import { linkTo } from "@truedat/core/routes";
9
9
  const PendingStructureNoteRow = ({ structureNote }) => {
10
10
  const { formatMessage } = useIntl();
11
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);
12
+ const dataStructure = structureNote?.dataStructure;
13
+ const path = _.propOr([], "dataStructure.currentVersion.path")(structureNote);
14
+ const name = dataStructure?.currentVersion?.name;
15
+ const system = dataStructure?.system?.name;
19
16
  const domainsNames = _.flow(
20
- _.prop("data_structure.domains"),
17
+ _.prop("dataStructure.domains"),
21
18
  _.map("name")
22
19
  )(structureNote);
23
20
 
@@ -3,51 +3,26 @@ import React, { useState } from "react";
3
3
  import PropTypes from "prop-types";
4
4
  import { connect } from "react-redux";
5
5
  import { FormattedMessage, useIntl } from "react-intl";
6
- import { gql, useQuery } from "@apollo/client";
6
+ import { useQuery } from "@apollo/client";
7
7
  import { Checkbox, Form, Header, Icon, Segment } from "semantic-ui-react";
8
8
  import { useForm, Controller } from "react-hook-form";
9
+ import { DomainSelector } from "@truedat/core/components";
10
+ import { STRUCTURE_NOTES_QUERY } from "../api/queries";
9
11
  import PendingStructureNotesTable from "./PendingStructureNotesTable";
10
12
 
11
- const DomainDropdownSelector = React.lazy(() =>
12
- import("@truedat/bg/taxonomy/components/DomainDropdownSelector")
13
- );
14
-
15
- export const STRUCTURE_NOTES = gql`
16
- query STRUCTURE_NOTES($filter: StructureNotesFilter) {
17
- structure_notes(filter: $filter) {
18
- id
19
- status
20
- data_structure {
21
- id
22
- current_version {
23
- id
24
- name
25
- path
26
- version
27
- }
28
- system {
29
- name
30
- }
31
- domains {
32
- name
33
- }
34
- }
35
- }
36
- }
37
- `;
38
-
39
13
  const STATUS = ["pending_approval", "draft", "rejected"];
40
14
 
41
15
  export const PendingStructureNotes = ({ systems }) => {
42
16
  const { formatMessage } = useIntl();
17
+ const [domainsLoading, setDomainsLoading] = useState(true);
43
18
  const [filter, setFilter] = useState({
44
19
  statuses: STATUS,
45
20
  });
46
- const { loading, error, data } = useQuery(STRUCTURE_NOTES, {
21
+ const { loading, error, data } = useQuery(STRUCTURE_NOTES_QUERY, {
47
22
  variables: { filter },
48
23
  fetchPolicy: "cache-and-network",
49
24
  });
50
- const items = loading || error ? [] : data?.structure_notes;
25
+ const items = loading || error ? [] : data?.structureNotes;
51
26
  const { control } = useForm({
52
27
  mode: "all",
53
28
  defaultValues: {
@@ -66,7 +41,7 @@ export const PendingStructureNotes = ({ systems }) => {
66
41
  </Header.Subheader>
67
42
  </Header.Content>
68
43
  </Header>
69
- <Form>
44
+ <Form loading={domainsLoading}>
70
45
  <Header
71
46
  as="h5"
72
47
  content={formatMessage({ id: "pendingStructureNotes.filters" })}
@@ -104,6 +79,24 @@ export const PendingStructureNotes = ({ systems }) => {
104
79
  </Form.Field>
105
80
  )}
106
81
  />
82
+ <Controller
83
+ control={control}
84
+ name="domain_ids"
85
+ render={({ field: { onChange, value } }) => (
86
+ <DomainSelector
87
+ label={formatMessage({ id: "domain.selector.label" })}
88
+ labels
89
+ action="publishStructureNote"
90
+ value={value}
91
+ onChange={(_e, { value }) => {
92
+ const domain_ids = _.isEmpty(value) ? [] : [value];
93
+ setFilter({ ...filter, domain_ids });
94
+ onChange(value);
95
+ }}
96
+ onLoad={() => setDomainsLoading(false)}
97
+ />
98
+ )}
99
+ />
107
100
  <Controller
108
101
  control={control}
109
102
  name="system_ids"
@@ -129,20 +122,6 @@ export const PendingStructureNotes = ({ systems }) => {
129
122
  />
130
123
  )}
131
124
  />
132
- <Controller
133
- control={control}
134
- name="domain_ids"
135
- render={({ field: { onChange, value } }) => (
136
- <DomainDropdownSelector
137
- value={value}
138
- onChange={(_e, { value }) => {
139
- const domain_ids = _.isNumber(value) ? [value] : [];
140
- setFilter({ ...filter, domain_ids });
141
- onChange(value);
142
- }}
143
- />
144
- )}
145
- />
146
125
  </Form>
147
126
  <PendingStructureNotesTable structureNotes={items} loading={loading} />
148
127
  </Segment>
@@ -1,67 +1,56 @@
1
1
  import _ from "lodash/fp";
2
2
  import React from "react";
3
3
  import PropTypes from "prop-types";
4
- import { FormattedMessage } from "react-intl";
4
+ import { FormattedMessage, useIntl } from "react-intl";
5
5
  import { Table, Header, Icon } from "semantic-ui-react";
6
6
  import PendingStructureNoteRow from "./PendingStructureNoteRow";
7
7
 
8
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
- </>
9
+ const { formatMessage } = useIntl();
10
+ return loading ? null : _.isEmpty(structureNotes) ? (
11
+ <Header as="h4">
12
+ <Icon name="search" />
13
+ <Header.Content>
14
+ <FormattedMessage id="pendingStructureNotes.search.results.empty" />
15
+ </Header.Content>
16
+ </Header>
17
+ ) : (
18
+ <Table selectable>
19
+ <Table.Header>
20
+ <Table.Row>
21
+ <Table.HeaderCell
22
+ content={formatMessage({
23
+ id: "pendingStructureNotes.props.structure",
24
+ })}
25
+ />
26
+ <Table.HeaderCell
27
+ content={formatMessage({
28
+ id: "pendingStructureNotes.props.status",
29
+ })}
30
+ />
31
+ <Table.HeaderCell
32
+ content={formatMessage({
33
+ id: "pendingStructureNotes.props.system",
34
+ })}
35
+ />
36
+ <Table.HeaderCell
37
+ content={formatMessage({
38
+ id: "pendingStructureNotes.props.domains",
39
+ })}
40
+ />
41
+ <Table.HeaderCell
42
+ content={formatMessage({
43
+ id: "pendingStructureNotes.props.path",
44
+ })}
45
+ />
46
+ </Table.Row>
47
+ </Table.Header>
48
+ <Table.Body>
49
+ {structureNotes.map((structureNote, key) => (
50
+ <PendingStructureNoteRow key={key} structureNote={structureNote} />
51
+ ))}
52
+ </Table.Body>
53
+ </Table>
65
54
  );
66
55
  };
67
56