@eeacms/volto-datahub 1.0.11 → 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
CHANGED
|
@@ -4,6 +4,20 @@ 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)]
|
|
13
|
+
### [1.0.12](https://github.com/eea/volto-datahub/compare/1.0.11...1.0.12) - 9 February 2023
|
|
14
|
+
|
|
15
|
+
#### :hammer_and_wrench: Others
|
|
16
|
+
|
|
17
|
+
- Small change: renaming [kreafox - [`cb2ea49`](https://github.com/eea/volto-datahub/commit/cb2ea492bace5b2608bfa17d26b0cbf08be6a962)]
|
|
18
|
+
- Fix undefined in datasets tab [kreafox - [`57ef7e0`](https://github.com/eea/volto-datahub/commit/57ef7e00e554c3a08996ec284ca33350c582c3a5)]
|
|
19
|
+
- Undo some changes [kreafox - [`7d1e80b`](https://github.com/eea/volto-datahub/commit/7d1e80b59385664873d240c2bc56137f3139c88d)]
|
|
20
|
+
- Use "missing" instead of undefined in datasets tab [kreafox - [`e215775`](https://github.com/eea/volto-datahub/commit/e215775fa22c2ac01e39151ba96f7c833e9aefd6)]
|
|
7
21
|
### [1.0.11](https://github.com/eea/volto-datahub/compare/1.0.10...1.0.11) - 7 February 2023
|
|
8
22
|
|
|
9
23
|
#### :hammer_and_wrench: Others
|
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 datasets =
|
|
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');
|
|
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
|
+
});
|
|
291
314
|
|
|
292
|
-
const
|
|
315
|
+
const groupedDatasets = sortedDatasets.map((v) => {
|
|
316
|
+
return { date: v, children: datasetsByCoverage[v] };
|
|
317
|
+
});
|
|
293
318
|
|
|
294
|
-
const panes =
|
|
295
|
-
menuItem:
|
|
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">
|
|
@@ -413,9 +428,13 @@ const Datasets = (props) => {
|
|
|
413
428
|
),
|
|
414
429
|
}));
|
|
415
430
|
|
|
416
|
-
return
|
|
431
|
+
return children && children.length > 0 ? (
|
|
417
432
|
<>
|
|
418
|
-
<div className="
|
|
433
|
+
<div className="dataset-container">
|
|
434
|
+
<h2>Datasets</h2>
|
|
435
|
+
</div>
|
|
436
|
+
|
|
437
|
+
<div className="item tabs-title">Temporal coverage</div>
|
|
419
438
|
<Tab
|
|
420
439
|
className="datasets-tab"
|
|
421
440
|
menu={{ vertical: true, secondary: true, pointing: true }}
|
|
@@ -147,10 +147,6 @@ function ItemView(props) {
|
|
|
147
147
|
<Callout>{description?.raw}</Callout>
|
|
148
148
|
</div>
|
|
149
149
|
|
|
150
|
-
<div className="dataset-container">
|
|
151
|
-
<h2>Datasets</h2>
|
|
152
|
-
</div>
|
|
153
|
-
|
|
154
150
|
<Datasets item={item} appConfig={appConfig} />
|
|
155
151
|
|
|
156
152
|
<MetadataSection item={item} appConfig={appConfig} docid={docid} />
|