@eeacms/volto-datahub 1.0.16 → 1.0.17

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,13 @@ 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.17](https://github.com/eea/volto-datahub/compare/1.0.16...1.0.17) - 10 March 2023
8
+
9
+ #### :hammer_and_wrench: Others
10
+
11
+ - test(Jenkinsfile): Use latest stable volto for testing [Zoltan Szabo - [`7aed7a1`](https://github.com/eea/volto-datahub/commit/7aed7a124289f3b39b479fda1bbedd72de88d95b)]
12
+ - Move labels inside <a> [kreafox - [`4273ece`](https://github.com/eea/volto-datahub/commit/4273ece5870b6661b1a66da91f6678923649a3cb)]
13
+ - updates on archived items [Zoltan Szabo - [`627225d`](https://github.com/eea/volto-datahub/commit/627225d726ef48cfbcebddbf574abbe46c2c844d)]
7
14
  ### [1.0.16](https://github.com/eea/volto-datahub/compare/1.0.15...1.0.16) - 6 March 2023
8
15
 
9
16
  #### :hammer_and_wrench: Others
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eeacms/volto-datahub",
3
- "version": "1.0.16",
3
+ "version": "1.0.17",
4
4
  "description": "@eeacms/volto-datahub: Volto add-on",
5
5
  "main": "src/index.js",
6
6
  "author": "European Environment Agency: IDM2 A-Team",
@@ -1,5 +1,6 @@
1
1
  import React from 'react';
2
2
 
3
+ import { Label } from 'semantic-ui-react';
3
4
  import { DateTime, StringList } from '@eeacms/search';
4
5
  import { ResultContext } from '@eeacms/search';
5
6
  import { Link } from 'react-router-dom';
@@ -16,9 +17,15 @@ const DatahubCardItem = (props) => {
16
17
 
17
18
  const item = {
18
19
  title: (
19
- <Link to={result.href} title={result.title}>
20
- {result.title}
21
- </Link>
20
+ <>
21
+ <Link to={result.href} title={result.title}>
22
+ {result.title}
23
+ {result.isNew && <Label className="new-item">New</Label>}
24
+ {result.isExpired && (
25
+ <Label className="archived-item">Archived</Label>
26
+ )}
27
+ </Link>
28
+ </>
22
29
  ),
23
30
  description: <ResultContext {...props} />,
24
31
  preview_image_url: result.hasImage ? result.thumbUrl : undefined,
@@ -3,10 +3,67 @@ import {
3
3
  fixedRangeFacet,
4
4
  histogramFacet,
5
5
  makeRange,
6
+ booleanFacet,
6
7
  } from '@eeacms/search';
7
8
  import { dateRangeFacet } from '@eeacms/search';
8
9
 
10
+ export function getTodayWithTime() {
11
+ const d = new Date();
12
+ const month = d.getMonth() + 1;
13
+ const day = d.getDate();
14
+ const hour = d.getHours();
15
+ const minute = d.getMinutes();
16
+ const second = d.getSeconds();
17
+
18
+ const output = [
19
+ d.getFullYear(),
20
+ '-',
21
+ month < 10 ? '0' : '',
22
+ month,
23
+ '-',
24
+ day < 10 ? '0' : '',
25
+ day,
26
+ 'T',
27
+ hour < 10 ? '0' : '',
28
+ hour,
29
+ ':',
30
+ minute < 10 ? '0' : '',
31
+ minute,
32
+ ':',
33
+ second < 10 ? '0' : '',
34
+ second,
35
+ 'Z',
36
+ ].join('');
37
+ return output;
38
+ }
39
+
9
40
  const facets = [
41
+ booleanFacet(() => ({
42
+ field: 'IncludeArchived',
43
+ label: 'Include archived content',
44
+ id: 'archived-facet',
45
+ showInFacetsList: false,
46
+ showInSecondaryFacetsList: true,
47
+ isFilter: true, // filters don't need facet options to show up
48
+
49
+ // we want this to be applied by default
50
+ // when the facet is checked, then apply the `on` key:
51
+ off: {
52
+ constant_score: {
53
+ filter: {
54
+ bool: {
55
+ should: [
56
+ { bool: { must_not: { exists: { field: 'expires' } } } },
57
+ // Functions should be supported in the buildFilters
58
+ { range: { expires: { gte: getTodayWithTime() } } },
59
+ ],
60
+ },
61
+ },
62
+ },
63
+ },
64
+ on: null,
65
+ })),
66
+
10
67
  multiTermFacet({
11
68
  field: 'instrument',
12
69
  isFilterable: true,