@truedat/bg 4.44.2 → 4.44.5
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 +21 -18
- package/src/concepts/components/ConceptEdit.js +5 -3
- package/src/concepts/components/ConceptFiltersDefault.js +1 -5
- package/src/concepts/components/ConceptFiltersPublished.js +1 -5
- package/src/concepts/components/ConceptForm.js +84 -159
- package/src/concepts/components/ConceptRoutes.js +14 -10
- package/src/concepts/components/ConceptsBulkUpdate.js +1 -1
- package/src/concepts/components/SharedToForm.js +1 -1
- package/src/concepts/components/__tests__/ConceptFilters.spec.js +10 -4
- package/src/concepts/components/__tests__/ConceptForm.spec.js +49 -109
- package/src/concepts/components/__tests__/ConceptsBulkUpdate.spec.js +41 -44
- package/src/concepts/components/__tests__/ConceptsLabelResults.spec.js +3 -3
- package/src/concepts/components/__tests__/SharedToForm.spec.js +8 -24
- package/src/concepts/components/__tests__/__snapshots__/ConceptFilters.spec.js.snap +43 -10
- package/src/concepts/components/__tests__/__snapshots__/ConceptForm.spec.js.snap +603 -163
- package/src/concepts/components/__tests__/__snapshots__/ConceptsLabelResults.spec.js.snap +7 -12
- package/src/concepts/components/__tests__/__snapshots__/SharedToForm.spec.js.snap +3 -3
- package/src/taxonomy/components/AddMemberForm.js +1 -3
- package/src/taxonomy/components/__tests__/DomainActions.spec.js +3 -3
- package/src/taxonomy/components/__tests__/DomainCrumbs.spec.js +4 -4
- package/src/taxonomy/components/__tests__/__snapshots__/DomainActions.spec.js.snap +5 -10
- package/src/taxonomy/components/__tests__/__snapshots__/DomainCrumbs.spec.js.snap +37 -74
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [4.44.5] 2022-05-20
|
|
4
|
+
|
|
5
|
+
### Changed
|
|
6
|
+
|
|
7
|
+
- [TD-4230] Refactored `ConceptForm` to use `SelectableDynamicForm`
|
|
8
|
+
|
|
9
|
+
## [4.44.4] 2022-05-19
|
|
10
|
+
|
|
11
|
+
### Changed
|
|
12
|
+
|
|
13
|
+
- Use `lowerDeburrTrim` function from `@truedat/core`
|
|
14
|
+
|
|
3
15
|
## [4.43.3] 2022-05-04
|
|
4
16
|
|
|
5
17
|
### Changed
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@truedat/bg",
|
|
3
|
-
"version": "4.44.
|
|
3
|
+
"version": "4.44.5",
|
|
4
4
|
"description": "Truedat Web Business Glossary",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"jsnext:main": "src/index.js",
|
|
@@ -22,20 +22,20 @@
|
|
|
22
22
|
"eslint:fix": "eslint --fix src/**"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
|
-
"@babel/cli": "^7.
|
|
26
|
-
"@babel/core": "^7.
|
|
27
|
-
"@babel/plugin-proposal-class-properties": "^7.
|
|
28
|
-
"@babel/plugin-proposal-object-rest-spread": "^7.
|
|
29
|
-
"@babel/plugin-proposal-optional-chaining": "^7.
|
|
25
|
+
"@babel/cli": "^7.17.10",
|
|
26
|
+
"@babel/core": "^7.18.0",
|
|
27
|
+
"@babel/plugin-proposal-class-properties": "^7.17.12",
|
|
28
|
+
"@babel/plugin-proposal-object-rest-spread": "^7.18.0",
|
|
29
|
+
"@babel/plugin-proposal-optional-chaining": "^7.17.12",
|
|
30
30
|
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
|
|
31
|
-
"@babel/plugin-transform-modules-commonjs": "^7.
|
|
32
|
-
"@babel/preset-env": "^7.
|
|
33
|
-
"@babel/preset-react": "^7.
|
|
34
|
-
"@testing-library/jest-dom": "^5.
|
|
31
|
+
"@babel/plugin-transform-modules-commonjs": "^7.18.0",
|
|
32
|
+
"@babel/preset-env": "^7.18.0",
|
|
33
|
+
"@babel/preset-react": "^7.17.12",
|
|
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.44.
|
|
38
|
-
"babel-jest": "^
|
|
37
|
+
"@truedat/test": "4.44.5",
|
|
38
|
+
"babel-jest": "^28.1.0",
|
|
39
39
|
"babel-plugin-dynamic-import-node": "^2.3.3",
|
|
40
40
|
"babel-plugin-lodash": "^3.3.4",
|
|
41
41
|
"babel-plugin-react-intl": "^5.1.18",
|
|
@@ -43,7 +43,8 @@
|
|
|
43
43
|
"enzyme": "^3.11.0",
|
|
44
44
|
"enzyme-to-json": "^3.6.2",
|
|
45
45
|
"identity-obj-proxy": "^3.0.0",
|
|
46
|
-
"jest": "^
|
|
46
|
+
"jest": "^28.1.0",
|
|
47
|
+
"jest-environment-jsdom": "^28.1.0",
|
|
47
48
|
"react": "^16.14.0",
|
|
48
49
|
"react-dom": "^16.14.0",
|
|
49
50
|
"redux-saga-test-plan": "^4.0.4",
|
|
@@ -51,6 +52,8 @@
|
|
|
51
52
|
"semantic-ui-react": "^2.0.3"
|
|
52
53
|
},
|
|
53
54
|
"jest": {
|
|
55
|
+
"maxWorkers": "50%",
|
|
56
|
+
"testTimeout": 10000,
|
|
54
57
|
"moduleDirectories": [
|
|
55
58
|
"<rootDir>/src",
|
|
56
59
|
"../../node_modules"
|
|
@@ -83,15 +86,15 @@
|
|
|
83
86
|
]
|
|
84
87
|
},
|
|
85
88
|
"dependencies": {
|
|
86
|
-
"@truedat/core": "4.44.
|
|
87
|
-
"@truedat/df": "4.44.
|
|
89
|
+
"@truedat/core": "4.44.5",
|
|
90
|
+
"@truedat/df": "4.44.5",
|
|
88
91
|
"file-saver": "^2.0.5",
|
|
89
92
|
"moment": "^2.24.0",
|
|
90
93
|
"path-to-regexp": "^1.7.0",
|
|
91
|
-
"prop-types": "^15.
|
|
94
|
+
"prop-types": "^15.8.1",
|
|
92
95
|
"react-hook-form": "^7.30.0",
|
|
93
96
|
"react-intl": "^5.20.10",
|
|
94
|
-
"react-moment": "^
|
|
97
|
+
"react-moment": "^1.1.2",
|
|
95
98
|
"react-redux": "^7.2.4",
|
|
96
99
|
"react-router-dom": "^5.2.0",
|
|
97
100
|
"redux": "^4.1.1",
|
|
@@ -104,5 +107,5 @@
|
|
|
104
107
|
"react-dom": ">= 16.8.6 < 17",
|
|
105
108
|
"semantic-ui-react": ">= 0.88.2 < 2.1"
|
|
106
109
|
},
|
|
107
|
-
"gitHead": "
|
|
110
|
+
"gitHead": "5a339468198c803592b285eddd0dd0c0b0eced93"
|
|
108
111
|
}
|
|
@@ -50,12 +50,14 @@ export class ConceptEdit extends React.Component {
|
|
|
50
50
|
static propTypes = {
|
|
51
51
|
action: PropTypes.object,
|
|
52
52
|
applyTemplate: PropTypes.func,
|
|
53
|
-
conceptAction: PropTypes.func.isRequired,
|
|
54
53
|
concept: PropTypes.object,
|
|
54
|
+
conceptAction: PropTypes.func.isRequired,
|
|
55
55
|
intl: PropTypes.object,
|
|
56
56
|
loading: PropTypes.bool,
|
|
57
|
-
|
|
57
|
+
selectDomain: PropTypes.func,
|
|
58
|
+
selectTemplate: PropTypes.func,
|
|
58
59
|
template: PropTypes.object,
|
|
60
|
+
templateId: PropTypes.number,
|
|
59
61
|
};
|
|
60
62
|
|
|
61
63
|
state = initialState;
|
|
@@ -162,7 +164,7 @@ export class ConceptEdit extends React.Component {
|
|
|
162
164
|
onChange={this.handleEditorChange}
|
|
163
165
|
/>
|
|
164
166
|
</Form.Field>
|
|
165
|
-
{
|
|
167
|
+
{_.isEmpty(template) || _.isNil(content) ? null : (
|
|
166
168
|
<DynamicForm
|
|
167
169
|
onChange={this.handleContentChange}
|
|
168
170
|
content={content}
|
|
@@ -1,13 +1,9 @@
|
|
|
1
|
-
import React from "react";
|
|
2
1
|
import { bindActionCreators } from "redux";
|
|
3
2
|
import { connect } from "react-redux";
|
|
3
|
+
import { AvailableFilters } from "@truedat/core/components";
|
|
4
4
|
import { addConceptFilter, resetConceptFilters } from "../routines";
|
|
5
5
|
import { getConceptAvailableFilters } from "../selectors";
|
|
6
6
|
|
|
7
|
-
const AvailableFilters = React.lazy(() =>
|
|
8
|
-
import("@truedat/core/components/AvailableFilters")
|
|
9
|
-
);
|
|
10
|
-
|
|
11
7
|
const mapStateToProps = (state) => ({
|
|
12
8
|
filters: getConceptAvailableFilters(state),
|
|
13
9
|
disabled: state.conceptFiltersLoading,
|
|
@@ -1,14 +1,10 @@
|
|
|
1
1
|
import _ from "lodash/fp";
|
|
2
|
-
import React from "react";
|
|
3
2
|
import { connect } from "react-redux";
|
|
4
3
|
import { bindActionCreators } from "redux";
|
|
4
|
+
import { AvailableFilters } from "@truedat/core/components";
|
|
5
5
|
import { addConceptFilter, resetConceptFilters } from "../routines";
|
|
6
6
|
import { getConceptAvailableFilters } from "../selectors";
|
|
7
7
|
|
|
8
|
-
const AvailableFilters = React.lazy(() =>
|
|
9
|
-
import("@truedat/core/components/AvailableFilters")
|
|
10
|
-
);
|
|
11
|
-
|
|
12
8
|
const mapStateToProps = (state) => ({
|
|
13
9
|
filters: _.flow(getConceptAvailableFilters, _.without(["status"]))(state),
|
|
14
10
|
disabled: state.conceptFiltersLoading,
|
|
@@ -14,27 +14,17 @@ import { compose } from "redux";
|
|
|
14
14
|
import { connect } from "react-redux";
|
|
15
15
|
import { injectIntl, FormattedMessage } from "react-intl";
|
|
16
16
|
import { HistoryBackButton } from "@truedat/core/components";
|
|
17
|
-
import { selectTemplate, selectDomain } from "@truedat/df/routines";
|
|
18
|
-
import { applyTemplate } from "@truedat/df/utils";
|
|
19
17
|
import { conceptAction } from "../routines";
|
|
20
18
|
import DomainDropdownSelector from "../../taxonomy/components/DomainDropdownSelector";
|
|
21
19
|
|
|
22
|
-
const
|
|
23
|
-
import("@truedat/df/components/
|
|
20
|
+
const SelectableDynamicForm = React.lazy(() =>
|
|
21
|
+
import("@truedat/df/components/SelectableDynamicForm")
|
|
24
22
|
);
|
|
25
23
|
|
|
26
24
|
const RichTextEditor = React.lazy(() =>
|
|
27
25
|
import("@truedat/core/components/RichTextEditor")
|
|
28
26
|
);
|
|
29
27
|
|
|
30
|
-
const TemplateLoader = React.lazy(() =>
|
|
31
|
-
import("@truedat/df/templates/components/TemplateLoader")
|
|
32
|
-
);
|
|
33
|
-
|
|
34
|
-
const TemplateSelector = React.lazy(() =>
|
|
35
|
-
import("@truedat/df/templates/components/TemplateSelector")
|
|
36
|
-
);
|
|
37
|
-
|
|
38
28
|
const actionKey = "create";
|
|
39
29
|
|
|
40
30
|
const staticFields = ["name", "description"];
|
|
@@ -50,59 +40,24 @@ const isValid = _.conforms({
|
|
|
50
40
|
name: isNonEmptyString,
|
|
51
41
|
domain_id: _.isFinite,
|
|
52
42
|
description: _.negate(_.isEmpty),
|
|
43
|
+
type: isNonEmptyString,
|
|
53
44
|
});
|
|
54
45
|
|
|
55
46
|
export class ConceptForm extends React.Component {
|
|
56
47
|
static propTypes = {
|
|
57
48
|
action: PropTypes.object,
|
|
58
|
-
applyTemplate: PropTypes.func,
|
|
59
49
|
conceptAction: PropTypes.func,
|
|
60
50
|
conceptActionLoading: PropTypes.string,
|
|
61
51
|
intl: PropTypes.object,
|
|
62
|
-
selectDomain: PropTypes.func,
|
|
63
|
-
selectTemplate: PropTypes.func,
|
|
64
|
-
template: PropTypes.object,
|
|
65
|
-
templateLoading: PropTypes.bool,
|
|
66
|
-
templates: PropTypes.array,
|
|
67
52
|
};
|
|
68
53
|
|
|
69
54
|
state = initialState;
|
|
70
55
|
|
|
71
|
-
|
|
72
|
-
const { templates } = this.props;
|
|
73
|
-
if (_.size(templates) == 1) {
|
|
74
|
-
const { selectTemplate } = this.props;
|
|
75
|
-
const id = _.flow(_.head, _.prop("id"))(templates);
|
|
76
|
-
selectTemplate({ id });
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
componentDidUpdate() {
|
|
81
|
-
const { applyTemplate, template } = this.props;
|
|
82
|
-
const { type, content, domain_id } = this.state;
|
|
83
|
-
|
|
84
|
-
if (_.has("name")(template) && !_.propEq("name", type)(template))
|
|
85
|
-
this.setState({
|
|
86
|
-
type: _.prop("name")(template),
|
|
87
|
-
content: applyTemplate(content, domain_id),
|
|
88
|
-
});
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
handleDomainSelected = (e, { value }) => {
|
|
56
|
+
handleDomainSelected = (_e, { value }) => {
|
|
92
57
|
const domain_id = value;
|
|
93
|
-
|
|
94
|
-
const { selectDomain } = this.props;
|
|
95
|
-
selectDomain({ id: domain_id });
|
|
96
|
-
|
|
97
58
|
this.setState({ domain_id });
|
|
98
59
|
};
|
|
99
60
|
|
|
100
|
-
handleTemplateSelected = (e, data) => {
|
|
101
|
-
const { value } = data;
|
|
102
|
-
const { selectTemplate } = this.props;
|
|
103
|
-
selectTemplate({ id: value });
|
|
104
|
-
};
|
|
105
|
-
|
|
106
61
|
handleEditorChange = (e, { value }) => {
|
|
107
62
|
this.handleChange(null, { name: "description", value });
|
|
108
63
|
};
|
|
@@ -115,27 +70,24 @@ export class ConceptForm extends React.Component {
|
|
|
115
70
|
}
|
|
116
71
|
};
|
|
117
72
|
|
|
118
|
-
handleContentChange = (content) => {
|
|
119
|
-
this.setState({ content });
|
|
120
|
-
};
|
|
73
|
+
handleContentChange = ({ content }) => this.setState({ content });
|
|
121
74
|
|
|
122
75
|
isInvalid = () => _.negate(isValid)(this.state);
|
|
123
76
|
|
|
124
77
|
handleSubmit = (e) => {
|
|
125
78
|
e.preventDefault();
|
|
126
|
-
const { action,
|
|
127
|
-
const
|
|
79
|
+
const { action, conceptAction } = this.props;
|
|
80
|
+
const business_concept_version = _.pick([
|
|
128
81
|
"domain_id",
|
|
129
82
|
"type",
|
|
83
|
+
"content",
|
|
130
84
|
...staticFields,
|
|
131
85
|
])(this.state);
|
|
132
86
|
|
|
133
|
-
const content = applyTemplate(this.state?.content, this.state?.domain_id);
|
|
134
|
-
|
|
135
87
|
conceptAction({
|
|
136
88
|
action: actionKey,
|
|
137
89
|
...action,
|
|
138
|
-
business_concept_version
|
|
90
|
+
business_concept_version,
|
|
139
91
|
});
|
|
140
92
|
};
|
|
141
93
|
|
|
@@ -144,124 +96,97 @@ export class ConceptForm extends React.Component {
|
|
|
144
96
|
action,
|
|
145
97
|
conceptActionLoading,
|
|
146
98
|
intl: { formatMessage },
|
|
147
|
-
template,
|
|
148
|
-
templateLoading,
|
|
149
|
-
templates,
|
|
150
99
|
} = this.props;
|
|
151
100
|
|
|
152
|
-
const { name, description, content } = this.state;
|
|
101
|
+
const { name, description, content, type, domain_id } = this.state;
|
|
153
102
|
|
|
154
103
|
const loading =
|
|
155
|
-
|
|
156
|
-
(action && action.href && conceptActionLoading === action.href);
|
|
104
|
+
action && action.href && conceptActionLoading === action.href;
|
|
157
105
|
|
|
158
106
|
return (
|
|
159
|
-
|
|
160
|
-
<
|
|
161
|
-
|
|
162
|
-
<Header
|
|
163
|
-
<
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
107
|
+
<Container as={Segment} text>
|
|
108
|
+
<Header as="h2">
|
|
109
|
+
<Icon name="book" />
|
|
110
|
+
<Header.Content>
|
|
111
|
+
<FormattedMessage id="concepts.actions.create" />
|
|
112
|
+
</Header.Content>
|
|
113
|
+
</Header>
|
|
114
|
+
<Form loading={loading}>
|
|
115
|
+
<Header
|
|
116
|
+
as="h3"
|
|
117
|
+
content={formatMessage({ id: "concepts.form.required_fields" })}
|
|
118
|
+
/>
|
|
119
|
+
<DomainDropdownSelector
|
|
120
|
+
name="domain"
|
|
121
|
+
invalid={!_.isFinite(domain_id)}
|
|
122
|
+
onChange={this.handleDomainSelected}
|
|
123
|
+
/>
|
|
124
|
+
<Form.Field required>
|
|
125
|
+
<label>
|
|
126
|
+
<FormattedMessage id="concepts.props.name" />
|
|
127
|
+
{_.isEmpty(name) ? (
|
|
128
|
+
<Label pointing="left">
|
|
129
|
+
<FormattedMessage id="template.form.validation.empty_required" />
|
|
130
|
+
</Label>
|
|
131
|
+
) : null}
|
|
132
|
+
</label>
|
|
133
|
+
<Form.Input name="name" value={name} onChange={this.handleChange} />
|
|
134
|
+
</Form.Field>
|
|
135
|
+
<Form.Field required>
|
|
136
|
+
<label>
|
|
137
|
+
<FormattedMessage id="concepts.props.description" />
|
|
138
|
+
{_.isEmpty(description) ? (
|
|
139
|
+
<Label pointing="left">
|
|
140
|
+
<FormattedMessage id="template.form.validation.empty_required" />
|
|
141
|
+
</Label>
|
|
142
|
+
) : null}
|
|
143
|
+
</label>
|
|
144
|
+
<RichTextEditor
|
|
145
|
+
name="description"
|
|
146
|
+
value={description}
|
|
147
|
+
onChange={this.handleEditorChange}
|
|
177
148
|
/>
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
149
|
+
</Form.Field>
|
|
150
|
+
<SelectableDynamicForm
|
|
151
|
+
scope="bg"
|
|
152
|
+
domainIds={_.isNil(domain_id) ? null : [domain_id]}
|
|
153
|
+
required
|
|
154
|
+
header={
|
|
155
|
+
<Header
|
|
156
|
+
as="h3"
|
|
157
|
+
content={formatMessage({
|
|
158
|
+
id: "concepts.form.aditional_fields",
|
|
159
|
+
})}
|
|
183
160
|
/>
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
<label>
|
|
204
|
-
{formatMessage({ id: "concepts.props.description" })}
|
|
205
|
-
{_.isEmpty(description) ? (
|
|
206
|
-
<Label pointing="left">
|
|
207
|
-
<FormattedMessage id="template.form.validation.empty_required" />
|
|
208
|
-
</Label>
|
|
209
|
-
) : null}
|
|
210
|
-
</label>
|
|
211
|
-
<RichTextEditor
|
|
212
|
-
name="description"
|
|
213
|
-
value={description}
|
|
214
|
-
onChange={this.handleEditorChange}
|
|
215
|
-
/>
|
|
216
|
-
</Form.Field>
|
|
217
|
-
{template && template.id && (
|
|
218
|
-
<>
|
|
219
|
-
<Header
|
|
220
|
-
as="h3"
|
|
221
|
-
content={
|
|
222
|
-
<FormattedMessage id="concepts.form.aditional_fields" />
|
|
223
|
-
}
|
|
224
|
-
/>
|
|
225
|
-
<DynamicForm
|
|
226
|
-
onChange={this.handleContentChange}
|
|
227
|
-
content={content}
|
|
228
|
-
/>
|
|
229
|
-
</>
|
|
230
|
-
)}
|
|
231
|
-
<div className="actions">
|
|
232
|
-
<HistoryBackButton
|
|
233
|
-
content={formatMessage({ id: "actions.cancel" })}
|
|
234
|
-
/>
|
|
235
|
-
<Button
|
|
236
|
-
primary
|
|
237
|
-
disabled={this.isInvalid()}
|
|
238
|
-
onClick={this.handleSubmit}
|
|
239
|
-
content={<FormattedMessage id="actions.create" />}
|
|
240
|
-
/>
|
|
241
|
-
</div>
|
|
242
|
-
</Form>
|
|
243
|
-
</Container>
|
|
244
|
-
</>
|
|
161
|
+
}
|
|
162
|
+
content={content}
|
|
163
|
+
name={type}
|
|
164
|
+
onChange={this.handleContentChange}
|
|
165
|
+
onNameChange={(type) => this.setState({ type })}
|
|
166
|
+
/>
|
|
167
|
+
<div className="actions">
|
|
168
|
+
<HistoryBackButton
|
|
169
|
+
content={formatMessage({ id: "actions.cancel" })}
|
|
170
|
+
/>
|
|
171
|
+
<Button
|
|
172
|
+
primary
|
|
173
|
+
disabled={this.isInvalid()}
|
|
174
|
+
onClick={this.handleSubmit}
|
|
175
|
+
content={formatMessage({ id: "actions.create" })}
|
|
176
|
+
/>
|
|
177
|
+
</div>
|
|
178
|
+
</Form>
|
|
179
|
+
</Container>
|
|
245
180
|
);
|
|
246
181
|
}
|
|
247
182
|
}
|
|
248
183
|
|
|
249
|
-
const mapStateToProps = ({
|
|
250
|
-
conceptActionLoading,
|
|
251
|
-
conceptsActions,
|
|
252
|
-
template,
|
|
253
|
-
templateLoading,
|
|
254
|
-
templates,
|
|
255
|
-
}) => ({
|
|
184
|
+
const mapStateToProps = ({ conceptActionLoading, conceptsActions }) => ({
|
|
256
185
|
action: _.prop(actionKey)(conceptsActions),
|
|
257
|
-
applyTemplate: applyTemplate(template),
|
|
258
186
|
conceptActionLoading,
|
|
259
|
-
template,
|
|
260
|
-
templateLoading,
|
|
261
|
-
templates,
|
|
262
187
|
});
|
|
263
188
|
|
|
264
189
|
export default compose(
|
|
265
190
|
injectIntl,
|
|
266
|
-
connect(mapStateToProps, { conceptAction
|
|
191
|
+
connect(mapStateToProps, { conceptAction })
|
|
267
192
|
)(ConceptForm);
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
CONCEPTS_NEW,
|
|
13
13
|
CONCEPTS_PENDING,
|
|
14
14
|
CONCEPT_EDIT,
|
|
15
|
-
CONCEPT_VERSION
|
|
15
|
+
CONCEPT_VERSION,
|
|
16
16
|
} from "@truedat/core/routes";
|
|
17
17
|
import DomainsLoader from "../../taxonomy/components/DomainsLoader";
|
|
18
18
|
import Concept from "./Concept";
|
|
@@ -43,7 +43,7 @@ const RelationsGraphLoader = React.lazy(() =>
|
|
|
43
43
|
export const ConceptRoutes = ({ concept, conceptLoaded, templatesLoaded }) => {
|
|
44
44
|
const authorized = useAuthorized([
|
|
45
45
|
"business_glossary_view",
|
|
46
|
-
"business_glossary_management"
|
|
46
|
+
"business_glossary_management",
|
|
47
47
|
]);
|
|
48
48
|
const conceptsActive = useActiveRoutes([CONCEPTS, CONCEPTS_PENDING]);
|
|
49
49
|
return (
|
|
@@ -58,12 +58,17 @@ export const ConceptRoutes = ({ concept, conceptLoaded, templatesLoaded }) => {
|
|
|
58
58
|
<ConceptUserFiltersLoader />
|
|
59
59
|
<ConceptsDefaultFiltersLoader
|
|
60
60
|
defaultFilters={{
|
|
61
|
-
status: ["pending_approval", "draft", "rejected"]
|
|
61
|
+
status: ["pending_approval", "draft", "rejected"],
|
|
62
62
|
}}
|
|
63
63
|
/>
|
|
64
64
|
<ConceptFiltersLoader
|
|
65
65
|
defaultFilters={{
|
|
66
|
-
status: [
|
|
66
|
+
status: [
|
|
67
|
+
"pending_approval",
|
|
68
|
+
"draft",
|
|
69
|
+
"rejected",
|
|
70
|
+
"published",
|
|
71
|
+
],
|
|
67
72
|
}}
|
|
68
73
|
/>
|
|
69
74
|
<Concepts
|
|
@@ -93,12 +98,12 @@ export const ConceptRoutes = ({ concept, conceptLoaded, templatesLoaded }) => {
|
|
|
93
98
|
<ConceptUserFiltersLoader />
|
|
94
99
|
<ConceptsDefaultFiltersLoader
|
|
95
100
|
defaultFilters={{
|
|
96
|
-
status: ["published"]
|
|
101
|
+
status: ["published"],
|
|
97
102
|
}}
|
|
98
103
|
/>
|
|
99
104
|
<ConceptFiltersLoader
|
|
100
105
|
defaultFilters={{
|
|
101
|
-
status: ["published"]
|
|
106
|
+
status: ["published"],
|
|
102
107
|
}}
|
|
103
108
|
/>
|
|
104
109
|
<Concepts
|
|
@@ -128,8 +133,7 @@ export const ConceptRoutes = ({ concept, conceptLoaded, templatesLoaded }) => {
|
|
|
128
133
|
<>
|
|
129
134
|
<DomainsLoader actions="create_business_concept" />
|
|
130
135
|
<ConceptCrumbs conceptAction="concepts.actions.create" />
|
|
131
|
-
<
|
|
132
|
-
{templatesLoaded && <ConceptForm />}
|
|
136
|
+
<ConceptForm />
|
|
133
137
|
</>
|
|
134
138
|
)}
|
|
135
139
|
/>
|
|
@@ -176,13 +180,13 @@ export const ConceptRoutes = ({ concept, conceptLoaded, templatesLoaded }) => {
|
|
|
176
180
|
ConceptRoutes.propTypes = {
|
|
177
181
|
concept: PropTypes.object,
|
|
178
182
|
conceptLoaded: PropTypes.bool,
|
|
179
|
-
templatesLoaded: PropTypes.bool
|
|
183
|
+
templatesLoaded: PropTypes.bool,
|
|
180
184
|
};
|
|
181
185
|
|
|
182
186
|
const mapStateToProps = ({ concept, templatesLoading, templates }) => ({
|
|
183
187
|
conceptLoaded: !_.isEmpty(concept),
|
|
184
188
|
templatesLoaded: !templatesLoading && !_.isEmpty(templates),
|
|
185
|
-
concept
|
|
189
|
+
concept,
|
|
186
190
|
});
|
|
187
191
|
|
|
188
192
|
export default connect(mapStateToProps)(ConceptRoutes);
|
|
@@ -211,7 +211,7 @@ const mapStateToProps = ({
|
|
|
211
211
|
}) => {
|
|
212
212
|
const concept = _.head(concepts);
|
|
213
213
|
const templateId =
|
|
214
|
-
templates && concept
|
|
214
|
+
templates && concept?.type
|
|
215
215
|
? _.flow(_.find(_.propEq("name", concept.type)), _.prop("id"))(templates)
|
|
216
216
|
: null;
|
|
217
217
|
return {
|
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
2
|
+
import { render } from "@truedat/test/render";
|
|
3
|
+
import ConceptFilters from "../ConceptFilters";
|
|
4
|
+
|
|
5
|
+
const state = {
|
|
6
|
+
conceptFilters: { domain_id: [1, 2], confidential: ["yes", "no"] },
|
|
7
|
+
conceptActiveFilters: { domain_id: [1] },
|
|
8
|
+
};
|
|
9
|
+
const renderOpts = { state };
|
|
4
10
|
|
|
5
11
|
describe("<ConceptFilters />", () => {
|
|
6
12
|
it("matches the latest snapshot", () => {
|
|
7
|
-
const
|
|
8
|
-
expect(
|
|
13
|
+
const { container } = render(<ConceptFilters />, renderOpts);
|
|
14
|
+
expect(container).toMatchSnapshot();
|
|
9
15
|
});
|
|
10
16
|
});
|