@eeacms/volto-datahub 1.0.25 → 1.0.27
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 +25 -1
- package/docker-compose.yml +5 -1
- package/jest-addon.config.js +1 -0
- package/package.json +4 -2
- package/src/components/ItemView/Datasets/DatasetItemDownloadList.jsx +7 -7
- package/src/components/ItemView/Datasets/DatasetItemsList.jsx +192 -151
- package/src/components/ItemView/Datasets/DatasetsTab.jsx +34 -14
- package/src/components/ItemView/ItemView.jsx +2 -17
- package/src/components/ItemView/MetadataSection.jsx +4 -1
- package/src/components/ItemView/MetadataSection.test.jsx +18 -0
- package/src/components/ItemView/MoreLikeThis.test.jsx +15 -0
- package/src/components/LandingPage/DatahubLandingPage.jsx +0 -7
package/CHANGELOG.md
CHANGED
|
@@ -4,7 +4,31 @@ 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.
|
|
7
|
+
### [1.0.27](https://github.com/eea/volto-datahub/compare/1.0.26...1.0.27) - 25 August 2023
|
|
8
|
+
|
|
9
|
+
#### :hammer_and_wrench: Others
|
|
10
|
+
|
|
11
|
+
- Add tests to increase coverage [kreafox - [`b112058`](https://github.com/eea/volto-datahub/commit/b112058ce16c34397e9cf59d5d96bcbc34dc70cf)]
|
|
12
|
+
- Formatting [kreafox - [`b0b0077`](https://github.com/eea/volto-datahub/commit/b0b007794b113a09e937ca7333b298555a947e68)]
|
|
13
|
+
- Accessibility improvements [kreafox - [`193ce3f`](https://github.com/eea/volto-datahub/commit/193ce3f99931ded1118065f46c5ef672ee49cbb2)]
|
|
14
|
+
- Accessibility improvements [kreafox - [`4301b19`](https://github.com/eea/volto-datahub/commit/4301b1946642a1c83f4f5194a73afab6f5d150fc)]
|
|
15
|
+
### [1.0.26](https://github.com/eea/volto-datahub/compare/1.0.25...1.0.26) - 23 August 2023
|
|
16
|
+
|
|
17
|
+
#### :hammer_and_wrench: Others
|
|
18
|
+
|
|
19
|
+
- Update tests [kreafox - [`b452535`](https://github.com/eea/volto-datahub/commit/b452535adabf75488d6c82725152d497c6758cd4)]
|
|
20
|
+
- Add tests [kreafox - [`3ef3c6f`](https://github.com/eea/volto-datahub/commit/3ef3c6f3ea11eff95d091fb5112f3e5c4a981e0d)]
|
|
21
|
+
- Update Jenkinsfile [kreafox - [`2202f7f`](https://github.com/eea/volto-datahub/commit/2202f7f4de801a209753b0abe159c974fc0da754)]
|
|
22
|
+
- Add test [kreafox - [`fcec0ba`](https://github.com/eea/volto-datahub/commit/fcec0ba7c8054d7973421428dd36d59c3a7fb2ba)]
|
|
23
|
+
- Add test [kreafox - [`5061ab7`](https://github.com/eea/volto-datahub/commit/5061ab71928e4e352635c49ba7b53bf204a5b797)]
|
|
24
|
+
- Code cleanup [kreafox - [`a0031be`](https://github.com/eea/volto-datahub/commit/a0031be9884b18fbbf247b0a2276b12df28bb6f1)]
|
|
25
|
+
- Update dependencies [kreafox - [`955fec2`](https://github.com/eea/volto-datahub/commit/955fec2f7b7acd84dd40b195fd5dc098a8e9a11c)]
|
|
26
|
+
- Fix icon size on firefox [kreafox - [`b49744d`](https://github.com/eea/volto-datahub/commit/b49744d1667988a93a5f3c43535136c3ca7f833a)]
|
|
27
|
+
- Fixes on datahub view [kreafox - [`32e91a0`](https://github.com/eea/volto-datahub/commit/32e91a0f92fb1c1297a9ff3d7aa36f993d2d547b)]
|
|
28
|
+
- test: Update Makefile and docker-compose to align it with Jenkinsfile [valentinab25 - [`9a9cfca`](https://github.com/eea/volto-datahub/commit/9a9cfca01faf04b5545a33e4657003dcdc3b72f6)]
|
|
29
|
+
- Add datasets filtering option [kreafox - [`3064341`](https://github.com/eea/volto-datahub/commit/30643419cab961809926c5e9221dfdb59ddf59ea)]
|
|
30
|
+
- Improve accordion on datahub view [kreafox - [`dd7716a`](https://github.com/eea/volto-datahub/commit/dd7716a4913a820e3031925e6af5d6f9add0d3c5)]
|
|
31
|
+
### [1.0.25](https://github.com/eea/volto-datahub/compare/1.0.24...1.0.25) - 16 August 2023
|
|
8
32
|
|
|
9
33
|
#### :house: Documentation changes
|
|
10
34
|
|
package/docker-compose.yml
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
version: "3"
|
|
2
2
|
services:
|
|
3
3
|
backend:
|
|
4
|
-
image:
|
|
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"
|
package/jest-addon.config.js
CHANGED
|
@@ -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.
|
|
3
|
+
"version": "1.0.27",
|
|
4
4
|
"description": "@eeacms/volto-datahub: Volto add-on",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"author": "European Environment Agency: IDM2 A-Team",
|
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
"url": "git@github.com:eea/volto-datahub.git"
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
|
+
"@eeacms/volto-accordion-block": "*",
|
|
20
21
|
"@eeacms/volto-globalsearch": "*",
|
|
21
22
|
"@eeacms/volto-listing-block": "*",
|
|
22
23
|
"feed": "4.2.2"
|
|
@@ -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="
|
|
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="
|
|
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="
|
|
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="
|
|
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="
|
|
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="
|
|
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="
|
|
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 {
|
|
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
|
-
|
|
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
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
}
|
|
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,88 @@ 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
|
-
|
|
86
|
-
|
|
87
|
-
|
|
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
|
-
|
|
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
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
{
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
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
|
+
role="button"
|
|
151
|
+
tabIndex={0}
|
|
152
|
+
active={active}
|
|
153
|
+
aria-expanded={active}
|
|
154
|
+
index={index}
|
|
155
|
+
onClick={(e) => handleClick(e, { index, id, item })}
|
|
156
|
+
onKeyDown={(e) => {
|
|
157
|
+
if (e.keyCode === 13 || e.keyCode === 32) {
|
|
158
|
+
e.preventDefault();
|
|
159
|
+
handleClick(e, { index, id, item });
|
|
160
|
+
}
|
|
161
|
+
}}
|
|
162
|
+
>
|
|
163
|
+
<span className="dataset-title">
|
|
164
|
+
{dataset.resourceTitleObject.default}
|
|
165
|
+
<span className="formats">
|
|
166
|
+
{(dataset.format || [])
|
|
143
167
|
.filter((item, pos, self) => self.indexOf(item) === pos)
|
|
144
168
|
.map((item, i) => {
|
|
145
169
|
return (
|
|
@@ -148,82 +172,99 @@ const DatasetItemsList = (props) => {
|
|
|
148
172
|
</span>
|
|
149
173
|
);
|
|
150
174
|
})}
|
|
151
|
-
</>
|
|
152
|
-
) : (
|
|
153
|
-
<>
|
|
154
|
-
{['ESRI', 'OGC'].includes(dataset.linkProtocol) && (
|
|
155
|
-
<span className="dh-label">{dataset.linkProtocol}</span>
|
|
156
|
-
)}
|
|
157
|
-
</>
|
|
158
|
-
)}
|
|
159
175
|
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
176
|
+
{Array.isArray(dataset.linkProtocol) ? (
|
|
177
|
+
<>
|
|
178
|
+
{dataset.linkProtocol
|
|
179
|
+
.filter(
|
|
180
|
+
(i) => i.includes('ESRI') || i.includes('OGC'),
|
|
181
|
+
)
|
|
182
|
+
.filter(
|
|
183
|
+
(item, pos, self) => self.indexOf(item) === pos,
|
|
184
|
+
)
|
|
185
|
+
.map((item, i) => {
|
|
186
|
+
return (
|
|
187
|
+
<span className="dh-label" key={i}>
|
|
188
|
+
{item}
|
|
189
|
+
</span>
|
|
190
|
+
);
|
|
191
|
+
})}
|
|
192
|
+
</>
|
|
193
|
+
) : (
|
|
194
|
+
<>
|
|
195
|
+
{['ESRI', 'OGC'].includes(dataset.linkProtocol) && (
|
|
196
|
+
<span className="dh-label">
|
|
197
|
+
{dataset.linkProtocol}
|
|
198
|
+
</span>
|
|
199
|
+
)}
|
|
200
|
+
</>
|
|
201
|
+
)}
|
|
163
202
|
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
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
|
-
)}
|
|
203
|
+
{archived && (
|
|
204
|
+
<span className="dh-label inverted">Archived</span>
|
|
205
|
+
)}
|
|
192
206
|
|
|
193
|
-
|
|
194
|
-
|
|
207
|
+
{isInternal(dataset) && (
|
|
208
|
+
<SVGIcon name={lockSVG} size="18" />
|
|
209
|
+
)}
|
|
210
|
+
</span>
|
|
211
|
+
</span>
|
|
212
|
+
{active ? (
|
|
213
|
+
<Icon className="ri-arrow-up-s-line" />
|
|
214
|
+
) : (
|
|
215
|
+
<Icon className="ri-arrow-down-s-line" />
|
|
216
|
+
)}
|
|
217
|
+
</Accordion.Title>
|
|
218
|
+
<Accordion.Content active={active}>
|
|
219
|
+
<div className="dataset-content">
|
|
220
|
+
<div>
|
|
221
|
+
{publicationDateForResource && (
|
|
195
222
|
<div>
|
|
196
|
-
<strong>
|
|
197
|
-
|
|
223
|
+
<strong>Published: </strong>
|
|
224
|
+
<DateTime
|
|
225
|
+
format="DATE_MED"
|
|
226
|
+
value={publicationDateForResource}
|
|
227
|
+
/>
|
|
198
228
|
</div>
|
|
199
229
|
)}
|
|
200
|
-
</div>
|
|
201
230
|
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
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>
|
|
231
|
+
{resourceTemporalExtentDetails &&
|
|
232
|
+
resourceTemporalExtentDetails?.length > 0 && (
|
|
233
|
+
<div>
|
|
234
|
+
<strong>Temporal coverage: </strong>
|
|
235
|
+
{temporalDateRange}
|
|
236
|
+
</div>
|
|
237
|
+
)}
|
|
214
238
|
</div>
|
|
239
|
+
|
|
240
|
+
{dataset.resourceType[0] !== 'nonGeographicDataset' && (
|
|
241
|
+
<div className="dataset-pdf">
|
|
242
|
+
<div className="d-link">
|
|
243
|
+
<Icon className="file pdf" />
|
|
244
|
+
<a
|
|
245
|
+
target="_blank"
|
|
246
|
+
rel="noreferrer"
|
|
247
|
+
href={
|
|
248
|
+
`${appConfig.indexBaseUrl}/catalogue/datahub/api/records/` +
|
|
249
|
+
`${dataset.metadataIdentifier}/formatters/xsl-view?output=pdf&language=eng&approved=true`
|
|
250
|
+
}
|
|
251
|
+
>
|
|
252
|
+
Metadata Factsheet
|
|
253
|
+
</a>
|
|
254
|
+
</div>
|
|
255
|
+
</div>
|
|
256
|
+
)}
|
|
257
|
+
</div>
|
|
258
|
+
|
|
259
|
+
{!!dataset.link && dataset.link.length > 0 && (
|
|
260
|
+
<DatasetItemDownloadList link={dataset.link} />
|
|
215
261
|
)}
|
|
216
|
-
</
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
</AnimateHeight>
|
|
223
|
-
</div>
|
|
224
|
-
);
|
|
225
|
-
})}
|
|
226
|
-
</Accordion>
|
|
262
|
+
</Accordion.Content>
|
|
263
|
+
</Accordion>
|
|
264
|
+
</>
|
|
265
|
+
);
|
|
266
|
+
})}
|
|
267
|
+
</>
|
|
227
268
|
);
|
|
228
269
|
};
|
|
229
270
|
|
|
@@ -6,35 +6,55 @@ 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
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
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
|
-
<Menu.Item
|
|
35
|
+
<Menu.Item
|
|
36
|
+
key={i}
|
|
37
|
+
tabIndex={0}
|
|
38
|
+
onKeyDown={(e) => {
|
|
39
|
+
if (e.keyCode === 13 || e.keyCode === 32) {
|
|
40
|
+
e.preventDefault();
|
|
41
|
+
setActiveTabIndex(i);
|
|
42
|
+
}
|
|
43
|
+
}}
|
|
44
|
+
>
|
|
29
45
|
{item.date ? <span>{item.date}</span> : 'No date'}
|
|
30
46
|
</Menu.Item>
|
|
31
47
|
),
|
|
32
48
|
render: () => (
|
|
33
|
-
<Tab.Pane>
|
|
49
|
+
<Tab.Pane tabIndex={0}>
|
|
34
50
|
<DatasetItemsList
|
|
35
|
-
appConfig={appConfig}
|
|
36
51
|
item={item}
|
|
37
|
-
|
|
52
|
+
appConfig={appConfig}
|
|
53
|
+
filterValue={filterValue}
|
|
54
|
+
setActiveTabIndex={setActiveTabIndex}
|
|
55
|
+
setActiveAccordionId={setActiveAccordionId}
|
|
56
|
+
setInitialAccordionId={setInitialAccordionId}
|
|
57
|
+
handleFilteredValueChange={handleFilteredValueChange}
|
|
38
58
|
/>
|
|
39
59
|
</Tab.Pane>
|
|
40
60
|
),
|
|
@@ -42,11 +62,11 @@ const DatasetsTab = (props) => {
|
|
|
42
62
|
|
|
43
63
|
return (
|
|
44
64
|
<Tab
|
|
65
|
+
panes={panes}
|
|
45
66
|
className="datasets-tab"
|
|
46
67
|
activeIndex={activeTabIndex}
|
|
47
|
-
menu={{ vertical: true, secondary: true, pointing: true }}
|
|
48
|
-
panes={panes}
|
|
49
68
|
onTabChange={handleTabChange}
|
|
69
|
+
menu={{ vertical: true, secondary: true, pointing: true }}
|
|
50
70
|
/>
|
|
51
71
|
);
|
|
52
72
|
};
|
|
@@ -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 || {};
|
|
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
|
|
@@ -81,7 +81,10 @@ const MetadataSection = (props) => {
|
|
|
81
81
|
<a
|
|
82
82
|
target="_blank"
|
|
83
83
|
rel="noreferrer"
|
|
84
|
-
href={
|
|
84
|
+
href={
|
|
85
|
+
`${appConfig.indexBaseUrl}/catalogue/datahub/api/records/` +
|
|
86
|
+
`${docid}/formatters/xsl-view?output=pdf&language=eng&approved=true`
|
|
87
|
+
}
|
|
85
88
|
>
|
|
86
89
|
Metadata Factsheet
|
|
87
90
|
</a>
|
|
@@ -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
|
+
});
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import renderer from 'react-test-renderer';
|
|
3
|
+
|
|
4
|
+
import MoreLikeThis from './MoreLikeThis';
|
|
5
|
+
|
|
6
|
+
jest.mock('@eeacms/search', () => ({
|
|
7
|
+
runRequest: jest.fn(),
|
|
8
|
+
}));
|
|
9
|
+
|
|
10
|
+
describe('MoreLikeThis', () => {
|
|
11
|
+
it('renders correctly', () => {
|
|
12
|
+
const tree = renderer.create(<MoreLikeThis appConfig={{}} />).toJSON();
|
|
13
|
+
expect(tree).toMatchSnapshot();
|
|
14
|
+
});
|
|
15
|
+
});
|
|
@@ -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 = [],
|