@truedat/dd 4.48.9 → 4.48.10

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.10] 2022-07-19
4
+
5
+ ### Changed
6
+
7
+ - [TD-4975] StructuresView can be used as embedded without header
8
+
3
9
  ## [4.48.8] 2022-07-18
4
10
 
5
11
  ### Changed
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@truedat/dd",
3
- "version": "4.48.9",
3
+ "version": "4.48.10",
4
4
  "description": "Truedat Web Data Dictionary",
5
5
  "sideEffects": false,
6
6
  "jsnext:main": "src/index.js",
@@ -88,9 +88,9 @@
88
88
  },
89
89
  "dependencies": {
90
90
  "@apollo/client": "^3.6.4",
91
- "@truedat/auth": "4.48.9",
92
- "@truedat/core": "4.48.9",
93
- "@truedat/df": "4.48.9",
91
+ "@truedat/auth": "4.48.10",
92
+ "@truedat/core": "4.48.10",
93
+ "@truedat/df": "4.48.10",
94
94
  "lodash": "^4.17.21",
95
95
  "path-to-regexp": "^1.7.0",
96
96
  "prop-types": "^15.8.1",
@@ -112,5 +112,5 @@
112
112
  "react-dom": ">= 16.8.6 < 17",
113
113
  "semantic-ui-react": ">= 0.88.2 < 2.1"
114
114
  },
115
- "gitHead": "82d6ab8fb0b3000bf4b8975670d3e5cf15b14487"
115
+ "gitHead": "9f5085bc64845d8eb2605c7c9d624feae44052f5"
116
116
  }
@@ -14,34 +14,39 @@ export const StructuresSearchResults = ({
14
14
  onSelect,
15
15
  selectedStructure,
16
16
  structures,
17
- loading
18
- }) =>
19
- !_.isEmpty(structures) || !_.isEmpty(selectedStructure) ? (
20
- <Dimmer.Dimmable dimmed={loading}>
21
- <StructuresLabelResults />
22
- <StructuresTable
23
- columns={columns}
24
- size={size}
25
- selectedStructure={selectedStructure}
26
- structures={structures}
27
- onStructureSelected={onSelect}
28
- />
29
- <StructuresPagination size={size} />
30
- <Dimmer inverted active={loading}>
31
- <Loader size="large" />
32
- </Dimmer>
33
- </Dimmer.Dimmable>
34
- ) : loading ? null : (
35
- <Message icon info>
36
- <Icon name="search" />
37
- <Message.Content>
38
- <Message.Header>
39
- <FormattedMessage id="structures.not_found.header" />
40
- </Message.Header>
41
- <FormattedMessage id="structures.not_found.body" />
42
- </Message.Content>
43
- </Message>
44
- );
17
+ loading,
18
+ }) => (
19
+ <Dimmer.Dimmable dimmed={loading}>
20
+ <Dimmer active={loading} inverted>
21
+ <Loader size="large" />
22
+ </Dimmer>
23
+ {!_.isEmpty(structures) || !_.isEmpty(selectedStructure) ? (
24
+ <>
25
+ <StructuresLabelResults />
26
+ <StructuresTable
27
+ columns={columns}
28
+ size={size}
29
+ selectedStructure={selectedStructure}
30
+ structures={structures}
31
+ onStructureSelected={onSelect}
32
+ />
33
+ <StructuresPagination size={size} />
34
+ </>
35
+ ) : (
36
+ <Message icon info>
37
+ <Icon name="search" />
38
+ <Message.Content>
39
+ <Message.Header>
40
+ <FormattedMessage
41
+ id={`structures.${loading ? "loading" : "not_found"}.header`}
42
+ />
43
+ </Message.Header>
44
+ {loading ? null : <FormattedMessage id="structures.not_found.body" />}
45
+ </Message.Content>
46
+ </Message>
47
+ )}
48
+ </Dimmer.Dimmable>
49
+ );
45
50
 
46
51
  StructuresSearchResults.propTypes = {
47
52
  columns: PropTypes.array,
@@ -49,7 +54,7 @@ StructuresSearchResults.propTypes = {
49
54
  onSelect: PropTypes.func,
50
55
  structures: PropTypes.array,
51
56
  selectedStructure: PropTypes.object,
52
- loading: PropTypes.bool
57
+ loading: PropTypes.bool,
53
58
  };
54
59
 
55
60
  export default StructuresSearchResults;
@@ -26,23 +26,21 @@ export const StructuresHeader = () => (
26
26
  </Header>
27
27
  );
28
28
 
29
- export const StructuresView = ({
29
+ const StructuresViewContent = ({
30
30
  actions = {},
31
31
  loading,
32
32
  structures,
33
33
  hasFilterApplied,
34
- systemsLoading,
34
+ embedded,
35
35
  }) => {
36
36
  const history = useHistory();
37
37
  return (
38
- <Segment loading={systemsLoading}>
39
- <StructuresHeader />
40
- <Divider hidden />
38
+ <>
41
39
  <StructuresOptions hasFilterApplied={hasFilterApplied} {...actions} />
42
40
  <StructuresSearch />
43
41
  <StructureSelectedFilters />
44
42
  <StructureDateFilter />
45
- {hasFilterApplied ? (
43
+ {hasFilterApplied || embedded ? (
46
44
  <StructuresSearchResults
47
45
  structures={structures}
48
46
  loading={loading}
@@ -51,6 +49,27 @@ export const StructuresView = ({
51
49
  ) : (
52
50
  <SystemCards />
53
51
  )}
52
+ </>
53
+ );
54
+ };
55
+
56
+ StructuresViewContent.propTypes = {
57
+ actions: PropTypes.object,
58
+ structures: PropTypes.array,
59
+ loading: PropTypes.bool,
60
+ hasFilterApplied: PropTypes.bool,
61
+ embedded: PropTypes.bool,
62
+ };
63
+
64
+ export const StructuresView = (props) => {
65
+ const { systemsLoading, embedded } = props;
66
+ return embedded ? (
67
+ <StructuresViewContent {...props} />
68
+ ) : (
69
+ <Segment loading={systemsLoading}>
70
+ <StructuresHeader />
71
+ <Divider hidden />
72
+ <StructuresViewContent {...props} />
54
73
  </Segment>
55
74
  );
56
75
  };
@@ -61,6 +80,7 @@ StructuresView.propTypes = {
61
80
  loading: PropTypes.bool,
62
81
  systemsLoading: PropTypes.bool,
63
82
  hasFilterApplied: PropTypes.bool,
83
+ embedded: PropTypes.bool,
64
84
  };
65
85
 
66
86
  const selectedFilters = ({ structureActiveFilters, structureDateFilter }) =>
@@ -71,13 +91,15 @@ const selectedFilters = ({ structureActiveFilters, structureDateFilter }) =>
71
91
 
72
92
  const isEmptyPath = (state, path) => _.flow(_.path(path), _.isEmpty)(state);
73
93
 
74
- const mapStateToProps = (state) => ({
75
- structures: structureRowsSelector(state),
76
- actions: state.structuresActions,
77
- loading: state.structuresLoading,
78
- systemsLoading: state.systemsLoading,
79
- hasFilterApplied:
80
- !isEmptyPath(state, "structureQuery.query") || selectedFilters(state),
81
- });
94
+ const mapStateToProps = (state) => {
95
+ return {
96
+ structures: structureRowsSelector(state),
97
+ actions: state.structuresActions,
98
+ loading: state.structuresLoading,
99
+ systemsLoading: state.systemsLoading,
100
+ hasFilterApplied:
101
+ !isEmptyPath(state, "structureQuery.query") || selectedFilters(state),
102
+ };
103
+ };
82
104
 
83
105
  export default connect(mapStateToProps)(StructuresView);
@@ -2,6 +2,13 @@
2
2
 
3
3
  exports[`<StructuresSearchResults /> matches the latest snapshot 1`] = `
4
4
  <DimmerDimmable>
5
+ <Dimmer
6
+ inverted={true}
7
+ >
8
+ <Loader
9
+ size="large"
10
+ />
11
+ </Dimmer>
5
12
  <Connect(StructuresLabelResults) />
6
13
  <Connect(StructuresTable)
7
14
  structures={
@@ -19,12 +26,5 @@ exports[`<StructuresSearchResults /> matches the latest snapshot 1`] = `
19
26
  }
20
27
  />
21
28
  <Connect(Pagination) />
22
- <Dimmer
23
- inverted={true}
24
- >
25
- <Loader
26
- size="large"
27
- />
28
- </Dimmer>
29
29
  </DimmerDimmable>
30
30
  `;
@@ -6,13 +6,44 @@ exports[`<StructuresView /> matches the latest snapshot 1`] = `
6
6
  <Divider
7
7
  hidden={true}
8
8
  />
9
- <StructuresOptions
10
- bulkUpdate={Object {}}
9
+ <StructuresViewContent
10
+ actions={
11
+ Object {
12
+ "bulkUpdate": Object {},
13
+ }
14
+ }
15
+ columns={
16
+ Array [
17
+ Object {
18
+ "name": "name",
19
+ },
20
+ Object {
21
+ "fieldSelector": [Function],
22
+ "name": "domain",
23
+ },
24
+ Object {
25
+ "name": "system",
26
+ },
27
+ Object {
28
+ "name": "group",
29
+ },
30
+ ]
31
+ }
32
+ structures={
33
+ Array [
34
+ Object {
35
+ "description": "dd",
36
+ "domain": Object {
37
+ "name": "org",
38
+ },
39
+ "group": "gp",
40
+ "id": 1,
41
+ "name": "s1",
42
+ "system": "sys",
43
+ },
44
+ ]
45
+ }
11
46
  />
12
- <Connect(StructuresSearch) />
13
- <injectIntl(Connect(SelectedFilters)) />
14
- <Connect(StructureDateFilter) />
15
- <Connect(SystemCards) />
16
47
  </Segment>
17
48
  `;
18
49
 
@@ -492,6 +492,7 @@ export default {
492
492
  "Only modify fields to be updated",
493
493
  "structures.header.edit.bulk.structures_count":
494
494
  'Selected structures: "{structures_count}"',
495
+ "structures.loading.header": "Loading structures...",
495
496
  "structures.not_found.body":
496
497
  "No structures have been found matching these filters.",
497
498
  "structures.not_found.header": "Nothing found...",
@@ -506,6 +506,7 @@ export default {
506
506
  "Rellenar únicamente los campos que se quieran actualizar",
507
507
  "structures.header.edit.bulk.structures_count":
508
508
  'Estructuras seleccionadas: "{structures_count}"',
509
+ "structures.loading.header": "Cargando estructuras...",
509
510
  "structures.not_found.body":
510
511
  "No existe ningún elemento para la búsqueda aplicada",
511
512
  "structures.not_found.header": "Ningún resultado encontrado",
@@ -1,4 +1,4 @@
1
- import { fetchStructures, toggleStructureFilterValue } from "../routines";
1
+ import { fetchStructures, fetchStructureFilters } from "../routines";
2
2
 
3
3
  const structuresLoading = (state = false, { type }) => {
4
4
  switch (type) {
@@ -6,8 +6,6 @@ const structuresLoading = (state = false, { type }) => {
6
6
  return true;
7
7
  case fetchStructures.FULFILL:
8
8
  return false;
9
- case toggleStructureFilterValue.TRIGGER:
10
- return true;
11
9
  default:
12
10
  return state;
13
11
  }