@truedat/bg 4.30.1 → 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 +12 -0
- package/package.json +5 -5
- package/src/taxonomy/components/DomainDropdownSelector.js +9 -0
- package/src/taxonomy/reducers/__tests__/domains.spec.js +2 -2
- package/src/taxonomy/reducers/__tests__/domainsActions.spec.js +1 -1
- package/src/taxonomy/reducers/domains.js +2 -1
- package/src/taxonomy/reducers/domainsActions.js +2 -1
- package/src/taxonomy/reducers/index.js +1 -1
- package/src/taxonomy/sagas/__tests__/fetchDomains.spec.js +5 -4
- package/src/taxonomy/sagas/fetchDomains.js +5 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [Unreleased]
|
|
4
|
+
|
|
5
|
+
### Fixed
|
|
6
|
+
|
|
7
|
+
- [TD-3874] Allow rule creation specifying domain for shared concepts
|
|
8
|
+
|
|
9
|
+
## [4.30.4] 2021-10-07
|
|
10
|
+
|
|
11
|
+
### Changed
|
|
12
|
+
|
|
13
|
+
- [TD-3874] Allow rule creation specifying domain for shared concepts
|
|
14
|
+
|
|
3
15
|
## [4.30.0] 2021-10-06
|
|
4
16
|
|
|
5
17
|
### Changed
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@truedat/bg",
|
|
3
|
-
"version": "4.30.
|
|
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.
|
|
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.
|
|
85
|
-
"@truedat/df": "4.30.
|
|
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": "
|
|
105
|
+
"gitHead": "f23b3cf877ac9383f2e638ddcd685d173ac6142a"
|
|
106
106
|
}
|
|
@@ -46,6 +46,15 @@ export const DomainDropdownSelector = ({
|
|
|
46
46
|
const [value, setValue] = useState(defaultValue);
|
|
47
47
|
const { formatMessage } = useIntl();
|
|
48
48
|
|
|
49
|
+
useEffect(() => {
|
|
50
|
+
if (_.size(options) === 1) {
|
|
51
|
+
const firstValue = _.first(options).id;
|
|
52
|
+
if (value !== firstValue) {
|
|
53
|
+
handleChange({ preventDefault: () => {} }, { value: firstValue });
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}, [options]);
|
|
57
|
+
|
|
49
58
|
useEffect(() => {
|
|
50
59
|
const option = _.find({ id: value })(options);
|
|
51
60
|
if (!_.isNil(option)) {
|
|
@@ -13,13 +13,13 @@ describe("reducers: domains", () => {
|
|
|
13
13
|
it("should handle the SUCCESS action", () => {
|
|
14
14
|
const data = [
|
|
15
15
|
{ id: 1, name: "Domain 1", description: "Desc 1" },
|
|
16
|
-
{ id: 2, name: "Domain 2", description: "Desc 2", parent_id: 1 }
|
|
16
|
+
{ id: 2, name: "Domain 2", description: "Desc 2", parent_id: 1 },
|
|
17
17
|
];
|
|
18
18
|
|
|
19
19
|
expect(
|
|
20
20
|
domains(fooState, {
|
|
21
21
|
type: fetchDomains.SUCCESS,
|
|
22
|
-
payload: { data }
|
|
22
|
+
payload: { data: { data } },
|
|
23
23
|
})
|
|
24
24
|
).toMatchObject(data);
|
|
25
25
|
});
|
|
@@ -16,7 +16,7 @@ describe("reducers: domainsActions", () => {
|
|
|
16
16
|
|
|
17
17
|
it("should extract _actions from the fetchDomains.SUCCESS action", () => {
|
|
18
18
|
const _actions = { delete: { foo: "bar" } };
|
|
19
|
-
const payload = { _actions };
|
|
19
|
+
const payload = { data: { _actions: _actions } };
|
|
20
20
|
expect(
|
|
21
21
|
domainsActions(fooState, { type: fetchDomains.SUCCESS, payload })
|
|
22
22
|
).toMatchObject(_actions);
|
|
@@ -8,7 +8,8 @@ const caseInsensitiveName = ({ name }) => _.toLower(name);
|
|
|
8
8
|
export const domains = (state = initialState, { type, payload }) => {
|
|
9
9
|
switch (type) {
|
|
10
10
|
case fetchDomains.SUCCESS:
|
|
11
|
-
const
|
|
11
|
+
const { data } = payload;
|
|
12
|
+
const collection = _.prop("data")(data);
|
|
12
13
|
return _.sortBy(caseInsensitiveName)(collection);
|
|
13
14
|
case clearDomains.TRIGGER:
|
|
14
15
|
return initialState;
|
|
@@ -10,7 +10,8 @@ export const domainsActions = (state = initialState, { type, payload }) => {
|
|
|
10
10
|
case fetchDomains.TRIGGER:
|
|
11
11
|
return initialState;
|
|
12
12
|
case fetchDomains.SUCCESS:
|
|
13
|
-
|
|
13
|
+
const { data } = payload;
|
|
14
|
+
return _.propOr(initialState, "_actions")(data);
|
|
14
15
|
default:
|
|
15
16
|
return state;
|
|
16
17
|
}
|
|
@@ -28,11 +28,12 @@ describe("sagas: fetchDomainsSaga", () => {
|
|
|
28
28
|
const data = {
|
|
29
29
|
collection: [
|
|
30
30
|
{ id: 1, name: "Top domain", description: "Desc" },
|
|
31
|
-
{ id: 2, name: "Child domain", description: "Desc2", parent_id: 2 }
|
|
32
|
-
]
|
|
31
|
+
{ id: 2, name: "Child domain", description: "Desc2", parent_id: 2 },
|
|
32
|
+
],
|
|
33
33
|
};
|
|
34
34
|
|
|
35
35
|
it("should put a success action when a response is returned", () => {
|
|
36
|
+
const actions = undefined;
|
|
36
37
|
expect(() => {
|
|
37
38
|
testSaga(fetchDomainsSaga, {})
|
|
38
39
|
.next()
|
|
@@ -40,7 +41,7 @@ describe("sagas: fetchDomainsSaga", () => {
|
|
|
40
41
|
.next()
|
|
41
42
|
.call(apiJson, API_DOMAINS, JSON_OPTS)
|
|
42
43
|
.next({ data })
|
|
43
|
-
.put(fetchDomains.success(data))
|
|
44
|
+
.put(fetchDomains.success({ data, actions }))
|
|
44
45
|
.next()
|
|
45
46
|
.put(fetchDomains.fulfill())
|
|
46
47
|
.next()
|
|
@@ -60,7 +61,7 @@ describe("sagas: fetchDomainsSaga", () => {
|
|
|
60
61
|
.next()
|
|
61
62
|
.call(apiJson, API_DOMAINS, json_opts)
|
|
62
63
|
.next({ data })
|
|
63
|
-
.put(fetchDomains.success(data))
|
|
64
|
+
.put(fetchDomains.success({ data, actions }))
|
|
64
65
|
.next()
|
|
65
66
|
.put(fetchDomains.fulfill())
|
|
66
67
|
.next()
|
|
@@ -10,13 +10,16 @@ export function* fetchDomainsSaga({ payload }) {
|
|
|
10
10
|
const json_opts = actions
|
|
11
11
|
? {
|
|
12
12
|
...JSON_OPTS,
|
|
13
|
-
params: {
|
|
13
|
+
params: {
|
|
14
|
+
actions: _.flow(_.castArray, _.join(","))(actions),
|
|
15
|
+
filter,
|
|
16
|
+
},
|
|
14
17
|
}
|
|
15
18
|
: JSON_OPTS;
|
|
16
19
|
const url = API_DOMAINS;
|
|
17
20
|
yield put(fetchDomains.request(payload));
|
|
18
21
|
const { data } = yield call(apiJson, url, json_opts);
|
|
19
|
-
yield put(fetchDomains.success(data));
|
|
22
|
+
yield put(fetchDomains.success({ data, actions }));
|
|
20
23
|
} catch (error) {
|
|
21
24
|
if (error.response) {
|
|
22
25
|
const { status, data } = error.response;
|