@truedat/bg 4.46.1 → 4.46.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.
Files changed (45) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/package.json +5 -5
  3. package/src/concepts/components/Concept.js +5 -6
  4. package/src/concepts/components/ConceptArchiveRow.js +8 -3
  5. package/src/concepts/components/ConceptDetails.js +3 -5
  6. package/src/concepts/components/ConceptEdit.js +1 -5
  7. package/src/concepts/components/ConceptFiltersLoader.js +1 -0
  8. package/src/concepts/components/ConceptForm.js +1 -5
  9. package/src/concepts/components/ConceptRoutes.js +1 -17
  10. package/src/concepts/components/ConceptSummary.js +11 -6
  11. package/src/concepts/components/ConceptTaxonomy.js +1 -4
  12. package/src/concepts/components/Concepts.js +6 -27
  13. package/src/concepts/components/ConceptsActions.js +12 -10
  14. package/src/concepts/components/ConceptsLoader.js +7 -28
  15. package/src/concepts/components/ConceptsPanel.js +34 -0
  16. package/src/concepts/components/ConceptsTable.js +13 -14
  17. package/src/concepts/components/DomainConcepts.js +29 -0
  18. package/src/concepts/components/__tests__/ConceptArchiveRow.spec.js +11 -14
  19. package/src/concepts/components/__tests__/ConceptsLoader.spec.js +2 -5
  20. package/src/concepts/components/__tests__/ConceptsPanel.spec.js +25 -0
  21. package/src/concepts/components/__tests__/__snapshots__/Concept.spec.js.snap +1 -1
  22. package/src/concepts/components/__tests__/__snapshots__/ConceptArchiveRow.spec.js.snap +34 -30
  23. package/src/concepts/components/__tests__/__snapshots__/ConceptDetails.spec.js.snap +1 -1
  24. package/src/concepts/components/__tests__/__snapshots__/ConceptForm.spec.js.snap +6 -6
  25. package/src/concepts/components/__tests__/__snapshots__/ConceptTaxonomy.spec.js.snap +1 -1
  26. package/src/concepts/components/__tests__/__snapshots__/Concepts.spec.js.snap +1 -30
  27. package/src/concepts/components/__tests__/__snapshots__/ConceptsPanel.spec.js.snap +157 -0
  28. package/src/concepts/components/__tests__/__snapshots__/ConceptsTable.spec.js.snap +36 -2
  29. package/src/concepts/reducers/conceptQuery.js +2 -2
  30. package/src/concepts/reducers/index.js +0 -2
  31. package/src/concepts/relations/components/ConceptImplementationLinks.js +1 -0
  32. package/src/concepts/relations/components/ConceptSelector.js +6 -3
  33. package/src/concepts/routines.js +0 -6
  34. package/src/messages/en.js +1 -0
  35. package/src/messages/es.js +1 -0
  36. package/src/taxonomy/components/Domain.js +22 -6
  37. package/src/taxonomy/components/DomainCrumbs.js +4 -3
  38. package/src/taxonomy/components/DomainDetail.js +3 -5
  39. package/src/taxonomy/components/DomainRoutes.js +3 -1
  40. package/src/taxonomy/components/DomainTabs.js +19 -5
  41. package/src/taxonomy/components/__tests__/__snapshots__/Domain.spec.js.snap +12 -18
  42. package/src/concepts/components/ConceptsDefaultFiltersLoader.js +0 -23
  43. package/src/concepts/components/__tests__/ConceptsDefaultFiltersLoader.spec.js +0 -18
  44. package/src/concepts/reducers/__tests__/conceptsDefaultFilters.spec.js +0 -37
  45. package/src/concepts/reducers/conceptsDefaultFilters.js +0 -20
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # Changelog
2
2
 
3
+ ## [4.46.4] 2022-06-16
4
+
5
+ ### Added
6
+
7
+ - [TD-4720] Include concepts tab in domain view
8
+
9
+ ## [4.46.2] 2022-06-16
10
+
11
+ ### Changed
12
+
13
+ - [TD-4739] Don't lazily load components from `@truedat/core`
14
+
3
15
  ## [4.45.1] 2022-05-26
4
16
 
5
17
  ### Changed
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@truedat/bg",
3
- "version": "4.46.1",
3
+ "version": "4.46.4",
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.46.0",
37
+ "@truedat/test": "4.46.4",
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.46.0",
90
- "@truedat/df": "4.46.1",
89
+ "@truedat/core": "4.46.4",
90
+ "@truedat/df": "4.46.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": "00524d691df3a57293aca6580e6bf96667e11761"
110
+ "gitHead": "dcd0aa42ffe1fb816945154ec2a2d06889dca7e7"
111
111
  }
@@ -4,6 +4,7 @@ import PropTypes from "prop-types";
4
4
  import { connect } from "react-redux";
5
5
  import { Route } from "react-router-dom";
6
6
  import { Grid, Segment } from "semantic-ui-react";
7
+ import { Comments, CommentsLoader } from "@truedat/core/components";
7
8
  import { CONCEPT_VERSION } from "@truedat/core/routes";
8
9
  import ConceptRelationsSummary from "../relations/components/ConceptRelationsSummary";
9
10
  import ConceptArchiveLoader from "./ConceptArchiveLoader";
@@ -19,13 +20,11 @@ import SharedToDomains from "./SharedToDomains";
19
20
  const EventsLoader = React.lazy(() =>
20
21
  import("@truedat/audit/components/EventsLoader")
21
22
  );
22
- const Comments = React.lazy(() => import("@truedat/core/components/Comments"));
23
- const CommentsLoader = React.lazy(() =>
24
- import("@truedat/core/components/CommentsLoader")
25
- );
23
+
26
24
  const RelationsLoader = React.lazy(() =>
27
25
  import("@truedat/lm/components/RelationsLoader")
28
26
  );
27
+
29
28
  const ConceptRulesLoader = React.lazy(() =>
30
29
  import("@truedat/dq/components/ConceptRulesLoader")
31
30
  );
@@ -71,11 +70,11 @@ export const Concept = ({ id }) => (
71
70
  );
72
71
 
73
72
  Concept.propTypes = {
74
- id: PropTypes.number.isRequired
73
+ id: PropTypes.number.isRequired,
75
74
  };
76
75
 
77
76
  const mapStateToProps = ({ concept }) => ({
78
- id: _.prop("business_concept_id")(concept)
77
+ id: _.prop("business_concept_id")(concept),
79
78
  });
80
79
 
81
80
  export default connect(mapStateToProps)(Concept);
@@ -13,7 +13,7 @@ export const ConceptArchiveRow = ({
13
13
  status,
14
14
  last_change_at,
15
15
  last_change_by,
16
- version
16
+ version,
17
17
  }) => {
18
18
  const history = useHistory();
19
19
  return (
@@ -23,7 +23,12 @@ export const ConceptArchiveRow = ({
23
23
  }
24
24
  >
25
25
  <Table.Cell
26
- content={<FormattedMessage id={`concepts.status.${status}`} />}
26
+ content={
27
+ <FormattedMessage
28
+ id={`concepts.status.${status}`}
29
+ defaultMessage={status}
30
+ />
31
+ }
27
32
  />
28
33
  <Table.Cell content={version} />
29
34
  <Table.Cell content={_.propOr("", "full_name")(last_change_by)} />
@@ -38,7 +43,7 @@ ConceptArchiveRow.propTypes = {
38
43
  status: PropTypes.string,
39
44
  last_change_at: PropTypes.string,
40
45
  last_change_by: PropTypes.string,
41
- version: PropTypes.number
46
+ version: PropTypes.number,
42
47
  };
43
48
 
44
49
  export default ConceptArchiveRow;
@@ -3,16 +3,14 @@ import PropTypes from "prop-types";
3
3
  import { connect } from "react-redux";
4
4
  import { Segment, Header } from "semantic-ui-react";
5
5
  import { FormattedMessage } from "react-intl";
6
+ import { RichTextEditor } from "@truedat/core/components";
6
7
 
7
8
  const DynamicFormViewer = React.lazy(() =>
8
9
  import("@truedat/df/components/DynamicFormViewer")
9
10
  );
10
- const RichTextEditor = React.lazy(() =>
11
- import("@truedat/core/components/RichTextEditor")
12
- );
13
11
 
14
12
  export const ConceptDetails = ({
15
- concept: { content, description, template }
13
+ concept: { content, description, template },
16
14
  }) => (
17
15
  <Segment attached="bottom">
18
16
  <Header as="h3">
@@ -24,7 +22,7 @@ export const ConceptDetails = ({
24
22
  );
25
23
 
26
24
  ConceptDetails.propTypes = {
27
- concept: PropTypes.object
25
+ concept: PropTypes.object,
28
26
  };
29
27
 
30
28
  const mapStateToProps = ({ concept }) => ({ concept });
@@ -13,7 +13,7 @@ import {
13
13
  import { compose } from "redux";
14
14
  import { connect } from "react-redux";
15
15
  import { injectIntl, FormattedMessage } from "react-intl";
16
- import { HistoryBackButton } from "@truedat/core/components";
16
+ import { HistoryBackButton, RichTextEditor } from "@truedat/core/components";
17
17
  import { selectTemplate, selectDomain } from "@truedat/df/routines";
18
18
  import { applyTemplate } from "@truedat/df/utils";
19
19
  import { conceptAction } from "../routines";
@@ -22,10 +22,6 @@ const DynamicForm = React.lazy(() =>
22
22
  import("@truedat/df/components/DynamicForm")
23
23
  );
24
24
 
25
- const RichTextEditor = React.lazy(() =>
26
- import("@truedat/core/components/RichTextEditor")
27
- );
28
-
29
25
  const TemplateLoader = React.lazy(() =>
30
26
  import("@truedat/df/templates/components/TemplateLoader")
31
27
  );
@@ -17,6 +17,7 @@ const makeMapStateToProps = () => {
17
17
  const mapStateToProps = (state, props) => ({
18
18
  selectedFilter: state.conceptSelectedFilter,
19
19
  filters: activeFiltersSelector(state, props),
20
+ defaultFilters: props?.defaultFilters || {},
20
21
  });
21
22
  return mapStateToProps;
22
23
  };
@@ -13,7 +13,7 @@ import {
13
13
  import { compose } from "redux";
14
14
  import { connect } from "react-redux";
15
15
  import { injectIntl, FormattedMessage } from "react-intl";
16
- import { HistoryBackButton } from "@truedat/core/components";
16
+ import { HistoryBackButton, RichTextEditor } from "@truedat/core/components";
17
17
  import { conceptAction } from "../routines";
18
18
  import DomainDropdownSelector from "../../taxonomy/components/DomainDropdownSelector";
19
19
 
@@ -21,10 +21,6 @@ const SelectableDynamicForm = React.lazy(() =>
21
21
  import("@truedat/df/components/SelectableDynamicForm")
22
22
  );
23
23
 
24
- const RichTextEditor = React.lazy(() =>
25
- import("@truedat/core/components/RichTextEditor")
26
- );
27
-
28
24
  const actionKey = "create";
29
25
 
30
26
  const staticFields = ["name", "description"];
@@ -25,7 +25,6 @@ import ConceptLoader from "./ConceptLoader";
25
25
  import Concepts from "./Concepts";
26
26
  import ConceptsBulkUpdate from "./ConceptsBulkUpdate";
27
27
  import ConceptsLoader from "./ConceptsLoader";
28
- import ConceptsDefaultFiltersLoader from "./ConceptsDefaultFiltersLoader";
29
28
  import ConceptSubscriptionLoader from "./ConceptSubscriptionLoader";
30
29
 
31
30
  const RelationTagsLoader = React.lazy(() =>
@@ -56,19 +55,9 @@ export const ConceptRoutes = ({ concept, conceptLoaded, templatesLoaded }) => {
56
55
  authorized ? (
57
56
  <>
58
57
  <ConceptUserFiltersLoader />
59
- <ConceptsDefaultFiltersLoader
60
- defaultFilters={{
61
- status: ["pending_approval", "draft", "rejected"],
62
- }}
63
- />
64
58
  <ConceptFiltersLoader
65
59
  defaultFilters={{
66
- status: [
67
- "pending_approval",
68
- "draft",
69
- "rejected",
70
- "published",
71
- ],
60
+ status: ["pending_approval", "draft", "rejected"],
72
61
  }}
73
62
  />
74
63
  <Concepts
@@ -96,11 +85,6 @@ export const ConceptRoutes = ({ concept, conceptLoaded, templatesLoaded }) => {
96
85
  render={() => (
97
86
  <>
98
87
  <ConceptUserFiltersLoader />
99
- <ConceptsDefaultFiltersLoader
100
- defaultFilters={{
101
- status: ["published"],
102
- }}
103
- />
104
88
  <ConceptFiltersLoader
105
89
  defaultFilters={{
106
90
  status: ["published"],
@@ -28,11 +28,11 @@ FieldValue.propTypes = {
28
28
  field: PropTypes.any,
29
29
  value: PropTypes.any,
30
30
  color: PropTypes.any,
31
- in_progress: PropTypes.bool
31
+ in_progress: PropTypes.bool,
32
32
  };
33
33
 
34
34
  export const ConceptSummary = ({
35
- concept: { status, version, last_change_at, last_change_user, in_progress }
35
+ concept: { status, version, last_change_at, last_change_user, in_progress },
36
36
  }) => (
37
37
  <Segment>
38
38
  <Header as="h3" dividing>
@@ -41,7 +41,12 @@ export const ConceptSummary = ({
41
41
 
42
42
  <FieldValue
43
43
  field="status"
44
- value={<FormattedMessage id={`concepts.status.${status}`} />}
44
+ value={
45
+ <FormattedMessage
46
+ id={`concepts.status.${status}`}
47
+ defaultMessage={status}
48
+ />
49
+ }
45
50
  color={mapStatusColor[status]}
46
51
  in_progress={in_progress}
47
52
  />
@@ -60,12 +65,12 @@ export const ConceptSummary = ({
60
65
  );
61
66
 
62
67
  ConceptSummary.propTypes = {
63
- concept: PropTypes.object
68
+ concept: PropTypes.object,
64
69
  };
65
70
 
66
- const mapStateToProps = state => ({
71
+ const mapStateToProps = (state) => ({
67
72
  concept: state.concept,
68
- fieldValues: getFieldValues(state)
73
+ fieldValues: getFieldValues(state),
69
74
  });
70
75
 
71
76
  export default connect(mapStateToProps)(ConceptSummary);
@@ -6,12 +6,9 @@ import { List, Header, Segment } from "semantic-ui-react";
6
6
  import { FormattedMessage } from "react-intl";
7
7
  import { getConceptDomainPath } from "../selectors";
8
8
  import DomainItem from "../../taxonomy/components/DomainItem";
9
+ import DomainsConceptLoader from "../../taxonomy/components/DomainsConceptLoader";
9
10
  import ConceptManageDomainPopup from "./ConceptManageDomainPopup";
10
11
 
11
- const DomainsConceptLoader = React.lazy(() =>
12
- import("../../taxonomy/components/DomainsConceptLoader")
13
- );
14
-
15
12
  export const ConceptTaxonomy = ({ domainPath }) =>
16
13
  _.negate(_.isEmpty)(domainPath) && (
17
14
  <Segment>
@@ -1,17 +1,11 @@
1
1
  import React from "react";
2
2
  import PropTypes from "prop-types";
3
- import { connect } from "react-redux";
4
- import { Dimmer, Header, Icon, Loader, Segment } from "semantic-ui-react";
3
+ import { Header, Icon, Segment } from "semantic-ui-react";
5
4
  import { FormattedMessage } from "react-intl";
6
- import ConceptsActions from "./ConceptsActions";
7
5
  import ConceptCrumbs from "./ConceptCrumbs";
8
- import ConceptsLabelResults from "./ConceptsLabelResults";
9
- import ConceptsPagination from "./ConceptsPagination";
10
- import ConceptsSearch from "./ConceptsSearch";
11
- import ConceptsTable from "./ConceptsTable";
12
- import ConceptSelectedFilters from "./ConceptSelectedFilters";
6
+ import ConceptsPanel from "./ConceptsPanel";
13
7
 
14
- export const Concepts = ({ loading, header, subheader, icon, ...actions }) => (
8
+ export const Concepts = ({ header, subheader, icon }) => (
15
9
  <>
16
10
  <ConceptCrumbs />
17
11
  <Segment>
@@ -25,17 +19,7 @@ export const Concepts = ({ loading, header, subheader, icon, ...actions }) => (
25
19
  </Header.Content>
26
20
  </Header>
27
21
  <Segment attached="bottom">
28
- <ConceptsActions {...actions} />
29
- <ConceptsSearch />
30
- <ConceptSelectedFilters />
31
- <Dimmer.Dimmable dimmed={loading}>
32
- <Dimmer active={loading} inverted>
33
- <Loader />
34
- </Dimmer>
35
- <ConceptsLabelResults />
36
- <ConceptsTable />
37
- <ConceptsPagination />
38
- </Dimmer.Dimmable>
22
+ <ConceptsPanel />
39
23
  </Segment>
40
24
  </Segment>
41
25
  </>
@@ -44,12 +28,7 @@ export const Concepts = ({ loading, header, subheader, icon, ...actions }) => (
44
28
  Concepts.propTypes = {
45
29
  header: PropTypes.string,
46
30
  icon: PropTypes.string,
47
- loading: PropTypes.bool,
48
- subheader: PropTypes.string
31
+ subheader: PropTypes.string,
49
32
  };
50
33
 
51
- const mapStateToProps = ({ conceptsLoading }) => ({
52
- loading: conceptsLoading
53
- });
54
-
55
- export default connect(mapStateToProps)(Concepts);
34
+ export default Concepts;
@@ -23,8 +23,8 @@ export const ConceptsActions = ({
23
23
  create,
24
24
  createUrl,
25
25
  conceptsDownloading,
26
- conceptActionsLoaded,
27
26
  downloadConcepts,
27
+ hidden,
28
28
  upload,
29
29
  }) => {
30
30
  const { formatMessage } = useIntl();
@@ -32,7 +32,7 @@ export const ConceptsActions = ({
32
32
  _.map((l) => [l, formatMessage({ id: `concepts.props.${l}` })]),
33
33
  _.fromPairs
34
34
  )(staticLabels);
35
- return conceptActionsLoaded ? (
35
+ return hidden ? null : (
36
36
  <div>
37
37
  {create && createUrl && (
38
38
  <Button
@@ -56,25 +56,27 @@ export const ConceptsActions = ({
56
56
  {upload && <ConceptsUploadButton />}
57
57
  <ConceptsUpdateButton />
58
58
  </div>
59
- ) : null;
59
+ );
60
60
  };
61
61
 
62
62
  ConceptsActions.propTypes = {
63
63
  conceptsDownloading: PropTypes.bool,
64
- conceptActionsLoaded: PropTypes.bool,
64
+ hidden: PropTypes.bool,
65
65
  create: PropTypes.bool,
66
66
  createUrl: PropTypes.string,
67
67
  downloadConcepts: PropTypes.func,
68
68
  upload: PropTypes.bool,
69
69
  };
70
70
 
71
- const mapStateToProps = (state) => ({
71
+ const mapStateToProps = ({
72
+ conceptActions,
73
+ conceptsActions,
74
+ conceptsDownloading,
75
+ }) => ({
72
76
  createUrl:
73
- _.isEmpty(state.conceptActions) &&
74
- _.has("create")(state.conceptsActions) &&
75
- CONCEPTS_NEW,
76
- conceptsDownloading: state.conceptsDownloading,
77
- conceptActionsLoaded: _.negate(_.isEmpty)(state.conceptsActions),
77
+ _.isEmpty(conceptActions) && conceptsActions?.create ? CONCEPTS_NEW : null,
78
+ conceptsDownloading: conceptsDownloading,
79
+ hidden: _.isEmpty(conceptsActions),
78
80
  });
79
81
 
80
82
  export default connect(mapStateToProps, { downloadConcepts, uploadConcepts })(
@@ -1,26 +1,15 @@
1
- import _ from "lodash/fp";
2
1
  import { useEffect } from "react";
3
2
  import PropTypes from "prop-types";
4
3
  import { connect } from "react-redux";
5
4
  import { makeSearchQuerySelector } from "@truedat/core/selectors";
6
- import {
7
- clearConcepts,
8
- clearConceptDefaultFilters,
9
- fetchConcepts,
10
- } from "../routines";
5
+ import { clearConcepts, fetchConcepts } from "../routines";
11
6
 
12
- export const ConceptsLoader = ({
13
- clearConcepts,
14
- clearConceptDefaultFilters,
15
- fetchConcepts,
16
- payload,
17
- }) => {
7
+ export const ConceptsLoader = ({ clearConcepts, fetchConcepts, payload }) => {
18
8
  useEffect(() => {
19
9
  return () => {
20
10
  clearConcepts();
21
- clearConceptDefaultFilters();
22
11
  };
23
- }, [clearConcepts, clearConceptDefaultFilters]);
12
+ }, [clearConcepts]);
24
13
  useEffect(() => {
25
14
  fetchConcepts(payload);
26
15
  }, [payload, fetchConcepts]);
@@ -33,27 +22,17 @@ ConceptsLoader.propTypes = {
33
22
  payload: PropTypes.object,
34
23
  };
35
24
 
36
- const defaultFilters = (defaultFilters, conceptsDefaultFilters) =>
37
- defaultFilters || conceptsDefaultFilters;
38
25
  const makeMapStateToProps = () => {
39
26
  const searchQuerySelector = makeSearchQuerySelector(
40
27
  "conceptQuery",
41
28
  "conceptActiveFilters"
42
29
  );
43
30
  const mapStateToProps = (state, props) => ({
44
- payload: searchQuerySelector(state, {
45
- ...props,
46
- defaultFilters: defaultFilters(
47
- _.prop("defaultFilters")(props),
48
- _.prop("conceptsDefaultFilters")(state)
49
- ),
50
- }),
31
+ payload: searchQuerySelector(state, props),
51
32
  });
52
33
  return mapStateToProps;
53
34
  };
54
35
 
55
- export default connect(makeMapStateToProps, {
56
- clearConcepts,
57
- clearConceptDefaultFilters,
58
- fetchConcepts,
59
- })(ConceptsLoader);
36
+ export default connect(makeMapStateToProps, { clearConcepts, fetchConcepts })(
37
+ ConceptsLoader
38
+ );
@@ -0,0 +1,34 @@
1
+ import React from "react";
2
+ import PropTypes from "prop-types";
3
+ import { connect } from "react-redux";
4
+ import { Dimmer, Loader } from "semantic-ui-react";
5
+ import ConceptsActions from "./ConceptsActions";
6
+ import ConceptsLabelResults from "./ConceptsLabelResults";
7
+ import ConceptsPagination from "./ConceptsPagination";
8
+ import ConceptsSearch from "./ConceptsSearch";
9
+ import ConceptsTable from "./ConceptsTable";
10
+ import ConceptSelectedFilters from "./ConceptSelectedFilters";
11
+
12
+ export const ConceptsPanel = ({ loading, ...actions }) => (
13
+ <>
14
+ <ConceptsActions {...actions} />
15
+ <ConceptsSearch />
16
+ <ConceptSelectedFilters />
17
+ <Dimmer.Dimmable dimmed={loading}>
18
+ <Dimmer active={loading} inverted>
19
+ <Loader />
20
+ </Dimmer>
21
+ <ConceptsLabelResults />
22
+ <ConceptsTable />
23
+ <ConceptsPagination />
24
+ </Dimmer.Dimmable>
25
+ </>
26
+ );
27
+
28
+ ConceptsPanel.propTypes = {
29
+ loading: PropTypes.bool,
30
+ };
31
+
32
+ const mapStateToProps = ({ conceptsLoading }) => ({ loading: conceptsLoading });
33
+
34
+ export default connect(mapStateToProps)(ConceptsPanel);
@@ -7,14 +7,15 @@ import { Table, Header, Icon } from "semantic-ui-react";
7
7
  import { FormattedMessage } from "react-intl";
8
8
  import { withRouter } from "react-router";
9
9
  import { getSortInfo, sortColumn } from "@truedat/core/services/sort";
10
- import { CONCEPTS, CONCEPTS_PENDING } from "@truedat/core/routes";
10
+ import { CONCEPTS } from "@truedat/core/routes";
11
11
  import { sortConcepts } from "../routines";
12
12
  import { getConceptsRows, getConceptColumns } from "../selectors";
13
13
  import ConceptRow from "./ConceptRow";
14
14
 
15
15
  export class ConceptsTable extends React.Component {
16
16
  static propTypes = {
17
- conceptsLoading: PropTypes.bool,
17
+ loading: PropTypes.bool,
18
+ sortBy: PropTypes.array,
18
19
  concepts: PropTypes.array,
19
20
  columns: PropTypes.array,
20
21
  location: PropTypes.object,
@@ -23,8 +24,8 @@ export class ConceptsTable extends React.Component {
23
24
 
24
25
  //initial state
25
26
  state = {
26
- sortedColumn: _.prop("column")(getSortInfo(this.props.conceptsSorting)),
27
- direction: _.prop("direction")(getSortInfo(this.props.conceptsSorting)),
27
+ sortedColumn: _.prop("column")(getSortInfo(this.props.sortBy)),
28
+ direction: _.prop("direction")(getSortInfo(this.props.sortBy)),
28
29
  };
29
30
 
30
31
  setDirection = (direction) => {
@@ -36,25 +37,23 @@ export class ConceptsTable extends React.Component {
36
37
  };
37
38
 
38
39
  componentDidUpdate(prevProps) {
39
- if (prevProps.conceptsSorting != this.props.conceptsSorting) {
40
+ if (prevProps.sortBy != this.props.sortBy) {
40
41
  const { column: sortedColumn, direction: direction } = getSortInfo(
41
- this.props.conceptsSorting
42
+ this.props.sortBy
42
43
  );
43
44
  this.setState({ sortedColumn, direction });
44
45
  }
45
46
  }
46
47
 
47
48
  render() {
48
- const { concepts, columns, conceptsLoading, location, sortConcepts } =
49
- this.props;
50
-
49
+ const { concepts, columns, loading, location, sortConcepts } = this.props;
51
50
  const { sortedColumn, direction } = this.state;
52
51
 
53
52
  const pathname = _.prop("pathname")(location);
54
53
  const conceptColumns = columns.filter(
55
54
  (column) =>
56
- (pathname == CONCEPTS && column.name != "status") ||
57
- pathname == CONCEPTS_PENDING
55
+ (pathname === CONCEPTS && column.name != "status") ||
56
+ pathname !== CONCEPTS
58
57
  );
59
58
 
60
59
  return (
@@ -100,7 +99,7 @@ export class ConceptsTable extends React.Component {
100
99
  </Table.Body>
101
100
  </Table>
102
101
  )}
103
- {_.isEmpty(concepts) && !conceptsLoading && (
102
+ {loading || concepts?.length ? null : (
104
103
  <Header as="h4">
105
104
  <Icon name="search" />
106
105
  <Header.Content>
@@ -116,8 +115,8 @@ export class ConceptsTable extends React.Component {
116
115
  const mapStateToProps = (state) => ({
117
116
  columns: getConceptColumns(state),
118
117
  concepts: getConceptsRows(state),
119
- conceptsLoading: state.conceptsLoading,
120
- conceptsSorting: _.path("conceptQuery.sort")(state),
118
+ loading: state.conceptsLoading,
119
+ sortBy: _.path("conceptQuery.sort")(state),
121
120
  });
122
121
 
123
122
  export default compose(
@@ -0,0 +1,29 @@
1
+ import React from "react";
2
+ import PropTypes from "prop-types";
3
+ import { connect } from "react-redux";
4
+ import ConceptsPanel from "./ConceptsPanel";
5
+ import ConceptsLoader from "./ConceptsLoader";
6
+ import ConceptFiltersLoader from "./ConceptFiltersLoader";
7
+
8
+ export const DomainConcepts = ({ domain = {} }) => {
9
+ const defaultFilters = {
10
+ taxonomy: [domain.id],
11
+ current: [true],
12
+ status: ["published"],
13
+ };
14
+ return (
15
+ <>
16
+ <ConceptFiltersLoader defaultFilters={defaultFilters} />
17
+ <ConceptsLoader defaultFilters={defaultFilters} />
18
+ <ConceptsPanel />
19
+ </>
20
+ );
21
+ };
22
+
23
+ DomainConcepts.propTypes = {
24
+ domain: PropTypes.object.isRequired,
25
+ };
26
+
27
+ export const mapStateToProps = ({ domain }) => ({ domain });
28
+
29
+ export default connect(mapStateToProps)(DomainConcepts);
@@ -1,26 +1,23 @@
1
1
  import React from "react";
2
- import { shallow } from "enzyme";
2
+ import { render } from "@truedat/test/render";
3
3
  import ConceptArchiveRow from "../ConceptArchiveRow";
4
4
 
5
- const mockHistory = {
6
- push: jest.fn()
7
- };
8
-
9
- jest.mock("react-router-dom", () => ({
10
- ...jest.requireActual("react-router-dom"),
11
- useHistory: () => mockHistory
12
- }));
13
-
14
5
  describe("<ConceptArchiveRow />", () => {
15
6
  it("matches the latest snapshot", () => {
16
7
  const props = {
17
8
  id: 123,
18
- status: "status",
9
+ status: "draft",
19
10
  last_change_at: "2018-06-27T07:32:53.154377Z",
20
11
  last_change_by: "maixu",
21
- version: 1
12
+ version: 1,
22
13
  };
23
- const wrapper = shallow(<ConceptArchiveRow {...props} />);
24
- expect(wrapper).toMatchSnapshot();
14
+ const { container } = render(
15
+ <table>
16
+ <tbody>
17
+ <ConceptArchiveRow {...props} />
18
+ </tbody>
19
+ </table>
20
+ );
21
+ expect(container).toMatchSnapshot();
25
22
  });
26
23
  });