@truedat/bg 4.48.0 → 4.48.4

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,18 @@
1
1
  # Changelog
2
2
 
3
+ ## [4.48.4] 2022-07-11
4
+
5
+
6
+ ### Changed
7
+
8
+ - [TD-4995] Removed `in domain` suffix from concept header
9
+
10
+ ## [4.48.2] 2022-07-08
11
+
12
+ ### Changed
13
+
14
+ - [TD-4995] Support localization of template fields and fixed values
15
+
3
16
  ## [4.47.1] 2022-06-22
4
17
 
5
18
  ### Fixed
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@truedat/bg",
3
- "version": "4.48.0",
3
+ "version": "4.48.4",
4
4
  "description": "Truedat Web Business Glossary",
5
5
  "sideEffects": false,
6
6
  "jsnext:main": "src/index.js",
@@ -86,8 +86,8 @@
86
86
  ]
87
87
  },
88
88
  "dependencies": {
89
- "@truedat/core": "4.48.0",
90
- "@truedat/df": "4.48.0",
89
+ "@truedat/core": "4.48.4",
90
+ "@truedat/df": "4.48.4",
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": "c4587d045fa6c9028082bdfbcfb35e4383f117ed"
110
+ "gitHead": "5e50a034469bf3ad8e02a64eb875ad2b710b6b03"
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,10 @@ 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
44
  </Header.Subheader>
45
45
  </Header.Content>
46
46
  </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,9 +16,10 @@ exports[`<ConceptHeader /> matches the latest snapshot 1`] = `
16
16
  <HeaderContent>
17
17
  Concept1
18
18
  <HeaderSubheader>
19
- Template1
20
-
21
- concept.header.message.in Domain name
19
+ <MemoizedFormattedMessage
20
+ defaultMessage="Template1"
21
+ id="templates.Template1"
22
+ />
22
23
  </HeaderSubheader>
23
24
  </HeaderContent>
24
25
  </Header>
@@ -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";
@@ -46,7 +46,6 @@ export default {
46
46
  "concept.events.relation_created": "added a link to a structure",
47
47
  "concept.events.relation_deleted": "removed a link to a structure",
48
48
  "concept.events.relation_deprecated": "deprecated link to a structure",
49
- "concept.header.message.in": "in",
50
49
  "concept.props.in_progress": "In progress",
51
50
  "concept.props.last_update_at": "Update",
52
51
  "concept.props.last_update_by": "User",
@@ -48,7 +48,6 @@ export default {
48
48
  "concept.events.relation_created": "Nueva relación",
49
49
  "concept.events.relation_deleted": "Relación eliminada",
50
50
  "concept.events.relation_deprecated": "Relación deprecada",
51
- "concept.header.message.in": "en",
52
51
  "concept.props.in_progress": "Sin completar",
53
52
  "concept.props.last_update_at": "Modificación",
54
53
  "concept.props.last_update_by": "Usuario",
@@ -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
- );