@truedat/dd 4.41.0 → 4.41.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Changelog
2
2
 
3
+ ## [4.41.1] 2022-03-25
4
+
5
+ ### Changed
6
+
7
+ - [TD-4617] Use domainMenuSelector on editDomainForm
8
+
3
9
  ## [4.41.0] 2022-03-25
4
10
 
5
11
  ### Added
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@truedat/dd",
3
- "version": "4.41.0",
3
+ "version": "4.41.1",
4
4
  "description": "Truedat Web Data Dictionary",
5
5
  "sideEffects": false,
6
6
  "jsnext:main": "src/index.js",
@@ -34,7 +34,7 @@
34
34
  "@testing-library/jest-dom": "^5.14.1",
35
35
  "@testing-library/react": "^12.0.0",
36
36
  "@testing-library/user-event": "^13.2.1",
37
- "@truedat/test": "4.41.0",
37
+ "@truedat/test": "4.41.1",
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.41.0",
88
- "@truedat/core": "4.41.0",
89
- "@truedat/df": "4.41.0",
87
+ "@truedat/auth": "4.41.1",
88
+ "@truedat/core": "4.41.1",
89
+ "@truedat/df": "4.41.1",
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": "f4d8bc5e536b847c7b562a84bfa70955a93166ea"
110
+ "gitHead": "6e19abfaa3541bfad20ea093e6666cbdbecf7b55"
111
111
  }
@@ -1,11 +1,19 @@
1
1
  import _ from "lodash/fp";
2
2
  import React, { useState } from "react";
3
- import { Button, Checkbox, Container, Form, Header } from "semantic-ui-react";
4
- import { DomainDropdownSelector } from "@truedat/bg/components";
3
+ import {
4
+ Button,
5
+ Checkbox,
6
+ Container,
7
+ Form,
8
+ Header,
9
+ Segment,
10
+ } from "semantic-ui-react";
5
11
  import { linkTo } from "@truedat/core/routes";
6
12
  import PropTypes from "prop-types";
7
13
  import { useIntl } from "react-intl";
8
14
  import { connect } from "react-redux";
15
+ import { DomainMenuSelector } from "@truedat/bg/taxonomy/components/DomainMenuSelector";
16
+ import { getDomainSelectorOptions } from "@truedat/bg/taxonomy/selectors";
9
17
  import { updateStructure } from "../routines";
10
18
 
11
19
  export const EditDomainForm = ({
@@ -13,6 +21,7 @@ export const EditDomainForm = ({
13
21
  title,
14
22
  updateStructure,
15
23
  structure,
24
+ domainOptions,
16
25
  }) => {
17
26
  const { formatMessage } = useIntl();
18
27
  const [domainIds, setDomainIds] = useState(structure?.domain_ids || []);
@@ -32,26 +41,26 @@ export const EditDomainForm = ({
32
41
  return (
33
42
  <Container style={{ width: "400px" }}>
34
43
  <Header as="h2" content={title} />
35
- <DomainDropdownSelector
36
- clearable={false}
37
- multiple={true}
38
- onChange={handleDomainSelected}
39
- name="domain"
40
- value={domainIds}
41
- />
42
-
43
- <Checkbox
44
- label={formatMessage({
45
- id: "structureDomain.actions.update.inherit",
46
- })}
47
- checked={inherit}
48
- onChange={(e) => {
49
- setInherit(!inherit);
50
- e.preventDefault();
51
- }}
52
- />
53
44
 
54
45
  <Form onSubmit={saving ? null : onSubmit}>
46
+ <Segment>
47
+ <DomainMenuSelector
48
+ domainOptions={domainOptions}
49
+ onChange={handleDomainSelected}
50
+ value={domainIds}
51
+ />
52
+ </Segment>
53
+
54
+ <Checkbox
55
+ label={formatMessage({
56
+ id: "structureDomain.actions.update.inherit",
57
+ })}
58
+ checked={inherit}
59
+ onChange={(e) => {
60
+ setInherit(!inherit);
61
+ e.preventDefault();
62
+ }}
63
+ />
55
64
  <div className="actions">
56
65
  <Button
57
66
  type="submit"
@@ -71,15 +80,19 @@ export const EditDomainForm = ({
71
80
  };
72
81
 
73
82
  EditDomainForm.propTypes = {
83
+ domainOptions: PropTypes.array,
74
84
  structure: PropTypes.object,
75
85
  updateStructure: PropTypes.func,
76
86
  title: PropTypes.string,
77
87
  saving: PropTypes.bool,
78
88
  };
79
89
 
80
- const mapStateToProps = (state) => ({
81
- structure: _.pick(["id", "domain_ids"])(state.structure),
82
- saving: state.structureUpdating,
83
- });
90
+ const mapStateToProps = (state) => {
91
+ return {
92
+ structure: _.pick(["id", "domain_ids"])(state.structure),
93
+ saving: state.structureUpdating,
94
+ domainOptions: getDomainSelectorOptions(state),
95
+ };
96
+ };
84
97
 
85
98
  export default connect(mapStateToProps, { updateStructure })(EditDomainForm);
@@ -18,7 +18,9 @@ export const StructuresDomainsUploadOption = ({
18
18
  trigger={
19
19
  <Dropdown.Item
20
20
  icon="upload"
21
- text={formatMessage({ id: "structures.actions.uploadDomains.tooltip" })}
21
+ text={formatMessage({
22
+ id: "structures.actions.uploadDomains.tooltip",
23
+ })}
22
24
  disabled={loading}
23
25
  />
24
26
  }
@@ -20,6 +20,7 @@ describe("<EditDomainForm />", () => {
20
20
  title: "title",
21
21
  updateStructure,
22
22
  structure,
23
+ domainOptions: domains,
23
24
  };
24
25
 
25
26
  const messages = {
@@ -29,6 +30,7 @@ describe("<EditDomainForm />", () => {
29
30
  "structureDomain.actions.update.inherit": "Apply on children",
30
31
  "domain.selector.label": "Domain",
31
32
  "domain.selector.placeholder": "Select a domain...",
33
+ "domain.multiple.placeholder": "Select domains ...",
32
34
  },
33
35
  };
34
36
 
@@ -11,107 +11,96 @@ exports[`<EditDomainForm /> matches the latest snapshot 1`] = `
11
11
  >
12
12
  title
13
13
  </h2>
14
- <div
15
- class="required field"
14
+ <form
15
+ class="ui form"
16
16
  >
17
- <label>
18
- Domain
19
- </label>
20
17
  <div
21
- class="field"
18
+ class="ui segment"
22
19
  >
23
20
  <div
24
- aria-expanded="false"
25
- class="ui fluid multiple search selection dropdown"
26
- name="domain"
27
- role="combobox"
21
+ class="field"
28
22
  >
29
- <input
30
- aria-autocomplete="list"
31
- autocomplete="off"
32
- class="search"
33
- tabindex="0"
34
- type="text"
35
- value=""
36
- />
37
- <span
38
- class="sizer"
39
- />
40
- <div
41
- aria-atomic="true"
42
- aria-live="polite"
43
- class="divider default text"
44
- role="alert"
45
- >
46
- Select a domain...
47
- </div>
48
- <i
49
- aria-hidden="true"
50
- class="dropdown icon"
51
- />
52
23
  <div
24
+ aria-expanded="false"
53
25
  aria-multiselectable="true"
54
- class="menu transition"
26
+ class="ui floating multiple dropdown"
55
27
  role="listbox"
28
+ tabindex="0"
56
29
  >
30
+ <label>
31
+ Select domains ...
32
+ </label>
33
+ <i
34
+ aria-hidden="true"
35
+ class="dropdown icon"
36
+ />
57
37
  <div
58
- aria-checked="false"
59
- aria-selected="true"
60
- class="selected item"
61
- role="option"
62
- style="pointer-events: all;"
38
+ class="menu transition"
63
39
  >
64
40
  <div
65
- class="text"
66
- style="margin-left: 0px;"
41
+ class="ui left icon input search"
67
42
  >
43
+ <input
44
+ type="text"
45
+ />
68
46
  <i
69
47
  aria-hidden="true"
70
- class="icon"
48
+ class="search icon"
71
49
  />
72
- Domain 1
73
50
  </div>
74
- </div>
75
- <div
76
- aria-checked="false"
77
- aria-selected="false"
78
- class="item"
79
- role="option"
80
- style="pointer-events: all;"
81
- >
82
51
  <div
83
- class="text"
84
- style="margin-left: 0px;"
52
+ class="scrolling menu transition"
85
53
  >
86
- <i
87
- aria-hidden="true"
88
- class="icon"
89
- />
90
- Domain 2
54
+ <div
55
+ aria-selected="false"
56
+ class="item"
57
+ role="option"
58
+ >
59
+ <div
60
+ style="margin-left: 0px;"
61
+ >
62
+ <i
63
+ aria-hidden="true"
64
+ class="icon"
65
+ />
66
+ Domain 1
67
+ </div>
68
+ </div>
69
+ <div
70
+ aria-selected="false"
71
+ class="item"
72
+ role="option"
73
+ >
74
+ <div
75
+ style="margin-left: 0px;"
76
+ >
77
+ <i
78
+ aria-hidden="true"
79
+ class="icon"
80
+ />
81
+ Domain 2
82
+ </div>
83
+ </div>
91
84
  </div>
92
85
  </div>
93
86
  </div>
94
87
  </div>
95
88
  </div>
96
- </div>
97
- <div
98
- class="ui checked checkbox"
99
- >
100
- <input
101
- checked=""
102
- class="hidden"
103
- readonly=""
104
- tabindex="0"
105
- type="checkbox"
106
- value=""
107
- />
108
- <label>
109
- Apply on children
110
- </label>
111
- </div>
112
- <form
113
- class="ui form"
114
- >
89
+ <div
90
+ class="ui checked checkbox"
91
+ >
92
+ <input
93
+ checked=""
94
+ class="hidden"
95
+ readonly=""
96
+ tabindex="0"
97
+ type="checkbox"
98
+ value=""
99
+ />
100
+ <label>
101
+ Apply on children
102
+ </label>
103
+ </div>
115
104
  <div
116
105
  class="actions"
117
106
  >
@@ -17,7 +17,8 @@ describe("reducers: ddMessage", () => {
17
17
  data: {
18
18
  errors: [
19
19
  {
20
- external_id: "postgres://Postgres-Test/postgres/public/city/city_id",
20
+ external_id:
21
+ "postgres://Postgres-Test/postgres/public/city/city_id",
21
22
  message: {
22
23
  external_domain_ids: ["must exist: UEUEUEU"],
23
24
  },
@@ -42,7 +43,7 @@ describe("reducers: ddMessage", () => {
42
43
  header: "structures.bulkUploadStructuresDomains.success.header",
43
44
  icon: "check",
44
45
  color: "orange",
45
- fields: { count_errors: 2, count_ids: 1}
46
+ fields: { count_errors: 2, count_ids: 1 },
46
47
  });
47
48
  const { messages: errors } = ddMsg;
48
49
  expect(errors.length).toEqual(2);
@@ -69,8 +70,4 @@ describe("reducers: ddMessage", () => {
69
70
  content: "invalid_headers, must be: external_id, domain_external_ids",
70
71
  });
71
72
  });
72
-
73
-
74
-
75
-
76
73
  });
package/src/routines.js CHANGED
@@ -132,7 +132,9 @@ export const updateStructureTag = createRoutine("UPDATE_STRUCTURE_TAG");
132
132
  export const updateStructureType = createRoutine("UPDATE_STRUCTURE_TYPE");
133
133
  export const updateSystem = createRoutine("UPDATE_SYSTEM");
134
134
  export const uploadStructures = createRoutine("UPLOAD_STRUCTURES");
135
- export const uploadStructuresDomains = createRoutine("UPLOAD_STRUCTURES_DOMAINS");
135
+ export const uploadStructuresDomains = createRoutine(
136
+ "UPLOAD_STRUCTURES_DOMAINS"
137
+ );
136
138
  export const addGrantRequestToCart = createRoutine("ADD_GRANT_REQUEST_TO_CART");
137
139
  export const removeGrantRequestFromCart = createRoutine(
138
140
  "REMOVE_GRANT_REQUEST_FROM_CART"