@eeacms/volto-datahub 0.1.3 → 0.1.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,8 +4,23 @@ 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
+ #### [0.1.4](https://github.com/eea/volto-datahub/compare/0.1.3...0.1.4)
8
+
9
+ - Improve temporal coverage [`d0483d4`](https://github.com/eea/volto-datahub/commit/d0483d46259b956a96a66268b9ec305d27456f88)
10
+ - Fix warning message [`305d2d6`](https://github.com/eea/volto-datahub/commit/305d2d61123d1ee23e8a4baf837b1aadc5d9a41f)
11
+ - Hide readingTime for now [`5e508d3`](https://github.com/eea/volto-datahub/commit/5e508d3c2bfd97bcc01dca59894a4f9ad582284b)
12
+ - ESlint fix [`dcfbab4`](https://github.com/eea/volto-datahub/commit/dcfbab4effa23ddcc3d4bf9a61d0b0d101c796b6)
13
+ - Set topics filter always visible [`1c062f4`](https://github.com/eea/volto-datahub/commit/1c062f473c123b5c04055fc6a52ea56bbd00e7b4)
14
+ - Update item view [`a53d297`](https://github.com/eea/volto-datahub/commit/a53d297916bb8d2c5d020acb9de600228e344982)
15
+ - Fix import [`bfa1cbc`](https://github.com/eea/volto-datahub/commit/bfa1cbc04c60009f949ac675278df894b4e1c892)
16
+ - WIP Update dataset's page based on new figma design [`01eecfa`](https://github.com/eea/volto-datahub/commit/01eecfacd482ca6abea81e4fd24eb7871e5365c9)
17
+ - Reconfigure datahub facets [`8636536`](https://github.com/eea/volto-datahub/commit/863653613d05faaa73101943896f05243055c696)
18
+ - Update result item based on new figma design [`eb618a0`](https://github.com/eea/volto-datahub/commit/eb618a0ce441cb9d797b39efad6bf98e4b07c728)
19
+
7
20
  #### [0.1.3](https://github.com/eea/volto-datahub/compare/0.1.2...0.1.3)
8
21
 
22
+ > 30 June 2022
23
+
9
24
 
10
25
  #### [0.1.2](https://github.com/eea/volto-datahub/compare/0.1.1...0.1.2)
11
26
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eeacms/volto-datahub",
3
- "version": "0.1.3",
3
+ "version": "0.1.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",
@@ -1,22 +1,15 @@
1
1
  import React from 'react';
2
2
  import {
3
3
  Container,
4
- Grid,
5
4
  Card,
6
5
  Image,
7
6
  Accordion,
8
7
  Icon,
8
+ Tab,
9
9
  } from 'semantic-ui-react';
10
10
  import { Toolbar } from '@plone/volto/components';
11
11
  import { BodyClass } from '@plone/volto/helpers';
12
12
  import { Portal } from 'react-portal';
13
- // import { useResult } from '@eeacms/search/lib/hocs';
14
- // import {
15
- // AppConfigContext,
16
- // SearchContext,
17
- // // useIsMounted,
18
- // } from '@eeacms/search/lib/hocs';
19
- // import { rebind, applyConfigurationSchema } from '@eeacms/search/lib/utils';
20
13
  import {
21
14
  useResult,
22
15
  AppConfigContext,
@@ -24,7 +17,8 @@ import {
24
17
  rebind,
25
18
  applyConfigurationSchema,
26
19
  } from '@eeacms/search';
27
- import { SearchProvider, WithSearch } from '@elastic/react-search-ui'; // ErrorBoundary,
20
+ import { DateTime } from '@eeacms/search';
21
+ import { SearchProvider, WithSearch } from '@elastic/react-search-ui';
28
22
  import { Callout } from '@eeacms/volto-eea-design-system/ui';
29
23
  import config from '@plone/volto/registry';
30
24
 
@@ -34,12 +28,21 @@ function ItemView(props) {
34
28
  const { docid } = props;
35
29
  const result = useResult(null, docid);
36
30
  const item = result ? result._result : {};
37
- const { title, description, id, raw_value, event } = item;
38
- const { contactForResource, contact } = raw_value?.raw || {};
31
+ const { title, description, raw_value, event, issued, time_coverage } = item; // readingTime
32
+ const {
33
+ // contactForResource,
34
+ // contact,
35
+ // resourceTemporalDateRange,
36
+ changeDate,
37
+ } = raw_value?.raw || {};
38
+
39
39
  const relatedItemsData = event?.raw.original;
40
40
  const relatedDatasets =
41
41
  (relatedItemsData && JSON.parse(relatedItemsData)) || {};
42
42
  const { children } = relatedDatasets?.raw_value || {};
43
+ const startTempCoverage = parseInt(time_coverage?.raw.at(0));
44
+ const endTempCoverage = parseInt(time_coverage?.raw.at(-1));
45
+
43
46
  const [activeIndex, setActiveIndex] = React.useState([]);
44
47
 
45
48
  const toggleOpenAccordion = (e, titleProps) => {
@@ -52,212 +55,255 @@ function ItemView(props) {
52
55
  setActiveIndex(newIndex);
53
56
  };
54
57
 
55
- // console.log('datahub item', item);
56
- // console.log('related datasets', children);
58
+ // console.log('result', result?._result);
57
59
 
58
- return (
59
- <>
60
- {item ? (
61
- <div>
62
- <Portal node={document.getElementById('page-header')}>
63
- <div className="eea banner">
64
- <div className="gradient">
65
- <div className="ui container">
66
- <div className="content">
67
- <h1 className="documentFirstHeading">{title?.raw}</h1>
68
- </div>
69
- </div>
60
+ const panes = [
61
+ {
62
+ menuItem: 'European data',
63
+ render: () => <Tab.Pane attached={false}>Tab 1 Content</Tab.Pane>,
64
+ },
65
+ {
66
+ menuItem: 'Dataset definition',
67
+ render: () => <Tab.Pane attached={false}>Tab 2 Content</Tab.Pane>,
68
+ },
69
+ ];
70
+
71
+ return item ? (
72
+ <div className="dataset-view">
73
+ <Portal node={document.getElementById('page-header')}>
74
+ <div className="eea banner">
75
+ <div className="gradient">
76
+ <div className="ui container">
77
+ <div className="content">
78
+ <h1 className="documentFirstHeading">Datahub</h1>
70
79
  </div>
71
80
  </div>
72
- </Portal>
73
- <Callout>{description?.raw}</Callout>
74
- <h3>Tabular data</h3>
75
- <Accordion exclusive={false}>
76
- <Accordion.Title
77
- active={activeIndex.includes(0)}
78
- index={0}
79
- onClick={toggleOpenAccordion}
80
- >
81
- Distribution files
82
- <Icon className="ri-arrow-down-s-line" />
83
- </Accordion.Title>
84
- <Accordion.Content active={activeIndex.includes(0)}>
85
- <p></p>
86
- </Accordion.Content>
81
+ </div>
82
+ </div>
83
+ </Portal>
87
84
 
88
- <Accordion.Title
89
- active={activeIndex.includes(1)}
90
- index={1}
91
- onClick={toggleOpenAccordion}
92
- >
93
- Programmatic access (APIs)
94
- <Icon className="ri-arrow-down-s-line" />
95
- </Accordion.Title>
96
- <Accordion.Content active={activeIndex.includes(1)}>
97
- <a
98
- href="https://discodata.eea.europa.eu/#!/"
99
- title="DiscoData REST API call"
100
- rel="noopener noreferrer"
101
- >
102
- DiscoData
103
- </a>
104
- (REST API)
105
- </Accordion.Content>
85
+ <div className="dataset-container">
86
+ <div className="dataset-header">
87
+ <h1>{title?.raw}</h1>
88
+ <div className="dataset-header-bottom">
89
+ <span className="header-data">Prod-ID: [No data]</span>
90
+ <span className="header-data">
91
+ Created: <DateTime format="DATE_MED" value={issued?.raw} />
92
+ </span>
93
+ <span className="header-data">Published: [No data]</span>
94
+ <span className="header-data">
95
+ Last modified: <DateTime format="DATE_MED" value={changeDate} />
96
+ </span>
97
+ {/*<span className="header-data">
98
+ Reading time: {readingTime?.raw}
99
+ </span>*/}
100
+ </div>
101
+ </div>
102
+ <Callout>{description?.raw}</Callout>
106
103
 
107
- <Accordion.Title
108
- active={activeIndex.includes(2)}
109
- index={2}
110
- onClick={toggleOpenAccordion}
111
- >
112
- Additional information
113
- <Icon className="ri-arrow-down-s-line" />
114
- </Accordion.Title>
115
- <Accordion.Content active={activeIndex.includes(2)}>
116
- {description?.raw}
117
- </Accordion.Content>
104
+ <Tab
105
+ menu={{ secondary: true, pointing: true }}
106
+ panes={panes}
107
+ className="dataset-tab-setion"
108
+ />
109
+ </div>
118
110
 
119
- <Accordion.Title
120
- active={activeIndex.includes(3)}
121
- index={3}
122
- onClick={toggleOpenAccordion}
123
- >
124
- Metadata
125
- <Icon className="ri-arrow-down-s-line" />
126
- </Accordion.Title>
127
- <Accordion.Content active={activeIndex.includes(3)}>
128
- Topics:
129
- <ul>
130
- {raw_value?.raw['allKeywords.th_eea-topics.keywords']?.map(
131
- (topic, i) => {
132
- return (
133
- <li key={i}>
134
- <a href={topic.link} target="_blank" rel="noreferrer">
135
- {topic.default}
136
- </a>
137
- </li>
138
- );
139
- },
140
- )}
141
- </ul>
142
- </Accordion.Content>
143
- </Accordion>
111
+ <div className="info-wrapper">
112
+ <div className="info-content">
113
+ <div className="info-title">More Information for {title?.raw}.</div>
114
+ <p>{description?.raw}</p>
115
+ </div>
116
+ </div>
144
117
 
145
- <h3>Geospatial data</h3>
118
+ {children && children.length > 0 && (
119
+ <div className="related-wrapper">
120
+ <h2>Related content</h2>
121
+ <Card.Group itemsPerRow={4}>
122
+ {children.map((item, index) => {
123
+ return (
124
+ <Card
125
+ href={`/datahub/view/${item.metadataIdentifier}`}
126
+ key={index}
127
+ >
128
+ <Image src={item.overview[0].url} wrapped ui={false} />
129
+ <Card.Content>
130
+ <Card.Description>
131
+ {item.resourceTitleObject.default}
132
+ </Card.Description>
133
+ </Card.Content>
134
+ </Card>
135
+ );
136
+ })}
137
+ </Card.Group>
138
+ </div>
139
+ )}
140
+
141
+ <div className="below-content-wrapper">
142
+ <Accordion exclusive={false}>
143
+ <Accordion.Title
144
+ active={activeIndex.includes(0)}
145
+ index={0}
146
+ onClick={toggleOpenAccordion}
147
+ >
148
+ Metadata
149
+ <Icon className="ri-arrow-down-s-line" />
150
+ </Accordion.Title>
151
+ <Accordion.Content active={activeIndex.includes(0)}>
152
+ {item.rod && (
153
+ <div>
154
+ Reporting obligations (ROD):
155
+ <ul>
156
+ {Array.isArray(item.rod?.raw) ? (
157
+ <>
158
+ {item?.rod?.raw.map((item, i) => {
159
+ return <li key={i}>{item}</li>;
160
+ })}
161
+ </>
162
+ ) : (
163
+ <li>{item.rod?.raw}</li>
164
+ )}
165
+ </ul>
166
+ </div>
167
+ )}
146
168
 
147
- <h3>Additional information</h3>
148
- <Accordion exclusive={false}>
149
- <Accordion.Title
150
- active={activeIndex.includes(4)}
151
- index={4}
152
- onClick={toggleOpenAccordion}
153
- >
154
- About this dataset
155
- <Icon className="ri-arrow-down-s-line" />
156
- </Accordion.Title>
157
- <Accordion.Content active={activeIndex.includes(4)}>
158
- {description?.raw}
159
- </Accordion.Content>
169
+ {item?.organisation && (
170
+ <div>
171
+ Organisation:
172
+ <ul>
173
+ {Array.isArray(item?.organisation?.raw) ? (
174
+ <>
175
+ {item?.organisation?.raw.map((item, i) => {
176
+ return <li key={i}>{item}</li>;
177
+ })}
178
+ </>
179
+ ) : (
180
+ <li>{item?.organisation?.raw}</li>
181
+ )}
182
+ </ul>
183
+ </div>
184
+ )}
185
+ </Accordion.Content>
160
186
 
161
- <Accordion.Title
162
- active={activeIndex.includes(5)}
163
- index={5}
164
- onClick={toggleOpenAccordion}
165
- >
166
- Contact information
167
- <Icon className="ri-arrow-down-s-line" />
168
- </Accordion.Title>
169
- <Accordion.Content active={activeIndex.includes(5)}>
170
- {contactForResource ? (
171
- <>
172
- {contactForResource.map((c, i) => {
173
- return (
174
- <Grid key={i}>
175
- <Grid.Column width={4}>
176
- <p>{c.role}: </p>
177
- </Grid.Column>
178
- <Grid.Column width={8}>
179
- <a
180
- href="https://www.eea.europa.eu/"
181
- target="_blank"
182
- rel="noreferrer"
183
- >
184
- <strong>{c.organisation}</strong>
185
- </a>
186
- <p>{c.address}</p>
187
- <a href={'mailto:' + c.email}>{c.email}</a>
188
- </Grid.Column>
189
- </Grid>
190
- );
191
- })}
192
- </>
193
- ) : (
194
- <>
195
- {contact &&
196
- contact.length > 0 &&
197
- contact.map((c, i) => {
198
- return (
199
- <Grid key={i}>
200
- <Grid.Column width={4}>
201
- {/*<p>{contact.role}: </p>*/}
202
- <p>Point of contact:</p>
203
- </Grid.Column>
204
- <Grid.Column width={8}>
205
- <a
206
- href="https://www.eea.europa.eu/"
207
- target="_blank"
208
- rel="noreferrer"
209
- >
210
- <strong>{c.organisation}</strong>
211
- </a>
212
- <p>{c.address}</p>
213
- <a href={'mailto:' + c.email}>{c.email}</a>
214
- </Grid.Column>
215
- </Grid>
216
- );
187
+ <Accordion.Title
188
+ active={activeIndex.includes(1)}
189
+ index={1}
190
+ onClick={toggleOpenAccordion}
191
+ >
192
+ Permalinks
193
+ <Icon className="ri-arrow-down-s-line" />
194
+ </Accordion.Title>
195
+ <Accordion.Content active={activeIndex.includes(1)}>
196
+ [No data]
197
+ </Accordion.Content>
198
+
199
+ <Accordion.Title
200
+ active={activeIndex.includes(2)}
201
+ index={2}
202
+ onClick={toggleOpenAccordion}
203
+ >
204
+ Geographic coverage
205
+ <Icon className="ri-arrow-down-s-line" />
206
+ </Accordion.Title>
207
+ <Accordion.Content active={activeIndex.includes(2)}>
208
+ {item.spatial && (
209
+ <div className="geotags">
210
+ {Array.isArray(item?.spatial?.raw) ? (
211
+ <>
212
+ {item?.spatial?.raw.map((item, i) => {
213
+ return <span key={i}>{item}</span>;
217
214
  })}
218
- </>
219
- )}
220
- </Accordion.Content>
221
- </Accordion>
215
+ </>
216
+ ) : (
217
+ <span>{item?.spatial?.raw}</span>
218
+ )}
219
+ </div>
220
+ )}
221
+ </Accordion.Content>
222
222
 
223
- <h3>Related datasets</h3>
224
- {children && children.length > 0 && (
225
- <Card.Group itemsPerRow={3}>
226
- {children.map((item, index) => {
223
+ <Accordion.Title
224
+ active={activeIndex.includes(3)}
225
+ index={3}
226
+ onClick={toggleOpenAccordion}
227
+ >
228
+ Temporal coverage
229
+ <Icon className="ri-arrow-down-s-line" />
230
+ </Accordion.Title>
231
+ <Accordion.Content active={activeIndex.includes(3)}>
232
+ {/*<ul>
233
+ {resourceTemporalDateRange?.map((temp, i) => {
227
234
  return (
228
- <Card
229
- href={`/datahub/view/${item.metadataIdentifier}`}
230
- key={index}
231
- >
232
- <Image src={item.overview[0].url} wrapped ui={false} />
233
- <Card.Content>
234
- <Card.Header>
235
- {item.resourceTitleObject.default}
236
- </Card.Header>
237
- </Card.Content>
238
- </Card>
235
+ <li key={i}>
236
+ <DateTime format="DATE_MED" value={temp.gte} /> -
237
+ <DateTime format="DATE_MED" value={temp.lte} />
238
+ </li>
239
239
  );
240
240
  })}
241
- </Card.Group>
242
- )}
241
+ </ul>*/}
242
+ {time_coverage?.raw.length > 0 && (
243
+ <div className="temporal-coverage">
244
+ <div className="side-temp">{`${startTempCoverage - 1}`}</div>
245
+ <div className="time-range">
246
+ <span>{startTempCoverage}</span> -
247
+ <span>{endTempCoverage}</span>
248
+ </div>
249
+ <div className="side-temp">{`${endTempCoverage + 1}`}</div>
250
+ </div>
251
+ )}
252
+ </Accordion.Content>
243
253
 
244
- <p>
245
- Source: SDI record{' '}
246
- <a
247
- href={
248
- 'https://galliwasp.eea.europa.eu/catalogue/srv/eng/catalog.search#/metadata/' +
249
- id
250
- }
251
- >
252
- {id}
253
- </a>
254
- </p>
255
- </div>
256
- ) : (
257
- ''
258
- )}
259
- </>
260
- );
254
+ <Accordion.Title
255
+ active={activeIndex.includes(4)}
256
+ index={4}
257
+ onClick={toggleOpenAccordion}
258
+ >
259
+ Topics
260
+ <Icon className="ri-arrow-down-s-line" />
261
+ </Accordion.Title>
262
+ <Accordion.Content active={activeIndex.includes(4)}>
263
+ {item.topic && (
264
+ <>
265
+ {Array.isArray(item?.topic?.raw) ? (
266
+ <>
267
+ {item?.topic?.raw.map((item, i) => {
268
+ return (
269
+ <span className="tag-item" key={i}>
270
+ {item}
271
+ </span>
272
+ );
273
+ })}
274
+ </>
275
+ ) : (
276
+ <span className="tag-item">{item?.topic?.raw}</span>
277
+ )}
278
+ </>
279
+ )}
280
+ </Accordion.Content>
281
+
282
+ <Accordion.Title
283
+ active={activeIndex.includes(5)}
284
+ index={5}
285
+ onClick={toggleOpenAccordion}
286
+ >
287
+ Tags
288
+ <Icon className="ri-arrow-down-s-line" />
289
+ </Accordion.Title>
290
+ <Accordion.Content active={activeIndex.includes(5)}>
291
+ <div className="dataset-tags">
292
+ {raw_value?.raw['allKeywords.th_EEAkeywordlist.keywords']?.map(
293
+ (tag, i) => {
294
+ return (
295
+ <span className="tag-item" key={i}>
296
+ {tag.default}
297
+ </span>
298
+ );
299
+ },
300
+ )}
301
+ </div>
302
+ </Accordion.Content>
303
+ </Accordion>
304
+ </div>
305
+ </div>
306
+ ) : null;
261
307
  }
262
308
 
263
309
  function DatahubItemView(props) {
@@ -1,31 +1,43 @@
1
1
  import React from 'react';
2
2
  import cx from 'classnames';
3
- import { Label, Button, Dropdown } from 'semantic-ui-react';
3
+ import {
4
+ Label,
5
+ // Button,
6
+ // Dropdown
7
+ } from 'semantic-ui-react';
8
+ import { DateTime as FormattedDate, StringList } from '@eeacms/search';
9
+ import { DateTime } from 'luxon';
4
10
  // import { useAppConfig, useWindowDimensions } from '@eeacms/search/lib/hocs';
5
11
  // import { TagsList } from '@eeacms/search/components'; // SegmentedBreadcrumb,
6
12
  // import { firstWords, getTermDisplayValue } from '@eeacms/search/lib/utils';
7
-
8
13
  // import MoreLikeThisTrigger from '@eeacms/search/components/Result/MoreLikeThisTrigger';
9
14
  // import ExternalLink from '@eeacms/search/components/Result/ExternalLink';
10
15
  // import ResultContext from '@eeacms/search/components/Result/ResultContext';
11
16
  // import ContentClusters from '@eeacms/search/components/Result/ContentClusters';
12
17
  import {
13
18
  useAppConfig,
14
- useWindowDimensions,
15
- ContentClusters,
16
- MoreLikeThisTrigger,
17
- TagsList,
18
- // ExternalLink,
19
19
  ResultContext,
20
20
  firstWords,
21
- getTermDisplayValue,
21
+ // ContentClusters,
22
+ // useWindowDimensions,
23
+ // MoreLikeThisTrigger,
24
+ // TagsList,
25
+ // ExternalLink,
26
+ // getTermDisplayValue,
22
27
  } from '@eeacms/search';
23
28
  import { Link } from 'react-router-dom';
24
29
 
25
30
  const DatahubCardItem = (props) => {
26
- const { result, showControls = true } = props;
31
+ const {
32
+ result,
33
+ // showControls = true
34
+ } = props;
27
35
  const { appConfig } = useAppConfig();
28
- const { vocab = {}, debugQuery } = appConfig;
36
+ const {
37
+ // vocab = {},
38
+ debugQuery,
39
+ } = appConfig;
40
+ const { topic } = result._result || [];
29
41
  const [hovered, setHovered] = React.useState(false);
30
42
 
31
43
  // console.log('result', result.metaTypes, result._result);
@@ -37,9 +49,9 @@ const DatahubCardItem = (props) => {
37
49
 
38
50
  const classColLeft = result.hasImage ? 'col-left' : 'col-left no-image';
39
51
 
40
- const { width } = useWindowDimensions();
41
- const isSmallScreen = width < 1000;
42
- const clusters = result.clusterInfo;
52
+ // const { width } = useWindowDimensions();
53
+ // const isSmallScreen = width < 1000;
54
+ // const clusters = result.clusterInfo;
43
55
  const [resultId] = (result.href || '').split('/').reverse();
44
56
 
45
57
  return (
@@ -48,16 +60,20 @@ const DatahubCardItem = (props) => {
48
60
  onMouseEnter={() => setHovered(true)}
49
61
  onMouseLeave={() => setHovered(false)}
50
62
  >
51
- <div className="col-full">
63
+ {/*<div className="col-full">
52
64
  <div className="meta">
53
65
  <ContentClusters clusters={clusters} item={result} />
54
66
  <div className="tags-list">
55
67
  <TagsList value={result.tags} />
56
68
  </div>
57
69
  </div>
58
- </div>
70
+ </div>*/}
59
71
  <div className={classColLeft}>
60
72
  <div className="details">
73
+ <div className="result-info">
74
+ <span className="result-info-title">Author: </span>
75
+ [EEA]
76
+ </div>
61
77
  <h3>
62
78
  <Link to={`/datahub/view/${resultId}`} title={result.title}>
63
79
  {firstWords(result.title, 12)}
@@ -73,7 +89,13 @@ const DatahubCardItem = (props) => {
73
89
  </Label>
74
90
  )}
75
91
  </h3>
76
- <div className="source">
92
+ {/* <SegmentedBreadcrumb */}
93
+ {/* href={result.href} */}
94
+ {/* short={true} */}
95
+ {/* maxChars={40} */}
96
+ {/* /> */}
97
+
98
+ {/*<div className="source">
77
99
  <span>Source: </span>
78
100
  <Link to={`/datahub/view/${resultId}`} title={result.title}>
79
101
  <strong title={result.source} className="source">
@@ -86,11 +108,6 @@ const DatahubCardItem = (props) => {
86
108
  8,
87
109
  )}
88
110
  </strong>
89
- {/* <SegmentedBreadcrumb */}
90
- {/* href={result.href} */}
91
- {/* short={true} */}
92
- {/* maxChars={40} */}
93
- {/* /> */}
94
111
  </Link>
95
112
 
96
113
  {showControls && !isSmallScreen && (
@@ -114,9 +131,31 @@ const DatahubCardItem = (props) => {
114
131
  </Dropdown.Menu>
115
132
  </Dropdown>
116
133
  )}
117
- </div>
134
+ </div>*/}
118
135
 
119
136
  {props.children ? props.children : <ResultContext {...props} />}
137
+
138
+ <div className="result-bottom">
139
+ {topic ? (
140
+ <div className="result-info">
141
+ <span className="result-info-title">Topic: </span>
142
+ <StringList value={topic.raw} />
143
+ </div>
144
+ ) : null}
145
+ <div className="result-info">
146
+ <span className="result-info-title">Last modified: </span>
147
+ <FormattedDate
148
+ format="DATE_MED"
149
+ value={DateTime.fromISO(
150
+ result?._result.raw_value.raw.changeDate,
151
+ )}
152
+ />
153
+ </div>
154
+ <div className="result-info">
155
+ <span className="result-info-title">Available formats: </span>
156
+ [Icons]
157
+ </div>
158
+ </div>
120
159
  </div>
121
160
  {debugQuery && (
122
161
  <div>
@@ -1,70 +1,50 @@
1
1
  import { multiTermFacet, fixedRangeFacet } from '@eeacms/search';
2
- import {
3
- // booleanFacet,
4
- // histogramFacet,
5
- // makeRange,
6
- dateRangeFacet,
7
- } from '@eeacms/search';
2
+ import { dateRangeFacet } from '@eeacms/search';
8
3
 
9
- // import { getTodayWithTime } from '@eeacms/globalsearch/utils';
10
4
  const facets = [
11
5
  multiTermFacet({
12
6
  field: 'rod',
13
7
  isFilterable: true,
14
8
  isMulti: true,
15
9
  label: 'Reporting obligations',
16
- factory: 'MultiTermListFacet',
17
- wrapper: 'ModalFacetWrapper',
18
10
  show: 10000,
19
11
  showAllOptions: true, // show all options (even if 0) in modal facet
20
- // factory: 'sui.Facet',
21
12
  }),
22
13
  multiTermFacet({
23
14
  field: 'topic',
24
15
  isFilterable: true,
25
16
  isMulti: true,
26
17
  label: 'EEA topics',
27
- factory: 'MultiTermListFacet',
28
- wrapper: 'ModalFacetWrapper',
29
18
  show: 10000,
30
19
  showAllOptions: true, // show all options (even if 0) in modal facet
31
- // factory: 'sui.Facet',
20
+ alwaysVisible: true,
32
21
  }),
33
22
  multiTermFacet({
34
23
  field: 'gemet',
35
24
  isFilterable: true,
36
25
  isMulti: true,
37
26
  label: 'GEMET keywords',
38
- factory: 'MultiTermListFacet',
39
- wrapper: 'ModalFacetWrapper',
40
27
  show: 10000,
41
28
  showAllOptions: true, // show all options (even if 0) in modal facet
42
- // factory: 'sui.Facet',
43
29
  }),
44
30
  multiTermFacet({
45
31
  field: 'organisation',
46
32
  isFilterable: true,
47
33
  isMulti: true,
48
34
  label: 'Organisations',
49
- factory: 'MultiTermListFacet',
50
- wrapper: 'ModalFacetWrapper',
51
35
  show: 10000,
52
36
  showAllOptions: true, // show all options (even if 0) in modal facet
53
- // factory: 'sui.Facet',
54
37
  }),
55
38
  multiTermFacet({
56
39
  field: 'spatialRepresentationType',
57
40
  isFilterable: true,
58
41
  isMulti: true,
59
42
  label: 'Spatial Representation Type',
60
- factory: 'MultiTermListFacet',
61
- wrapper: 'ModalFacetWrapper',
62
43
  show: 10000,
63
44
  showAllOptions: true, // show all options (even if 0) in modal facet
64
- // factory: 'sui.Facet',
65
45
  }),
66
46
  fixedRangeFacet({
67
- wrapper: 'ModalFacetWrapper',
47
+ // wrapper: 'ModalFacetWrapper',
68
48
  field: 'resolutionScaleDenominator',
69
49
  label: 'Scales',
70
50
  rangeType: 'fixed',
@@ -76,212 +56,16 @@ const facets = [
76
56
  { from: 10000000, to: 99999999999, key: '10,000,000-*' },
77
57
  // { to: -0.0001, key: 'Unknown' },
78
58
  ],
79
- factory: 'ModalFixedRangeFacet',
80
- // default: {
81
- // values: [{ name: 'All', rangeType: 'fixed' }],
82
- // type: 'any',
83
- // },
59
+ factory: 'FixedRangeFacet',
84
60
  }),
85
- ////////////////////
86
- // booleanFacet(() => ({
87
- // field: 'IncludeArchived',
88
- // label: 'Include archived content',
89
- // id: 'archived-facet',
90
- // showInFacetsList: false,
91
- // showInSecondaryFacetsList: true,
92
- // isFilter: true, // filters don't need facet options to show up
93
-
94
- // // we want this to be applied by default
95
- // // when the facet is checked, then apply the `on` key:
96
- // off: {
97
- // constant_score: {
98
- // filter: {
99
- // bool: {
100
- // should: [
101
- // { bool: { must_not: { exists: { field: 'expires' } } } },
102
- // // Functions should be supported in the buildFilters
103
- // { range: { expires: { gte: getTodayWithTime() } } },
104
- // ],
105
- // },
106
- // },
107
- // },
108
- // },
109
- // on: null,
110
- // })),
111
- // multiTermFacet({
112
- // field: 'moreLikeThis',
113
- // isFilterable: true,
114
- // isMulti: false,
115
- // label: 'More like this',
116
- // showInFacetsList: false,
117
- // filterListComponent: 'MoreLikeThisEntry',
118
- // factory: 'MoreLikeThis',
119
- // condition: 'like',
120
- // queryParams: {
121
- // fields: ['title', 'text'],
122
- // min_term_freq: 1,
123
- // max_query_terms: 12,
124
- // },
125
-
126
- // // registryConfig: 'MoreLikeThis',
127
- // }),
128
- // multiTermFacet({
129
- // field: 'topic',
130
- // isFilterable: true,
131
- // isMulti: true,
132
- // label: 'Topics',
133
- // //blacklist: topicsBlacklist,
134
- // factory: 'MultiTermListFacet',
135
- // wrapper: 'ModalFacetWrapper',
136
- // show: 10000,
137
- // showAllOptions: true, // show all options (even if 0) in modal facet
138
- // // factory: 'sui.Facet',
139
- // }),
140
- // multiTermFacet({
141
- // field: 'spatial',
142
- // isFilterable: true,
143
- // isMulti: true,
144
- // label: 'Countries',
145
- // //whitelist: spatialWhitelist,
146
- // wrapper: 'ModalFacetWrapper',
147
- // show: 10000,
148
- // factory: 'MultiTermListFacet',
149
- // iconsFamily: 'Countries',
150
- // enableExact: true,
151
- // sortOn: 'value',
152
- // }),
153
61
  multiTermFacet({
154
62
  field: 'op_cluster',
155
63
  isFilterable: true,
156
64
  isMulti: true,
157
65
  label: 'Section',
158
- wrapper: 'ModalFacetWrapper',
159
66
  show: 10000,
160
- factory: 'MultiTermListFacet',
161
67
  showInFacetsList: false,
162
68
  }),
163
-
164
- // multiTermFacet({
165
- // field: 'places',
166
- // isFilterable: true,
167
- // isMulti: true,
168
- // label: 'Regions/Places/Cities/Seas...',
169
- // //blacklist: placesBlacklist,
170
- // wrapper: 'ModalFacetWrapper',
171
- // show: 10000,
172
- // factory: 'MultiTermListFacet',
173
- // showAllOptions: true, // show all options (even if 0) in modal facet
174
- // }),
175
- // multiTermFacet({
176
- // field: 'objectProvides',
177
- // isFilterable: false,
178
- // isMulti: true,
179
- // label: 'Content types',
180
- // iconsFamily: 'Content types',
181
- // //whitelist: objectProvidesWhitelist,
182
- // wrapper: 'ModalFacetWrapper',
183
- // factory: 'MultiTermListFacet',
184
- // optionsFilter: 'typesForClustersOptionsFilter',
185
- // }),
186
- multiTermFacet({
187
- field: 'cluster_name',
188
- isFilterable: false,
189
- isMulti: true,
190
- showInFacetsList: false,
191
- label: 'Sources',
192
- wrapper: 'ModalFacetWrapper',
193
- factory: 'MultiTermListFacet',
194
- iconsFamily: 'Sources',
195
- }),
196
- // histogramFacet({
197
- // wrapper: 'ModalFacetWrapper',
198
- // field: 'year',
199
- // // isFilterable: false,
200
- // isMulti: true,
201
- // label: 'Publishing year',
202
- // // TODO: implement split in buckets
203
- // ranges: makeRange({
204
- // step: 1,
205
- // normalRange: [1994, 2022],
206
- // includeOutlierStart: false,
207
- // includeOutlierEnd: false,
208
- // }),
209
- // step: 10,
210
- // // [
211
- // // {
212
- // // to: 1900,
213
- // // },
214
- // // {
215
- // // key: '2001-2010',
216
- // // from: 2001,
217
- // // to: 2010,
218
- // // },
219
- // // {
220
- // // from: 2011,
221
- // // },
222
- // // ]
223
- // // min_max_script:
224
- // //
225
- // //"def vals = doc['year']; if (vals.length == 0){return 2000} else {def ret = [];for (val in vals){def tmp_val = val.substring(0,4);ret.add(tmp_val.toLowerCase() == tmp_val.toUpperCase() ? Integer.parseInt(tmp_val) : 2000);}return ret;}",
226
-
227
- // aggs_script:
228
- // "def vals = doc['year']; if (vals.length == 0){return 2500} else {def ret = [];for (val in vals){def tmp_val = val.substring(0,4);ret.add(tmp_val.toLowerCase() == tmp_val.toUpperCase() ? Integer.parseInt(tmp_val) : 2500);}return ret;}",
229
- // }),
230
-
231
- // histogramFacet({
232
- // wrapper: 'ModalFacetWrapper',
233
- // field: 'time_coverage',
234
- // // isFilterable: false,
235
- // isMulti: true,
236
- // label: 'Time coverage',
237
- // // TODO: implement split in buckets
238
- // ranges: makeRange({
239
- // step: 10,
240
- // normalRange: [1700, 2210],
241
- // includeOutlierStart: false,
242
- // includeOutlierEnd: false,
243
- // }),
244
- // step: 10,
245
- // // [
246
- // // {
247
- // // to: 1900,
248
- // // },
249
- // // {
250
- // // key: '2001-2010',
251
- // // from: 2001,
252
- // // to: 2010,
253
- // // },
254
- // // {
255
- // // from: 2011,
256
- // // },
257
- // // ]
258
- // // min_max_script:
259
- // //
260
- // //"def vals = doc['year']; if (vals.length == 0){return 2000} else {def ret = [];for (val in vals){def tmp_val = val.substring(0,4);ret.add(tmp_val.toLowerCase() == tmp_val.toUpperCase() ? Integer.parseInt(tmp_val) : 2000);}return ret;}",
261
-
262
- // aggs_script:
263
- // "def vals = doc['time_coverage']; if (vals.length == 0){return 2500} else {def ret = [];for (val in vals){def tmp_val = val.substring(0,4);ret.add(tmp_val.toLowerCase() == tmp_val.toUpperCase() ? Integer.parseInt(tmp_val) : 2500);}return ret;}",
264
- // }),
265
-
266
- // fixedRangeFacet({
267
- // wrapper: 'ModalFacetWrapper',
268
- // field: 'readingTime',
269
- // label: 'Reading time (minutes)',
270
- // rangeType: 'fixed',
271
- // isMulti: true,
272
- // ranges: [
273
- // { key: 'All' },
274
- // { from: 0, to: 4.99999, key: 'Short (<5 minutes)' },
275
- // { from: 5, to: 24.9999, key: 'Medium (5-25 minutes)' },
276
- // { from: 25, to: 10000, key: 'Large (25+ minutes)' },
277
- // // { to: -0.0001, key: 'Unknown' },
278
- // ],
279
- // factory: 'ModalFixedRangeFacet',
280
- // default: {
281
- // values: [{ name: 'All', rangeType: 'fixed' }],
282
- // type: 'any',
283
- // },
284
- // }),
285
69
  dateRangeFacet({
286
70
  field: 'issued.date',
287
71
  label: ' ',
@@ -304,67 +88,195 @@ const facets = [
304
88
  type: 'any',
305
89
  },
306
90
  }),
307
- // multiTermFacet({
308
- // wrapper: 'ModalFacetWrapper',
309
- // field: 'language',
310
- // isFilterable: false,
311
- // isMulti: true,
312
- // label: 'Language',
313
- // default: {
314
- // values: ['en'],
315
- // type: 'any',
316
- // },
317
- // factory: 'MultiTermListFacet',
318
- // facetValues: [
319
- // 'ar',
320
- // 'sr',
321
- // 'sq',
322
- // 'bg',
323
- // 'bs',
324
- // 'cs',
325
- // 'hr',
326
- // 'da',
327
- // 'nl',
328
- // 'el',
329
- // 'en',
330
- // 'et',
331
- // 'fi',
332
- // 'fr',
333
- // 'ga',
334
- // 'de',
335
- // 'hu',
336
- // 'is',
337
- // 'it',
338
- // 'lv',
339
- // 'lt',
340
- // 'mk',
341
- // 'mt',
342
- // 'no',
343
- // 'pl',
344
- // 'pt',
345
- // 'ro',
346
- // 'ru',
347
- // 'sh',
348
- // 'sk',
349
- // 'sl',
350
- // 'es',
351
- // 'sv',
352
- // 'tr',
353
- // ],
354
- // sortOn: 'custom',
355
- // sortOnCustomLabel: 'Alphabetical',
356
- // }),
91
+ multiTermFacet({
92
+ field: 'cluster_name',
93
+ isFilterable: false,
94
+ isMulti: true,
95
+ showInFacetsList: false,
96
+ label: 'Sources',
97
+ iconsFamily: 'Sources',
98
+ }),
357
99
  ];
358
100
 
359
101
  export default {
360
102
  facets,
361
103
  };
362
104
 
363
- // default filter values
364
- // TODO: this needs to be removed and the configuration plugged into each of
365
- // the facets
366
- // readingTime: {
367
- // value: { name: 'All', rangeType: 'fixed' },
105
+ // wrapper: 'ModalFacetWrapper',
106
+ // factory: 'MultiTermListFacet',
107
+ // histogramFacet({
108
+ // wrapper: 'ModalFacetWrapper',
109
+ // field: 'year',
110
+ // // isFilterable: false,
111
+ // isMulti: true,
112
+ // label: 'Publishing year',
113
+ // // TODO: implement split in buckets
114
+ // ranges: makeRange({
115
+ // step: 1,
116
+ // normalRange: [1994, 2022],
117
+ // includeOutlierStart: false,
118
+ // includeOutlierEnd: false,
119
+ // }),
120
+ // step: 10,
121
+ // // [
122
+ // // {
123
+ // // to: 1900,
124
+ // // },
125
+ // // {
126
+ // // key: '2001-2010',
127
+ // // from: 2001,
128
+ // // to: 2010,
129
+ // // },
130
+ // // {
131
+ // // from: 2011,
132
+ // // },
133
+ // // ]
134
+ // // min_max_script:
135
+ // //
136
+ // //"def vals = doc['year']; if (vals.length == 0){return 2000} else {def ret = [];for (val in vals){def tmp_val = val.substring(0,4);ret.add(tmp_val.toLowerCase() == tmp_val.toUpperCase() ? Integer.parseInt(tmp_val) : 2000);}return ret;}",
137
+
138
+ // aggs_script:
139
+ // "def vals = doc['year']; if (vals.length == 0){return 2500} else {def ret = [];for (val in vals){def tmp_val = val.substring(0,4);ret.add(tmp_val.toLowerCase() == tmp_val.toUpperCase() ? Integer.parseInt(tmp_val) : 2500);}return ret;}",
140
+ // }),
141
+
142
+ // histogramFacet({
143
+ // wrapper: 'ModalFacetWrapper',
144
+ // field: 'time_coverage',
145
+ // // isFilterable: false,
146
+ // isMulti: true,
147
+ // label: 'Time coverage',
148
+ // // TODO: implement split in buckets
149
+ // ranges: makeRange({
150
+ // step: 10,
151
+ // normalRange: [1700, 2210],
152
+ // includeOutlierStart: false,
153
+ // includeOutlierEnd: false,
154
+ // }),
155
+ // step: 10,
156
+ // // [
157
+ // // {
158
+ // // to: 1900,
159
+ // // },
160
+ // // {
161
+ // // key: '2001-2010',
162
+ // // from: 2001,
163
+ // // to: 2010,
164
+ // // },
165
+ // // {
166
+ // // from: 2011,
167
+ // // },
168
+ // // ]
169
+ // // min_max_script:
170
+ // //
171
+ // //"def vals = doc['year']; if (vals.length == 0){return 2000} else {def ret = [];for (val in vals){def tmp_val = val.substring(0,4);ret.add(tmp_val.toLowerCase() == tmp_val.toUpperCase() ? Integer.parseInt(tmp_val) : 2000);}return ret;}",
172
+
173
+ // aggs_script:
174
+ // "def vals = doc['time_coverage']; if (vals.length == 0){return 2500} else {def ret = [];for (val in vals){def tmp_val = val.substring(0,4);ret.add(tmp_val.toLowerCase() == tmp_val.toUpperCase() ? Integer.parseInt(tmp_val) : 2500);}return ret;}",
175
+ // }),
176
+
177
+ // fixedRangeFacet({
178
+ // wrapper: 'ModalFacetWrapper',
179
+ // field: 'readingTime',
180
+ // label: 'Reading time (minutes)',
181
+ // rangeType: 'fixed',
182
+ // isMulti: true,
183
+ // ranges: [
184
+ // { key: 'All' },
185
+ // { from: 0, to: 4.99999, key: 'Short (<5 minutes)' },
186
+ // { from: 5, to: 24.9999, key: 'Medium (5-25 minutes)' },
187
+ // { from: 25, to: 10000, key: 'Large (25+ minutes)' },
188
+ // // { to: -0.0001, key: 'Unknown' },
189
+ // ],
190
+ // factory: 'ModalFixedRangeFacet',
191
+ // default: {
192
+ // values: [{ name: 'All', rangeType: 'fixed' }],
193
+ // type: 'any',
194
+ // },
195
+ // }),
196
+ ////////////////////
197
+ // booleanFacet(() => ({
198
+ // field: 'IncludeArchived',
199
+ // label: 'Include archived content',
200
+ // id: 'archived-facet',
201
+ // showInFacetsList: false,
202
+ // showInSecondaryFacetsList: true,
203
+ // isFilter: true, // filters don't need facet options to show up
204
+
205
+ // // we want this to be applied by default
206
+ // // when the facet is checked, then apply the `on` key:
207
+ // off: {
208
+ // constant_score: {
209
+ // filter: {
210
+ // bool: {
211
+ // should: [
212
+ // { bool: { must_not: { exists: { field: 'expires' } } } },
213
+ // // Functions should be supported in the buildFilters
214
+ // { range: { expires: { gte: getTodayWithTime() } } },
215
+ // ],
216
+ // },
217
+ // },
218
+ // },
219
+ // },
220
+ // on: null,
221
+ // })),
222
+ // multiTermFacet({
223
+ // field: 'moreLikeThis',
224
+ // isFilterable: true,
225
+ // isMulti: false,
226
+ // label: 'More like this',
227
+ // showInFacetsList: false,
228
+ // filterListComponent: 'MoreLikeThisEntry',
229
+ // factory: 'MoreLikeThis',
230
+ // condition: 'like',
231
+ // queryParams: {
232
+ // fields: ['title', 'text'],
233
+ // min_term_freq: 1,
234
+ // max_query_terms: 12,
235
+ // },
236
+
237
+ // // registryConfig: 'MoreLikeThis',
238
+ // }),
239
+ // multiTermFacet({
240
+ // field: 'topic',
241
+ // isFilterable: true,
242
+ // isMulti: true,
243
+ // label: 'Topics',
244
+ // //blacklist: topicsBlacklist,
245
+ // factory: 'MultiTermListFacet',
246
+ // wrapper: 'ModalFacetWrapper',
247
+ // show: 10000,
248
+ // showAllOptions: true, // show all options (even if 0) in modal facet
249
+ // // factory: 'sui.Facet',
250
+ // }),
251
+ // multiTermFacet({
252
+ // field: 'spatial',
253
+ // isFilterable: true,
254
+ // isMulti: true,
255
+ // label: 'Countries',
256
+ // //whitelist: spatialWhitelist,
257
+ // wrapper: 'ModalFacetWrapper',
258
+ // show: 10000,
259
+ // factory: 'MultiTermListFacet',
260
+ // iconsFamily: 'Countries',
261
+ // enableExact: true,
262
+ // sortOn: 'value',
263
+ // }),
264
+ // factory: 'MultiTermListFacet',
265
+ // wrapper: 'ModalFacetWrapper',
266
+ // factory: 'sui.Facet',
267
+ // factory: 'MultiTermListFacet',
268
+ // wrapper: 'ModalFacetWrapper',
269
+ // factory: 'sui.Facet',
270
+ // factory: 'MultiTermListFacet',
271
+ // wrapper: 'ModalFacetWrapper',
272
+ // factory: 'sui.Facet',
273
+ // factory: 'MultiTermListFacet',
274
+ // wrapper: 'ModalFacetWrapper',
275
+ // factory: 'sui.Facet',
276
+ // factory: 'ModalFixedRangeFacet',
277
+ // default: {
278
+ // values: [{ name: 'All', rangeType: 'fixed' }],
368
279
  // type: 'any',
369
280
  // },
370
- // },
281
+ // wrapper: 'ModalFacetWrapper',
282
+ // factory: 'MultiTermListFacet',