@eeacms/volto-datahub 1.0.29 → 1.0.31

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,13 +4,27 @@ 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.31](https://github.com/eea/volto-datahub/compare/1.0.30...1.0.31) - 29 September 2023
8
+
9
+ #### :house: Documentation changes
10
+
11
+ - docs: Update README and DEVELOP [Alin Voinea - [`45530f9`](https://github.com/eea/volto-datahub/commit/45530f9f8c408e06326ff2207832d9aaf0c9e533)]
12
+
13
+ ### [1.0.30](https://github.com/eea/volto-datahub/compare/1.0.29...1.0.30) - 27 September 2023
14
+
15
+ #### :hammer_and_wrench: Others
16
+
17
+ - Fix undefined [kreafox - [`081615c`](https://github.com/eea/volto-datahub/commit/081615c3f44364c153c44cf190660007758c6214)]
18
+ - Add tests [kreafox - [`e2234c7`](https://github.com/eea/volto-datahub/commit/e2234c7ba4a0094b7dd89c141d48667f328111f8)]
19
+ - Fix texts [kreafox - [`c76ad45`](https://github.com/eea/volto-datahub/commit/c76ad45053b70cb35ef270da4a3959a533d6d82e)]
20
+ - Improve prod id section + icons [kreafox - [`e89a45f`](https://github.com/eea/volto-datahub/commit/e89a45fabc50e0c331b33703afa70f0b0a9507e7)]
21
+ - Improve multiple prod ids display [kreafox - [`9797092`](https://github.com/eea/volto-datahub/commit/979709216803b23b21d3208e73a63027ea8189f2)]
7
22
  ### [1.0.29](https://github.com/eea/volto-datahub/compare/1.0.28...1.0.29) - 13 September 2023
8
23
 
9
24
  #### :hammer_and_wrench: Others
10
25
 
11
26
  - Fix snapshot [kreafox - [`3e070c5`](https://github.com/eea/volto-datahub/commit/3e070c5973e314935d674c5d41a361882317937b)]
12
27
  - Add test [kreafox - [`5683383`](https://github.com/eea/volto-datahub/commit/568338374247690706c4b5b1b766e1663602ace9)]
13
- - Fix crash in dataset view [Tiberiu Ichim - [`f3a7310`](https://github.com/eea/volto-datahub/commit/f3a7310344b760bc8b4246bf69f47912068d6d90)]
14
28
  ### [1.0.28](https://github.com/eea/volto-datahub/compare/1.0.27...1.0.28) - 8 September 2023
15
29
 
16
30
  #### :hammer_and_wrench: Others
package/DEVELOP.md CHANGED
@@ -16,12 +16,14 @@
16
16
 
17
17
  1. Go to http://localhost:3000
18
18
 
19
- 1. Happy hacking!
19
+ 1. Initialize git hooks
20
20
 
21
21
  ```Bash
22
- cd src/addons/volto-datahub/
22
+ yarn prepare
23
23
  ```
24
24
 
25
+ 1. Happy hacking!
26
+
25
27
  ### Or add @eeacms/volto-datahub to your Volto project
26
28
 
27
29
  Before starting make sure your development environment is properly set. See [Volto Developer Documentation](https://docs.voltocms.com/getting-started/install/)
@@ -48,18 +50,15 @@ Before starting make sure your development environment is properly set. See [Vol
48
50
 
49
51
  1. Install
50
52
 
51
- yarn develop
53
+ make develop
52
54
  yarn
53
55
 
54
56
  1. Start backend
55
57
 
56
- docker pull plone
57
- docker run -d --name plone -p 8080:8080 -e SITE=Plone -e PROFILES="profile-plone.restapi:blocks" plone
58
+ docker run --pull always -it --rm --name plone -p 8080:8080 -e SITE=Plone plone/plone-backend
58
59
 
59
60
  ...wait for backend to setup and start - `Ready to handle requests`:
60
61
 
61
- docker logs -f plone
62
-
63
62
  ...you can also check http://localhost:8080/Plone
64
63
 
65
64
  1. Start frontend
@@ -71,7 +70,6 @@ Before starting make sure your development environment is properly set. See [Vol
71
70
  1. Happy hacking!
72
71
 
73
72
  cd src/addons/volto-datahub/
74
- cd src/addons/volto-addon-template/
75
73
 
76
74
  ## Cypress
77
75
 
package/README.md CHANGED
@@ -15,11 +15,11 @@
15
15
  [![Duplicated Lines (%)](https://sonarqube.eea.europa.eu/api/project_badges/measure?project=volto-datahub-develop&metric=duplicated_lines_density)](https://sonarqube.eea.europa.eu/dashboard?id=volto-datahub-develop)
16
16
 
17
17
 
18
- [Volto](https://github.com/plone/volto) add-on
18
+ EEA DataHub search [Volto](https://github.com/plone/volto) add-on
19
19
 
20
- ## Features
20
+ ## Demo
21
21
 
22
- Demo GIF
22
+ - https://demo-www.eea.europa.eu/en/datahub
23
23
 
24
24
  ## Getting started
25
25
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eeacms/volto-datahub",
3
- "version": "1.0.29",
3
+ "version": "1.0.31",
4
4
  "description": "@eeacms/volto-datahub: Volto add-on",
5
5
  "main": "src/index.js",
6
6
  "author": "European Environment Agency: IDM2 A-Team",
@@ -8,7 +8,7 @@ import servicesSVG from '../icons/services.svg';
8
8
  const ItemLink = ({ item }) => (
9
9
  <List.Item key={item.id}>
10
10
  <List.Content>
11
- <div>
11
+ <div className="dataset-item">
12
12
  <SVGIcon name={servicesSVG} size="20px" />
13
13
  <a
14
14
  className="item-link"
@@ -0,0 +1,28 @@
1
+ import React from 'react';
2
+ import renderer from 'react-test-renderer';
3
+
4
+ import DatasetItemDownloadList from './DatasetItemDownloadList';
5
+
6
+ jest.mock('@eeacms/search', () => ({
7
+ runRequest: jest.fn(),
8
+ }));
9
+
10
+ const link = [
11
+ {
12
+ function: 'download',
13
+ mimeType: '',
14
+ protocol: 'WWW:URL',
15
+ url: 'https://example.org/1',
16
+ name: 'Direct download',
17
+ group: 0,
18
+ },
19
+ ];
20
+
21
+ describe('DatasetItemDownloadList', () => {
22
+ it('renders correctly', () => {
23
+ const tree = renderer
24
+ .create(<DatasetItemDownloadList link={link} />)
25
+ .toJSON();
26
+ expect(tree).toMatchSnapshot();
27
+ });
28
+ });
@@ -2,7 +2,7 @@ import React from 'react';
2
2
  import { Portal } from 'react-portal';
3
3
  import { useDispatch, useSelector } from 'react-redux';
4
4
  import { Link, useLocation } from 'react-router-dom';
5
- import { Container, Icon, Button } from 'semantic-ui-react';
5
+ import { Container, Icon, Button, Popup } from 'semantic-ui-react';
6
6
  import { Toolbar } from '@plone/volto/components';
7
7
  import { BodyClass, asyncConnect, Helmet } from '@plone/volto/helpers';
8
8
  import config from '@plone/volto/registry';
@@ -22,6 +22,7 @@ import { isObsolete } from '@eeacms/volto-datahub/utils';
22
22
 
23
23
  const appName = 'datahub';
24
24
  const WORD_COUNT = 60;
25
+ const PROD_ID_COUNT = 3;
25
26
 
26
27
  const splitContent = (content, wordCount) => {
27
28
  const words = content.split(' ');
@@ -87,12 +88,16 @@ function ItemView(props) {
87
88
 
88
89
  const item = result ? result._result : null;
89
90
  const { title, description, raw_value } = item || {};
90
- const { changeDate, resourceIdentifier, cl_status } = raw_value?.raw;
91
+ const { changeDate, cl_status } = raw_value?.raw || {}; // resourceIdentifier
91
92
  const obsolete = isObsolete(cl_status);
92
93
 
93
- const prodID = (resourceIdentifier || []).filter((p) => {
94
- return p.code.includes('DAT');
95
- })[0]?.code;
94
+ // const prodID = (resourceIdentifier || []).filter((p) => {
95
+ // return p.code.includes('DAT');
96
+ // })[0]?.code;
97
+
98
+ const prodID = Array.isArray(item?.prod_id?.raw)
99
+ ? item?.prod_id?.raw
100
+ : item?.prod_id?.raw.split(', ');
96
101
 
97
102
  const rawTitle = item && item._meta.found ? title?.raw || '' : docid;
98
103
 
@@ -180,19 +185,56 @@ function ItemView(props) {
180
185
  </Link>
181
186
  </Banner.Subtitle>
182
187
  <Banner.Title>{title?.raw}</Banner.Title>
188
+ {/* <Banner.MetadataField label="Prod-ID" value={prodID} /> */}
183
189
  <Banner.Metadata>
184
190
  {obsolete && <div class="ui label archived-item">Archived</div>}
185
- <Banner.MetadataField label="Prod-ID" value={prodID} />
186
- <Banner.MetadataField
187
- label="Published"
188
- type="date"
189
- value={new Date(result.issued)}
190
- />
191
- <Banner.MetadataField
192
- label="Last modified"
193
- type="date"
194
- value={new Date(changeDate)}
195
- />
191
+ {prodID && (
192
+ <>
193
+ {prodID.length > PROD_ID_COUNT ? (
194
+ <>
195
+ <Popup
196
+ // on="click"
197
+ position="top right"
198
+ trigger={
199
+ <span className="prod-id">
200
+ <span>
201
+ <Banner.MetadataField
202
+ label="Prod-ID"
203
+ value={prodID
204
+ .slice(0, PROD_ID_COUNT)
205
+ .join(', ')}
206
+ />
207
+ </span>
208
+ {'...'}
209
+ <Icon className="ri-add-line" />
210
+ </span>
211
+ }
212
+ content={prodID.slice(PROD_ID_COUNT).join(', ')}
213
+ />
214
+ {' | '}
215
+ </>
216
+ ) : (
217
+ <Banner.MetadataField
218
+ label="Prod-ID"
219
+ value={prodID.join(', ')}
220
+ />
221
+ )}
222
+ </>
223
+ )}
224
+ {result.issued && (
225
+ <Banner.MetadataField
226
+ label="Published"
227
+ type="date"
228
+ value={new Date(result.issued)}
229
+ />
230
+ )}
231
+ {changeDate && (
232
+ <Banner.MetadataField
233
+ label="Last modified"
234
+ type="date"
235
+ value={new Date(changeDate)}
236
+ />
237
+ )}
196
238
  </Banner.Metadata>
197
239
  </Banner.Content>
198
240
  </Banner>
@@ -91,7 +91,7 @@ const MetadataSection = (props) => {
91
91
  </div>
92
92
 
93
93
  <div className="d-link">
94
- <i className="ri-external-link-line"></i>
94
+ <Icon className="ri-external-link-line" />
95
95
  <a
96
96
  target="_blank"
97
97
  rel="noreferrer"