@eeacms/volto-datahub 1.0.2 → 1.0.4

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,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.4](https://github.com/eea/volto-datahub/compare/1.0.3...1.0.4) - 29 November 2022
8
+
9
+ #### :hammer_and_wrench: Others
10
+
11
+ - Small improvements [kreafox - [`fd2c67c`](https://github.com/eea/volto-datahub/commit/fd2c67ce73aa716e487331f2db6c04232b59883f)]
12
+ - Add isomorphic portal [Tiberiu Ichim - [`8b183b1`](https://github.com/eea/volto-datahub/commit/8b183b1d1fd424055e5f2330b56320d930f903da)]
13
+ ### [1.0.3](https://github.com/eea/volto-datahub/compare/1.0.2...1.0.3) - 25 November 2022
14
+
15
+ #### :hammer_and_wrench: Others
16
+
17
+ - Use volto alpha [kreafox - [`a70c4c0`](https://github.com/eea/volto-datahub/commit/a70c4c02a53e69f5fee3cc27c4f4fa0aaad5ff95)]
18
+ - SSR for datahub item [Tiberiu Ichim - [`5cc9695`](https://github.com/eea/volto-datahub/commit/5cc9695f6e0c9d098a83c261135ebbb56ee2655a)]
19
+ - updated condition for displaying message for missing product id [Zoltan Szabo - [`1aab056`](https://github.com/eea/volto-datahub/commit/1aab0560020c4e13db7ac39301c806f0362a1bea)]
20
+ - updated message [Zoltan Szabo - [`4d71ec7`](https://github.com/eea/volto-datahub/commit/4d71ec75fba697fbc99286ae4312b8e65c2dfdd9)]
21
+ - wip, show error message when product id is not found [Zoltan Szabo - [`6fff576`](https://github.com/eea/volto-datahub/commit/6fff57609a53cb9f4dea5196e67e74a688371eba)]
22
+ - moved up the legal instruments facet [Zoltan Szabo - [`c453842`](https://github.com/eea/volto-datahub/commit/c4538426f2b54318e99ab2584f8d3d87984a33f6)]
23
+ - Added new facet for available formats [Zoltan Szabo - [`1c3de33`](https://github.com/eea/volto-datahub/commit/1c3de33e28b73d696e972aa81695f7ca8c176d0b)]
24
+ - show available formats on listing [Zoltan Szabo - [`0ee2f6b`](https://github.com/eea/volto-datahub/commit/0ee2f6b1a3a64b3b25748c4a8baedac547d04868)]
25
+ - show the access level info for datasets [Zoltan Szabo - [`217641e`](https://github.com/eea/volto-datahub/commit/217641e2fe8b6d16331d80fbbe2a5c7a1b12b894)]
26
+ - Revert "test(estlint): Fix .project.eslintrc.js" [Tiberiu Ichim - [`3c36650`](https://github.com/eea/volto-datahub/commit/3c36650806b3a8c9a11ffc6ad16445f0a4cacee9)]
27
+ - test(estlint): Fix .project.eslintrc.js [Alin Voinea - [`cdfbbdd`](https://github.com/eea/volto-datahub/commit/cdfbbdd0a777bd56118d961f56b8005800faeb2c)]
7
28
  ### [1.0.2](https://github.com/eea/volto-datahub/compare/1.0.1...1.0.2) - 15 November 2022
8
29
 
9
30
  #### :hammer_and_wrench: Others
@@ -14,11 +35,9 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
14
35
  #### :hammer_and_wrench: Others
15
36
 
16
37
  - Fix eslintrc: add @eeacms/search [kreafox - [`465816f`](https://github.com/eea/volto-datahub/commit/465816feb8f58095ab4b5b3168cd29ebede3a10c)]
17
- - Use latest Volto before yarn 3 [Tiberiu Ichim - [`69f5859`](https://github.com/eea/volto-datahub/commit/69f585980fd9a38ff99d0c7875704671857720f7)]
18
38
  - Reorder sections on landing page [kreafox - [`46fac8d`](https://github.com/eea/volto-datahub/commit/46fac8d821cf93fe1b2c380380719de130c3f1cb)]
19
39
  - Fix project eslintrc [kreafox - [`5baa150`](https://github.com/eea/volto-datahub/commit/5baa1505ec38ed313269f5608c186c6a6a8bbfc4)]
20
40
  - Open dataset links in new tab [kreafox - [`bbed914`](https://github.com/eea/volto-datahub/commit/bbed914dc2edf6c749d1d73d93a423bc642e680c)]
21
- - Add Sonarqube tag using circularity-frontend addons list [EEA Jenkins - [`380a2a9`](https://github.com/eea/volto-datahub/commit/380a2a9625c6f799df7a7c343fad3f3b3d959f96)]
22
41
  ## [1.0.0](https://github.com/eea/volto-datahub/compare/0.1.12...1.0.0) - 28 October 2022
23
42
 
24
43
  #### :nail_care: Enhancements
@@ -43,7 +62,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
43
62
  #### :hammer_and_wrench: Others
44
63
 
45
64
  - fixed query for related items [Zoltan Szabo - [`b66faee`](https://github.com/eea/volto-datahub/commit/b66faee1f8a1922cd22b3a36eccc9c7b92e377d4)]
46
- - Add Sonarqube tag using eea-website-frontend addons list [EEA Jenkins - [`158fe1a`](https://github.com/eea/volto-datahub/commit/158fe1a0b1767452e2e51a3e2ef97169589a50e8)]
47
65
  ### [0.1.10](https://github.com/eea/volto-datahub/compare/0.1.9...0.1.10) - 21 September 2022
48
66
 
49
67
  #### :hammer_and_wrench: Others
@@ -132,7 +150,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
132
150
  #### :hammer_and_wrench: Others
133
151
 
134
152
  - Hide questions & fix landing page [kreafox - [`a1ef303`](https://github.com/eea/volto-datahub/commit/a1ef3033df0e84f3a72dd0f984c8717dff2a771c)]
135
- - Add Sonarqube tag using eea-website-frontend addons list [EEA Jenkins - [`910688e`](https://github.com/eea/volto-datahub/commit/910688e3ddf2f8cda4f941595ae9a6ee0ec0ea3b)]
136
153
  ### [0.1.1](https://github.com/eea/volto-datahub/compare/0.1.0...0.1.1) - 10 June 2022
137
154
 
138
155
  ### [0.1.0](https://github.com/eea/volto-datahub/compare/0.0.1...0.1.0) - 9 June 2022
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eeacms/volto-datahub",
3
- "version": "1.0.2",
3
+ "version": "1.0.4",
4
4
  "description": "@eeacms/volto-datahub: Volto add-on",
5
5
  "main": "src/index.js",
6
6
  "author": "European Environment Agency: IDM2 A-Team",
@@ -21,8 +21,8 @@
21
21
  "@eeacms/volto-listing-block": "*"
22
22
  },
23
23
  "devDependencies": {
24
- "@plone/scripts": "*",
25
24
  "@cypress/code-coverage": "^3.10.0",
25
+ "@plone/scripts": "*",
26
26
  "babel-plugin-transform-class-properties": "^6.24.1",
27
27
  "md5": "^2.3.0"
28
28
  },
@@ -2,6 +2,28 @@ import React from 'react';
2
2
  import { Icon, List, Accordion } from 'semantic-ui-react';
3
3
 
4
4
  import servicesSVG from './icons/services.svg';
5
+ import lockSVG from 'remixicon/icons/System/lock-line.svg';
6
+
7
+ const is_internal_url = (url) => {
8
+ let internal = false;
9
+ url.split('/').forEach((part) => {
10
+ if (part.split('_')[6] === 'i') {
11
+ internal = true;
12
+ }
13
+ });
14
+ return internal;
15
+ };
16
+
17
+ const is_internal = (dataset) => {
18
+ let internal = false;
19
+ const links = dataset?.link || [];
20
+ links.forEach((link) => {
21
+ if (is_internal_url(link?.url)) {
22
+ internal = true;
23
+ }
24
+ });
25
+ return internal;
26
+ };
5
27
 
6
28
  const SVGIcon = ({ name, size, color, className, title, onClick }) => {
7
29
  return (
@@ -51,6 +73,9 @@ const DatasetList = (props) => {
51
73
  >
52
74
  <span>{item.name}</span>
53
75
  </a>
76
+ {is_internal_url(item.url) && (
77
+ <SVGIcon name={lockSVG} size="18" />
78
+ )}
54
79
  </div>
55
80
  </List.Content>
56
81
  {item.description && (
@@ -87,6 +112,9 @@ const DatasetList = (props) => {
87
112
  Download link
88
113
  </a>
89
114
  )}
115
+ {is_internal_url(item.url) && (
116
+ <SVGIcon name={lockSVG} size="18" />
117
+ )}
90
118
  </div>
91
119
  </List.Content>
92
120
  </List.Item>
@@ -107,6 +135,9 @@ const DatasetList = (props) => {
107
135
  >
108
136
  WebDAV: {item.name || item.function}
109
137
  </a>
138
+ {is_internal_url(item.url) && (
139
+ <SVGIcon name={lockSVG} size="18" />
140
+ )}
110
141
  </div>
111
142
  </List.Content>
112
143
  </List.Item>
@@ -127,6 +158,9 @@ const DatasetList = (props) => {
127
158
  >
128
159
  WebDAV: {item.name || item.function}
129
160
  </a>
161
+ {is_internal_url(item.url) && (
162
+ <SVGIcon name={lockSVG} size="18" />
163
+ )}
130
164
  </div>
131
165
  </List.Content>
132
166
  </List.Item>
@@ -144,13 +178,23 @@ const DatasetList = (props) => {
144
178
  return (
145
179
  <List.Item key={i}>
146
180
  <List.Content>
147
- <SVGIcon name={servicesSVG} size="18" />
148
- {/* {(item.name || item.description) && (
149
- <span className="item-protocol">{item.protocol}:</span>
150
- )} */}
151
- <a className="item-link" href={item.url}>
152
- {item.protocol} {item.name || item.description}
153
- </a>
181
+ <div>
182
+ <SVGIcon name={servicesSVG} size="18" />
183
+ {/* {(item.name || item.description) && (
184
+ <span className="item-protocol">{item.protocol}:</span>
185
+ )} */}
186
+ <a
187
+ className="item-link"
188
+ href={item.url}
189
+ target="_blank"
190
+ rel="noreferrer"
191
+ >
192
+ {item.protocol} {item.name || item.description}
193
+ </a>
194
+ {is_internal_url(item.url) && (
195
+ <SVGIcon name={lockSVG} size="18" />
196
+ )}
197
+ </div>
154
198
  </List.Content>
155
199
  </List.Item>
156
200
  );
@@ -160,13 +204,23 @@ const DatasetList = (props) => {
160
204
  return (
161
205
  <List.Item key={i}>
162
206
  <List.Content>
163
- <SVGIcon name={servicesSVG} size="18" />
164
- {/* {(item.name || item.description) && (
165
- <span className="item-protocol">{item.protocol}:</span>
166
- )} */}
167
- <a className="item-link" href={item.url}>
168
- {item.protocol} {item.name || item.description}
169
- </a>
207
+ <div>
208
+ <SVGIcon name={servicesSVG} size="18" />
209
+ {/* {(item.name || item.description) && (
210
+ <span className="item-protocol">{item.protocol}:</span>
211
+ )} */}
212
+ <a
213
+ className="item-link"
214
+ href={item.url}
215
+ target="_blank"
216
+ rel="noreferrer"
217
+ >
218
+ {item.protocol} {item.name || item.description}
219
+ </a>
220
+ {is_internal_url(item.url) && (
221
+ <SVGIcon name={lockSVG} size="18" />
222
+ )}
223
+ </div>
170
224
  </List.Content>
171
225
  </List.Item>
172
226
  );
@@ -193,6 +247,9 @@ const DatasetList = (props) => {
193
247
  >
194
248
  <span>{item.name || item.url}</span>
195
249
  </a>
250
+ {is_internal_url(item.url) && (
251
+ <SVGIcon name={lockSVG} size="18" />
252
+ )}
196
253
  </div>
197
254
  </List.Content>
198
255
  {item.description && (
@@ -258,7 +315,18 @@ const Datasets = (props) => {
258
315
  </span>
259
316
  );
260
317
  })}
318
+ {(dataset.linkProtocol || [])
319
+ .filter((i) => i.includes('ESRI') || i.includes('OGC'))
320
+ .map((item, i) => {
321
+ return (
322
+ <span className="format-label" key={i}>
323
+ {item}
324
+ </span>
325
+ );
326
+ })}
261
327
  </span>
328
+
329
+ {is_internal(dataset) && <SVGIcon name={lockSVG} size="18" />}
262
330
  </span>
263
331
  <Icon className="ri-arrow-down-s-line" />
264
332
  </Accordion.Title>
@@ -300,14 +368,14 @@ const Datasets = (props) => {
300
368
 
301
369
  {dataset.resourceType[0] !== 'nonGeographicDataset' && (
302
370
  <div className="dataset-pdf">
303
- <div className="pdf-btn">
371
+ <div className="d-link">
304
372
  <Icon className="file pdf" />
305
373
  <a
306
374
  target="_blank"
307
375
  rel="noreferrer"
308
376
  href={`${appConfig.indexBaseUrl}/catalogue/datahub/api/records/${dataset.metadataIdentifier}/formatters/xsl-view?output=pdf&language=eng&approved=true`}
309
377
  >
310
- SDI Metadata Factsheet
378
+ Metadata Factsheet
311
379
  </a>
312
380
  </div>
313
381
  </div>
@@ -1,36 +1,64 @@
1
1
  import React from 'react';
2
2
  import { Portal } from 'react-portal';
3
- import { useDispatch } from 'react-redux';
3
+ import { useDispatch, useSelector } from 'react-redux';
4
4
  import { Link, useLocation } from 'react-router-dom';
5
5
  import { Container, Icon } from 'semantic-ui-react';
6
6
  import { Toolbar } from '@plone/volto/components';
7
7
  import { BodyClass } from '@plone/volto/helpers';
8
8
  import config from '@plone/volto/registry';
9
- import {
10
- useResult,
11
- AppConfigContext,
12
- SearchContext,
13
- rebind,
14
- applyConfigurationSchema,
15
- DateTime,
16
- } from '@eeacms/search';
17
- import { SearchProvider, WithSearch } from '@elastic/react-search-ui';
9
+ import { rebind, applyConfigurationSchema, DateTime } from '@eeacms/search';
18
10
  import { Callout, Banner } from '@eeacms/volto-eea-design-system/ui';
19
11
  import {
20
12
  MoreLikeThis,
21
13
  MetadataSection,
22
14
  Datasets,
23
15
  } from '@eeacms/volto-datahub/components/ItemView';
24
- // import bannerBG from './banner.svg';
16
+
17
+ import { asyncConnect, Helmet } from '@plone/volto/helpers';
18
+ import { fetchResult } from '@eeacms/search/lib/hocs/useResult';
19
+ import { setDatahubResult } from '@eeacms/volto-datahub/store';
25
20
 
26
21
  const appName = 'datahub';
27
22
 
23
+ function IsomorphicPortal({ children }) {
24
+ const [isClient, setIsClient] = React.useState();
25
+ React.useEffect(() => setIsClient(true), []);
26
+
27
+ return isClient ? (
28
+ <Portal node={document.getElementById('page-header')}>{children}</Portal>
29
+ ) : (
30
+ children
31
+ );
32
+ }
33
+
28
34
  function ItemView(props) {
29
- const { docid, location, appConfig } = props;
35
+ const { docid, location } = props;
30
36
  const { fromPathname, fromSearch } = location?.state || {};
31
37
  const dispatch = useDispatch();
32
38
  // const content = useSelector((state) => state.content.data);
33
- const result = useResult(null, docid);
39
+ let result = useSelector((state) => state.datahub_results?.[docid]);
40
+ const registry = config.settings.searchlib;
41
+ const appConfig = React.useMemo(
42
+ () => applyConfigurationSchema(rebind(registry.searchui[appName])),
43
+ [registry.searchui],
44
+ );
45
+
46
+ React.useEffect(() => {
47
+ let ignore = false;
48
+
49
+ const doIt = async () => {
50
+ const result = await fetchResult(docid, appConfig, registry);
51
+ dispatch(setDatahubResult(docid, result));
52
+ };
53
+
54
+ if (!ignore && !result) {
55
+ doIt();
56
+ }
57
+ return () => {
58
+ ignore = true;
59
+ };
60
+ }, [result, docid, appConfig, registry, dispatch]);
61
+
34
62
  const item = result ? result._result : null;
35
63
  const { title, description, raw_value } = item || {}; // readingTime
36
64
  const { changeDate, resourceIdentifier } = raw_value?.raw || {};
@@ -39,7 +67,7 @@ function ItemView(props) {
39
67
  return p.code.includes('DAT');
40
68
  })[0]?.code;
41
69
 
42
- const rawTitle = title?.raw || '';
70
+ const rawTitle = item && item._meta.found ? title?.raw || '' : docid;
43
71
 
44
72
  React.useEffect(() => {
45
73
  const handler = async () => {
@@ -67,9 +95,10 @@ function ItemView(props) {
67
95
  handler();
68
96
  }, [item, dispatch, docid, rawTitle]);
69
97
 
70
- return item ? (
98
+ return item && item._meta.found ? (
71
99
  <div className="dataset-view">
72
- <Portal node={document.getElementById('page-header')}>
100
+ <Helmet title={title?.raw} />
101
+ <IsomorphicPortal>
73
102
  <div className="dataset">
74
103
  <Banner>
75
104
  <Banner.Content>
@@ -108,7 +137,7 @@ function ItemView(props) {
108
137
  </Banner.Content>
109
138
  </Banner>
110
139
  </div>
111
- </Portal>
140
+ </IsomorphicPortal>
112
141
 
113
142
  <div className="dataset-container">
114
143
  <Callout>{description?.raw}</Callout>
@@ -127,7 +156,13 @@ function ItemView(props) {
127
156
  </div>
128
157
  </div> */}
129
158
  </div>
130
- ) : null;
159
+ ) : item ? (
160
+ <>
161
+ <h1>Data series not found...</h1>
162
+ </>
163
+ ) : (
164
+ <></>
165
+ );
131
166
  }
132
167
 
133
168
  function DatahubItemView(props) {
@@ -136,16 +171,6 @@ function DatahubItemView(props) {
136
171
  React.useEffect(() => setIsClient(true), []);
137
172
 
138
173
  const docid = props.match?.params?.id;
139
- const registry = config.settings.searchlib;
140
-
141
- const appConfig = React.useMemo(
142
- () => applyConfigurationSchema(rebind(registry.searchui[appName])),
143
- [registry],
144
- );
145
- const appConfigContext = React.useMemo(() => ({ appConfig, registry }), [
146
- appConfig,
147
- registry,
148
- ]);
149
174
 
150
175
  return (
151
176
  <div id="view">
@@ -153,28 +178,7 @@ function DatahubItemView(props) {
153
178
  {/* Body class if displayName in component is set */}
154
179
  <BodyClass className="view-datahub-item" />
155
180
  <Container className="view-wrapper">
156
- <SearchProvider config={config}>
157
- <WithSearch
158
- mapContextToProps={(searchContext) => ({
159
- ...searchContext,
160
- })}
161
- >
162
- {(params) => {
163
- // TODO: this needs to be optimized, it causes unmounts
164
- return (
165
- <AppConfigContext.Provider value={appConfigContext}>
166
- <SearchContext.Provider value={params}>
167
- <ItemView
168
- docid={docid}
169
- location={location}
170
- appConfig={appConfig}
171
- />
172
- </SearchContext.Provider>
173
- </AppConfigContext.Provider>
174
- );
175
- }}
176
- </WithSearch>
177
- </SearchProvider>
181
+ <ItemView docid={docid} location={location} />
178
182
  </Container>
179
183
  {isClient && (
180
184
  <Portal node={document.getElementById('toolbar')}>
@@ -184,5 +188,23 @@ function DatahubItemView(props) {
184
188
  </div>
185
189
  );
186
190
  }
187
-
188
- export default DatahubItemView;
191
+ export default asyncConnect([
192
+ {
193
+ key: 'datahubItem',
194
+ promise: function datahubItem({
195
+ location,
196
+ store,
197
+ match: {
198
+ params: { id },
199
+ },
200
+ }) {
201
+ const registry = config.settings.searchlib;
202
+ const appConfig = applyConfigurationSchema(
203
+ rebind(registry.searchui[appName]),
204
+ );
205
+ return fetchResult(id, appConfig, registry).then((result) => {
206
+ store.dispatch(setDatahubResult(id, result));
207
+ });
208
+ },
209
+ },
210
+ ])(DatahubItemView);
@@ -64,14 +64,25 @@ const MetadataSection = (props) => {
64
64
  </div>
65
65
  )}
66
66
 
67
- <div className="pdf-btn">
67
+ <div className="d-link">
68
68
  <Icon className="file pdf" />
69
69
  <a
70
70
  target="_blank"
71
71
  rel="noreferrer"
72
72
  href={`${appConfig.indexBaseUrl}/catalogue/datahub/api/records/${docid}/formatters/xsl-view?output=pdf&language=eng&approved=true`}
73
73
  >
74
- SDI Metadata Factsheet
74
+ Metadata Factsheet
75
+ </a>
76
+ </div>
77
+
78
+ <div className="d-link">
79
+ <i class="ri-external-link-line"></i>
80
+ <a
81
+ target="_blank"
82
+ rel="noreferrer"
83
+ href={`${appConfig.indexBaseUrl}/catalogue/srv/eng/catalog.search#/metadata/${docid}`}
84
+ >
85
+ Metadata catalogue
75
86
  </a>
76
87
  </div>
77
88
  </div>
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
 
3
- import { Tab, Card, Menu } from 'semantic-ui-react';
3
+ import { Tab, Card, Menu, Divider } from 'semantic-ui-react';
4
4
  import useDeepCompareEffect from 'use-deep-compare-effect';
5
5
  import { useAtom } from 'jotai';
6
6
 
@@ -247,7 +247,7 @@ const LandingPage = (props) => {
247
247
  </div>
248
248
  ) : null}
249
249
  {children}
250
- <hr></hr>
250
+ <Divider />
251
251
  <div className="landing-page-cards">
252
252
  <div className="ui cards">
253
253
  <div
@@ -7,13 +7,12 @@ import { UniversalCard } from '@eeacms/volto-listing-block';
7
7
 
8
8
  const DatahubCardItem = (props) => {
9
9
  const { result } = props;
10
- const { topic } = result._result || [];
10
+ const { topic, dataset_formats } = result._result || [];
11
11
 
12
12
  // let metaType = result.metaTypes || '';
13
13
  // if (metaType.length === 0) {
14
14
  // metaType = 'Others';
15
15
  // }
16
-
17
16
  const item = {
18
17
  title: (
19
18
  <Link
@@ -43,10 +42,12 @@ const DatahubCardItem = (props) => {
43
42
  <StringList value={topic.raw} />
44
43
  </div>
45
44
  ) : null}
46
- <div className="result-info">
47
- <span className="result-info-title">Available formats: </span>
48
- [Icons]
49
- </div>
45
+ {dataset_formats ? (
46
+ <div className="result-info">
47
+ <span className="result-info-title">Available formats: </span>
48
+ <StringList value={dataset_formats.raw} />
49
+ </div>
50
+ ) : null}
50
51
  </div>
51
52
  ),
52
53
  };
@@ -8,18 +8,18 @@ import { dateRangeFacet } from '@eeacms/search';
8
8
 
9
9
  const facets = [
10
10
  multiTermFacet({
11
- field: 'rod',
11
+ field: 'instrument',
12
12
  isFilterable: true,
13
13
  isMulti: true,
14
- label: 'Reporting obligations',
14
+ label: 'Legal instruments',
15
15
  show: 10000,
16
16
  showAllOptions: true, // show all options (even if 0) in modal facet
17
17
  }),
18
18
  multiTermFacet({
19
- field: 'instrument',
19
+ field: 'rod',
20
20
  isFilterable: true,
21
21
  isMulti: true,
22
- label: 'Legal instruments',
22
+ label: 'Reporting obligations',
23
23
  show: 10000,
24
24
  showAllOptions: true, // show all options (even if 0) in modal facet
25
25
  }),
@@ -32,6 +32,14 @@ const facets = [
32
32
  showAllOptions: true, // show all options (even if 0) in modal facet
33
33
  alwaysVisible: true,
34
34
  }),
35
+ multiTermFacet({
36
+ field: 'dataset_formats',
37
+ isFilterable: true,
38
+ isMulti: true,
39
+ label: 'Available formats',
40
+ show: 10000,
41
+ showAllOptions: true, // show all options (even if 0) in modal facet
42
+ }),
35
43
  multiTermFacet({
36
44
  field: 'gemet',
37
45
  isFilterable: true,
package/src/index.js CHANGED
@@ -2,6 +2,7 @@ import installDatahub from './config';
2
2
  import DatahubCardItem from './components/Result/DatahubCardItem';
3
3
  import DatahubItemView from './components/ItemView/ItemView';
4
4
  import { DatahubResultModel } from './config/models';
5
+ import { datahub_results } from './store';
5
6
 
6
7
  function tweakForNLPService(body, config) {
7
8
  if (!config.enableNLP) {
@@ -42,6 +43,7 @@ const applyConfig = (config) => {
42
43
 
43
44
  ...(config.addonRoutes || []),
44
45
  ];
46
+ config.addonReducers.datahub_results = datahub_results;
45
47
  return config;
46
48
  };
47
49
 
package/src/store.js ADDED
@@ -0,0 +1,16 @@
1
+ export const setDatahubResult = (id, result) => {
2
+ return {
3
+ type: 'SET_DATAHUB_RESULT',
4
+ id,
5
+ result,
6
+ };
7
+ };
8
+
9
+ const initialState = {};
10
+
11
+ export const datahub_results = (state = initialState, action) => {
12
+ return {
13
+ ...state,
14
+ [action.id]: action.result,
15
+ };
16
+ };