@eeacms/volto-datahub 1.0.25 → 1.0.26

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,7 +4,23 @@ 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.25](https://github.com/eea/volto-datahub/compare/1.0.24...1.0.25) - 15 August 2023
7
+ ### [1.0.26](https://github.com/eea/volto-datahub/compare/1.0.25...1.0.26) - 23 August 2023
8
+
9
+ #### :hammer_and_wrench: Others
10
+
11
+ - Update tests [kreafox - [`b452535`](https://github.com/eea/volto-datahub/commit/b452535adabf75488d6c82725152d497c6758cd4)]
12
+ - Add tests [kreafox - [`3ef3c6f`](https://github.com/eea/volto-datahub/commit/3ef3c6f3ea11eff95d091fb5112f3e5c4a981e0d)]
13
+ - Update Jenkinsfile [kreafox - [`2202f7f`](https://github.com/eea/volto-datahub/commit/2202f7f4de801a209753b0abe159c974fc0da754)]
14
+ - Add test [kreafox - [`fcec0ba`](https://github.com/eea/volto-datahub/commit/fcec0ba7c8054d7973421428dd36d59c3a7fb2ba)]
15
+ - Add test [kreafox - [`5061ab7`](https://github.com/eea/volto-datahub/commit/5061ab71928e4e352635c49ba7b53bf204a5b797)]
16
+ - Code cleanup [kreafox - [`a0031be`](https://github.com/eea/volto-datahub/commit/a0031be9884b18fbbf247b0a2276b12df28bb6f1)]
17
+ - Update dependencies [kreafox - [`955fec2`](https://github.com/eea/volto-datahub/commit/955fec2f7b7acd84dd40b195fd5dc098a8e9a11c)]
18
+ - Fix icon size on firefox [kreafox - [`b49744d`](https://github.com/eea/volto-datahub/commit/b49744d1667988a93a5f3c43535136c3ca7f833a)]
19
+ - Fixes on datahub view [kreafox - [`32e91a0`](https://github.com/eea/volto-datahub/commit/32e91a0f92fb1c1297a9ff3d7aa36f993d2d547b)]
20
+ - test: Update Makefile and docker-compose to align it with Jenkinsfile [valentinab25 - [`9a9cfca`](https://github.com/eea/volto-datahub/commit/9a9cfca01faf04b5545a33e4657003dcdc3b72f6)]
21
+ - Add datasets filtering option [kreafox - [`3064341`](https://github.com/eea/volto-datahub/commit/30643419cab961809926c5e9221dfdb59ddf59ea)]
22
+ - Improve accordion on datahub view [kreafox - [`dd7716a`](https://github.com/eea/volto-datahub/commit/dd7716a4913a820e3031925e6af5d6f9add0d3c5)]
23
+ ### [1.0.25](https://github.com/eea/volto-datahub/compare/1.0.24...1.0.25) - 16 August 2023
8
24
 
9
25
  #### :house: Documentation changes
10
26
 
@@ -26,7 +42,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
26
42
 
27
43
  #### :house: Internal changes
28
44
 
29
- - chore: [JENKINS] Deprecate circularity website [valentinab25 - [`e5933ce`](https://github.com/eea/volto-datahub/commit/e5933ce8879d98aabe0bab56980dbd50ce856a36)]
30
45
 
31
46
  #### :hammer_and_wrench: Others
32
47
 
@@ -81,7 +96,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
81
96
  - added utils.js [Zoltan Szabo - [`fdb33c3`](https://github.com/eea/volto-datahub/commit/fdb33c37e1af2fe071dbe8f4f5dcd2b82932edc8)]
82
97
  - Show 'Obsolete' info in the metadata section in the banner [Zoltan Szabo - [`fddfd2a`](https://github.com/eea/volto-datahub/commit/fddfd2aea63d1a1d1567c163ab29dd7119781117)]
83
98
  - Show 'More information' section only if it's not empty [Zoltan Szabo - [`612f035`](https://github.com/eea/volto-datahub/commit/612f03509c6adf143631ae6dee5ca2bd48a501c3)]
84
- - Add Sonarqube tag using eea-website-frontend addons list [EEA Jenkins - [`b9100f6`](https://github.com/eea/volto-datahub/commit/b9100f6b2b2e9e9a26b9c11708c8fda94137cecc)]
85
99
  ### [1.0.15](https://github.com/eea/volto-datahub/compare/1.0.14...1.0.15) - 1 March 2023
86
100
 
87
101
  ### [1.0.14](https://github.com/eea/volto-datahub/compare/1.0.13...1.0.14) - 1 March 2023
@@ -174,11 +188,9 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
174
188
  #### :hammer_and_wrench: Others
175
189
 
176
190
  - Fix eslintrc: add @eeacms/search [kreafox - [`465816f`](https://github.com/eea/volto-datahub/commit/465816feb8f58095ab4b5b3168cd29ebede3a10c)]
177
- - Use latest Volto before yarn 3 [Tiberiu Ichim - [`69f5859`](https://github.com/eea/volto-datahub/commit/69f585980fd9a38ff99d0c7875704671857720f7)]
178
191
  - Reorder sections on landing page [kreafox - [`46fac8d`](https://github.com/eea/volto-datahub/commit/46fac8d821cf93fe1b2c380380719de130c3f1cb)]
179
192
  - Fix project eslintrc [kreafox - [`5baa150`](https://github.com/eea/volto-datahub/commit/5baa1505ec38ed313269f5608c186c6a6a8bbfc4)]
180
193
  - Open dataset links in new tab [kreafox - [`bbed914`](https://github.com/eea/volto-datahub/commit/bbed914dc2edf6c749d1d73d93a423bc642e680c)]
181
- - Add Sonarqube tag using circularity-frontend addons list [EEA Jenkins - [`380a2a9`](https://github.com/eea/volto-datahub/commit/380a2a9625c6f799df7a7c343fad3f3b3d959f96)]
182
194
  ## [1.0.0](https://github.com/eea/volto-datahub/compare/0.1.12...1.0.0) - 28 October 2022
183
195
 
184
196
  #### :nail_care: Enhancements
@@ -203,7 +215,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
203
215
  #### :hammer_and_wrench: Others
204
216
 
205
217
  - fixed query for related items [Zoltan Szabo - [`b66faee`](https://github.com/eea/volto-datahub/commit/b66faee1f8a1922cd22b3a36eccc9c7b92e377d4)]
206
- - Add Sonarqube tag using eea-website-frontend addons list [EEA Jenkins - [`158fe1a`](https://github.com/eea/volto-datahub/commit/158fe1a0b1767452e2e51a3e2ef97169589a50e8)]
207
218
  ### [0.1.10](https://github.com/eea/volto-datahub/compare/0.1.9...0.1.10) - 21 September 2022
208
219
 
209
220
  #### :hammer_and_wrench: Others
@@ -292,7 +303,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
292
303
  #### :hammer_and_wrench: Others
293
304
 
294
305
  - Hide questions & fix landing page [kreafox - [`a1ef303`](https://github.com/eea/volto-datahub/commit/a1ef3033df0e84f3a72dd0f984c8717dff2a771c)]
295
- - Add Sonarqube tag using eea-website-frontend addons list [EEA Jenkins - [`910688e`](https://github.com/eea/volto-datahub/commit/910688e3ddf2f8cda4f941595ae9a6ee0ec0ea3b)]
296
306
  ### [0.1.1](https://github.com/eea/volto-datahub/compare/0.1.0...0.1.1) - 10 June 2022
297
307
 
298
308
  ### [0.1.0](https://github.com/eea/volto-datahub/compare/0.0.1...0.1.0) - 9 June 2022
@@ -1,11 +1,12 @@
1
1
  version: "3"
2
2
  services:
3
3
  backend:
4
- image: plone/plone-backend:${PLONE_VERSION:-6}
4
+ image: eeacms/plone-backend
5
5
  ports:
6
6
  - "8080:8080"
7
7
  environment:
8
8
  SITE: "Plone"
9
+ PROFILES: "eea.kitkat:testing"
9
10
 
10
11
  frontend:
11
12
  build:
@@ -23,6 +24,9 @@ services:
23
24
  volumes:
24
25
  - ./:/app/src/addons/${ADDON_PATH}
25
26
  environment:
27
+ CI: "true"
28
+ NODE_ENV: "development"
29
+ RAZZLE_JEST_CONFIG: "src/addons/${ADDON_PATH}/jest-addon.config.js"
26
30
  RAZZLE_INTERNAL_API_PATH: "http://backend:8080/Plone"
27
31
  RAZZLE_DEV_PROXY_API_PATH: "http://backend:8080/Plone"
28
32
  HOST: "0.0.0.0"
@@ -12,6 +12,7 @@ module.exports = {
12
12
  '@package/(.*)$': '<rootDir>/src/$1',
13
13
  '@root/(.*)$': '<rootDir>/src/$1',
14
14
  '@plone/volto-quanta/(.*)$': '<rootDir>/src/addons/volto-quanta/src/$1',
15
+ '@eeacms/search': '<rootDir>/node_modules/@eeacms/volto-searchlib/src',
15
16
  '@eeacms/(.*?)/(.*)$': '<rootDir>/node_modules/@eeacms/$1/src/$2',
16
17
  '@plone/volto-slate':
17
18
  '<rootDir>/node_modules/@plone/volto/packages/volto-slate/src',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eeacms/volto-datahub",
3
- "version": "1.0.25",
3
+ "version": "1.0.26",
4
4
  "description": "@eeacms/volto-datahub: Volto add-on",
5
5
  "main": "src/index.js",
6
6
  "author": "European Environment Agency: IDM2 A-Team",
@@ -19,6 +19,7 @@
19
19
  "dependencies": {
20
20
  "@eeacms/volto-globalsearch": "*",
21
21
  "@eeacms/volto-listing-block": "*",
22
+ "@eeacms/volto-accordion-block": "*",
22
23
  "feed": "4.2.2"
23
24
  },
24
25
  "devDependencies": {
@@ -29,7 +30,8 @@
29
30
  },
30
31
  "addons": [
31
32
  "@eeacms/volto-globalsearch",
32
- "@eeacms/volto-listing-block"
33
+ "@eeacms/volto-listing-block",
34
+ "@eeacms/volto-accordion-block"
33
35
  ],
34
36
  "scripts": {
35
37
  "release": "release-it",
@@ -33,7 +33,7 @@ const DatasetItemDownloadList = (props) => {
33
33
  <span>{item.name}</span>
34
34
  </a>
35
35
  {isInternalURL(item.url) && (
36
- <SVGIcon name={lockSVG} size="18" />
36
+ <SVGIcon name={lockSVG} size="20px" />
37
37
  )}
38
38
  </div>
39
39
  </List.Content>
@@ -72,7 +72,7 @@ const DatasetItemDownloadList = (props) => {
72
72
  </a>
73
73
  )}
74
74
  {isInternalURL(item.url) && (
75
- <SVGIcon name={lockSVG} size="18" />
75
+ <SVGIcon name={lockSVG} size="20px" />
76
76
  )}
77
77
  </div>
78
78
  </List.Content>
@@ -92,7 +92,7 @@ const DatasetItemDownloadList = (props) => {
92
92
  <List.Item key={i}>
93
93
  <List.Content>
94
94
  <div>
95
- <SVGIcon name={servicesSVG} size="18" />
95
+ <SVGIcon name={servicesSVG} size="20px" />
96
96
  <a
97
97
  className="item-link"
98
98
  href={item.url}
@@ -102,7 +102,7 @@ const DatasetItemDownloadList = (props) => {
102
102
  {item.protocol} {item.name || item.description}
103
103
  </a>
104
104
  {isInternalURL(item.url) && (
105
- <SVGIcon name={lockSVG} size="18" />
105
+ <SVGIcon name={lockSVG} size="20px" />
106
106
  )}
107
107
  </div>
108
108
  </List.Content>
@@ -115,7 +115,7 @@ const DatasetItemDownloadList = (props) => {
115
115
  <List.Item key={i}>
116
116
  <List.Content>
117
117
  <div>
118
- <SVGIcon name={servicesSVG} size="18" />
118
+ <SVGIcon name={servicesSVG} size="20px" />
119
119
  <a
120
120
  className="item-link"
121
121
  href={item.url}
@@ -125,7 +125,7 @@ const DatasetItemDownloadList = (props) => {
125
125
  {item.protocol} {item.name || item.description}
126
126
  </a>
127
127
  {isInternalURL(item.url) && (
128
- <SVGIcon name={lockSVG} size="18" />
128
+ <SVGIcon name={lockSVG} size="20px" />
129
129
  )}
130
130
  </div>
131
131
  </List.Content>
@@ -155,7 +155,7 @@ const DatasetItemDownloadList = (props) => {
155
155
  <span>{item.name || item.url}</span>
156
156
  </a>
157
157
  {isInternalURL(item.url) && (
158
- <SVGIcon name={lockSVG} size="18" />
158
+ <SVGIcon name={lockSVG} size="20px" />
159
159
  )}
160
160
  </div>
161
161
  </List.Content>
@@ -1,33 +1,52 @@
1
1
  import React from 'react';
2
+ import config from '@plone/volto/registry';
2
3
  import { Accordion, Icon } from 'semantic-ui-react';
4
+ import { useLocation, useHistory } from 'react-router-dom';
5
+
3
6
  import { DateTime } from '@eeacms/search';
7
+ import { AccordionFilter } from '@eeacms/volto-accordion-block/components';
8
+
4
9
  import { isInternal, SVGIcon, isObsolete } from '../utils.js';
5
10
  import DatasetItemDownloadList from './DatasetItemDownloadList';
6
11
 
7
- import AnimateHeight from 'react-animate-height';
8
-
9
12
  import lockSVG from 'remixicon/icons/System/lock-line.svg';
10
13
 
11
- import { useLocation, useHistory } from 'react-router-dom';
12
-
13
14
  const useQuery = (location) => {
14
15
  const { search } = location;
15
16
  return React.useMemo(() => new URLSearchParams(search), [search]);
16
17
  };
17
18
 
18
19
  const DatasetItemsList = (props) => {
19
- const { appConfig, item, setActiveAccordion } = props;
20
+ const {
21
+ item,
22
+ appConfig,
23
+ filterValue,
24
+ setActiveTabIndex,
25
+ setActiveAccordionId,
26
+ setInitialAccordionId,
27
+ handleFilteredValueChange,
28
+ } = props;
20
29
 
21
- const location = useLocation();
22
30
  const history = useHistory();
31
+ const location = useLocation();
23
32
  const query = useQuery(location);
24
- const { search } = useLocation();
25
33
 
34
+ const datasets = item?.children;
35
+ const firstIdFromPanels = datasets?.[0]?.id;
36
+ const accordionConfig = config.blocks.blocksConfig.accordion;
26
37
  const activePanels = query.get('activeAccordion')?.split(',') || [];
27
- const [itemToScroll, setItemToScroll] = React.useState('');
38
+
28
39
  const [activeIndex, setActiveIndex] = React.useState([]);
29
40
  const [activePanel, setActivePanel] = React.useState([]);
41
+
30
42
  const activePanelsRef = React.useRef(activePanels);
43
+ const firstIdFromPanelsRef = React.useRef(firstIdFromPanels);
44
+
45
+ React.useEffect(() => {
46
+ setInitialAccordionId(
47
+ activePanelsRef.current[activePanelsRef.current.length - 1],
48
+ );
49
+ }, [setInitialAccordionId]);
31
50
 
32
51
  const addQueryParam = (key, value) => {
33
52
  const searchParams = new URLSearchParams(location.search);
@@ -40,14 +59,18 @@ const DatasetItemsList = (props) => {
40
59
  });
41
60
  };
42
61
 
43
- React.useEffect(() => {
44
- const query = new URLSearchParams(search);
45
- const panels = query.get('activeAccordion')?.split(',') || [];
46
- setActiveAccordion(panels);
47
- }, [search, setActiveAccordion]);
62
+ const handleActiveIndex = (index, id) => {
63
+ setActivePanel(id);
64
+ setActiveIndex(index);
65
+ addQueryParam('activeAccordion', id);
66
+ };
67
+
68
+ const isActive = (id) => {
69
+ return activePanel.includes(id);
70
+ };
48
71
 
49
72
  const handleClick = (e, titleProps) => {
50
- const { index, id } = titleProps;
73
+ const { index, id, item } = titleProps;
51
74
 
52
75
  const newIndex =
53
76
  activeIndex.indexOf(index) === -1
@@ -59,87 +82,85 @@ const DatasetItemsList = (props) => {
59
82
  ? [...activePanel, id]
60
83
  : activePanel.filter((item) => item !== id);
61
84
 
85
+ setActiveAccordionId(id);
86
+ setActiveTabIndex(item.id);
62
87
  handleActiveIndex(newIndex, newPanel);
63
88
  };
64
89
 
65
- const handleActiveIndex = (index, id) => {
66
- setActiveIndex(index);
67
- setActivePanel(id);
68
- addQueryParam('activeAccordion', id);
69
- };
70
-
71
- const scrollToElement = () => {
72
- if (!!activePanels && !!activePanels[0].length) {
73
- let element = document.getElementById(
74
- activePanels[activePanels.length - 1],
75
- );
76
- element.scrollIntoView({ behavior: 'smooth' });
77
- }
78
- };
79
-
80
- const isActive = (id) => {
81
- return activePanel.includes(id);
82
- };
83
-
84
90
  React.useEffect(() => {
85
- const firstAccordion = item?.children?.[0].id;
86
- if (activePanel.length < 1) {
87
- setActivePanel([firstAccordion]);
91
+ if (!!activePanelsRef.current && !!activePanelsRef?.current[0]?.length) {
92
+ setActivePanel(activePanelsRef.current || []);
93
+ } else {
94
+ setActivePanel([
95
+ firstIdFromPanelsRef.current,
96
+ ...(activePanelsRef.current || []),
97
+ ]);
88
98
  }
89
- }, [activePanel.length, item.children]);
90
-
91
- React.useEffect(() => {
92
- !!activePanelsRef.current &&
93
- setItemToScroll(
94
- activePanelsRef.current[activePanelsRef.current?.length - 1],
95
- );
96
99
  }, []);
97
100
 
98
101
  React.useEffect(() => {
99
- setActivePanel(activePanelsRef.current || []);
102
+ const timer = setTimeout(() => {
103
+ const activeAccordionId =
104
+ activePanelsRef?.current[activePanelsRef?.current.length - 1];
105
+ const element = document.getElementById(activeAccordionId);
106
+ element &&
107
+ element.scrollIntoView({
108
+ behavior: 'smooth',
109
+ inline: 'start',
110
+ });
111
+ }, 1000);
112
+ return () => clearTimeout(timer);
100
113
  }, []);
101
114
 
102
115
  return (
103
- <Accordion>
104
- {item?.children.map((dataset, index) => {
105
- const {
106
- id,
107
- resourceTemporalExtentDetails,
108
- temporalDateRange,
109
- publicationDateForResource,
110
- } = dataset;
111
- const archived = isObsolete(dataset.cl_status);
112
-
113
- return (
114
- <div key={index} id={id}>
115
- <Accordion.Title
116
- tabIndex={0}
117
- active={isActive(id)}
118
- index={index}
119
- onClick={(e) => handleClick(e, { index, id })}
120
- onKeyDown={(e) => {
121
- if (e.key === 'Enter') {
122
- handleClick(e, { index });
123
- }
124
- }}
125
- >
126
- <span className="dataset-title">
127
- {dataset.resourceTitleObject.default}
128
- <span className="formats">
129
- {(dataset.format || [])
130
- .filter((item, pos, self) => self.indexOf(item) === pos)
131
- .map((item, i) => {
132
- return (
133
- <span className="dh-label" key={i}>
134
- {item}
135
- </span>
136
- );
137
- })}
138
-
139
- {Array.isArray(dataset.linkProtocol) ? (
140
- <>
141
- {dataset.linkProtocol
142
- .filter((i) => i.includes('ESRI') || i.includes('OGC'))
116
+ <>
117
+ <div className="accordion-block">
118
+ {datasets.length > 5 && (
119
+ <AccordionFilter
120
+ config={accordionConfig}
121
+ filterValue={filterValue}
122
+ data={{ right_arrows: true, styles: {} }}
123
+ handleFilteredValueChange={handleFilteredValueChange}
124
+ />
125
+ )}
126
+ </div>
127
+ {datasets
128
+ .filter(
129
+ (dataset) =>
130
+ filterValue === '' ||
131
+ (filterValue !== '' &&
132
+ dataset.resourceTitleObject.default
133
+ ?.toLowerCase()
134
+ .includes(filterValue.toLowerCase())),
135
+ )
136
+ .map((dataset, index) => {
137
+ const {
138
+ id,
139
+ resourceTemporalExtentDetails,
140
+ temporalDateRange,
141
+ publicationDateForResource,
142
+ } = dataset;
143
+ const archived = isObsolete(dataset.cl_status);
144
+ const active = isActive(id);
145
+
146
+ return (
147
+ <>
148
+ <Accordion id={id} key={index}>
149
+ <Accordion.Title
150
+ tabIndex={0}
151
+ active={active}
152
+ index={index}
153
+ onClick={(e) => handleClick(e, { index, id, item })}
154
+ onKeyDown={(e) => {
155
+ if (e.key === 'Enter') {
156
+ handleClick(e, { index });
157
+ }
158
+ }}
159
+ >
160
+ <span className="dataset-title">
161
+ {dataset.resourceTitleObject.default}
162
+ <span className="formats">
163
+ {(dataset.format || [])
143
164
  .filter((item, pos, self) => self.indexOf(item) === pos)
144
165
  .map((item, i) => {
145
166
  return (
@@ -148,82 +169,95 @@ const DatasetItemsList = (props) => {
148
169
  </span>
149
170
  );
150
171
  })}
151
- </>
152
- ) : (
153
- <>
154
- {['ESRI', 'OGC'].includes(dataset.linkProtocol) && (
155
- <span className="dh-label">{dataset.linkProtocol}</span>
156
- )}
157
- </>
158
- )}
159
172
 
160
- {archived && (
161
- <span className="dh-label inverted">Archived</span>
162
- )}
173
+ {Array.isArray(dataset.linkProtocol) ? (
174
+ <>
175
+ {dataset.linkProtocol
176
+ .filter(
177
+ (i) => i.includes('ESRI') || i.includes('OGC'),
178
+ )
179
+ .filter(
180
+ (item, pos, self) => self.indexOf(item) === pos,
181
+ )
182
+ .map((item, i) => {
183
+ return (
184
+ <span className="dh-label" key={i}>
185
+ {item}
186
+ </span>
187
+ );
188
+ })}
189
+ </>
190
+ ) : (
191
+ <>
192
+ {['ESRI', 'OGC'].includes(dataset.linkProtocol) && (
193
+ <span className="dh-label">
194
+ {dataset.linkProtocol}
195
+ </span>
196
+ )}
197
+ </>
198
+ )}
163
199
 
164
- {isInternal(dataset) && <SVGIcon name={lockSVG} size="18" />}
165
- </span>
166
- </span>
167
- <Icon className="ri-arrow-down-s-line" />
168
- </Accordion.Title>
169
- <AnimateHeight
170
- animateOpacity
171
- duration={500}
172
- height={isActive(id) ? 'auto' : 0}
173
- onTransitionEnd={() => {
174
- if (!!activePanels && id === itemToScroll) {
175
- setItemToScroll('');
176
- scrollToElement();
177
- }
178
- }}
179
- >
180
- <Accordion.Content active={isActive(id)}>
181
- <div className="dataset-content">
182
- <div>
183
- {publicationDateForResource && (
184
- <div>
185
- <strong>Published: </strong>
186
- <DateTime
187
- format="DATE_MED"
188
- value={publicationDateForResource}
189
- />
190
- </div>
191
- )}
200
+ {archived && (
201
+ <span className="dh-label inverted">Archived</span>
202
+ )}
192
203
 
193
- {resourceTemporalExtentDetails &&
194
- resourceTemporalExtentDetails?.length > 0 && (
204
+ {isInternal(dataset) && (
205
+ <SVGIcon name={lockSVG} size="18" />
206
+ )}
207
+ </span>
208
+ </span>
209
+ <Icon className="ri-arrow-down-s-line" />
210
+ </Accordion.Title>
211
+ <Accordion.Content active={active}>
212
+ <div className="dataset-content">
213
+ <div>
214
+ {publicationDateForResource && (
195
215
  <div>
196
- <strong>Temporal coverage: </strong>
197
- {temporalDateRange}
216
+ <strong>Published: </strong>
217
+ <DateTime
218
+ format="DATE_MED"
219
+ value={publicationDateForResource}
220
+ />
198
221
  </div>
199
222
  )}
200
- </div>
201
223
 
202
- {dataset.resourceType[0] !== 'nonGeographicDataset' && (
203
- <div className="dataset-pdf">
204
- <div className="d-link">
205
- <Icon className="file pdf" />
206
- <a
207
- target="_blank"
208
- rel="noreferrer"
209
- href={`${appConfig.indexBaseUrl}/catalogue/datahub/api/records/${dataset.metadataIdentifier}/formatters/xsl-view?output=pdf&language=eng&approved=true`}
210
- >
211
- Metadata Factsheet
212
- </a>
213
- </div>
224
+ {resourceTemporalExtentDetails &&
225
+ resourceTemporalExtentDetails?.length > 0 && (
226
+ <div>
227
+ <strong>Temporal coverage: </strong>
228
+ {temporalDateRange}
229
+ </div>
230
+ )}
214
231
  </div>
232
+
233
+ {dataset.resourceType[0] !== 'nonGeographicDataset' && (
234
+ <div className="dataset-pdf">
235
+ <div className="d-link">
236
+ <Icon className="file pdf" />
237
+ <a
238
+ target="_blank"
239
+ rel="noreferrer"
240
+ href={
241
+ `${appConfig.indexBaseUrl}/catalogue/datahub/api/records/` +
242
+ `${dataset.metadataIdentifier}/formatters/xsl-view?output=pdf&language=eng&approved=true`
243
+ }
244
+ >
245
+ Metadata Factsheet
246
+ </a>
247
+ </div>
248
+ </div>
249
+ )}
250
+ </div>
251
+
252
+ {!!dataset.link && dataset.link.length > 0 && (
253
+ <DatasetItemDownloadList link={dataset.link} />
215
254
  )}
216
- </div>
217
-
218
- {!!dataset.link && dataset.link.length > 0 && (
219
- <DatasetItemDownloadList link={dataset.link} />
220
- )}
221
- </Accordion.Content>
222
- </AnimateHeight>
223
- </div>
224
- );
225
- })}
226
- </Accordion>
255
+ </Accordion.Content>
256
+ </Accordion>
257
+ </>
258
+ );
259
+ })}
260
+ </>
227
261
  );
228
262
  };
229
263
 
@@ -6,23 +6,30 @@ import DatasetItemsList from './DatasetItemsList';
6
6
  const DatasetsTab = (props) => {
7
7
  const { items, appConfig } = props;
8
8
 
9
+ const [filterValue, setFilterValue] = React.useState('');
10
+
9
11
  const [activeTabIndex, setActiveTabIndex] = React.useState(0);
10
12
  const [activeAccordionId, setActiveAccordionId] = React.useState();
13
+ const [initialAccordionId, setInitialAccordionId] = React.useState();
11
14
 
12
15
  React.useEffect(() => {
13
- const lastAccordionSelected =
14
- activeAccordionId?.[activeAccordionId.length - 1];
15
-
16
- const activeTab = items.filter((item) =>
17
- item.children.find((child) => child.id === lastAccordionSelected),
18
- );
19
- setActiveTabIndex(activeTab?.[0]?.id);
20
- }, [activeAccordionId, items]);
16
+ if (!activeAccordionId) {
17
+ const activeTab = items.filter((item) =>
18
+ item.children.find((child) => child.id === initialAccordionId),
19
+ );
20
+ setActiveTabIndex(activeTab?.[0]?.id);
21
+ }
22
+ }, [activeAccordionId, initialAccordionId, items]);
21
23
 
22
24
  const handleTabChange = (e, { activeIndex }) => {
25
+ setFilterValue('');
23
26
  setActiveTabIndex(activeIndex);
24
27
  };
25
28
 
29
+ const handleFilteredValueChange = (value) => {
30
+ setFilterValue(value);
31
+ };
32
+
26
33
  const panes = (items || []).map((item, i) => ({
27
34
  menuItem: (
28
35
  <Menu.Item key={i} tabIndex={0}>
@@ -32,9 +39,13 @@ const DatasetsTab = (props) => {
32
39
  render: () => (
33
40
  <Tab.Pane>
34
41
  <DatasetItemsList
35
- appConfig={appConfig}
36
42
  item={item}
37
- setActiveAccordion={setActiveAccordionId}
43
+ appConfig={appConfig}
44
+ filterValue={filterValue}
45
+ setActiveTabIndex={setActiveTabIndex}
46
+ setActiveAccordionId={setActiveAccordionId}
47
+ setInitialAccordionId={setInitialAccordionId}
48
+ handleFilteredValueChange={handleFilteredValueChange}
38
49
  />
39
50
  </Tab.Pane>
40
51
  ),
@@ -42,11 +53,11 @@ const DatasetsTab = (props) => {
42
53
 
43
54
  return (
44
55
  <Tab
56
+ panes={panes}
45
57
  className="datasets-tab"
46
58
  activeIndex={activeTabIndex}
47
- menu={{ vertical: true, secondary: true, pointing: true }}
48
- panes={panes}
49
59
  onTabChange={handleTabChange}
60
+ menu={{ vertical: true, secondary: true, pointing: true }}
50
61
  />
51
62
  );
52
63
  };
@@ -77,8 +77,8 @@ function ItemView(props) {
77
77
  }, [result, docid, appConfig, registry, dispatch]);
78
78
 
79
79
  const item = result ? result._result : null;
80
- const { title, description, raw_value } = item || {}; // readingTime
81
- const { changeDate, resourceIdentifier, cl_status } = raw_value?.raw || {};
80
+ const { title, description, raw_value } = item || {};
81
+ const { changeDate, resourceIdentifier, cl_status } = raw_value?.raw;
82
82
  const obsolete = isObsolete(cl_status);
83
83
 
84
84
  const prodID = (resourceIdentifier || []).filter((p) => {
@@ -147,10 +147,6 @@ function ItemView(props) {
147
147
  type="date"
148
148
  value={new Date(changeDate)}
149
149
  />
150
- {/* <Banner.MetadataField
151
- label="Reading time"
152
- value={readingTime?.raw}
153
- /> */}
154
150
  </Banner.Metadata>
155
151
  </Banner.Content>
156
152
  </Banner>
@@ -176,17 +172,8 @@ function ItemView(props) {
176
172
  </div>
177
173
 
178
174
  <DatasetsView item={item} appConfig={appConfig} />
179
-
180
175
  <MetadataSection item={item} appConfig={appConfig} docid={docid} />
181
-
182
176
  <MoreLikeThis docid={docid} title={title?.raw} appConfig={appConfig} />
183
-
184
- {/* <div className="info-wrapper">
185
- <div className="info-content">
186
- <div className="info-title">More Information for {title?.raw}.</div>
187
- <p>{description?.raw}</p>
188
- </div>
189
- </div> */}
190
177
  </div>
191
178
  ) : item ? (
192
179
  <>
@@ -207,8 +194,6 @@ function DatahubItemView(props) {
207
194
 
208
195
  return (
209
196
  <div id="view">
210
- {/* <ContentMetadataTags content={this.props.content} /> */}
211
- {/* Body class if displayName in component is set */}
212
197
  <BodyClass className="view-datahub-item" />
213
198
  <Container className="view-wrapper">
214
199
  <ItemView
@@ -0,0 +1,18 @@
1
+ import React from 'react';
2
+ import renderer from 'react-test-renderer';
3
+
4
+ import MetadataSection from './MetadataSection';
5
+
6
+ describe('MetadataSection Component', () => {
7
+ it('renders correctly with data', () => {
8
+ const appConfig = {
9
+ indexBaseUrl: 'https://sdi.eea.europa.eu',
10
+ };
11
+
12
+ const component = renderer.create(
13
+ <MetadataSection appConfig={appConfig} />,
14
+ );
15
+ const json = component.toJSON();
16
+ expect(json).toMatchSnapshot();
17
+ });
18
+ });
@@ -4,12 +4,6 @@ import { Tab, Menu, Divider, List } from 'semantic-ui-react';
4
4
  import useDeepCompareEffect from 'use-deep-compare-effect';
5
5
  import { useAtom } from 'jotai';
6
6
 
7
- // import { showFacetsAsideAtom } from '@eeacms/search/state';
8
- // import { getFacetCounts } from '@eeacms/search/components/LandingPage/request';
9
- // import buildStateFacets from '@eeacms/search/lib/search/state/facets';
10
- // import { customOrder } from '@eeacms/search/lib/utils';
11
- // import { Icon, Term } from '@eeacms/search/components';
12
-
13
7
  import {
14
8
  customOrder,
15
9
  showFacetsAsideAtom,
@@ -50,7 +44,6 @@ const LandingPage = (props) => {
50
44
  const { appConfig, children, setFilter, setSort } = props;
51
45
  const { appName } = appConfig;
52
46
  const { onlyLandingPage = false } = appConfig;
53
- // const facetsConfig = appConfig.facets;
54
47
 
55
48
  const {
56
49
  sections = [],