@eeacms/volto-clms-theme 1.1.15 → 1.1.16
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 +14 -5
- package/package.json +1 -1
- package/src/components/AppExtra/AppExtra.jsx +52 -0
- package/src/components/Blocks/CclRelatedListingBlock/CclRelatedListingView.jsx +7 -1
- package/src/components/CLMSDatasetDetailView/DataSetInfoContent.jsx +8 -0
- package/src/components/CLMSDatasetDetailView/MetadataPaginatedListing.jsx +6 -2
- package/src/components/CLMSDownloadCartView/CLMSCartContent.jsx +99 -33
- package/src/components/CLMSDownloadCartView/TimeseriesPicker.jsx +3 -0
- package/src/components/CLMSDownloadCartView/cartUtils.js +2 -2
- package/src/components/CclUtils/useFilteredPagination.js +32 -1
- package/src/index.js +8 -0
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,20 @@ 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.1.16](https://github.com/eea/volto-clms-theme/compare/1.1.15...1.1.16) - 29 June 2023
|
|
8
|
+
|
|
9
|
+
#### :rocket: New Features
|
|
10
|
+
|
|
11
|
+
- feat: track site searches in custom places [Mikel Larreategi - [`7691879`](https://github.com/eea/volto-clms-theme/commit/7691879372b3995b3b9bef372b5979e482e8b34f)]
|
|
12
|
+
- feat: reverse the cart before storing in the localStorage in event of duplication/deletion of items [Mikel Larreategi - [`6634db3`](https://github.com/eea/volto-clms-theme/commit/6634db3966bab45d87b2c215e15c882263cca55d)]
|
|
13
|
+
|
|
14
|
+
#### :hammer_and_wrench: Others
|
|
15
|
+
|
|
16
|
+
- matomo track site search [Unai - [`08166d2`](https://github.com/eea/volto-clms-theme/commit/08166d23e030a549d17453737287c8e0fef69993)]
|
|
17
|
+
- disable cart TimeSeries apply button ifthere is no endValue or endValue is earlier than startValue [ionlizarazu - [`a44f1b9`](https://github.com/eea/volto-clms-theme/commit/a44f1b94e0ef9de24e4d9953ec5a331889470240)]
|
|
18
|
+
- cart pagination and reverse ordering [ionlizarazu - [`38bf27e`](https://github.com/eea/volto-clms-theme/commit/38bf27ea42fe5805d630d6d944cb784f6e55563f)]
|
|
19
|
+
- related listing pagination [ionlizarazu - [`5213d92`](https://github.com/eea/volto-clms-theme/commit/5213d92759f250293bc2bf81903b848875ccfa6b)]
|
|
20
|
+
- cart: collection and layer/band only shown when it has value [Unai - [`fa1f823`](https://github.com/eea/volto-clms-theme/commit/fa1f8235d144f4e909bd08da1286391d5573ecd0)]
|
|
7
21
|
### [1.1.15](https://github.com/eea/volto-clms-theme/compare/1.1.14...1.1.15) - 23 June 2023
|
|
8
22
|
|
|
9
23
|
#### :hammer_and_wrench: Others
|
|
@@ -72,7 +86,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
|
72
86
|
|
|
73
87
|
#### :house: Internal changes
|
|
74
88
|
|
|
75
|
-
- chore: [JENKINS] Remove alpha testing version [valentinab25 - [`b4cbf65`](https://github.com/eea/volto-clms-theme/commit/b4cbf6557fbc67f7fc4cea5aa2cb19804f3d7e3c)]
|
|
76
89
|
|
|
77
90
|
#### :hammer_and_wrench: Others
|
|
78
91
|
|
|
@@ -1271,7 +1284,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
|
1271
1284
|
#### :hammer_and_wrench: Others
|
|
1272
1285
|
|
|
1273
1286
|
- related products and datasets added to news and meeting views and login-plone route created [Unai - [`5704a1a`](https://github.com/eea/volto-clms-theme/commit/5704a1a766148746162b60efaf232ea90dc20cf4)]
|
|
1274
|
-
- Revert "[JENKINS] Use eeacms/plone-backend and Volto alpha version- Refs #151967" [Mikel Larreategi - [`46eb694`](https://github.com/eea/volto-clms-theme/commit/46eb69415280a3c982405299135027ae4221426a)]
|
|
1275
1287
|
- sort items according to the lowercased label and put those with special meaning at the end [Mikel Larreategi - [`6410abe`](https://github.com/eea/volto-clms-theme/commit/6410abe096f60dcad54dced2026c9df9b7946d68)]
|
|
1276
1288
|
- lint fix [Unai - [`1264a7a`](https://github.com/eea/volto-clms-theme/commit/1264a7adfe8d679fea1bd821ad087add20f4271d)]
|
|
1277
1289
|
- footer newsletter subscription change, global search maxLength change from 8000 to 200 and /login design change [Unai - [`a09d24a`](https://github.com/eea/volto-clms-theme/commit/a09d24adbb6fa053fb2a2cc0071506b906593b42)]
|
|
@@ -1422,7 +1434,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
|
1422
1434
|
- search block new features [ionlizarazu - [`8e814cb`](https://github.com/eea/volto-clms-theme/commit/8e814cbd359782540c21fe37b37ef146d331f0d6)]
|
|
1423
1435
|
- language selector cookie management [ionlizarazu - [`1385ac9`](https://github.com/eea/volto-clms-theme/commit/1385ac95795702206d3623ba6e780faa43a89e0a)]
|
|
1424
1436
|
- toolbar cookie management [ionlizarazu - [`5c23200`](https://github.com/eea/volto-clms-theme/commit/5c23200790b20e1d4f1bc966463c37bf4c808f47)]
|
|
1425
|
-
- Add Sonarqube tag using clms-frontend addons list [EEA Jenkins - [`0316a0d`](https://github.com/eea/volto-clms-theme/commit/0316a0d8b6fb0fa14af13002415f3c95d9f8ede3)]
|
|
1426
1437
|
### [1.0.84](https://github.com/eea/volto-clms-theme/compare/1.0.83...1.0.84) - 18 March 2022
|
|
1427
1438
|
|
|
1428
1439
|
#### :hammer_and_wrench: Others
|
|
@@ -2327,13 +2338,11 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
|
2327
2338
|
#### :hammer_and_wrench: Others
|
|
2328
2339
|
|
|
2329
2340
|
- replace @collective/volto-dropdownmenu with volto-dropdownmenu [ionlizarazu - [`07f004f`](https://github.com/eea/volto-clms-theme/commit/07f004fe0219e403fb51bc045c83d34f3b981f76)]
|
|
2330
|
-
- yarn.lock [ionlizarazu - [`fe1ca04`](https://github.com/eea/volto-clms-theme/commit/fe1ca04889d29fe7b653db4c69af2751b84b8a1a)]
|
|
2331
2341
|
- add NODE_ENV parameter [ionlizarazu - [`101f27c`](https://github.com/eea/volto-clms-theme/commit/101f27c25b8fbd192e1b11865e95cf5ffee08c1b)]
|
|
2332
2342
|
- upgrade volto-dropdownmenu version [ionlizarazu - [`2081855`](https://github.com/eea/volto-clms-theme/commit/2081855301f4c708776e0dbab39db143cee00dbc)]
|
|
2333
2343
|
- HomeSearch block missing url behaviour [ionlizarazu - [`d20a378`](https://github.com/eea/volto-clms-theme/commit/d20a378ce3f254b8343692348f314bf281974542)]
|
|
2334
2344
|
- babel configuration [ionlizarazu - [`203ea2d`](https://github.com/eea/volto-clms-theme/commit/203ea2de07f99ca3403e4ca220ca74d7ce69b61d)]
|
|
2335
2345
|
- prettier [ionlizarazu - [`e79e26b`](https://github.com/eea/volto-clms-theme/commit/e79e26bf2fa40ba7b4eb53a24dabd87928221c28)]
|
|
2336
|
-
- add yarn lock [ionlizarazu - [`e1ab28b`](https://github.com/eea/volto-clms-theme/commit/e1ab28b060d5a74431c368b0de82a68dabce1eab)]
|
|
2337
2346
|
- Jenkinsfile cypress test [ionlizarazu - [`b385d65`](https://github.com/eea/volto-clms-theme/commit/b385d65986f717c60f8c434a08fc11b829d08eb4)]
|
|
2338
2347
|
- cypress [ionlizarazu - [`a243cf0`](https://github.com/eea/volto-clms-theme/commit/a243cf0182fa3dd113c16ff495c71e310252d83b)]
|
|
2339
2348
|
- some fixes [ionlizarazu - [`046279b`](https://github.com/eea/volto-clms-theme/commit/046279b9d05bea8a64eca03eed493e02621534c9)]
|
package/package.json
CHANGED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import React, { useEffect } from 'react';
|
|
2
|
+
import { useSelector } from 'react-redux';
|
|
3
|
+
import { pushInstruction, trackSiteSearch } from '@eeacms/volto-matomo/utils';
|
|
4
|
+
import config from '@plone/volto/registry';
|
|
5
|
+
|
|
6
|
+
export const CustomMatomoAppExtra = () => {
|
|
7
|
+
const { id } = useSelector((state) => state.users.user);
|
|
8
|
+
const { search, query, pathname } = useSelector(
|
|
9
|
+
(state) => state.router.location,
|
|
10
|
+
);
|
|
11
|
+
|
|
12
|
+
const extractSearchableText = (query) => {
|
|
13
|
+
// Handle catalog-querystring-like queries, which are
|
|
14
|
+
// send in a JSON object
|
|
15
|
+
if (query?.query) {
|
|
16
|
+
let parsed = JSON.parse(unescape(query.query));
|
|
17
|
+
let items = parsed.filter((item) => item.i === 'SearchableText');
|
|
18
|
+
if (items.length === 1) {
|
|
19
|
+
return items[0].v;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
// check if there is an explicit SearchableText parameter
|
|
24
|
+
// in the querystring
|
|
25
|
+
if (query?.SearchableText) {
|
|
26
|
+
return query.SearchableText;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
return '';
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
React.useEffect(() => {
|
|
33
|
+
if (id) {
|
|
34
|
+
pushInstruction('setUserId', id);
|
|
35
|
+
}
|
|
36
|
+
}, [id]);
|
|
37
|
+
|
|
38
|
+
useEffect(() => {
|
|
39
|
+
const searchableText = extractSearchableText(query);
|
|
40
|
+
if (
|
|
41
|
+
config.settings.track_search_paths.includes(pathname) &&
|
|
42
|
+
searchableText
|
|
43
|
+
) {
|
|
44
|
+
trackSiteSearch({ keyword: searchableText });
|
|
45
|
+
}
|
|
46
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
47
|
+
}, [search]);
|
|
48
|
+
|
|
49
|
+
return <React.Fragment />;
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
export default CustomMatomoAppExtra;
|
|
@@ -17,8 +17,14 @@ const CclRelatedListingView = (props) => {
|
|
|
17
17
|
properties,
|
|
18
18
|
metadata,
|
|
19
19
|
associated_elements = 'products',
|
|
20
|
+
searchParamsExecution = () => {},
|
|
20
21
|
} = props;
|
|
21
|
-
const use_pagination = useFilteredPagination(
|
|
22
|
+
const use_pagination = useFilteredPagination(
|
|
23
|
+
[],
|
|
24
|
+
10,
|
|
25
|
+
id,
|
|
26
|
+
searchParamsExecution,
|
|
27
|
+
);
|
|
22
28
|
const p_functions = use_pagination.functions;
|
|
23
29
|
const p_data = use_pagination.data;
|
|
24
30
|
const { pagination, currentPage, paginationSize, dataList } = p_data;
|
|
@@ -223,6 +223,7 @@ const DataSetInfoContent = (props) => {
|
|
|
223
223
|
<br />
|
|
224
224
|
<h3>Access full metadata here</h3>
|
|
225
225
|
<MetadataPaginatedListing
|
|
226
|
+
id={'metadata-access'}
|
|
226
227
|
geonetwork_identifiers_items={
|
|
227
228
|
geonetwork_identifiers.items
|
|
228
229
|
}
|
|
@@ -267,6 +268,13 @@ const DataSetInfoContent = (props) => {
|
|
|
267
268
|
content_type: 'TechnicalLibrary',
|
|
268
269
|
}}
|
|
269
270
|
associated_elements="dataset"
|
|
271
|
+
searchParamsExecution={() => {
|
|
272
|
+
const newIndex =
|
|
273
|
+
activeIndex.indexOf(1) === -1
|
|
274
|
+
? [...activeIndex, 1]
|
|
275
|
+
: activeIndex.filter((item) => item !== 1);
|
|
276
|
+
setActiveIndex(newIndex);
|
|
277
|
+
}}
|
|
270
278
|
/>
|
|
271
279
|
</AnimateHeight>
|
|
272
280
|
</Accordion.Content>
|
|
@@ -7,8 +7,12 @@ import paginationRightSVG from '@plone/volto/icons/right-key.svg';
|
|
|
7
7
|
|
|
8
8
|
import { useFilteredPagination } from '../CclUtils/useFilteredPagination';
|
|
9
9
|
export const MetadataPaginatedListing = (props) => {
|
|
10
|
-
const { geonetwork_identifiers_items } = props;
|
|
11
|
-
const use_pagination = useFilteredPagination(
|
|
10
|
+
const { geonetwork_identifiers_items, id } = props;
|
|
11
|
+
const use_pagination = useFilteredPagination(
|
|
12
|
+
geonetwork_identifiers_items,
|
|
13
|
+
10,
|
|
14
|
+
id,
|
|
15
|
+
);
|
|
12
16
|
const p_functions = use_pagination.functions;
|
|
13
17
|
const p_data = use_pagination.data;
|
|
14
18
|
const { pagination, currentPage, paginationSize, dataList } = p_data;
|
|
@@ -1,18 +1,28 @@
|
|
|
1
1
|
import React, { useEffect, useState } from 'react';
|
|
2
2
|
import { useDispatch, useSelector } from 'react-redux';
|
|
3
3
|
import { toast } from 'react-toastify';
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
Checkbox,
|
|
6
|
+
Modal,
|
|
7
|
+
Segment,
|
|
8
|
+
Select,
|
|
9
|
+
Table,
|
|
10
|
+
Pagination,
|
|
11
|
+
} from 'semantic-ui-react';
|
|
5
12
|
|
|
6
13
|
import { Icon } from '@plone/volto/components';
|
|
7
14
|
import { Toast } from '@plone/volto/components';
|
|
8
15
|
import addDocumentSVG from '@plone/volto/icons/add-document.svg';
|
|
9
16
|
import removeSVG from '@plone/volto/icons/delete.svg';
|
|
17
|
+
import paginationLeftSVG from '@plone/volto/icons/left-key.svg';
|
|
18
|
+
import paginationRightSVG from '@plone/volto/icons/right-key.svg';
|
|
10
19
|
import CclButton from '@eeacms/volto-clms-theme/components/CclButton/CclButton';
|
|
11
20
|
import useCartState from '@eeacms/volto-clms-utils/cart/useCartState';
|
|
12
21
|
import { cleanDuplicatesEntries } from '@eeacms/volto-clms-utils/utils';
|
|
13
22
|
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
|
14
23
|
|
|
15
24
|
import { getDownloadtool, postDownloadtool } from '../../actions';
|
|
25
|
+
import { useFilteredPagination } from '../CclUtils/useFilteredPagination';
|
|
16
26
|
import './cart-table.less';
|
|
17
27
|
import {
|
|
18
28
|
getDownloadToolPostBody,
|
|
@@ -21,6 +31,7 @@ import {
|
|
|
21
31
|
isChecked,
|
|
22
32
|
contentOrDash,
|
|
23
33
|
} from './cartUtils';
|
|
34
|
+
|
|
24
35
|
import {
|
|
25
36
|
TypeNaming,
|
|
26
37
|
AreaNaming,
|
|
@@ -47,12 +58,6 @@ const CLMSCartContent = (props) => {
|
|
|
47
58
|
);
|
|
48
59
|
const downloadtool_state = useSelector((state) => state.downloadtool);
|
|
49
60
|
const datasetTimeseries = useSelector((state) => state.datasetTimeseries);
|
|
50
|
-
|
|
51
|
-
// component states
|
|
52
|
-
const [openedModal, setOpenedModal] = useState(false);
|
|
53
|
-
const [cartSelection, setCartSelection] = useState([]);
|
|
54
|
-
const [loadingTable, setLoadingTable] = useState(false);
|
|
55
|
-
const [cartItems, setCartItems] = useState([]);
|
|
56
61
|
const datasets_items = useSelector(
|
|
57
62
|
(state) => state.datasetsByUid.datasets.items,
|
|
58
63
|
);
|
|
@@ -63,11 +68,28 @@ const CLMSCartContent = (props) => {
|
|
|
63
68
|
(state) => state.downloadtool.projections_in_progress,
|
|
64
69
|
);
|
|
65
70
|
const nutsnames = useSelector((state) => state.nutsnames);
|
|
71
|
+
|
|
72
|
+
// component states
|
|
73
|
+
const [openedModal, setOpenedModal] = useState(false);
|
|
74
|
+
const [cartSelection, setCartSelection] = useState([]);
|
|
75
|
+
const [loadingTable, setLoadingTable] = useState(false);
|
|
76
|
+
const [cartItems, setCartItems] = useState([]);
|
|
77
|
+
|
|
66
78
|
useEffect(() => {
|
|
67
79
|
setCartItemInProgress(post_download_in_progress.unique_ids || '');
|
|
68
80
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
69
81
|
}, [post_download_in_progress]);
|
|
70
82
|
|
|
83
|
+
const use_p = useFilteredPagination(cartItems);
|
|
84
|
+
const p_f = use_p.functions;
|
|
85
|
+
const p_data = use_p.data;
|
|
86
|
+
const { pagination, currentPage, paginationSize, dataList } = p_data;
|
|
87
|
+
|
|
88
|
+
useEffect(() => {
|
|
89
|
+
if (cartItems.length > 0) {
|
|
90
|
+
p_f.setOriginalDataList(cartItems);
|
|
91
|
+
}
|
|
92
|
+
}, [cartItems]);
|
|
71
93
|
useEffect(() => {
|
|
72
94
|
const array_ids =
|
|
73
95
|
cart.length > 0 ? cart?.map((item) => item.unique_id) : [];
|
|
@@ -200,10 +222,16 @@ const CLMSCartContent = (props) => {
|
|
|
200
222
|
setCartItems([...cartItems]);
|
|
201
223
|
};
|
|
202
224
|
|
|
225
|
+
const hascollection = (collection) => collection.value > 0;
|
|
226
|
+
const ref = React.useRef();
|
|
227
|
+
|
|
228
|
+
const handleScroll = (ref) => {
|
|
229
|
+
ref.scrollIntoView({ behavior: 'smooth' });
|
|
230
|
+
};
|
|
203
231
|
return (
|
|
204
232
|
<>
|
|
205
|
-
{
|
|
206
|
-
<div className="custom-table cart-table">
|
|
233
|
+
{pagination?.length !== 0 ? (
|
|
234
|
+
<div ref={ref} className="custom-table cart-table">
|
|
207
235
|
<Segment basic loading={loadingTable}>
|
|
208
236
|
<h2>My cart</h2>
|
|
209
237
|
<Table responsive>
|
|
@@ -229,8 +257,8 @@ const CLMSCartContent = (props) => {
|
|
|
229
257
|
</Table.Row>
|
|
230
258
|
</Table.Header>
|
|
231
259
|
<tbody>
|
|
232
|
-
{
|
|
233
|
-
|
|
260
|
+
{pagination.length > 0 &&
|
|
261
|
+
pagination.map((item, key) => (
|
|
234
262
|
<tr
|
|
235
263
|
key={key}
|
|
236
264
|
style={
|
|
@@ -285,15 +313,19 @@ const CLMSCartContent = (props) => {
|
|
|
285
313
|
<div className="mb-2">
|
|
286
314
|
<strong>Type: </strong>
|
|
287
315
|
</div>
|
|
288
|
-
|
|
289
|
-
<
|
|
290
|
-
|
|
316
|
+
{item?.type_options?.some(hascollection) && (
|
|
317
|
+
<div className="mb-2">
|
|
318
|
+
<strong>Collection: </strong>
|
|
319
|
+
</div>
|
|
320
|
+
)}
|
|
291
321
|
<div className="mb-2">
|
|
292
322
|
<strong>Format: </strong>
|
|
293
323
|
</div>
|
|
294
|
-
|
|
295
|
-
<
|
|
296
|
-
|
|
324
|
+
{item?.layer !== null && (
|
|
325
|
+
<div className="mb-2">
|
|
326
|
+
<strong>Layer/Band: </strong>
|
|
327
|
+
</div>
|
|
328
|
+
)}
|
|
297
329
|
</td>
|
|
298
330
|
<td>
|
|
299
331
|
<div className="mb-2">
|
|
@@ -304,14 +336,16 @@ const CLMSCartContent = (props) => {
|
|
|
304
336
|
setCartItems={setCartItems}
|
|
305
337
|
/>
|
|
306
338
|
</div>
|
|
307
|
-
|
|
308
|
-
<
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
339
|
+
{item?.type_options?.some(hascollection) && (
|
|
340
|
+
<div className="mb-2">
|
|
341
|
+
<CollectionNaming
|
|
342
|
+
item={item}
|
|
343
|
+
datasets_items={datasets_items}
|
|
344
|
+
cartItems={cartItems}
|
|
345
|
+
setCartItems={setCartItems}
|
|
346
|
+
/>
|
|
347
|
+
</div>
|
|
348
|
+
)}
|
|
315
349
|
<div className="mb-2">
|
|
316
350
|
{formatConversionTable && item && (
|
|
317
351
|
<FormatNaming
|
|
@@ -322,13 +356,15 @@ const CLMSCartContent = (props) => {
|
|
|
322
356
|
/>
|
|
323
357
|
)}
|
|
324
358
|
</div>
|
|
325
|
-
|
|
326
|
-
<
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
359
|
+
{item?.layer !== null && (
|
|
360
|
+
<div className="mb-2">
|
|
361
|
+
<LayerNaming
|
|
362
|
+
item={item}
|
|
363
|
+
cartItems={cartItems}
|
|
364
|
+
setCartItems={setCartItems}
|
|
365
|
+
/>
|
|
366
|
+
</div>
|
|
367
|
+
)}
|
|
332
368
|
</td>
|
|
333
369
|
<td className="table-td-projections">
|
|
334
370
|
{!item.file_id ? (
|
|
@@ -446,11 +482,41 @@ const CLMSCartContent = (props) => {
|
|
|
446
482
|
</tbody>
|
|
447
483
|
</Table>
|
|
448
484
|
</Segment>
|
|
485
|
+
{dataList.length / paginationSize > 1 && (
|
|
486
|
+
<div className="pagination-wrapper">
|
|
487
|
+
<Pagination
|
|
488
|
+
activePage={currentPage}
|
|
489
|
+
totalPages={Math.ceil(dataList.length / paginationSize)}
|
|
490
|
+
onPageChange={(e, { activePage }) => {
|
|
491
|
+
if (ref.current) handleScroll(ref.current);
|
|
492
|
+
p_f.setCurrentPage(activePage);
|
|
493
|
+
}}
|
|
494
|
+
firstItem={null}
|
|
495
|
+
lastItem={null}
|
|
496
|
+
prevItem={{
|
|
497
|
+
content: <Icon name={paginationLeftSVG} size="18px" />,
|
|
498
|
+
icon: true,
|
|
499
|
+
'aria-disabled': currentPage === 1,
|
|
500
|
+
className: currentPage === 1 ? 'disabled' : null,
|
|
501
|
+
}}
|
|
502
|
+
nextItem={{
|
|
503
|
+
content: <Icon name={paginationRightSVG} size="18px" />,
|
|
504
|
+
icon: true,
|
|
505
|
+
'aria-disabled':
|
|
506
|
+
currentPage === Math.ceil(dataList.length / paginationSize),
|
|
507
|
+
className:
|
|
508
|
+
currentPage === Math.ceil(dataList.length / paginationSize)
|
|
509
|
+
? 'disabled'
|
|
510
|
+
: null,
|
|
511
|
+
}}
|
|
512
|
+
></Pagination>
|
|
513
|
+
</div>
|
|
514
|
+
)}
|
|
449
515
|
</div>
|
|
450
516
|
) : (
|
|
451
517
|
<h2 style={{ textAlign: 'center' }}>Empty cart</h2>
|
|
452
518
|
)}
|
|
453
|
-
{
|
|
519
|
+
{pagination?.length !== 0 && (
|
|
454
520
|
<CclButton
|
|
455
521
|
onClick={() => downloadModal()}
|
|
456
522
|
disabled={cartSelection.length === 0}
|
|
@@ -112,6 +112,9 @@ export const TimeseriesPicker = (props) => {
|
|
|
112
112
|
<CclButton
|
|
113
113
|
isButton={true}
|
|
114
114
|
mode={'filled'}
|
|
115
|
+
disabled={
|
|
116
|
+
startValue?.getTime() > endValue?.getTime() || !endValue
|
|
117
|
+
}
|
|
115
118
|
onClick={() => {
|
|
116
119
|
setTimeseriesValue(item.unique_id, {
|
|
117
120
|
StartDate: startValue,
|
|
@@ -160,7 +160,7 @@ export const duplicateCartItem = (
|
|
|
160
160
|
export const refreshCart = (cartItems, setCartItems, updateCart) => {
|
|
161
161
|
setCartItems([...cartItems]);
|
|
162
162
|
updateCart([
|
|
163
|
-
...cartItems.map((c_i) => {
|
|
163
|
+
...[...cartItems].reverse().map((c_i) => {
|
|
164
164
|
const file_id = c_i.file_id ? { file_id: c_i.file_id } : {};
|
|
165
165
|
const id = c_i.id ? { id: c_i.id } : {};
|
|
166
166
|
return {
|
|
@@ -183,7 +183,7 @@ export const concatRequestedCartItem = (
|
|
|
183
183
|
nutsnames,
|
|
184
184
|
) => {
|
|
185
185
|
let newCartItems = [...cartItems];
|
|
186
|
-
localSessionCart.forEach((localItem) => {
|
|
186
|
+
[...localSessionCart].reverse().forEach((localItem) => {
|
|
187
187
|
const requestedItem = datasets_items
|
|
188
188
|
? datasets_items.find((req) => req.UID === localItem.UID)
|
|
189
189
|
: false;
|
|
@@ -1,19 +1,26 @@
|
|
|
1
|
-
import { useEffect, useState } from 'react';
|
|
1
|
+
import { useEffect, useState, useRef } from 'react';
|
|
2
|
+
import { useHistory, useLocation } from 'react-router-dom';
|
|
3
|
+
import qs from 'query-string';
|
|
2
4
|
import { dynamicSort } from './dynamicSort';
|
|
3
5
|
export const useFilteredPagination = (
|
|
4
6
|
original_data = [],
|
|
5
7
|
defaultPaginationSize = 10,
|
|
8
|
+
id = '',
|
|
9
|
+
searchParamsExecution = () => {},
|
|
6
10
|
) => {
|
|
7
11
|
const [originalDataList, setOriginalDataList] = useState(original_data);
|
|
8
12
|
const [dataList, setDataList] = useState(original_data);
|
|
9
13
|
const [paginationSize, setPaginationSize] = useState(defaultPaginationSize);
|
|
10
14
|
const [currentPage, setCurrentPage] = useState(1);
|
|
15
|
+
const currentPage_ref = useRef(currentPage);
|
|
11
16
|
const [pagination, setPagination] = useState(
|
|
12
17
|
original_data.slice(
|
|
13
18
|
(currentPage - 1) * paginationSize,
|
|
14
19
|
(currentPage - 1) * paginationSize + paginationSize,
|
|
15
20
|
),
|
|
16
21
|
);
|
|
22
|
+
const history = useHistory();
|
|
23
|
+
const location = useLocation();
|
|
17
24
|
const [search, setSearch] = useState({});
|
|
18
25
|
const applySearch = (e, { value }, field, setter) => {
|
|
19
26
|
const new_filters = { [field]: value };
|
|
@@ -27,6 +34,9 @@ export const useFilteredPagination = (
|
|
|
27
34
|
setDataList(originalDataList);
|
|
28
35
|
setSearch({});
|
|
29
36
|
};
|
|
37
|
+
useEffect(() => {
|
|
38
|
+
setDataList(originalDataList);
|
|
39
|
+
}, [originalDataList]);
|
|
30
40
|
useEffect(() => {
|
|
31
41
|
let filtered_data_list = [...originalDataList];
|
|
32
42
|
Object.entries(search).forEach((filter) => {
|
|
@@ -53,6 +63,27 @@ export const useFilteredPagination = (
|
|
|
53
63
|
);
|
|
54
64
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
55
65
|
}, [dataList, currentPage, paginationSize]);
|
|
66
|
+
useEffect(() => {
|
|
67
|
+
if (id) {
|
|
68
|
+
if (currentPage !== currentPage_ref.current) {
|
|
69
|
+
history.replace({
|
|
70
|
+
search: qs.stringify({
|
|
71
|
+
...qs.parse(location.search),
|
|
72
|
+
[`page-${id}`]: currentPage,
|
|
73
|
+
}),
|
|
74
|
+
});
|
|
75
|
+
} else if (
|
|
76
|
+
qs.parse(location.search)?.[`page-${id}`] &&
|
|
77
|
+
qs.parse(location.search)?.[`page-${id}`] !== currentPage
|
|
78
|
+
) {
|
|
79
|
+
// add here the execution on the first load with search params such as pagination
|
|
80
|
+
searchParamsExecution();
|
|
81
|
+
setCurrentPage(qs.parse(location.search)?.[`page-${id}`]);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
currentPage_ref.current = currentPage;
|
|
85
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
86
|
+
}, [currentPage]);
|
|
56
87
|
|
|
57
88
|
return {
|
|
58
89
|
functions: {
|
package/src/index.js
CHANGED
|
@@ -52,6 +52,9 @@ import CLMSLoginView from './components/CLMSLoginView/CLMSLogin';
|
|
|
52
52
|
//SLATE CONFIGURATION
|
|
53
53
|
import installLinkEditor from '@plone/volto-slate/editor/plugins/AdvancedLink';
|
|
54
54
|
|
|
55
|
+
//APPEXTRA
|
|
56
|
+
import CustomMatomoAppExtra from './components/AppExtra/AppExtra';
|
|
57
|
+
|
|
55
58
|
const applyConfig = (config) => {
|
|
56
59
|
config.views = {
|
|
57
60
|
...config.views,
|
|
@@ -122,6 +125,10 @@ const applyConfig = (config) => {
|
|
|
122
125
|
match: '*',
|
|
123
126
|
component: CookieBanner,
|
|
124
127
|
},
|
|
128
|
+
{
|
|
129
|
+
match: '',
|
|
130
|
+
component: CustomMatomoAppExtra,
|
|
131
|
+
},
|
|
125
132
|
],
|
|
126
133
|
nonContentRoutes: [
|
|
127
134
|
...config.settings.nonContentRoutes,
|
|
@@ -166,6 +173,7 @@ const applyConfig = (config) => {
|
|
|
166
173
|
},
|
|
167
174
|
showTags: false,
|
|
168
175
|
ownDomain: 'land.copernicus.eu',
|
|
176
|
+
track_search_paths: ['/en/global-search', '/en/dataset-catalog'],
|
|
169
177
|
};
|
|
170
178
|
|
|
171
179
|
config.settings.slate.toolbarButtons = [
|