@eeacms/volto-datahub 1.0.18 → 1.0.20
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 +21 -1
- package/package.json +1 -1
- package/src/components/ItemView/Datasets/DatasetItemDownloadList.jsx +227 -0
- package/src/components/ItemView/Datasets/DatasetItemsList.jsx +139 -0
- package/src/components/ItemView/Datasets/DatasetsTab.jsx +51 -0
- package/src/components/ItemView/Datasets/DatasetsView.jsx +95 -0
- package/src/components/ItemView/ItemView.jsx +3 -3
- package/src/components/ItemView/index.js +1 -1
- package/src/components/ItemView/utils.js +45 -0
- package/src/components/ItemView/Datasets.jsx +0 -452
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,22 @@ 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.20](https://github.com/eea/volto-datahub/compare/1.0.19...1.0.20) - 14 March 2023
|
|
8
|
+
|
|
9
|
+
#### :hammer_and_wrench: Others
|
|
10
|
+
|
|
11
|
+
- Fix archived item condition [kreafox - [`8c0d70a`](https://github.com/eea/volto-datahub/commit/8c0d70afc7429b7c0382350d291ea68e7a55e37b)]
|
|
12
|
+
- Add archived label [kreafox - [`be58335`](https://github.com/eea/volto-datahub/commit/be583359b5de2a198a13c55b1191e2f8b7dab193)]
|
|
13
|
+
### [1.0.19](https://github.com/eea/volto-datahub/compare/1.0.18...1.0.19) - 14 March 2023
|
|
14
|
+
|
|
15
|
+
#### :hammer_and_wrench: Others
|
|
16
|
+
|
|
17
|
+
- Fix case when there are no datasets [kreafox - [`20c58dc`](https://github.com/eea/volto-datahub/commit/20c58dcd270a020e1d5c1a4809e8cd7e0169f276)]
|
|
18
|
+
- Merge from develop [Zoltan Szabo - [`3478d37`](https://github.com/eea/volto-datahub/commit/3478d3795f14f16d322f6fcd9a948b46f0e25917)]
|
|
19
|
+
- removed duplicated formats [Zoltan Szabo - [`eefe941`](https://github.com/eea/volto-datahub/commit/eefe94178f1976aca7ad57ecbdcecf004fbc24ec)]
|
|
20
|
+
- Make multiple dataset tabs work [kreafox - [`7762336`](https://github.com/eea/volto-datahub/commit/7762336fb6ee50349879e693218bb58d295ff1e8)]
|
|
21
|
+
- remove duplicated formats [Zoltan Szabo - [`675a203`](https://github.com/eea/volto-datahub/commit/675a203c86baea3dd4344d28672b2fb336478a44)]
|
|
22
|
+
- WIP [Zoltan Szabo - [`56660f9`](https://github.com/eea/volto-datahub/commit/56660f96545216491c0eb604852bc87d13c6b22d)]
|
|
7
23
|
### [1.0.18](https://github.com/eea/volto-datahub/compare/1.0.17...1.0.18) - 13 March 2023
|
|
8
24
|
|
|
9
25
|
#### :hammer_and_wrench: Others
|
|
@@ -11,7 +27,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
|
11
27
|
- lint [Zoltan Szabo - [`3d9c842`](https://github.com/eea/volto-datahub/commit/3d9c8428fac3aa66cba164639926745b81434b52)]
|
|
12
28
|
- Remove console.logs [Zoltan Szabo - [`09e19bf`](https://github.com/eea/volto-datahub/commit/09e19bf7656b3a11c5f967b0ff45d05ca8b3bcd5)]
|
|
13
29
|
- set lastmod in sitemap [Zoltan Szabo - [`bb2819c`](https://github.com/eea/volto-datahub/commit/bb2819c41eed63a23532cba01eeedd7c3f8b7217)]
|
|
14
|
-
- Refs #250008; add datahub sitemap [Tiberiu Ichim - [`c9f9996`](https://github.com/eea/volto-datahub/commit/c9f9996ba71b49932a52b21aeb6b7cfcb80a60d2)]
|
|
15
30
|
### [1.0.17](https://github.com/eea/volto-datahub/compare/1.0.16...1.0.17) - 10 March 2023
|
|
16
31
|
|
|
17
32
|
#### :hammer_and_wrench: Others
|
|
@@ -26,6 +41,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
|
26
41
|
- added utils.js [Zoltan Szabo - [`fdb33c3`](https://github.com/eea/volto-datahub/commit/fdb33c37e1af2fe071dbe8f4f5dcd2b82932edc8)]
|
|
27
42
|
- Show 'Obsolete' info in the metadata section in the banner [Zoltan Szabo - [`fddfd2a`](https://github.com/eea/volto-datahub/commit/fddfd2aea63d1a1d1567c163ab29dd7119781117)]
|
|
28
43
|
- Show 'More information' section only if it's not empty [Zoltan Szabo - [`612f035`](https://github.com/eea/volto-datahub/commit/612f03509c6adf143631ae6dee5ca2bd48a501c3)]
|
|
44
|
+
- Add Sonarqube tag using eea-website-frontend addons list [EEA Jenkins - [`b9100f6`](https://github.com/eea/volto-datahub/commit/b9100f6b2b2e9e9a26b9c11708c8fda94137cecc)]
|
|
29
45
|
### [1.0.15](https://github.com/eea/volto-datahub/compare/1.0.14...1.0.15) - 1 March 2023
|
|
30
46
|
|
|
31
47
|
### [1.0.14](https://github.com/eea/volto-datahub/compare/1.0.13...1.0.14) - 1 March 2023
|
|
@@ -118,9 +134,11 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
|
118
134
|
#### :hammer_and_wrench: Others
|
|
119
135
|
|
|
120
136
|
- Fix eslintrc: add @eeacms/search [kreafox - [`465816f`](https://github.com/eea/volto-datahub/commit/465816feb8f58095ab4b5b3168cd29ebede3a10c)]
|
|
137
|
+
- Use latest Volto before yarn 3 [Tiberiu Ichim - [`69f5859`](https://github.com/eea/volto-datahub/commit/69f585980fd9a38ff99d0c7875704671857720f7)]
|
|
121
138
|
- Reorder sections on landing page [kreafox - [`46fac8d`](https://github.com/eea/volto-datahub/commit/46fac8d821cf93fe1b2c380380719de130c3f1cb)]
|
|
122
139
|
- Fix project eslintrc [kreafox - [`5baa150`](https://github.com/eea/volto-datahub/commit/5baa1505ec38ed313269f5608c186c6a6a8bbfc4)]
|
|
123
140
|
- Open dataset links in new tab [kreafox - [`bbed914`](https://github.com/eea/volto-datahub/commit/bbed914dc2edf6c749d1d73d93a423bc642e680c)]
|
|
141
|
+
- Add Sonarqube tag using circularity-frontend addons list [EEA Jenkins - [`380a2a9`](https://github.com/eea/volto-datahub/commit/380a2a9625c6f799df7a7c343fad3f3b3d959f96)]
|
|
124
142
|
## [1.0.0](https://github.com/eea/volto-datahub/compare/0.1.12...1.0.0) - 28 October 2022
|
|
125
143
|
|
|
126
144
|
#### :nail_care: Enhancements
|
|
@@ -145,6 +163,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
|
145
163
|
#### :hammer_and_wrench: Others
|
|
146
164
|
|
|
147
165
|
- fixed query for related items [Zoltan Szabo - [`b66faee`](https://github.com/eea/volto-datahub/commit/b66faee1f8a1922cd22b3a36eccc9c7b92e377d4)]
|
|
166
|
+
- Add Sonarqube tag using eea-website-frontend addons list [EEA Jenkins - [`158fe1a`](https://github.com/eea/volto-datahub/commit/158fe1a0b1767452e2e51a3e2ef97169589a50e8)]
|
|
148
167
|
### [0.1.10](https://github.com/eea/volto-datahub/compare/0.1.9...0.1.10) - 21 September 2022
|
|
149
168
|
|
|
150
169
|
#### :hammer_and_wrench: Others
|
|
@@ -233,6 +252,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
|
233
252
|
#### :hammer_and_wrench: Others
|
|
234
253
|
|
|
235
254
|
- Hide questions & fix landing page [kreafox - [`a1ef303`](https://github.com/eea/volto-datahub/commit/a1ef3033df0e84f3a72dd0f984c8717dff2a771c)]
|
|
255
|
+
- Add Sonarqube tag using eea-website-frontend addons list [EEA Jenkins - [`910688e`](https://github.com/eea/volto-datahub/commit/910688e3ddf2f8cda4f941595ae9a6ee0ec0ea3b)]
|
|
236
256
|
### [0.1.1](https://github.com/eea/volto-datahub/compare/0.1.0...0.1.1) - 10 June 2022
|
|
237
257
|
|
|
238
258
|
### [0.1.0](https://github.com/eea/volto-datahub/compare/0.0.1...0.1.0) - 9 June 2022
|
package/package.json
CHANGED
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Icon, List } from 'semantic-ui-react';
|
|
3
|
+
import { isInternalURL, groupBy, SVGIcon } from '../utils.js';
|
|
4
|
+
|
|
5
|
+
import servicesSVG from '../icons/services.svg';
|
|
6
|
+
import lockSVG from 'remixicon/icons/System/lock-line.svg';
|
|
7
|
+
|
|
8
|
+
const DatasetItemDownloadList = (props) => {
|
|
9
|
+
const { link } = props;
|
|
10
|
+
const dataset = groupBy(link, 'protocol');
|
|
11
|
+
|
|
12
|
+
return (
|
|
13
|
+
<div>
|
|
14
|
+
{(dataset['WWW:URL'] ||
|
|
15
|
+
dataset['WWW:LINK'] ||
|
|
16
|
+
dataset['EEA:FILEPATH'] ||
|
|
17
|
+
dataset['EEA:FOLDERPATH']) && (
|
|
18
|
+
<>
|
|
19
|
+
<h5>Download:</h5>
|
|
20
|
+
<List divided relaxed>
|
|
21
|
+
{(dataset['WWW:URL'] || []).map((item, i) => {
|
|
22
|
+
return (
|
|
23
|
+
<List.Item key={i}>
|
|
24
|
+
<List.Content>
|
|
25
|
+
<div className="dataset-item">
|
|
26
|
+
<Icon className="download" />
|
|
27
|
+
<a
|
|
28
|
+
href={item.url}
|
|
29
|
+
className="item-link"
|
|
30
|
+
target="_blank"
|
|
31
|
+
rel="noreferrer"
|
|
32
|
+
>
|
|
33
|
+
<span>{item.name}</span>
|
|
34
|
+
</a>
|
|
35
|
+
{isInternalURL(item.url) && (
|
|
36
|
+
<SVGIcon name={lockSVG} size="18" />
|
|
37
|
+
)}
|
|
38
|
+
</div>
|
|
39
|
+
</List.Content>
|
|
40
|
+
{item.description && (
|
|
41
|
+
<span className="item-description" title={item.description}>
|
|
42
|
+
{item.description}
|
|
43
|
+
</span>
|
|
44
|
+
)}
|
|
45
|
+
</List.Item>
|
|
46
|
+
);
|
|
47
|
+
})}
|
|
48
|
+
|
|
49
|
+
{(dataset['WWW:LINK'] || []).map((item, i) => {
|
|
50
|
+
return (
|
|
51
|
+
<List.Item key={i}>
|
|
52
|
+
<List.Content>
|
|
53
|
+
<div className="dataset-item">
|
|
54
|
+
<Icon className="download" />
|
|
55
|
+
{item.name ? (
|
|
56
|
+
<a
|
|
57
|
+
href={item.url}
|
|
58
|
+
className="item-link"
|
|
59
|
+
target="_blank"
|
|
60
|
+
rel="noreferrer"
|
|
61
|
+
>
|
|
62
|
+
{item.name}
|
|
63
|
+
</a>
|
|
64
|
+
) : (
|
|
65
|
+
<a
|
|
66
|
+
href={item.url}
|
|
67
|
+
className="item-link"
|
|
68
|
+
target="_blank"
|
|
69
|
+
rel="noreferrer"
|
|
70
|
+
>
|
|
71
|
+
Download link
|
|
72
|
+
</a>
|
|
73
|
+
)}
|
|
74
|
+
{isInternalURL(item.url) && (
|
|
75
|
+
<SVGIcon name={lockSVG} size="18" />
|
|
76
|
+
)}
|
|
77
|
+
</div>
|
|
78
|
+
</List.Content>
|
|
79
|
+
</List.Item>
|
|
80
|
+
);
|
|
81
|
+
})}
|
|
82
|
+
|
|
83
|
+
{(dataset['EEA:FILEPATH'] || []).map((item, i) => {
|
|
84
|
+
return (
|
|
85
|
+
<List.Item key={i}>
|
|
86
|
+
<List.Content>
|
|
87
|
+
<div className="dataset-item">
|
|
88
|
+
<Icon className="download" />
|
|
89
|
+
<a
|
|
90
|
+
href={item.url}
|
|
91
|
+
className="item-link"
|
|
92
|
+
target="_blank"
|
|
93
|
+
rel="noreferrer"
|
|
94
|
+
>
|
|
95
|
+
WebDAV: {item.name || item.function}
|
|
96
|
+
</a>
|
|
97
|
+
{isInternalURL(item.url) && (
|
|
98
|
+
<SVGIcon name={lockSVG} size="18" />
|
|
99
|
+
)}
|
|
100
|
+
</div>
|
|
101
|
+
</List.Content>
|
|
102
|
+
</List.Item>
|
|
103
|
+
);
|
|
104
|
+
})}
|
|
105
|
+
|
|
106
|
+
{(dataset['EEA:FOLDERPATH'] || []).map((item, i) => {
|
|
107
|
+
return (
|
|
108
|
+
<List.Item key={i}>
|
|
109
|
+
<List.Content>
|
|
110
|
+
<div className="dataset-item">
|
|
111
|
+
<Icon className="download" />
|
|
112
|
+
<a
|
|
113
|
+
href={item.url}
|
|
114
|
+
className="item-link"
|
|
115
|
+
target="_blank"
|
|
116
|
+
rel="noreferrer"
|
|
117
|
+
>
|
|
118
|
+
WebDAV: {item.name || item.function}
|
|
119
|
+
</a>
|
|
120
|
+
{isInternalURL(item.url) && (
|
|
121
|
+
<SVGIcon name={lockSVG} size="18" />
|
|
122
|
+
)}
|
|
123
|
+
</div>
|
|
124
|
+
</List.Content>
|
|
125
|
+
</List.Item>
|
|
126
|
+
);
|
|
127
|
+
})}
|
|
128
|
+
</List>
|
|
129
|
+
</>
|
|
130
|
+
)}
|
|
131
|
+
|
|
132
|
+
{(dataset['ESRI:REST'] || dataset['OGC:WMS']) && (
|
|
133
|
+
<>
|
|
134
|
+
<h5>Services:</h5>
|
|
135
|
+
<List divided relaxed>
|
|
136
|
+
{(dataset['ESRI:REST'] || []).map((item, i) => {
|
|
137
|
+
return (
|
|
138
|
+
<List.Item key={i}>
|
|
139
|
+
<List.Content>
|
|
140
|
+
<div>
|
|
141
|
+
<SVGIcon name={servicesSVG} size="18" />
|
|
142
|
+
{/* {(item.name || item.description) && (
|
|
143
|
+
<span className="item-protocol">{item.protocol}:</span>
|
|
144
|
+
)} */}
|
|
145
|
+
<a
|
|
146
|
+
className="item-link"
|
|
147
|
+
href={item.url}
|
|
148
|
+
target="_blank"
|
|
149
|
+
rel="noreferrer"
|
|
150
|
+
>
|
|
151
|
+
{item.protocol} {item.name || item.description}
|
|
152
|
+
</a>
|
|
153
|
+
{isInternalURL(item.url) && (
|
|
154
|
+
<SVGIcon name={lockSVG} size="18" />
|
|
155
|
+
)}
|
|
156
|
+
</div>
|
|
157
|
+
</List.Content>
|
|
158
|
+
</List.Item>
|
|
159
|
+
);
|
|
160
|
+
})}
|
|
161
|
+
|
|
162
|
+
{(dataset['OGC:WMS'] || []).map((item, i) => {
|
|
163
|
+
return (
|
|
164
|
+
<List.Item key={i}>
|
|
165
|
+
<List.Content>
|
|
166
|
+
<div>
|
|
167
|
+
<SVGIcon name={servicesSVG} size="18" />
|
|
168
|
+
{/* {(item.name || item.description) && (
|
|
169
|
+
<span className="item-protocol">{item.protocol}:</span>
|
|
170
|
+
)} */}
|
|
171
|
+
<a
|
|
172
|
+
className="item-link"
|
|
173
|
+
href={item.url}
|
|
174
|
+
target="_blank"
|
|
175
|
+
rel="noreferrer"
|
|
176
|
+
>
|
|
177
|
+
{item.protocol} {item.name || item.description}
|
|
178
|
+
</a>
|
|
179
|
+
{isInternalURL(item.url) && (
|
|
180
|
+
<SVGIcon name={lockSVG} size="18" />
|
|
181
|
+
)}
|
|
182
|
+
</div>
|
|
183
|
+
</List.Content>
|
|
184
|
+
</List.Item>
|
|
185
|
+
);
|
|
186
|
+
})}
|
|
187
|
+
</List>
|
|
188
|
+
</>
|
|
189
|
+
)}
|
|
190
|
+
|
|
191
|
+
{dataset['WWW:LINK-1.0-http--link'] && (
|
|
192
|
+
<>
|
|
193
|
+
<h5>Links:</h5>
|
|
194
|
+
<List divided relaxed>
|
|
195
|
+
{(dataset['WWW:LINK-1.0-http--link'] || []).map((item, i) => {
|
|
196
|
+
return (
|
|
197
|
+
<List.Item key={i}>
|
|
198
|
+
<List.Content>
|
|
199
|
+
<div className="dataset-item">
|
|
200
|
+
<Icon className="linkify" />
|
|
201
|
+
<a
|
|
202
|
+
href={item.url}
|
|
203
|
+
className="item-link"
|
|
204
|
+
target="_blank"
|
|
205
|
+
rel="noreferrer"
|
|
206
|
+
>
|
|
207
|
+
<span>{item.name || item.url}</span>
|
|
208
|
+
</a>
|
|
209
|
+
{isInternalURL(item.url) && (
|
|
210
|
+
<SVGIcon name={lockSVG} size="18" />
|
|
211
|
+
)}
|
|
212
|
+
</div>
|
|
213
|
+
</List.Content>
|
|
214
|
+
{item.description && (
|
|
215
|
+
<span className="item-description">{item.description}</span>
|
|
216
|
+
)}
|
|
217
|
+
</List.Item>
|
|
218
|
+
);
|
|
219
|
+
})}
|
|
220
|
+
</List>
|
|
221
|
+
</>
|
|
222
|
+
)}
|
|
223
|
+
</div>
|
|
224
|
+
);
|
|
225
|
+
};
|
|
226
|
+
|
|
227
|
+
export default DatasetItemDownloadList;
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Accordion } from 'semantic-ui-react';
|
|
3
|
+
import { Icon } from 'semantic-ui-react';
|
|
4
|
+
import { DateTime } from '@eeacms/search';
|
|
5
|
+
import { isInternal, SVGIcon, isObsolete } from '../utils.js';
|
|
6
|
+
import DatasetItemDownloadList from './DatasetItemDownloadList';
|
|
7
|
+
|
|
8
|
+
import lockSVG from 'remixicon/icons/System/lock-line.svg';
|
|
9
|
+
|
|
10
|
+
const DatasetItemsList = (props) => {
|
|
11
|
+
const { appConfig, item, setActiveTabIndex, activeTabIndex } = props;
|
|
12
|
+
|
|
13
|
+
const [activeIndex, setActiveIndex] = React.useState(activeTabIndex);
|
|
14
|
+
|
|
15
|
+
React.useEffect(() => {
|
|
16
|
+
setActiveIndex(activeTabIndex);
|
|
17
|
+
}, [activeTabIndex]);
|
|
18
|
+
|
|
19
|
+
React.useEffect(() => {
|
|
20
|
+
setActiveTabIndex(activeIndex);
|
|
21
|
+
}, [activeIndex, setActiveTabIndex]);
|
|
22
|
+
|
|
23
|
+
function handleClick(e, titleProps) {
|
|
24
|
+
const { index } = titleProps;
|
|
25
|
+
const newIndex = activeIndex === index ? -1 : index;
|
|
26
|
+
setActiveIndex(newIndex);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
return (
|
|
30
|
+
<Accordion>
|
|
31
|
+
{item?.children.map((dataset, index) => {
|
|
32
|
+
const {
|
|
33
|
+
resourceTemporalExtentDetails,
|
|
34
|
+
temporalDateRange,
|
|
35
|
+
publicationDateForResource,
|
|
36
|
+
} = dataset;
|
|
37
|
+
const archived = isObsolete(dataset.cl_status);
|
|
38
|
+
|
|
39
|
+
return (
|
|
40
|
+
<React.Fragment key={index}>
|
|
41
|
+
<Accordion.Title
|
|
42
|
+
active={activeIndex === index}
|
|
43
|
+
index={index}
|
|
44
|
+
onClick={handleClick}
|
|
45
|
+
>
|
|
46
|
+
<span className="dataset-title">
|
|
47
|
+
{dataset.resourceTitleObject.default}
|
|
48
|
+
|
|
49
|
+
<span className="formats">
|
|
50
|
+
{(dataset.format || [])
|
|
51
|
+
.filter((item, pos, self) => self.indexOf(item) === pos)
|
|
52
|
+
.map((item, i) => {
|
|
53
|
+
return (
|
|
54
|
+
<span className="dh-label" key={i}>
|
|
55
|
+
{item}
|
|
56
|
+
</span>
|
|
57
|
+
);
|
|
58
|
+
})}
|
|
59
|
+
|
|
60
|
+
{Array.isArray(dataset.linkProtocol) ? (
|
|
61
|
+
<>
|
|
62
|
+
{dataset.linkProtocol
|
|
63
|
+
.filter((i) => i.includes('ESRI') || i.includes('OGC'))
|
|
64
|
+
.filter((item, pos, self) => self.indexOf(item) === pos)
|
|
65
|
+
.map((item, i) => {
|
|
66
|
+
return (
|
|
67
|
+
<span className="dh-label" key={i}>
|
|
68
|
+
{item}
|
|
69
|
+
</span>
|
|
70
|
+
);
|
|
71
|
+
})}
|
|
72
|
+
</>
|
|
73
|
+
) : (
|
|
74
|
+
<>
|
|
75
|
+
{['ESRI', 'OGC'].includes(dataset.linkProtocol) && (
|
|
76
|
+
<span className="dh-label">{dataset.linkProtocol}</span>
|
|
77
|
+
)}
|
|
78
|
+
</>
|
|
79
|
+
)}
|
|
80
|
+
|
|
81
|
+
{archived && (
|
|
82
|
+
<span className="dh-label inverted">Archived</span>
|
|
83
|
+
)}
|
|
84
|
+
|
|
85
|
+
{isInternal(dataset) && <SVGIcon name={lockSVG} size="18" />}
|
|
86
|
+
</span>
|
|
87
|
+
</span>
|
|
88
|
+
<Icon className="ri-arrow-down-s-line" />
|
|
89
|
+
</Accordion.Title>
|
|
90
|
+
<Accordion.Content active={activeIndex === index}>
|
|
91
|
+
<div className="dataset-content">
|
|
92
|
+
<div>
|
|
93
|
+
{publicationDateForResource && (
|
|
94
|
+
<div>
|
|
95
|
+
<strong>Published: </strong>
|
|
96
|
+
<DateTime
|
|
97
|
+
format="DATE_MED"
|
|
98
|
+
value={publicationDateForResource}
|
|
99
|
+
/>
|
|
100
|
+
</div>
|
|
101
|
+
)}
|
|
102
|
+
|
|
103
|
+
{resourceTemporalExtentDetails &&
|
|
104
|
+
resourceTemporalExtentDetails?.length > 0 && (
|
|
105
|
+
<div>
|
|
106
|
+
<strong>Temporal coverage: </strong>
|
|
107
|
+
{temporalDateRange}
|
|
108
|
+
</div>
|
|
109
|
+
)}
|
|
110
|
+
</div>
|
|
111
|
+
|
|
112
|
+
{dataset.resourceType[0] !== 'nonGeographicDataset' && (
|
|
113
|
+
<div className="dataset-pdf">
|
|
114
|
+
<div className="d-link">
|
|
115
|
+
<Icon className="file pdf" />
|
|
116
|
+
<a
|
|
117
|
+
target="_blank"
|
|
118
|
+
rel="noreferrer"
|
|
119
|
+
href={`${appConfig.indexBaseUrl}/catalogue/datahub/api/records/${dataset.metadataIdentifier}/formatters/xsl-view?output=pdf&language=eng&approved=true`}
|
|
120
|
+
>
|
|
121
|
+
Metadata Factsheet
|
|
122
|
+
</a>
|
|
123
|
+
</div>
|
|
124
|
+
</div>
|
|
125
|
+
)}
|
|
126
|
+
</div>
|
|
127
|
+
|
|
128
|
+
{!!dataset.link && dataset.link.length > 0 && (
|
|
129
|
+
<DatasetItemDownloadList link={dataset.link} />
|
|
130
|
+
)}
|
|
131
|
+
</Accordion.Content>
|
|
132
|
+
</React.Fragment>
|
|
133
|
+
);
|
|
134
|
+
})}
|
|
135
|
+
</Accordion>
|
|
136
|
+
);
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
export default DatasetItemsList;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Tab, Menu } from 'semantic-ui-react';
|
|
3
|
+
|
|
4
|
+
import DatasetItemsList from './DatasetItemsList';
|
|
5
|
+
|
|
6
|
+
const DatasetsTab = (props) => {
|
|
7
|
+
const { items, appConfig, defaultAccordionOpenIndex } = props;
|
|
8
|
+
|
|
9
|
+
const [activeAccordionIndex, setActiveAccordionIndex] = React.useState(
|
|
10
|
+
defaultAccordionOpenIndex,
|
|
11
|
+
);
|
|
12
|
+
|
|
13
|
+
React.useEffect(() => {
|
|
14
|
+
if (defaultAccordionOpenIndex !== undefined) {
|
|
15
|
+
setActiveAccordionIndex(defaultAccordionOpenIndex);
|
|
16
|
+
} else {
|
|
17
|
+
setActiveAccordionIndex(-1);
|
|
18
|
+
}
|
|
19
|
+
}, [defaultAccordionOpenIndex]);
|
|
20
|
+
|
|
21
|
+
const panes = (items || []).map((item, i) => ({
|
|
22
|
+
menuItem: (
|
|
23
|
+
<Menu.Item key={i}>
|
|
24
|
+
{item.date ? <span>{item.date}</span> : 'No date'}
|
|
25
|
+
</Menu.Item>
|
|
26
|
+
),
|
|
27
|
+
render: () => (
|
|
28
|
+
<Tab.Pane>
|
|
29
|
+
<DatasetItemsList
|
|
30
|
+
appConfig={appConfig}
|
|
31
|
+
item={item}
|
|
32
|
+
activeTabIndex={activeAccordionIndex}
|
|
33
|
+
setActiveTabIndex={setActiveAccordionIndex}
|
|
34
|
+
/>
|
|
35
|
+
</Tab.Pane>
|
|
36
|
+
),
|
|
37
|
+
}));
|
|
38
|
+
|
|
39
|
+
return (
|
|
40
|
+
<Tab
|
|
41
|
+
className="datasets-tab"
|
|
42
|
+
menu={{ vertical: true, secondary: true, pointing: true }}
|
|
43
|
+
panes={panes}
|
|
44
|
+
onTabChange={() => {
|
|
45
|
+
setActiveAccordionIndex(0);
|
|
46
|
+
}}
|
|
47
|
+
/>
|
|
48
|
+
);
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
export default DatasetsTab;
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { isObsolete, isInternal, groupBy } from '../utils.js';
|
|
3
|
+
import DatasetsTab from './DatasetsTab';
|
|
4
|
+
|
|
5
|
+
const DatasetsView = (props) => {
|
|
6
|
+
const { item, appConfig } = props;
|
|
7
|
+
const { children } = item?.raw_value?.raw || {};
|
|
8
|
+
|
|
9
|
+
const all_datasets = children.map((v, e) => {
|
|
10
|
+
let date;
|
|
11
|
+
if (v.resourceTemporalExtentDetails) {
|
|
12
|
+
const tc = v.resourceTemporalExtentDetails[0];
|
|
13
|
+
const { start, end } = tc || {};
|
|
14
|
+
const tc_start = start?.date
|
|
15
|
+
? new Date(Date.parse(start.date)).getFullYear()
|
|
16
|
+
: '';
|
|
17
|
+
const tc_end = end?.date
|
|
18
|
+
? new Date(Date.parse(end.date)).getFullYear()
|
|
19
|
+
: '';
|
|
20
|
+
if (tc_start === tc_end) {
|
|
21
|
+
date = tc_start;
|
|
22
|
+
} else {
|
|
23
|
+
date = tc_start + '-' + tc_end;
|
|
24
|
+
}
|
|
25
|
+
} else {
|
|
26
|
+
date = '';
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
return Object.assign({ temporalDateRange: date, ...v }, e);
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
const datasets = all_datasets.filter((v) => {
|
|
33
|
+
return !(isObsolete(v.cl_status) || isInternal(v));
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
const archivedOrRestrictedDatasets = all_datasets.filter((v) => {
|
|
37
|
+
return isObsolete(v.cl_status) || isInternal(v);
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
const groupDatasets = (items) => {
|
|
41
|
+
const datasetsByCoverage = groupBy(items, 'temporalDateRange');
|
|
42
|
+
|
|
43
|
+
const sortedDatasets = Object.keys(datasetsByCoverage).sort(function (
|
|
44
|
+
a,
|
|
45
|
+
b,
|
|
46
|
+
) {
|
|
47
|
+
a = Math.max(...a.split('-'));
|
|
48
|
+
b = Math.max(...b.split('-'));
|
|
49
|
+
return b - a;
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
const groupedDatasets = sortedDatasets.map((v) => {
|
|
53
|
+
return { date: v, children: datasetsByCoverage[v] };
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
return groupedDatasets;
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
const groupedByTemporalCoverage = groupDatasets(datasets);
|
|
60
|
+
const groupedByArchivedOrRestricted = groupDatasets(
|
|
61
|
+
archivedOrRestrictedDatasets,
|
|
62
|
+
);
|
|
63
|
+
|
|
64
|
+
return (
|
|
65
|
+
<>
|
|
66
|
+
{groupedByTemporalCoverage && groupedByTemporalCoverage.length > 0 && (
|
|
67
|
+
<>
|
|
68
|
+
<div className="dataset-container">
|
|
69
|
+
<h2>Datasets</h2>
|
|
70
|
+
</div>
|
|
71
|
+
<DatasetsTab
|
|
72
|
+
appConfig={appConfig}
|
|
73
|
+
items={groupedByTemporalCoverage}
|
|
74
|
+
defaultAccordionOpenIndex={0}
|
|
75
|
+
/>
|
|
76
|
+
</>
|
|
77
|
+
)}
|
|
78
|
+
|
|
79
|
+
{groupedByArchivedOrRestricted &&
|
|
80
|
+
groupedByArchivedOrRestricted.length > 0 && (
|
|
81
|
+
<>
|
|
82
|
+
<div className="dataset-container">
|
|
83
|
+
<h2>Archived or restricted datasets</h2>
|
|
84
|
+
</div>
|
|
85
|
+
<DatasetsTab
|
|
86
|
+
appConfig={appConfig}
|
|
87
|
+
items={groupedByArchivedOrRestricted}
|
|
88
|
+
/>
|
|
89
|
+
</>
|
|
90
|
+
)}
|
|
91
|
+
</>
|
|
92
|
+
);
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
export default DatasetsView;
|
|
@@ -11,7 +11,7 @@ import { Callout, Banner } from '@eeacms/volto-eea-design-system/ui';
|
|
|
11
11
|
import {
|
|
12
12
|
MoreLikeThis,
|
|
13
13
|
MetadataSection,
|
|
14
|
-
|
|
14
|
+
DatasetsView,
|
|
15
15
|
} from '@eeacms/volto-datahub/components/ItemView';
|
|
16
16
|
|
|
17
17
|
import { asyncConnect, Helmet } from '@plone/volto/helpers';
|
|
@@ -116,7 +116,7 @@ function ItemView(props) {
|
|
|
116
116
|
</Banner.Subtitle>
|
|
117
117
|
<Banner.Title>{title?.raw}</Banner.Title>
|
|
118
118
|
<Banner.Metadata>
|
|
119
|
-
{obsolete && <div class="ui label archived-item">
|
|
119
|
+
{obsolete && <div class="ui label archived-item">Archived</div>}
|
|
120
120
|
<Banner.MetadataField label="Prod-ID" value={prodID} />
|
|
121
121
|
<Banner.MetadataField
|
|
122
122
|
label="Published"
|
|
@@ -142,7 +142,7 @@ function ItemView(props) {
|
|
|
142
142
|
<Callout>{description?.raw}</Callout>
|
|
143
143
|
</div>
|
|
144
144
|
|
|
145
|
-
<
|
|
145
|
+
<DatasetsView item={item} appConfig={appConfig} />
|
|
146
146
|
|
|
147
147
|
<MetadataSection item={item} appConfig={appConfig} docid={docid} />
|
|
148
148
|
|
|
@@ -17,3 +17,48 @@ export const isObsolete = (status) => {
|
|
|
17
17
|
}
|
|
18
18
|
return obsolete;
|
|
19
19
|
};
|
|
20
|
+
|
|
21
|
+
export const isInternalURL = (url) => {
|
|
22
|
+
let internal = false;
|
|
23
|
+
url.split('/').forEach((part) => {
|
|
24
|
+
if (part.split('_')[6] === 'i') {
|
|
25
|
+
internal = true;
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
return internal;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export const isInternal = (item) => {
|
|
32
|
+
let internal = false;
|
|
33
|
+
const links = item?.link || [];
|
|
34
|
+
links.forEach((link) => {
|
|
35
|
+
if (isInternalURL(link?.url)) {
|
|
36
|
+
internal = true;
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
return internal;
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
export const groupBy = (obj, key) => {
|
|
43
|
+
return obj.reduce((rv, item) => {
|
|
44
|
+
const group = rv[item[key]] || [];
|
|
45
|
+
group.push(item);
|
|
46
|
+
rv[item[key]] = group;
|
|
47
|
+
return rv;
|
|
48
|
+
}, {});
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
export const SVGIcon = ({ name, size, color, className, title, onClick }) => {
|
|
52
|
+
return (
|
|
53
|
+
<svg
|
|
54
|
+
xmlns={name.attributes && name.attributes.xmlns}
|
|
55
|
+
viewBox={name.attributes && name.attributes.viewBox}
|
|
56
|
+
style={{ height: size, width: 'auto', fill: color || 'currentColor' }}
|
|
57
|
+
className={className ? `icon ${className}` : 'icon'}
|
|
58
|
+
onClick={onClick}
|
|
59
|
+
dangerouslySetInnerHTML={{
|
|
60
|
+
__html: title ? `<title>${title}</title>${name.content}` : name.content,
|
|
61
|
+
}}
|
|
62
|
+
/>
|
|
63
|
+
);
|
|
64
|
+
};
|
|
@@ -1,452 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { Icon, List, Accordion, Tab, Menu } from 'semantic-ui-react';
|
|
3
|
-
import { DateTime } from '@eeacms/search';
|
|
4
|
-
import servicesSVG from './icons/services.svg';
|
|
5
|
-
import lockSVG from 'remixicon/icons/System/lock-line.svg';
|
|
6
|
-
|
|
7
|
-
const is_internal_url = (url) => {
|
|
8
|
-
let internal = false;
|
|
9
|
-
url.split('/').forEach((part) => {
|
|
10
|
-
if (part.split('_')[6] === 'i') {
|
|
11
|
-
internal = true;
|
|
12
|
-
}
|
|
13
|
-
});
|
|
14
|
-
return internal;
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
const is_internal = (dataset) => {
|
|
18
|
-
let internal = false;
|
|
19
|
-
const links = dataset?.link || [];
|
|
20
|
-
links.forEach((link) => {
|
|
21
|
-
if (is_internal_url(link?.url)) {
|
|
22
|
-
internal = true;
|
|
23
|
-
}
|
|
24
|
-
});
|
|
25
|
-
return internal;
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
const groupBy = (obj, key) => {
|
|
29
|
-
return obj.reduce((rv, item) => {
|
|
30
|
-
const group = rv[item[key]] || [];
|
|
31
|
-
group.push(item);
|
|
32
|
-
rv[item[key]] = group;
|
|
33
|
-
return rv;
|
|
34
|
-
}, {});
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
const SVGIcon = ({ name, size, color, className, title, onClick }) => {
|
|
38
|
-
return (
|
|
39
|
-
<svg
|
|
40
|
-
xmlns={name.attributes && name.attributes.xmlns}
|
|
41
|
-
viewBox={name.attributes && name.attributes.viewBox}
|
|
42
|
-
style={{ height: size, width: 'auto', fill: color || 'currentColor' }}
|
|
43
|
-
className={className ? `icon ${className}` : 'icon'}
|
|
44
|
-
onClick={onClick}
|
|
45
|
-
dangerouslySetInnerHTML={{
|
|
46
|
-
__html: title ? `<title>${title}</title>${name.content}` : name.content,
|
|
47
|
-
}}
|
|
48
|
-
/>
|
|
49
|
-
);
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
const DatasetList = (props) => {
|
|
53
|
-
const { link } = props;
|
|
54
|
-
const dataset = groupBy(link, 'protocol');
|
|
55
|
-
|
|
56
|
-
return (
|
|
57
|
-
<div>
|
|
58
|
-
{(dataset['WWW:URL'] ||
|
|
59
|
-
dataset['WWW:LINK'] ||
|
|
60
|
-
dataset['EEA:FILEPATH'] ||
|
|
61
|
-
dataset['EEA:FOLDERPATH']) && (
|
|
62
|
-
<>
|
|
63
|
-
<h5>Download:</h5>
|
|
64
|
-
<List divided relaxed>
|
|
65
|
-
{(dataset['WWW:URL'] || []).map((item, i) => {
|
|
66
|
-
return (
|
|
67
|
-
<List.Item key={i}>
|
|
68
|
-
<List.Content>
|
|
69
|
-
<div className="dataset-item">
|
|
70
|
-
<Icon className="download" />
|
|
71
|
-
<a
|
|
72
|
-
href={item.url}
|
|
73
|
-
className="item-link"
|
|
74
|
-
target="_blank"
|
|
75
|
-
rel="noreferrer"
|
|
76
|
-
>
|
|
77
|
-
<span>{item.name}</span>
|
|
78
|
-
</a>
|
|
79
|
-
{is_internal_url(item.url) && (
|
|
80
|
-
<SVGIcon name={lockSVG} size="18" />
|
|
81
|
-
)}
|
|
82
|
-
</div>
|
|
83
|
-
</List.Content>
|
|
84
|
-
{item.description && (
|
|
85
|
-
<span className="item-description" title={item.description}>
|
|
86
|
-
{item.description}
|
|
87
|
-
</span>
|
|
88
|
-
)}
|
|
89
|
-
</List.Item>
|
|
90
|
-
);
|
|
91
|
-
})}
|
|
92
|
-
|
|
93
|
-
{(dataset['WWW:LINK'] || []).map((item, i) => {
|
|
94
|
-
return (
|
|
95
|
-
<List.Item key={i}>
|
|
96
|
-
<List.Content>
|
|
97
|
-
<div className="dataset-item">
|
|
98
|
-
<Icon className="download" />
|
|
99
|
-
{item.name ? (
|
|
100
|
-
<a
|
|
101
|
-
href={item.url}
|
|
102
|
-
className="item-link"
|
|
103
|
-
target="_blank"
|
|
104
|
-
rel="noreferrer"
|
|
105
|
-
>
|
|
106
|
-
{item.name}
|
|
107
|
-
</a>
|
|
108
|
-
) : (
|
|
109
|
-
<a
|
|
110
|
-
href={item.url}
|
|
111
|
-
className="item-link"
|
|
112
|
-
target="_blank"
|
|
113
|
-
rel="noreferrer"
|
|
114
|
-
>
|
|
115
|
-
Download link
|
|
116
|
-
</a>
|
|
117
|
-
)}
|
|
118
|
-
{is_internal_url(item.url) && (
|
|
119
|
-
<SVGIcon name={lockSVG} size="18" />
|
|
120
|
-
)}
|
|
121
|
-
</div>
|
|
122
|
-
</List.Content>
|
|
123
|
-
</List.Item>
|
|
124
|
-
);
|
|
125
|
-
})}
|
|
126
|
-
|
|
127
|
-
{(dataset['EEA:FILEPATH'] || []).map((item, i) => {
|
|
128
|
-
return (
|
|
129
|
-
<List.Item key={i}>
|
|
130
|
-
<List.Content>
|
|
131
|
-
<div className="dataset-item">
|
|
132
|
-
<Icon className="download" />
|
|
133
|
-
<a
|
|
134
|
-
href={item.url}
|
|
135
|
-
className="item-link"
|
|
136
|
-
target="_blank"
|
|
137
|
-
rel="noreferrer"
|
|
138
|
-
>
|
|
139
|
-
WebDAV: {item.name || item.function}
|
|
140
|
-
</a>
|
|
141
|
-
{is_internal_url(item.url) && (
|
|
142
|
-
<SVGIcon name={lockSVG} size="18" />
|
|
143
|
-
)}
|
|
144
|
-
</div>
|
|
145
|
-
</List.Content>
|
|
146
|
-
</List.Item>
|
|
147
|
-
);
|
|
148
|
-
})}
|
|
149
|
-
|
|
150
|
-
{(dataset['EEA:FOLDERPATH'] || []).map((item, i) => {
|
|
151
|
-
return (
|
|
152
|
-
<List.Item key={i}>
|
|
153
|
-
<List.Content>
|
|
154
|
-
<div className="dataset-item">
|
|
155
|
-
<Icon className="download" />
|
|
156
|
-
<a
|
|
157
|
-
href={item.url}
|
|
158
|
-
className="item-link"
|
|
159
|
-
target="_blank"
|
|
160
|
-
rel="noreferrer"
|
|
161
|
-
>
|
|
162
|
-
WebDAV: {item.name || item.function}
|
|
163
|
-
</a>
|
|
164
|
-
{is_internal_url(item.url) && (
|
|
165
|
-
<SVGIcon name={lockSVG} size="18" />
|
|
166
|
-
)}
|
|
167
|
-
</div>
|
|
168
|
-
</List.Content>
|
|
169
|
-
</List.Item>
|
|
170
|
-
);
|
|
171
|
-
})}
|
|
172
|
-
</List>
|
|
173
|
-
</>
|
|
174
|
-
)}
|
|
175
|
-
|
|
176
|
-
{(dataset['ESRI:REST'] || dataset['OGC:WMS']) && (
|
|
177
|
-
<>
|
|
178
|
-
<h5>Services:</h5>
|
|
179
|
-
<List divided relaxed>
|
|
180
|
-
{(dataset['ESRI:REST'] || []).map((item, i) => {
|
|
181
|
-
return (
|
|
182
|
-
<List.Item key={i}>
|
|
183
|
-
<List.Content>
|
|
184
|
-
<div>
|
|
185
|
-
<SVGIcon name={servicesSVG} size="18" />
|
|
186
|
-
{/* {(item.name || item.description) && (
|
|
187
|
-
<span className="item-protocol">{item.protocol}:</span>
|
|
188
|
-
)} */}
|
|
189
|
-
<a
|
|
190
|
-
className="item-link"
|
|
191
|
-
href={item.url}
|
|
192
|
-
target="_blank"
|
|
193
|
-
rel="noreferrer"
|
|
194
|
-
>
|
|
195
|
-
{item.protocol} {item.name || item.description}
|
|
196
|
-
</a>
|
|
197
|
-
{is_internal_url(item.url) && (
|
|
198
|
-
<SVGIcon name={lockSVG} size="18" />
|
|
199
|
-
)}
|
|
200
|
-
</div>
|
|
201
|
-
</List.Content>
|
|
202
|
-
</List.Item>
|
|
203
|
-
);
|
|
204
|
-
})}
|
|
205
|
-
|
|
206
|
-
{(dataset['OGC:WMS'] || []).map((item, i) => {
|
|
207
|
-
return (
|
|
208
|
-
<List.Item key={i}>
|
|
209
|
-
<List.Content>
|
|
210
|
-
<div>
|
|
211
|
-
<SVGIcon name={servicesSVG} size="18" />
|
|
212
|
-
{/* {(item.name || item.description) && (
|
|
213
|
-
<span className="item-protocol">{item.protocol}:</span>
|
|
214
|
-
)} */}
|
|
215
|
-
<a
|
|
216
|
-
className="item-link"
|
|
217
|
-
href={item.url}
|
|
218
|
-
target="_blank"
|
|
219
|
-
rel="noreferrer"
|
|
220
|
-
>
|
|
221
|
-
{item.protocol} {item.name || item.description}
|
|
222
|
-
</a>
|
|
223
|
-
{is_internal_url(item.url) && (
|
|
224
|
-
<SVGIcon name={lockSVG} size="18" />
|
|
225
|
-
)}
|
|
226
|
-
</div>
|
|
227
|
-
</List.Content>
|
|
228
|
-
</List.Item>
|
|
229
|
-
);
|
|
230
|
-
})}
|
|
231
|
-
</List>
|
|
232
|
-
</>
|
|
233
|
-
)}
|
|
234
|
-
|
|
235
|
-
{dataset['WWW:LINK-1.0-http--link'] && (
|
|
236
|
-
<>
|
|
237
|
-
<h5>Links:</h5>
|
|
238
|
-
<List divided relaxed>
|
|
239
|
-
{(dataset['WWW:LINK-1.0-http--link'] || []).map((item, i) => {
|
|
240
|
-
return (
|
|
241
|
-
<List.Item key={i}>
|
|
242
|
-
<List.Content>
|
|
243
|
-
<div className="dataset-item">
|
|
244
|
-
<Icon className="linkify" />
|
|
245
|
-
<a
|
|
246
|
-
href={item.url}
|
|
247
|
-
className="item-link"
|
|
248
|
-
target="_blank"
|
|
249
|
-
rel="noreferrer"
|
|
250
|
-
>
|
|
251
|
-
<span>{item.name || item.url}</span>
|
|
252
|
-
</a>
|
|
253
|
-
{is_internal_url(item.url) && (
|
|
254
|
-
<SVGIcon name={lockSVG} size="18" />
|
|
255
|
-
)}
|
|
256
|
-
</div>
|
|
257
|
-
</List.Content>
|
|
258
|
-
{item.description && (
|
|
259
|
-
<span className="item-description">{item.description}</span>
|
|
260
|
-
)}
|
|
261
|
-
</List.Item>
|
|
262
|
-
);
|
|
263
|
-
})}
|
|
264
|
-
</List>
|
|
265
|
-
</>
|
|
266
|
-
)}
|
|
267
|
-
</div>
|
|
268
|
-
);
|
|
269
|
-
};
|
|
270
|
-
|
|
271
|
-
const Datasets = (props) => {
|
|
272
|
-
const { item, appConfig } = props;
|
|
273
|
-
const { children } = item?.raw_value?.raw || {};
|
|
274
|
-
|
|
275
|
-
const [activeIndex, setActiveIndex] = React.useState(0);
|
|
276
|
-
|
|
277
|
-
function handleClick(e, titleProps) {
|
|
278
|
-
const { index } = titleProps;
|
|
279
|
-
const newIndex = activeIndex === index ? -1 : index;
|
|
280
|
-
setActiveIndex(newIndex);
|
|
281
|
-
}
|
|
282
|
-
|
|
283
|
-
const datasets = children.map((v, e) => {
|
|
284
|
-
let date;
|
|
285
|
-
|
|
286
|
-
if (v.resourceTemporalExtentDetails) {
|
|
287
|
-
const tc = v.resourceTemporalExtentDetails[0];
|
|
288
|
-
const { start, end } = tc || {};
|
|
289
|
-
const tc_start = start?.date
|
|
290
|
-
? new Date(Date.parse(start.date)).getFullYear()
|
|
291
|
-
: '';
|
|
292
|
-
const tc_end = end?.date
|
|
293
|
-
? new Date(Date.parse(end.date)).getFullYear()
|
|
294
|
-
: '';
|
|
295
|
-
if (tc_start === tc_end) {
|
|
296
|
-
date = tc_start;
|
|
297
|
-
} else {
|
|
298
|
-
date = tc_start + '-' + tc_end;
|
|
299
|
-
}
|
|
300
|
-
} else {
|
|
301
|
-
date = '';
|
|
302
|
-
}
|
|
303
|
-
|
|
304
|
-
return Object.assign({ temporalDateRange: date, ...v }, e);
|
|
305
|
-
});
|
|
306
|
-
|
|
307
|
-
const datasetsByCoverage = groupBy(datasets, 'temporalDateRange');
|
|
308
|
-
|
|
309
|
-
const sortedDatasets = Object.keys(datasetsByCoverage).sort(function (a, b) {
|
|
310
|
-
a = Math.max(...a.split('-'));
|
|
311
|
-
b = Math.max(...b.split('-'));
|
|
312
|
-
return b - a;
|
|
313
|
-
});
|
|
314
|
-
|
|
315
|
-
const groupedDatasets = sortedDatasets.map((v) => {
|
|
316
|
-
return { date: v, children: datasetsByCoverage[v] };
|
|
317
|
-
});
|
|
318
|
-
|
|
319
|
-
const panes = (groupedDatasets || []).map((item, i) => ({
|
|
320
|
-
menuItem: (
|
|
321
|
-
<Menu.Item key={i}>
|
|
322
|
-
{item.date ? <span>{item.date}</span> : 'No date'}
|
|
323
|
-
</Menu.Item>
|
|
324
|
-
),
|
|
325
|
-
render: () => (
|
|
326
|
-
<Tab.Pane>
|
|
327
|
-
<Accordion>
|
|
328
|
-
{item?.children.map((dataset, index) => {
|
|
329
|
-
const {
|
|
330
|
-
resourceTemporalExtentDetails,
|
|
331
|
-
temporalDateRange,
|
|
332
|
-
publicationDateForResource,
|
|
333
|
-
} = dataset;
|
|
334
|
-
return (
|
|
335
|
-
<React.Fragment key={index}>
|
|
336
|
-
<Accordion.Title
|
|
337
|
-
active={activeIndex === index}
|
|
338
|
-
index={index}
|
|
339
|
-
onClick={handleClick}
|
|
340
|
-
>
|
|
341
|
-
<span className="dataset-title">
|
|
342
|
-
{dataset.resourceTitleObject.default}
|
|
343
|
-
<span className="formats">
|
|
344
|
-
{(dataset.format || []).map((item, i) => {
|
|
345
|
-
return (
|
|
346
|
-
<span className="format-label" key={i}>
|
|
347
|
-
{item}
|
|
348
|
-
</span>
|
|
349
|
-
);
|
|
350
|
-
})}
|
|
351
|
-
|
|
352
|
-
{Array.isArray(dataset.linkProtocol) ? (
|
|
353
|
-
<>
|
|
354
|
-
{dataset.linkProtocol
|
|
355
|
-
.filter(
|
|
356
|
-
(i) => i.includes('ESRI') || i.includes('OGC'),
|
|
357
|
-
)
|
|
358
|
-
.map((item, i) => {
|
|
359
|
-
return (
|
|
360
|
-
<span className="format-label" key={i}>
|
|
361
|
-
{item}
|
|
362
|
-
</span>
|
|
363
|
-
);
|
|
364
|
-
})}
|
|
365
|
-
</>
|
|
366
|
-
) : (
|
|
367
|
-
<>
|
|
368
|
-
{['ESRI', 'OGC'].includes(dataset.linkProtocol) && (
|
|
369
|
-
<span className="format-label">
|
|
370
|
-
{dataset.linkProtocol}
|
|
371
|
-
</span>
|
|
372
|
-
)}
|
|
373
|
-
</>
|
|
374
|
-
)}
|
|
375
|
-
</span>
|
|
376
|
-
|
|
377
|
-
{is_internal(dataset) && (
|
|
378
|
-
<SVGIcon name={lockSVG} size="18" />
|
|
379
|
-
)}
|
|
380
|
-
</span>
|
|
381
|
-
<Icon className="ri-arrow-down-s-line" />
|
|
382
|
-
</Accordion.Title>
|
|
383
|
-
<Accordion.Content active={activeIndex === index}>
|
|
384
|
-
<div className="dataset-content">
|
|
385
|
-
<div>
|
|
386
|
-
{publicationDateForResource && (
|
|
387
|
-
<div>
|
|
388
|
-
<strong>Published: </strong>
|
|
389
|
-
<DateTime
|
|
390
|
-
format="DATE_MED"
|
|
391
|
-
value={publicationDateForResource}
|
|
392
|
-
/>
|
|
393
|
-
</div>
|
|
394
|
-
)}
|
|
395
|
-
|
|
396
|
-
{resourceTemporalExtentDetails &&
|
|
397
|
-
resourceTemporalExtentDetails?.length > 0 && (
|
|
398
|
-
<div>
|
|
399
|
-
<strong>Temporal coverage: </strong>
|
|
400
|
-
{temporalDateRange}
|
|
401
|
-
</div>
|
|
402
|
-
)}
|
|
403
|
-
</div>
|
|
404
|
-
|
|
405
|
-
{dataset.resourceType[0] !== 'nonGeographicDataset' && (
|
|
406
|
-
<div className="dataset-pdf">
|
|
407
|
-
<div className="d-link">
|
|
408
|
-
<Icon className="file pdf" />
|
|
409
|
-
<a
|
|
410
|
-
target="_blank"
|
|
411
|
-
rel="noreferrer"
|
|
412
|
-
href={`${appConfig.indexBaseUrl}/catalogue/datahub/api/records/${dataset.metadataIdentifier}/formatters/xsl-view?output=pdf&language=eng&approved=true`}
|
|
413
|
-
>
|
|
414
|
-
Metadata Factsheet
|
|
415
|
-
</a>
|
|
416
|
-
</div>
|
|
417
|
-
</div>
|
|
418
|
-
)}
|
|
419
|
-
</div>
|
|
420
|
-
|
|
421
|
-
{!!dataset.link && dataset.link.length > 0 && (
|
|
422
|
-
<DatasetList link={dataset.link} />
|
|
423
|
-
)}
|
|
424
|
-
</Accordion.Content>
|
|
425
|
-
</React.Fragment>
|
|
426
|
-
);
|
|
427
|
-
})}
|
|
428
|
-
</Accordion>
|
|
429
|
-
</Tab.Pane>
|
|
430
|
-
),
|
|
431
|
-
}));
|
|
432
|
-
|
|
433
|
-
return children && children.length > 0 ? (
|
|
434
|
-
<>
|
|
435
|
-
<div className="dataset-container">
|
|
436
|
-
<h2>Datasets</h2>
|
|
437
|
-
</div>
|
|
438
|
-
|
|
439
|
-
<div className="item tabs-title">Temporal coverage</div>
|
|
440
|
-
<Tab
|
|
441
|
-
className="datasets-tab"
|
|
442
|
-
menu={{ vertical: true, secondary: true, pointing: true }}
|
|
443
|
-
panes={panes}
|
|
444
|
-
onTabChange={() => {
|
|
445
|
-
setActiveIndex(0);
|
|
446
|
-
}}
|
|
447
|
-
/>
|
|
448
|
-
</>
|
|
449
|
-
) : null;
|
|
450
|
-
};
|
|
451
|
-
|
|
452
|
-
export default Datasets;
|