@eeacms/volto-datahub 1.0.24 → 1.0.26
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 +29 -6
- package/DEVELOP.md +56 -0
- package/README.md +35 -23
- package/docker-compose.yml +32 -0
- package/jest-addon.config.js +1 -0
- package/locales/de/LC_MESSAGES/volto.po +14 -0
- package/locales/it/LC_MESSAGES/volto.po +14 -0
- package/locales/ro/LC_MESSAGES/volto.po +14 -0
- package/locales/volto.pot +16 -0
- package/package.json +6 -3
- package/src/components/ItemView/Datasets/DatasetItemDownloadList.jsx +7 -59
- package/src/components/ItemView/Datasets/DatasetItemsList.jsx +227 -108
- package/src/components/ItemView/Datasets/DatasetsTab.jsx +28 -26
- package/src/components/ItemView/Datasets/DatasetsView.jsx +2 -3
- package/src/components/ItemView/ItemView.jsx +3 -21
- package/src/components/ItemView/MetadataSection.test.jsx +18 -0
- package/src/components/ItemView/utils.test.js +128 -0
- package/src/components/LandingPage/DatahubLandingPage.jsx +0 -8
- package/src/components/Result/DatahubCardItem.jsx +1 -85
- package/src/config/facets.js +1 -1
- package/src/config/index.js +0 -1
- package/src/express-middleware.js +56 -1
- package/src/index.js +8 -0
- package/.i18n.babel.config.js +0 -1
|
@@ -1,72 +1,166 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import
|
|
3
|
-
import { Icon } from 'semantic-ui-react';
|
|
2
|
+
import config from '@plone/volto/registry';
|
|
3
|
+
import { Accordion, Icon } from 'semantic-ui-react';
|
|
4
|
+
import { useLocation, useHistory } from 'react-router-dom';
|
|
5
|
+
|
|
4
6
|
import { DateTime } from '@eeacms/search';
|
|
7
|
+
import { AccordionFilter } from '@eeacms/volto-accordion-block/components';
|
|
8
|
+
|
|
5
9
|
import { isInternal, SVGIcon, isObsolete } from '../utils.js';
|
|
6
10
|
import DatasetItemDownloadList from './DatasetItemDownloadList';
|
|
7
11
|
|
|
8
12
|
import lockSVG from 'remixicon/icons/System/lock-line.svg';
|
|
9
13
|
|
|
14
|
+
const useQuery = (location) => {
|
|
15
|
+
const { search } = location;
|
|
16
|
+
return React.useMemo(() => new URLSearchParams(search), [search]);
|
|
17
|
+
};
|
|
18
|
+
|
|
10
19
|
const DatasetItemsList = (props) => {
|
|
11
|
-
const {
|
|
20
|
+
const {
|
|
21
|
+
item,
|
|
22
|
+
appConfig,
|
|
23
|
+
filterValue,
|
|
24
|
+
setActiveTabIndex,
|
|
25
|
+
setActiveAccordionId,
|
|
26
|
+
setInitialAccordionId,
|
|
27
|
+
handleFilteredValueChange,
|
|
28
|
+
} = props;
|
|
12
29
|
|
|
13
|
-
const
|
|
30
|
+
const history = useHistory();
|
|
31
|
+
const location = useLocation();
|
|
32
|
+
const query = useQuery(location);
|
|
33
|
+
|
|
34
|
+
const datasets = item?.children;
|
|
35
|
+
const firstIdFromPanels = datasets?.[0]?.id;
|
|
36
|
+
const accordionConfig = config.blocks.blocksConfig.accordion;
|
|
37
|
+
const activePanels = query.get('activeAccordion')?.split(',') || [];
|
|
38
|
+
|
|
39
|
+
const [activeIndex, setActiveIndex] = React.useState([]);
|
|
40
|
+
const [activePanel, setActivePanel] = React.useState([]);
|
|
41
|
+
|
|
42
|
+
const activePanelsRef = React.useRef(activePanels);
|
|
43
|
+
const firstIdFromPanelsRef = React.useRef(firstIdFromPanels);
|
|
14
44
|
|
|
15
45
|
React.useEffect(() => {
|
|
16
|
-
|
|
17
|
-
|
|
46
|
+
setInitialAccordionId(
|
|
47
|
+
activePanelsRef.current[activePanelsRef.current.length - 1],
|
|
48
|
+
);
|
|
49
|
+
}, [setInitialAccordionId]);
|
|
50
|
+
|
|
51
|
+
const addQueryParam = (key, value) => {
|
|
52
|
+
const searchParams = new URLSearchParams(location.search);
|
|
53
|
+
searchParams.set(key, value);
|
|
54
|
+
|
|
55
|
+
history.push({
|
|
56
|
+
hash: location.hash,
|
|
57
|
+
pathname: location.pathname,
|
|
58
|
+
search: searchParams.toString(),
|
|
59
|
+
});
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
const handleActiveIndex = (index, id) => {
|
|
63
|
+
setActivePanel(id);
|
|
64
|
+
setActiveIndex(index);
|
|
65
|
+
addQueryParam('activeAccordion', id);
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
const isActive = (id) => {
|
|
69
|
+
return activePanel.includes(id);
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
const handleClick = (e, titleProps) => {
|
|
73
|
+
const { index, id, item } = titleProps;
|
|
74
|
+
|
|
75
|
+
const newIndex =
|
|
76
|
+
activeIndex.indexOf(index) === -1
|
|
77
|
+
? [...activeIndex, index]
|
|
78
|
+
: activeIndex.filter((item) => item !== index);
|
|
79
|
+
|
|
80
|
+
const newPanel =
|
|
81
|
+
activePanel.indexOf(id) === -1
|
|
82
|
+
? [...activePanel, id]
|
|
83
|
+
: activePanel.filter((item) => item !== id);
|
|
84
|
+
|
|
85
|
+
setActiveAccordionId(id);
|
|
86
|
+
setActiveTabIndex(item.id);
|
|
87
|
+
handleActiveIndex(newIndex, newPanel);
|
|
88
|
+
};
|
|
18
89
|
|
|
19
90
|
React.useEffect(() => {
|
|
20
|
-
|
|
21
|
-
|
|
91
|
+
if (!!activePanelsRef.current && !!activePanelsRef?.current[0]?.length) {
|
|
92
|
+
setActivePanel(activePanelsRef.current || []);
|
|
93
|
+
} else {
|
|
94
|
+
setActivePanel([
|
|
95
|
+
firstIdFromPanelsRef.current,
|
|
96
|
+
...(activePanelsRef.current || []),
|
|
97
|
+
]);
|
|
98
|
+
}
|
|
99
|
+
}, []);
|
|
22
100
|
|
|
23
|
-
|
|
24
|
-
const
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
101
|
+
React.useEffect(() => {
|
|
102
|
+
const timer = setTimeout(() => {
|
|
103
|
+
const activeAccordionId =
|
|
104
|
+
activePanelsRef?.current[activePanelsRef?.current.length - 1];
|
|
105
|
+
const element = document.getElementById(activeAccordionId);
|
|
106
|
+
element &&
|
|
107
|
+
element.scrollIntoView({
|
|
108
|
+
behavior: 'smooth',
|
|
109
|
+
inline: 'start',
|
|
110
|
+
});
|
|
111
|
+
}, 1000);
|
|
112
|
+
return () => clearTimeout(timer);
|
|
113
|
+
}, []);
|
|
28
114
|
|
|
29
115
|
return (
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
{
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
116
|
+
<>
|
|
117
|
+
<div className="accordion-block">
|
|
118
|
+
{datasets.length > 5 && (
|
|
119
|
+
<AccordionFilter
|
|
120
|
+
config={accordionConfig}
|
|
121
|
+
filterValue={filterValue}
|
|
122
|
+
data={{ right_arrows: true, styles: {} }}
|
|
123
|
+
handleFilteredValueChange={handleFilteredValueChange}
|
|
124
|
+
/>
|
|
125
|
+
)}
|
|
126
|
+
</div>
|
|
127
|
+
{datasets
|
|
128
|
+
.filter(
|
|
129
|
+
(dataset) =>
|
|
130
|
+
filterValue === '' ||
|
|
131
|
+
(filterValue !== '' &&
|
|
132
|
+
dataset.resourceTitleObject.default
|
|
133
|
+
?.toLowerCase()
|
|
134
|
+
.includes(filterValue.toLowerCase())),
|
|
135
|
+
)
|
|
136
|
+
.map((dataset, index) => {
|
|
137
|
+
const {
|
|
138
|
+
id,
|
|
139
|
+
resourceTemporalExtentDetails,
|
|
140
|
+
temporalDateRange,
|
|
141
|
+
publicationDateForResource,
|
|
142
|
+
} = dataset;
|
|
143
|
+
const archived = isObsolete(dataset.cl_status);
|
|
144
|
+
const active = isActive(id);
|
|
145
|
+
|
|
146
|
+
return (
|
|
147
|
+
<>
|
|
148
|
+
<Accordion id={id} key={index}>
|
|
149
|
+
<Accordion.Title
|
|
150
|
+
tabIndex={0}
|
|
151
|
+
active={active}
|
|
152
|
+
index={index}
|
|
153
|
+
onClick={(e) => handleClick(e, { index, id, item })}
|
|
154
|
+
onKeyDown={(e) => {
|
|
155
|
+
if (e.key === 'Enter') {
|
|
156
|
+
handleClick(e, { index });
|
|
157
|
+
}
|
|
158
|
+
}}
|
|
159
|
+
>
|
|
160
|
+
<span className="dataset-title">
|
|
161
|
+
{dataset.resourceTitleObject.default}
|
|
162
|
+
<span className="formats">
|
|
163
|
+
{(dataset.format || [])
|
|
70
164
|
.filter((item, pos, self) => self.indexOf(item) === pos)
|
|
71
165
|
.map((item, i) => {
|
|
72
166
|
return (
|
|
@@ -75,70 +169,95 @@ const DatasetItemsList = (props) => {
|
|
|
75
169
|
</span>
|
|
76
170
|
);
|
|
77
171
|
})}
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
172
|
+
|
|
173
|
+
{Array.isArray(dataset.linkProtocol) ? (
|
|
174
|
+
<>
|
|
175
|
+
{dataset.linkProtocol
|
|
176
|
+
.filter(
|
|
177
|
+
(i) => i.includes('ESRI') || i.includes('OGC'),
|
|
178
|
+
)
|
|
179
|
+
.filter(
|
|
180
|
+
(item, pos, self) => self.indexOf(item) === pos,
|
|
181
|
+
)
|
|
182
|
+
.map((item, i) => {
|
|
183
|
+
return (
|
|
184
|
+
<span className="dh-label" key={i}>
|
|
185
|
+
{item}
|
|
186
|
+
</span>
|
|
187
|
+
);
|
|
188
|
+
})}
|
|
189
|
+
</>
|
|
190
|
+
) : (
|
|
191
|
+
<>
|
|
192
|
+
{['ESRI', 'OGC'].includes(dataset.linkProtocol) && (
|
|
193
|
+
<span className="dh-label">
|
|
194
|
+
{dataset.linkProtocol}
|
|
195
|
+
</span>
|
|
196
|
+
)}
|
|
197
|
+
</>
|
|
83
198
|
)}
|
|
84
|
-
</>
|
|
85
|
-
)}
|
|
86
199
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
200
|
+
{archived && (
|
|
201
|
+
<span className="dh-label inverted">Archived</span>
|
|
202
|
+
)}
|
|
90
203
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
<
|
|
99
|
-
|
|
204
|
+
{isInternal(dataset) && (
|
|
205
|
+
<SVGIcon name={lockSVG} size="18" />
|
|
206
|
+
)}
|
|
207
|
+
</span>
|
|
208
|
+
</span>
|
|
209
|
+
<Icon className="ri-arrow-down-s-line" />
|
|
210
|
+
</Accordion.Title>
|
|
211
|
+
<Accordion.Content active={active}>
|
|
212
|
+
<div className="dataset-content">
|
|
100
213
|
<div>
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
214
|
+
{publicationDateForResource && (
|
|
215
|
+
<div>
|
|
216
|
+
<strong>Published: </strong>
|
|
217
|
+
<DateTime
|
|
218
|
+
format="DATE_MED"
|
|
219
|
+
value={publicationDateForResource}
|
|
220
|
+
/>
|
|
221
|
+
</div>
|
|
222
|
+
)}
|
|
223
|
+
|
|
224
|
+
{resourceTemporalExtentDetails &&
|
|
225
|
+
resourceTemporalExtentDetails?.length > 0 && (
|
|
226
|
+
<div>
|
|
227
|
+
<strong>Temporal coverage: </strong>
|
|
228
|
+
{temporalDateRange}
|
|
229
|
+
</div>
|
|
230
|
+
)}
|
|
106
231
|
</div>
|
|
107
|
-
)}
|
|
108
232
|
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
233
|
+
{dataset.resourceType[0] !== 'nonGeographicDataset' && (
|
|
234
|
+
<div className="dataset-pdf">
|
|
235
|
+
<div className="d-link">
|
|
236
|
+
<Icon className="file pdf" />
|
|
237
|
+
<a
|
|
238
|
+
target="_blank"
|
|
239
|
+
rel="noreferrer"
|
|
240
|
+
href={
|
|
241
|
+
`${appConfig.indexBaseUrl}/catalogue/datahub/api/records/` +
|
|
242
|
+
`${dataset.metadataIdentifier}/formatters/xsl-view?output=pdf&language=eng&approved=true`
|
|
243
|
+
}
|
|
244
|
+
>
|
|
245
|
+
Metadata Factsheet
|
|
246
|
+
</a>
|
|
247
|
+
</div>
|
|
114
248
|
</div>
|
|
115
249
|
)}
|
|
116
|
-
</div>
|
|
117
|
-
|
|
118
|
-
{dataset.resourceType[0] !== 'nonGeographicDataset' && (
|
|
119
|
-
<div className="dataset-pdf">
|
|
120
|
-
<div className="d-link">
|
|
121
|
-
<Icon className="file pdf" />
|
|
122
|
-
<a
|
|
123
|
-
target="_blank"
|
|
124
|
-
rel="noreferrer"
|
|
125
|
-
href={`${appConfig.indexBaseUrl}/catalogue/datahub/api/records/${dataset.metadataIdentifier}/formatters/xsl-view?output=pdf&language=eng&approved=true`}
|
|
126
|
-
>
|
|
127
|
-
Metadata Factsheet
|
|
128
|
-
</a>
|
|
129
|
-
</div>
|
|
130
250
|
</div>
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
)
|
|
140
|
-
|
|
141
|
-
</Accordion>
|
|
251
|
+
|
|
252
|
+
{!!dataset.link && dataset.link.length > 0 && (
|
|
253
|
+
<DatasetItemDownloadList link={dataset.link} />
|
|
254
|
+
)}
|
|
255
|
+
</Accordion.Content>
|
|
256
|
+
</Accordion>
|
|
257
|
+
</>
|
|
258
|
+
);
|
|
259
|
+
})}
|
|
260
|
+
</>
|
|
142
261
|
);
|
|
143
262
|
};
|
|
144
263
|
|
|
@@ -4,44 +4,48 @@ import { Tab, Menu } from 'semantic-ui-react';
|
|
|
4
4
|
import DatasetItemsList from './DatasetItemsList';
|
|
5
5
|
|
|
6
6
|
const DatasetsTab = (props) => {
|
|
7
|
-
const { items, appConfig
|
|
7
|
+
const { items, appConfig } = props;
|
|
8
8
|
|
|
9
|
-
const [
|
|
10
|
-
defaultAccordionOpenIndex,
|
|
11
|
-
);
|
|
9
|
+
const [filterValue, setFilterValue] = React.useState('');
|
|
12
10
|
|
|
13
11
|
const [activeTabIndex, setActiveTabIndex] = React.useState(0);
|
|
12
|
+
const [activeAccordionId, setActiveAccordionId] = React.useState();
|
|
13
|
+
const [initialAccordionId, setInitialAccordionId] = React.useState();
|
|
14
14
|
|
|
15
15
|
React.useEffect(() => {
|
|
16
|
-
if (
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
16
|
+
if (!activeAccordionId) {
|
|
17
|
+
const activeTab = items.filter((item) =>
|
|
18
|
+
item.children.find((child) => child.id === initialAccordionId),
|
|
19
|
+
);
|
|
20
|
+
setActiveTabIndex(activeTab?.[0]?.id);
|
|
20
21
|
}
|
|
21
|
-
}, [
|
|
22
|
+
}, [activeAccordionId, initialAccordionId, items]);
|
|
23
|
+
|
|
24
|
+
const handleTabChange = (e, { activeIndex }) => {
|
|
25
|
+
setFilterValue('');
|
|
26
|
+
setActiveTabIndex(activeIndex);
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
const handleFilteredValueChange = (value) => {
|
|
30
|
+
setFilterValue(value);
|
|
31
|
+
};
|
|
22
32
|
|
|
23
33
|
const panes = (items || []).map((item, i) => ({
|
|
24
34
|
menuItem: (
|
|
25
|
-
<Menu.Item
|
|
26
|
-
key={i}
|
|
27
|
-
tabIndex={0}
|
|
28
|
-
onClick={() => setActiveTabIndex(i)}
|
|
29
|
-
onKeyDown={(e) => {
|
|
30
|
-
if (e.key === 'Enter') {
|
|
31
|
-
setActiveTabIndex(i);
|
|
32
|
-
}
|
|
33
|
-
}}
|
|
34
|
-
>
|
|
35
|
+
<Menu.Item key={i} tabIndex={0}>
|
|
35
36
|
{item.date ? <span>{item.date}</span> : 'No date'}
|
|
36
37
|
</Menu.Item>
|
|
37
38
|
),
|
|
38
39
|
render: () => (
|
|
39
40
|
<Tab.Pane>
|
|
40
41
|
<DatasetItemsList
|
|
41
|
-
appConfig={appConfig}
|
|
42
42
|
item={item}
|
|
43
|
-
|
|
44
|
-
|
|
43
|
+
appConfig={appConfig}
|
|
44
|
+
filterValue={filterValue}
|
|
45
|
+
setActiveTabIndex={setActiveTabIndex}
|
|
46
|
+
setActiveAccordionId={setActiveAccordionId}
|
|
47
|
+
setInitialAccordionId={setInitialAccordionId}
|
|
48
|
+
handleFilteredValueChange={handleFilteredValueChange}
|
|
45
49
|
/>
|
|
46
50
|
</Tab.Pane>
|
|
47
51
|
),
|
|
@@ -49,13 +53,11 @@ const DatasetsTab = (props) => {
|
|
|
49
53
|
|
|
50
54
|
return (
|
|
51
55
|
<Tab
|
|
56
|
+
panes={panes}
|
|
52
57
|
className="datasets-tab"
|
|
53
58
|
activeIndex={activeTabIndex}
|
|
59
|
+
onTabChange={handleTabChange}
|
|
54
60
|
menu={{ vertical: true, secondary: true, pointing: true }}
|
|
55
|
-
panes={panes}
|
|
56
|
-
onTabChange={() => {
|
|
57
|
-
setActiveAccordionIndex(0);
|
|
58
|
-
}}
|
|
59
61
|
/>
|
|
60
62
|
);
|
|
61
63
|
};
|
|
@@ -49,8 +49,8 @@ const DatasetsView = (props) => {
|
|
|
49
49
|
return b - a;
|
|
50
50
|
});
|
|
51
51
|
|
|
52
|
-
const groupedDatasets = sortedDatasets.map((v) => {
|
|
53
|
-
return { date: v, children: datasetsByCoverage[v] };
|
|
52
|
+
const groupedDatasets = sortedDatasets.map((v, i) => {
|
|
53
|
+
return { id: i, date: v, children: datasetsByCoverage[v] };
|
|
54
54
|
});
|
|
55
55
|
|
|
56
56
|
return groupedDatasets;
|
|
@@ -71,7 +71,6 @@ const DatasetsView = (props) => {
|
|
|
71
71
|
<DatasetsTab
|
|
72
72
|
appConfig={appConfig}
|
|
73
73
|
items={groupedByTemporalCoverage}
|
|
74
|
-
defaultAccordionOpenIndex={0}
|
|
75
74
|
/>
|
|
76
75
|
</>
|
|
77
76
|
)}
|
|
@@ -4,7 +4,7 @@ import { useDispatch, useSelector } from 'react-redux';
|
|
|
4
4
|
import { Link, useLocation } from 'react-router-dom';
|
|
5
5
|
import { Container, Icon, Button } from 'semantic-ui-react';
|
|
6
6
|
import { Toolbar } from '@plone/volto/components';
|
|
7
|
-
import { BodyClass } from '@plone/volto/helpers';
|
|
7
|
+
import { BodyClass, asyncConnect, Helmet } from '@plone/volto/helpers';
|
|
8
8
|
import config from '@plone/volto/registry';
|
|
9
9
|
import { rebind, applyConfigurationSchema } from '@eeacms/search';
|
|
10
10
|
import { Callout, Banner } from '@eeacms/volto-eea-design-system/ui';
|
|
@@ -13,8 +13,6 @@ import {
|
|
|
13
13
|
MetadataSection,
|
|
14
14
|
DatasetsView,
|
|
15
15
|
} from '@eeacms/volto-datahub/components/ItemView';
|
|
16
|
-
|
|
17
|
-
import { asyncConnect, Helmet } from '@plone/volto/helpers';
|
|
18
16
|
import { fetchResult } from '@eeacms/search/lib/hocs/useResult';
|
|
19
17
|
import { setDatahubResult } from '@eeacms/volto-datahub/store';
|
|
20
18
|
|
|
@@ -51,7 +49,6 @@ function IsomorphicPortal({ children }) {
|
|
|
51
49
|
function ItemView(props) {
|
|
52
50
|
const { docid, staticContext } = props;
|
|
53
51
|
const dispatch = useDispatch();
|
|
54
|
-
// const content = useSelector((state) => state.content.data);
|
|
55
52
|
let result = useSelector((state) => state.datahub_results?.[docid]);
|
|
56
53
|
if (__SERVER__ && !result?._original?.found) {
|
|
57
54
|
staticContext.error_code = 404;
|
|
@@ -80,8 +77,8 @@ function ItemView(props) {
|
|
|
80
77
|
}, [result, docid, appConfig, registry, dispatch]);
|
|
81
78
|
|
|
82
79
|
const item = result ? result._result : null;
|
|
83
|
-
const { title, description, raw_value } = item || {};
|
|
84
|
-
const { changeDate, resourceIdentifier, cl_status } = raw_value?.raw
|
|
80
|
+
const { title, description, raw_value } = item || {};
|
|
81
|
+
const { changeDate, resourceIdentifier, cl_status } = raw_value?.raw;
|
|
85
82
|
const obsolete = isObsolete(cl_status);
|
|
86
83
|
|
|
87
84
|
const prodID = (resourceIdentifier || []).filter((p) => {
|
|
@@ -150,10 +147,6 @@ function ItemView(props) {
|
|
|
150
147
|
type="date"
|
|
151
148
|
value={new Date(changeDate)}
|
|
152
149
|
/>
|
|
153
|
-
{/* <Banner.MetadataField
|
|
154
|
-
label="Reading time"
|
|
155
|
-
value={readingTime?.raw}
|
|
156
|
-
/> */}
|
|
157
150
|
</Banner.Metadata>
|
|
158
151
|
</Banner.Content>
|
|
159
152
|
</Banner>
|
|
@@ -179,17 +172,8 @@ function ItemView(props) {
|
|
|
179
172
|
</div>
|
|
180
173
|
|
|
181
174
|
<DatasetsView item={item} appConfig={appConfig} />
|
|
182
|
-
|
|
183
175
|
<MetadataSection item={item} appConfig={appConfig} docid={docid} />
|
|
184
|
-
|
|
185
176
|
<MoreLikeThis docid={docid} title={title?.raw} appConfig={appConfig} />
|
|
186
|
-
|
|
187
|
-
{/* <div className="info-wrapper">
|
|
188
|
-
<div className="info-content">
|
|
189
|
-
<div className="info-title">More Information for {title?.raw}.</div>
|
|
190
|
-
<p>{description?.raw}</p>
|
|
191
|
-
</div>
|
|
192
|
-
</div> */}
|
|
193
177
|
</div>
|
|
194
178
|
) : item ? (
|
|
195
179
|
<>
|
|
@@ -210,8 +194,6 @@ function DatahubItemView(props) {
|
|
|
210
194
|
|
|
211
195
|
return (
|
|
212
196
|
<div id="view">
|
|
213
|
-
{/* <ContentMetadataTags content={this.props.content} /> */}
|
|
214
|
-
{/* Body class if displayName in component is set */}
|
|
215
197
|
<BodyClass className="view-datahub-item" />
|
|
216
198
|
<Container className="view-wrapper">
|
|
217
199
|
<ItemView
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import renderer from 'react-test-renderer';
|
|
3
|
+
|
|
4
|
+
import MetadataSection from './MetadataSection';
|
|
5
|
+
|
|
6
|
+
describe('MetadataSection Component', () => {
|
|
7
|
+
it('renders correctly with data', () => {
|
|
8
|
+
const appConfig = {
|
|
9
|
+
indexBaseUrl: 'https://sdi.eea.europa.eu',
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
const component = renderer.create(
|
|
13
|
+
<MetadataSection appConfig={appConfig} />,
|
|
14
|
+
);
|
|
15
|
+
const json = component.toJSON();
|
|
16
|
+
expect(json).toMatchSnapshot();
|
|
17
|
+
});
|
|
18
|
+
});
|