@eeacms/volto-datahub 1.0.14 → 1.0.16

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
@@ -4,6 +4,16 @@ All notable changes to this project will be documented in this file. Dates are d
4
4
 
5
5
  Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
6
6
 
7
+ ### [1.0.16](https://github.com/eea/volto-datahub/compare/1.0.15...1.0.16) - 6 March 2023
8
+
9
+ #### :hammer_and_wrench: Others
10
+
11
+ - added utils.js [Zoltan Szabo - [`fdb33c3`](https://github.com/eea/volto-datahub/commit/fdb33c37e1af2fe071dbe8f4f5dcd2b82932edc8)]
12
+ - Show 'Obsolete' info in the metadata section in the banner [Zoltan Szabo - [`fddfd2a`](https://github.com/eea/volto-datahub/commit/fddfd2aea63d1a1d1567c163ab29dd7119781117)]
13
+ - Show 'More information' section only if it's not empty [Zoltan Szabo - [`612f035`](https://github.com/eea/volto-datahub/commit/612f03509c6adf143631ae6dee5ca2bd48a501c3)]
14
+ - Add Sonarqube tag using eea-website-frontend addons list [EEA Jenkins - [`b9100f6`](https://github.com/eea/volto-datahub/commit/b9100f6b2b2e9e9a26b9c11708c8fda94137cecc)]
15
+ ### [1.0.15](https://github.com/eea/volto-datahub/compare/1.0.14...1.0.15) - 1 March 2023
16
+
7
17
  ### [1.0.14](https://github.com/eea/volto-datahub/compare/1.0.13...1.0.14) - 1 March 2023
8
18
 
9
19
  #### :hammer_and_wrench: Others
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eeacms/volto-datahub",
3
- "version": "1.0.14",
3
+ "version": "1.0.16",
4
4
  "description": "@eeacms/volto-datahub: Volto add-on",
5
5
  "main": "src/index.js",
6
6
  "author": "European Environment Agency: IDM2 A-Team",
@@ -441,6 +441,9 @@ const Datasets = (props) => {
441
441
  className="datasets-tab"
442
442
  menu={{ vertical: true, secondary: true, pointing: true }}
443
443
  panes={panes}
444
+ onTabChange={() => {
445
+ setActiveIndex(0);
446
+ }}
444
447
  />
445
448
  </>
446
449
  ) : null;
@@ -18,6 +18,8 @@ import { asyncConnect, Helmet } from '@plone/volto/helpers';
18
18
  import { fetchResult } from '@eeacms/search/lib/hocs/useResult';
19
19
  import { setDatahubResult } from '@eeacms/volto-datahub/store';
20
20
 
21
+ import { isObsolete } from './utils.js';
22
+
21
23
  const appName = 'datahub';
22
24
 
23
25
  function IsomorphicPortal({ children }) {
@@ -64,7 +66,8 @@ function ItemView(props) {
64
66
 
65
67
  const item = result ? result._result : null;
66
68
  const { title, description, raw_value } = item || {}; // readingTime
67
- const { changeDate, resourceIdentifier } = raw_value?.raw || {};
69
+ const { changeDate, resourceIdentifier, cl_status } = raw_value?.raw || {};
70
+ const obsolete = isObsolete(cl_status);
68
71
 
69
72
  const prodID = (resourceIdentifier || []).filter((p) => {
70
73
  return p.code.includes('DAT');
@@ -113,6 +116,7 @@ function ItemView(props) {
113
116
  </Banner.Subtitle>
114
117
  <Banner.Title>{title?.raw}</Banner.Title>
115
118
  <Banner.Metadata>
119
+ {obsolete && <div class="ui label archived-item">Obsolete</div>}
116
120
  <Banner.MetadataField label="Prod-ID" value={prodID} />
117
121
  <Banner.MetadataField
118
122
  label="Published"
@@ -16,59 +16,65 @@ const MetadataSection = (props) => {
16
16
 
17
17
  return (
18
18
  <>
19
- <div className="dataset-container metadata-wrapper">
20
- <h2>More information</h2>
19
+ {(!!rod ||
20
+ (!!organisations && organisations.length > 0) ||
21
+ (merged_time_coverage_range &&
22
+ merged_time_coverage_range?.length > 0)) && (
23
+ <div className="dataset-container metadata-wrapper">
24
+ <h2>More information</h2>
21
25
 
22
- <div className="metadata-list">
23
- {!!rod && (
24
- <div className="metadata-section">
25
- <h5>Reporting obligations (ROD)</h5>
26
-
27
- {Array.isArray(rod?.raw) ? (
28
- <>
29
- {rod?.raw.map((item, i) => {
30
- return <div key={i}>{item}</div>;
31
- })}
32
- </>
33
- ) : (
34
- <div>{rod?.raw}</div>
35
- )}
36
- </div>
37
- )}
38
-
39
- {!!organisations && organisations.length > 0 && (
40
- <div className="metadata-section">
41
- <h5>Organisation:</h5>
26
+ <div className="metadata-list">
27
+ {!!rod && (
28
+ <div className="metadata-section">
29
+ <h5>Reporting obligations (ROD)</h5>
42
30
 
43
- {organisations.map((item, i) => {
44
- return <div key={i}>{item}</div>;
45
- })}
46
- </div>
47
- )}
31
+ {Array.isArray(rod?.raw) ? (
32
+ <>
33
+ {rod?.raw.map((item, i) => {
34
+ return <div key={i}>{item}</div>;
35
+ })}
36
+ </>
37
+ ) : (
38
+ <div>{rod?.raw}</div>
39
+ )}
40
+ </div>
41
+ )}
48
42
 
49
- {merged_time_coverage_range &&
50
- merged_time_coverage_range?.length > 0 && (
43
+ {!!organisations && organisations.length > 0 && (
51
44
  <div className="metadata-section">
52
- <h5>Temporal coverage:</h5>
45
+ <h5>Organisation:</h5>
53
46
 
54
- {merged_time_coverage_range.map((tc, i) => {
55
- const tc_start = tc.start || '';
56
- const tc_end = tc.end || '';
57
- return (
58
- <React.Fragment key={i}>
59
- <span>
60
- {tc_start === tc_end && tc_start}
61
- {tc_start !== tc_end && tc_start + ' - ' + tc_end}
62
- </span>
63
- {i !== merged_time_coverage_range.length - 1 ? ', ' : ' '}
64
- </React.Fragment>
65
- );
47
+ {organisations.map((item, i) => {
48
+ return <div key={i}>{item}</div>;
66
49
  })}
67
50
  </div>
68
51
  )}
69
- </div>
70
- </div>
71
52
 
53
+ {merged_time_coverage_range &&
54
+ merged_time_coverage_range?.length > 0 && (
55
+ <div className="metadata-section">
56
+ <h5>Temporal coverage:</h5>
57
+
58
+ {merged_time_coverage_range.map((tc, i) => {
59
+ const tc_start = tc.start || '';
60
+ const tc_end = tc.end || '';
61
+ return (
62
+ <React.Fragment key={i}>
63
+ <span>
64
+ {tc_start === tc_end && tc_start}
65
+ {tc_start !== tc_end && tc_start + ' - ' + tc_end}
66
+ </span>
67
+ {i !== merged_time_coverage_range.length - 1
68
+ ? ', '
69
+ : ' '}
70
+ </React.Fragment>
71
+ );
72
+ })}
73
+ </div>
74
+ )}
75
+ </div>
76
+ </div>
77
+ )}
72
78
  <div className="dataset-container">
73
79
  <div className="d-link">
74
80
  <Icon className="file pdf" />
@@ -0,0 +1,19 @@
1
+ const OBSOLETE_KEYS = ['obsolete', 'superseded'];
2
+
3
+ export const isObsolete = (status) => {
4
+ let obsolete = false;
5
+ if (status) {
6
+ if (Array.isArray(status)) {
7
+ if (
8
+ status.filter((stat) => OBSOLETE_KEYS.includes(stat?.key)).length > 0
9
+ ) {
10
+ obsolete = true;
11
+ }
12
+ } else {
13
+ if (OBSOLETE_KEYS.includes(status?.key)) {
14
+ obsolete = true;
15
+ }
16
+ }
17
+ }
18
+ return obsolete;
19
+ };