@eeacms/volto-datahub 1.0.12 → 1.0.13
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 +6 -4
- package/package.json +1 -1
- package/src/components/ItemView/Datasets.jsx +63 -48
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,12 @@ 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.13](https://github.com/eea/volto-datahub/compare/1.0.12...1.0.13) - 10 February 2023
|
|
8
|
+
|
|
9
|
+
#### :hammer_and_wrench: Others
|
|
10
|
+
|
|
11
|
+
- Fix case with no coverage [kreafox - [`6a67083`](https://github.com/eea/volto-datahub/commit/6a67083acebb5fc358882e8592d1eca05fcb38bc)]
|
|
12
|
+
- Group datasets by temporal coverage [kreafox - [`599b122`](https://github.com/eea/volto-datahub/commit/599b122596bc72ccafedeba8fa2d9787e6fdfff0)]
|
|
7
13
|
### [1.0.12](https://github.com/eea/volto-datahub/compare/1.0.11...1.0.12) - 9 February 2023
|
|
8
14
|
|
|
9
15
|
#### :hammer_and_wrench: Others
|
|
@@ -81,11 +87,9 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
|
81
87
|
#### :hammer_and_wrench: Others
|
|
82
88
|
|
|
83
89
|
- Fix eslintrc: add @eeacms/search [kreafox - [`465816f`](https://github.com/eea/volto-datahub/commit/465816feb8f58095ab4b5b3168cd29ebede3a10c)]
|
|
84
|
-
- Use latest Volto before yarn 3 [Tiberiu Ichim - [`69f5859`](https://github.com/eea/volto-datahub/commit/69f585980fd9a38ff99d0c7875704671857720f7)]
|
|
85
90
|
- Reorder sections on landing page [kreafox - [`46fac8d`](https://github.com/eea/volto-datahub/commit/46fac8d821cf93fe1b2c380380719de130c3f1cb)]
|
|
86
91
|
- Fix project eslintrc [kreafox - [`5baa150`](https://github.com/eea/volto-datahub/commit/5baa1505ec38ed313269f5608c186c6a6a8bbfc4)]
|
|
87
92
|
- Open dataset links in new tab [kreafox - [`bbed914`](https://github.com/eea/volto-datahub/commit/bbed914dc2edf6c749d1d73d93a423bc642e680c)]
|
|
88
|
-
- Add Sonarqube tag using circularity-frontend addons list [EEA Jenkins - [`380a2a9`](https://github.com/eea/volto-datahub/commit/380a2a9625c6f799df7a7c343fad3f3b3d959f96)]
|
|
89
93
|
## [1.0.0](https://github.com/eea/volto-datahub/compare/0.1.12...1.0.0) - 28 October 2022
|
|
90
94
|
|
|
91
95
|
#### :nail_care: Enhancements
|
|
@@ -110,7 +114,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
|
110
114
|
#### :hammer_and_wrench: Others
|
|
111
115
|
|
|
112
116
|
- fixed query for related items [Zoltan Szabo - [`b66faee`](https://github.com/eea/volto-datahub/commit/b66faee1f8a1922cd22b3a36eccc9c7b92e377d4)]
|
|
113
|
-
- Add Sonarqube tag using eea-website-frontend addons list [EEA Jenkins - [`158fe1a`](https://github.com/eea/volto-datahub/commit/158fe1a0b1767452e2e51a3e2ef97169589a50e8)]
|
|
114
117
|
### [0.1.10](https://github.com/eea/volto-datahub/compare/0.1.9...0.1.10) - 21 September 2022
|
|
115
118
|
|
|
116
119
|
#### :hammer_and_wrench: Others
|
|
@@ -199,7 +202,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
|
199
202
|
#### :hammer_and_wrench: Others
|
|
200
203
|
|
|
201
204
|
- Hide questions & fix landing page [kreafox - [`a1ef303`](https://github.com/eea/volto-datahub/commit/a1ef3033df0e84f3a72dd0f984c8717dff2a771c)]
|
|
202
|
-
- Add Sonarqube tag using eea-website-frontend addons list [EEA Jenkins - [`910688e`](https://github.com/eea/volto-datahub/commit/910688e3ddf2f8cda4f941595ae9a6ee0ec0ea3b)]
|
|
203
205
|
### [0.1.1](https://github.com/eea/volto-datahub/compare/0.1.0...0.1.1) - 10 June 2022
|
|
204
206
|
|
|
205
207
|
### [0.1.0](https://github.com/eea/volto-datahub/compare/0.0.1...0.1.0) - 9 June 2022
|
package/package.json
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { Icon, List, Accordion, Tab } from 'semantic-ui-react';
|
|
2
|
+
import { Icon, List, Accordion, Tab, Menu } from 'semantic-ui-react';
|
|
3
|
+
import { DateTime } from '@eeacms/search';
|
|
3
4
|
import servicesSVG from './icons/services.svg';
|
|
4
5
|
import lockSVG from 'remixicon/icons/System/lock-line.svg';
|
|
5
6
|
|
|
@@ -279,25 +280,55 @@ const Datasets = (props) => {
|
|
|
279
280
|
setActiveIndex(newIndex);
|
|
280
281
|
}
|
|
281
282
|
|
|
282
|
-
const
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
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');
|
|
291
308
|
|
|
292
|
-
const
|
|
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
|
+
});
|
|
293
314
|
|
|
294
|
-
const
|
|
295
|
-
|
|
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>{item.date ? <span>{item.date}</span> : 'No date'}</Menu.Item>
|
|
322
|
+
),
|
|
296
323
|
render: () => (
|
|
297
324
|
<Tab.Pane>
|
|
298
325
|
<Accordion>
|
|
299
|
-
{
|
|
300
|
-
const {
|
|
326
|
+
{item?.children.map((dataset, index) => {
|
|
327
|
+
const {
|
|
328
|
+
resourceTemporalExtentDetails,
|
|
329
|
+
temporalDateRange,
|
|
330
|
+
publicationDateForResource,
|
|
331
|
+
} = dataset;
|
|
301
332
|
return (
|
|
302
333
|
<React.Fragment key={index}>
|
|
303
334
|
<Accordion.Title
|
|
@@ -349,42 +380,26 @@ const Datasets = (props) => {
|
|
|
349
380
|
</Accordion.Title>
|
|
350
381
|
<Accordion.Content active={activeIndex === index}>
|
|
351
382
|
<div className="dataset-content">
|
|
352
|
-
|
|
353
|
-
|
|
383
|
+
<div>
|
|
384
|
+
{publicationDateForResource && (
|
|
354
385
|
<div>
|
|
355
|
-
<strong>
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
tc_start = new Date(
|
|
361
|
-
Date.parse(tc_start),
|
|
362
|
-
).getFullYear();
|
|
363
|
-
}
|
|
364
|
-
let tc_end = tc?.end?.date;
|
|
365
|
-
if (tc_end) {
|
|
366
|
-
tc_end = new Date(
|
|
367
|
-
Date.parse(tc_end),
|
|
368
|
-
).getFullYear();
|
|
369
|
-
}
|
|
370
|
-
tc_start = tc_start || '';
|
|
371
|
-
tc_end = tc_end || '';
|
|
372
|
-
return (
|
|
373
|
-
<React.Fragment key={i}>
|
|
374
|
-
<span>
|
|
375
|
-
{tc_start === tc_end && tc_start}
|
|
376
|
-
{tc_start !== tc_end &&
|
|
377
|
-
tc_start + ' - ' + tc_end}
|
|
378
|
-
</span>
|
|
379
|
-
{i !== resourceTemporalExtentDetails.length - 1
|
|
380
|
-
? ', '
|
|
381
|
-
: ' '}
|
|
382
|
-
</React.Fragment>
|
|
383
|
-
);
|
|
384
|
-
})}
|
|
386
|
+
<strong>Published: </strong>
|
|
387
|
+
<DateTime
|
|
388
|
+
format="DATE_MED"
|
|
389
|
+
value={publicationDateForResource}
|
|
390
|
+
/>
|
|
385
391
|
</div>
|
|
386
392
|
)}
|
|
387
393
|
|
|
394
|
+
{resourceTemporalExtentDetails &&
|
|
395
|
+
resourceTemporalExtentDetails?.length > 0 && (
|
|
396
|
+
<div>
|
|
397
|
+
<strong>Temporal coverage: </strong>
|
|
398
|
+
{temporalDateRange}
|
|
399
|
+
</div>
|
|
400
|
+
)}
|
|
401
|
+
</div>
|
|
402
|
+
|
|
388
403
|
{dataset.resourceType[0] !== 'nonGeographicDataset' && (
|
|
389
404
|
<div className="dataset-pdf">
|
|
390
405
|
<div className="d-link">
|
|
@@ -419,7 +434,7 @@ const Datasets = (props) => {
|
|
|
419
434
|
<h2>Datasets</h2>
|
|
420
435
|
</div>
|
|
421
436
|
|
|
422
|
-
<div className="item tabs-title">
|
|
437
|
+
<div className="item tabs-title">Temporal coverage</div>
|
|
423
438
|
<Tab
|
|
424
439
|
className="datasets-tab"
|
|
425
440
|
menu={{ vertical: true, secondary: true, pointing: true }}
|