@truedat/bg 4.47.8 → 4.48.2

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.48.2] 2022-07-08
4
+
5
+ ### Changed
6
+
7
+ - [TD-4995] Support localization of template fields and fixed values
8
+
3
9
  ## [4.47.1] 2022-06-22
4
10
 
5
11
  ### Fixed
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@truedat/bg",
3
- "version": "4.47.8",
3
+ "version": "4.48.2",
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.16.4",
35
35
  "@testing-library/react": "^12.0.0",
36
36
  "@testing-library/user-event": "^13.2.1",
37
- "@truedat/test": "4.47.8",
37
+ "@truedat/test": "4.47.9",
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",
@@ -86,8 +86,8 @@
86
86
  ]
87
87
  },
88
88
  "dependencies": {
89
- "@truedat/core": "4.47.8",
90
- "@truedat/df": "4.47.8",
89
+ "@truedat/core": "4.48.2",
90
+ "@truedat/df": "4.48.2",
91
91
  "file-saver": "^2.0.5",
92
92
  "moment": "^2.24.0",
93
93
  "path-to-regexp": "^1.7.0",
@@ -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": "dccc0d92c419a5ee257a8e15b64c1b98d909809a"
110
+ "gitHead": "93133e957332713e64c97eecdf45cc283c29bd32"
111
111
  }
@@ -12,19 +12,18 @@ export const ConceptCompleteness = ({ concept }) => {
12
12
  const status = _.get("status")(concept);
13
13
 
14
14
  const missingRequiredFields = _.flow(
15
- _.get("template.content"),
16
- _.map(({ fields }) =>
15
+ _.path("template.content"),
16
+ _.flatMap(({ fields }) =>
17
17
  _.filter((field) => {
18
18
  const name = field?.name;
19
- const value = _.get(name)(content);
19
+ const value = _.prop(name)(content);
20
20
  return (
21
21
  !_.isNumber(value) &&
22
22
  isRequired(field, content) &&
23
23
  (_.isNil(value) || _.isEmpty(value))
24
24
  );
25
25
  })(fields)
26
- ),
27
- _.flatten
26
+ )
28
27
  )(concept);
29
28
 
30
29
  return (
@@ -56,7 +55,12 @@ export const ConceptCompleteness = ({ concept }) => {
56
55
  {_.map.convert({ cap: false })(({ label }, i) => (
57
56
  <List.Item key={i}>
58
57
  <Icon name="right angle" color="grey" fitted />
59
- {label}
58
+ {label ? (
59
+ <FormattedMessage
60
+ id={`fields.${label}`}
61
+ defaultMessage={label}
62
+ />
63
+ ) : null}
60
64
  </List.Item>
61
65
  ))(missingRequiredFields)}
62
66
  </List>
@@ -2,7 +2,7 @@ import _ from "lodash/fp";
2
2
  import React from "react";
3
3
  import PropTypes from "prop-types";
4
4
  import { connect } from "react-redux";
5
- import { useIntl } from "react-intl";
5
+ import { FormattedMessage, useIntl } from "react-intl";
6
6
  import { Grid, Header, Icon } from "semantic-ui-react";
7
7
  import { linkTo } from "@truedat/core/routes";
8
8
  import ShareLinkPopup from "@truedat/audit/components/ShareLinkPopup";
@@ -27,6 +27,7 @@ export const ConceptHeader = ({
27
27
  const description = concept?.description;
28
28
  const shareUrl = `${location.protocol}//${location.host}${path}`;
29
29
  const shareTitle = formatMessage({ id: "concepts.share.title" });
30
+ const templateLabel = template?.label;
30
31
 
31
32
  return (
32
33
  <Grid>
@@ -36,11 +37,15 @@ export const ConceptHeader = ({
36
37
  <Header.Content>
37
38
  {concept.name}
38
39
  <Header.Subheader>
39
- {template.label}{" "}
40
- {domain &&
41
- `${formatMessage({ id: "concept.header.message.in" })} ${
42
- domain.name
43
- }`}
40
+ <FormattedMessage
41
+ id={`templates.${templateLabel}`}
42
+ defaultMessage={templateLabel}
43
+ />
44
+ {domain
45
+ ? `${formatMessage({ id: "concept.header.message.in" })} ${
46
+ domain.name
47
+ }`
48
+ : null}
44
49
  </Header.Subheader>
45
50
  </Header.Content>
46
51
  </Header>
@@ -4,19 +4,14 @@ import PropTypes from "prop-types";
4
4
  import { connect } from "react-redux";
5
5
  import { Header, Label, List, Icon, Segment } from "semantic-ui-react";
6
6
  import { FormattedMessage } from "react-intl";
7
- import { getFieldValues } from "../selectors";
8
7
  import { mapStatusColor } from "../constants/mappings";
9
8
 
10
- const Bold = ({ children }) => (
11
- <div className="concept-summary__content-bold">{children}</div>
12
- );
13
-
14
- const FieldValue = ({ field, value, color, in_progress }) => (
9
+ const FieldValue = ({ field, value, color }) => (
15
10
  <List.Item className="concept-summary">
16
11
  <List.Content className="concept-summary__content">
17
- <Bold>
12
+ <div className="concept-summary__content-bold">
18
13
  <FormattedMessage id={`concept.props.${field}`} />:
19
- </Bold>
14
+ </div>
20
15
  <Label color={color}>
21
16
  {value || <Icon name="ellipsis vertical" color="grey" />}
22
17
  </Label>
@@ -28,17 +23,15 @@ FieldValue.propTypes = {
28
23
  field: PropTypes.any,
29
24
  value: PropTypes.any,
30
25
  color: PropTypes.any,
31
- in_progress: PropTypes.bool,
32
26
  };
33
27
 
34
28
  export const ConceptSummary = ({
35
- concept: { status, version, last_change_at, last_change_user, in_progress },
29
+ concept: { status, version, last_change_at, last_change_user },
36
30
  }) => (
37
31
  <Segment>
38
32
  <Header as="h3" dividing>
39
33
  <FormattedMessage id="concepts.summary" defaultMessage="Resumen" />
40
34
  </Header>
41
-
42
35
  <FieldValue
43
36
  field="status"
44
37
  value={
@@ -48,7 +41,6 @@ export const ConceptSummary = ({
48
41
  />
49
42
  }
50
43
  color={mapStatusColor[status]}
51
- in_progress={in_progress}
52
44
  />
53
45
  <FieldValue field="version" value={version} />
54
46
  <FieldValue
@@ -68,9 +60,6 @@ ConceptSummary.propTypes = {
68
60
  concept: PropTypes.object,
69
61
  };
70
62
 
71
- const mapStateToProps = (state) => ({
72
- concept: state.concept,
73
- fieldValues: getFieldValues(state),
74
- });
63
+ const mapStateToProps = ({ concept }) => ({ concept });
75
64
 
76
65
  export default connect(mapStateToProps)(ConceptSummary);
@@ -16,8 +16,10 @@ exports[`<ConceptHeader /> matches the latest snapshot 1`] = `
16
16
  <HeaderContent>
17
17
  Concept1
18
18
  <HeaderSubheader>
19
- Template1
20
-
19
+ <MemoizedFormattedMessage
20
+ defaultMessage="Template1"
21
+ id="templates.Template1"
22
+ />
21
23
  concept.header.message.in Domain name
22
24
  </HeaderSubheader>
23
25
  </HeaderContent>
@@ -4,7 +4,6 @@ export { getConceptDomainPath } from "./getConceptDomainPath";
4
4
  export { getConceptSelectedFilters } from "./getConceptSelectedFilters";
5
5
  export { getConceptSelectedFilterActiveValues } from "./getConceptSelectedFilterActiveValues";
6
6
  export { getConceptSelectedFilterValues } from "./getConceptSelectedFilterValues";
7
- export { getFieldValues } from "./getFieldValues";
8
7
  export { getParsedEvents } from "./getParsedEvents";
9
8
  export { getPreviousConceptQuery } from "./getPreviousConceptQuery";
10
9
  export { getTemplateFields } from "./getTemplateFields";
@@ -1,32 +0,0 @@
1
- import _ from "lodash/fp";
2
- import { createSelector } from "reselect";
3
- import { getTemplateGroups } from "./getTemplateGroups";
4
- import { getConcept } from "./getConcept";
5
-
6
- const checkDependency = (field, content) => {
7
- const on = _.prop(_.path("depends.on")(field))(content);
8
- const to_be = _.path("depends.to_be")(field);
9
- return _.isArray(on)
10
- ? _.some(d => to_be.includes(d))(on)
11
- : to_be.includes(on);
12
- };
13
-
14
- export const getFieldValues = createSelector(
15
- [getTemplateGroups, getConcept],
16
- (groups, concept) =>
17
- groups && concept && concept.content
18
- ? groups.map(([name, fields]) => [
19
- name,
20
- fields.map(f => ({
21
- field: f.label,
22
- type: f.type,
23
- widget: f.widget,
24
- value: concept.content[f.name],
25
- hidden:
26
- _.has("depends.to_be")(f) &&
27
- _.has("depends.on")(f) &&
28
- !checkDependency(f, _.prop("content")(concept))
29
- }))
30
- ])
31
- : []
32
- );