@eeacms/volto-datahub 1.0.29 → 1.0.30

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,21 @@ 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.30](https://github.com/eea/volto-datahub/compare/1.0.29...1.0.30) - 26 September 2023
8
+
9
+ #### :hammer_and_wrench: Others
10
+
11
+ - Fix undefined [kreafox - [`081615c`](https://github.com/eea/volto-datahub/commit/081615c3f44364c153c44cf190660007758c6214)]
12
+ - Add tests [kreafox - [`e2234c7`](https://github.com/eea/volto-datahub/commit/e2234c7ba4a0094b7dd89c141d48667f328111f8)]
13
+ - Fix texts [kreafox - [`c76ad45`](https://github.com/eea/volto-datahub/commit/c76ad45053b70cb35ef270da4a3959a533d6d82e)]
14
+ - Improve prod id section + icons [kreafox - [`e89a45f`](https://github.com/eea/volto-datahub/commit/e89a45fabc50e0c331b33703afa70f0b0a9507e7)]
15
+ - Improve multiple prod ids display [kreafox - [`9797092`](https://github.com/eea/volto-datahub/commit/979709216803b23b21d3208e73a63027ea8189f2)]
7
16
  ### [1.0.29](https://github.com/eea/volto-datahub/compare/1.0.28...1.0.29) - 13 September 2023
8
17
 
9
18
  #### :hammer_and_wrench: Others
10
19
 
11
20
  - Fix snapshot [kreafox - [`3e070c5`](https://github.com/eea/volto-datahub/commit/3e070c5973e314935d674c5d41a361882317937b)]
12
21
  - 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
22
  ### [1.0.28](https://github.com/eea/volto-datahub/compare/1.0.27...1.0.28) - 8 September 2023
15
23
 
16
24
  #### :hammer_and_wrench: Others
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.30",
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"