@truedat/bg 4.30.4 → 4.30.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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Changelog
2
2
 
3
+ ## [Unreleased]
4
+
5
+ ### Fixed
6
+
7
+ - [TD-3874] Allow rule creation specifying domain for shared concepts
8
+
3
9
  ## [4.30.4] 2021-10-07
4
10
 
5
11
  ### Changed
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@truedat/bg",
3
- "version": "4.30.4",
3
+ "version": "4.30.6",
4
4
  "description": "Truedat Web Business Glossary",
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.30.4",
37
+ "@truedat/test": "4.30.6",
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",
@@ -81,8 +81,8 @@
81
81
  ]
82
82
  },
83
83
  "dependencies": {
84
- "@truedat/core": "4.30.4",
85
- "@truedat/df": "4.30.4",
84
+ "@truedat/core": "4.30.6",
85
+ "@truedat/df": "4.30.6",
86
86
  "file-saver": "^2.0.5",
87
87
  "moment": "^2.24.0",
88
88
  "path-to-regexp": "^1.7.0",
@@ -102,5 +102,5 @@
102
102
  "react-dom": ">= 16.8.6 < 17",
103
103
  "semantic-ui-react": ">= 0.88.2 < 2.1"
104
104
  },
105
- "gitHead": "2e189ae67285367f4e5870566cdd5b2e217729c0"
105
+ "gitHead": "f23b3cf877ac9383f2e638ddcd685d173ac6142a"
106
106
  }
@@ -75,9 +75,7 @@ SharedToForm.propTypes = {
75
75
  };
76
76
 
77
77
  const mapStateToProps = (state) => ({
78
- domainOptions: getDomainSelectorOptions({
79
- domains: _.pathOr([], "domainsByActions.*")(state),
80
- }),
78
+ domainOptions: getDomainSelectorOptions(state),
81
79
  id: state.concept.business_concept_id,
82
80
  saving: state.savingSharedTo,
83
81
  sharedTo: state.sharedToDomains,
@@ -49,9 +49,11 @@ export const DomainDropdownSelector = ({
49
49
  useEffect(() => {
50
50
  if (_.size(options) === 1) {
51
51
  const firstValue = _.first(options).id;
52
- handleChange({ preventDefault: () => {} }, { value: firstValue });
52
+ if (value !== firstValue) {
53
+ handleChange({ preventDefault: () => {} }, { value: firstValue });
54
+ }
53
55
  }
54
- }, [defaultValue, options]);
56
+ }, [options]);
55
57
 
56
58
  useEffect(() => {
57
59
  const option = _.find({ id: value })(options);
@@ -185,13 +187,7 @@ DomainDropdownSelector.propTypes = {
185
187
  const mapStateToProps = (state, props) => ({
186
188
  domainOptions: _.flow(
187
189
  _.prop("domainOptions"),
188
- _.defaultTo(
189
- props.scope
190
- ? getDomainSelectorOptions({
191
- domains: _.pathOr([], "domainsByActions." + props.scope)(state),
192
- })
193
- : getDomainSelectorOptions(state)
194
- )
190
+ _.defaultTo(getDomainSelectorOptions(state))
195
191
  )(props),
196
192
  });
197
193
 
@@ -15,7 +15,6 @@ import { domainsActions } from "./domainsActions";
15
15
  import { domainsFilter } from "./domainsFilter";
16
16
  import { domainsLoading } from "./domainsLoading";
17
17
  import { domainUpdating } from "./domainUpdating";
18
- import { domainsByActions } from "./domainsByActions";
19
18
 
20
19
  export {
21
20
  domain,
@@ -35,5 +34,4 @@ export {
35
34
  domainsFilter,
36
35
  domainsLoading,
37
36
  domainUpdating,
38
- domainsByActions,
39
37
  };
@@ -1,49 +0,0 @@
1
- import { fetchDomains } from "../../routines";
2
- import { domainsByActions } from "..";
3
-
4
- const fooState = { foo: "bar" };
5
-
6
- describe("reducers: domainsByActions", () => {
7
- const initialState = {};
8
-
9
- it("should provide the initial state", () => {
10
- expect(domainsByActions(undefined, {})).toEqual(initialState);
11
- });
12
-
13
- it("should handle the SUCCESS action", () => {
14
- const data = [
15
- { id: 1, name: "Domain 1", description: "Desc 1" },
16
- { id: 2, name: "Domain 2", description: "Desc 2", parent_id: 1 },
17
- ];
18
- const actions = "manage_cool_things";
19
-
20
- expect(
21
- domainsByActions(fooState, {
22
- type: fetchDomains.SUCCESS,
23
- payload: { data: { data }, actions },
24
- })
25
- ).toMatchObject({
26
- manage_cool_things: data,
27
- });
28
- });
29
-
30
- it("should handle the SUCCESS action without specific permission", () => {
31
- const data = [
32
- { id: 1, name: "Domain 1", description: "Desc 1" },
33
- { id: 2, name: "Domain 2", description: "Desc 2", parent_id: 1 },
34
- ];
35
-
36
- expect(
37
- domainsByActions(fooState, {
38
- type: fetchDomains.SUCCESS,
39
- payload: { data: { data } },
40
- })
41
- ).toMatchObject({
42
- "*": data,
43
- });
44
- });
45
-
46
- it("should ignore unknown actions", () => {
47
- expect(domainsByActions(fooState, { type: "FOO" })).toBe(fooState);
48
- });
49
- });
@@ -1,22 +0,0 @@
1
- import _ from "lodash/fp";
2
- import { fetchDomains, clearDomains } from "../routines";
3
-
4
- const initialState = {};
5
-
6
- const caseInsensitiveName = ({ name }) => _.toLower(name);
7
-
8
- export const domainsByActions = (state = initialState, { type, payload }) => {
9
- switch (type) {
10
- case fetchDomains.SUCCESS:
11
- const { data, actions } = payload;
12
- const collection = _.prop("data")(data);
13
- return _.set(
14
- actions ? actions : "*",
15
- _.sortBy(caseInsensitiveName)(collection)
16
- )(state);
17
- case clearDomains.TRIGGER:
18
- return initialState;
19
- default:
20
- return state;
21
- }
22
- };