@eeacms/volto-clms-theme 1.1.7 → 1.1.9
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 +22 -0
- package/Jenkinsfile +2 -1
- package/jest-addon.config.js +1 -1
- package/package.json +1 -1
- package/src/actions/dataset_timeseries/dataset_timeseries.js +21 -0
- package/src/actions/index.js +5 -0
- package/src/components/Blocks/CustomTemplates/VoltoListingBlock/CclListingCards.jsx +23 -5
- package/src/components/Blocks/CustomTemplates/VoltoListingBlock/CclListingCards.test.jsx +7 -0
- package/src/components/CLMSDownloadCartView/AreaNaming.jsx +30 -0
- package/src/components/CLMSDownloadCartView/CLMSCartContent.jsx +63 -239
- package/src/components/CLMSDownloadCartView/CLMSDownloadCartView.jsx +18 -2
- package/src/components/CLMSDownloadCartView/CollectionNaming.jsx +57 -0
- package/src/components/CLMSDownloadCartView/FormatNaming.jsx +37 -0
- package/src/components/CLMSDownloadCartView/LayerNaming.jsx +47 -0
- package/src/components/CLMSDownloadCartView/TimeseriesPicker.jsx +171 -0
- package/src/components/CLMSDownloadCartView/TypeNaming.jsx +63 -0
- package/src/components/CLMSDownloadCartView/cartUtils.js +22 -1
- package/src/components/CLMSDownloadCartView/index.js +6 -0
- package/src/components/CLMSDownloadsView/CLMSHistoricDownloadsView.jsx +4 -4
- package/src/components/CclCard/CclCard.jsx +25 -35
- package/src/components/Widgets/TaxonomyWidget.jsx +10 -5
- package/src/customizations/@plone/volto-slate/editor/SlateEditor.jsx +3 -2
- package/src/customizations/volto/components/theme/Header/Header.jsx +1 -1
- package/src/customizations/volto/components/theme/SearchWidget/SearchWidget.jsx +1 -7
- package/src/reducers/dataset_timeseries/dataset_timeseries.js +43 -0
- package/src/reducers/index.js +2 -0
- package/theme/clms/css/home.css +4 -4
- package/theme/clms/css/styles.less +42 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,28 @@ 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.9](https://github.com/eea/volto-clms-theme/compare/1.1.8...1.1.9) - 12 June 2023
|
|
8
|
+
|
|
9
|
+
#### :hammer_and_wrench: Others
|
|
10
|
+
|
|
11
|
+
- tests [ionlizarazu - [`3904a4c`](https://github.com/eea/volto-clms-theme/commit/3904a4c42683de2a6be0d985156ab47048b98f09)]
|
|
12
|
+
- fix eslint [ionlizarazu - [`77e7835`](https://github.com/eea/volto-clms-theme/commit/77e783541b36f54a13de42dd006bdfd5b63a6d2a)]
|
|
13
|
+
- datepicker and nuts naming [ionlizarazu - [`78f44b7`](https://github.com/eea/volto-clms-theme/commit/78f44b7ecc555d3783301a74bc27e4fc6008a5b1)]
|
|
14
|
+
- styles [ionlizarazu - [`22bb1af`](https://github.com/eea/volto-clms-theme/commit/22bb1af08f708a9f3870cdd263ff8445947f1676)]
|
|
15
|
+
- fix header search button a11y [ionlizarazu - [`94b0e32`](https://github.com/eea/volto-clms-theme/commit/94b0e322d15ea4704ae3a0089a1b7a86bf44e364)]
|
|
16
|
+
- prevent lisitng error [ionlizarazu - [`2c61e7f`](https://github.com/eea/volto-clms-theme/commit/2c61e7f8179a902d9b2520fc00b628cf2d4e4ede)]
|
|
17
|
+
- fix TL type and prevent requests to vocabulary on doc variation [ionlizarazu - [`063443f`](https://github.com/eea/volto-clms-theme/commit/063443fbbf753091b301737795dab8345a66ef9e)]
|
|
18
|
+
- clean code and add datepicker to cart [ionlizarazu - [`e230d06`](https://github.com/eea/volto-clms-theme/commit/e230d065153957a68e2b696ef9b3e9d1f2a5e2a8)]
|
|
19
|
+
- test: Fix test config, coverage Refs #253277 [valentinab25 - [`f8ca3d4`](https://github.com/eea/volto-clms-theme/commit/f8ca3d46ceffbf3255000836bee8a791f4817791)]
|
|
20
|
+
- CLMS-2282 cart coordinates [ionlizarazu - [`c8101c4`](https://github.com/eea/volto-clms-theme/commit/c8101c47498ca533bed0160c4f381c455a6a1ff8)]
|
|
21
|
+
- timeseries first steps [ionlizarazu - [`f37d2e6`](https://github.com/eea/volto-clms-theme/commit/f37d2e656d7c108deb89e62c98019da7618dcd10)]
|
|
22
|
+
### [1.1.8](https://github.com/eea/volto-clms-theme/compare/1.1.7...1.1.8) - 5 June 2023
|
|
23
|
+
|
|
24
|
+
#### :hammer_and_wrench: Others
|
|
25
|
+
|
|
26
|
+
- [CLMS-2283] taxonomywidget bugfix [ionlizarazu - [`5f95cf4`](https://github.com/eea/volto-clms-theme/commit/5f95cf4802dc5391ee2ed155b07c20a42fb8f9b2)]
|
|
27
|
+
- slate link editor test [ionlizarazu - [`8ed08bc`](https://github.com/eea/volto-clms-theme/commit/8ed08bc7411f1869a190ecc73c06fd153c09804a)]
|
|
28
|
+
- historic downloads typo [ionlizarazu - [`b2695b5`](https://github.com/eea/volto-clms-theme/commit/b2695b533998f0fd471624e78afd394f62536a59)]
|
|
7
29
|
### [1.1.7](https://github.com/eea/volto-clms-theme/compare/1.1.6...1.1.7) - 1 June 2023
|
|
8
30
|
|
|
9
31
|
#### :hammer_and_wrench: Others
|
package/Jenkinsfile
CHANGED
|
@@ -188,6 +188,7 @@ pipeline {
|
|
|
188
188
|
// def nodeJS = tool 'NodeJS';
|
|
189
189
|
// withSonarQubeEnv('Sonarqube') {
|
|
190
190
|
// sh '''sed -i "s#/opt/frontend/my-volto-project/src/addons/${GIT_NAME}/##g" xunit-reports/coverage/lcov.info'''
|
|
191
|
+
// sh '''sed -i "s#src/addons/${GIT_NAME}/##g" xunit-reports/coverage/lcov.info'''
|
|
191
192
|
// sh "export PATH=${scannerHome}/bin:${nodeJS}/bin:$PATH; sonar-scanner -Dsonar.javascript.lcov.reportPaths=./xunit-reports/coverage/lcov.info,./cypress-coverage/coverage/lcov.info -Dsonar.sources=./src -Dsonar.projectKey=$GIT_NAME-$BRANCH_NAME -Dsonar.projectVersion=$BRANCH_NAME-$BUILD_NUMBER"
|
|
192
193
|
// sh '''try=2; while [ \$try -gt 0 ]; do curl -s -XPOST -u "${SONAR_AUTH_TOKEN}:" "${SONAR_HOST_URL}api/project_tags/set?project=${GIT_NAME}-${BRANCH_NAME}&tags=${SONARQUBE_TAGS},${BRANCH_NAME}" > set_tags_result; if [ \$(grep -ic error set_tags_result ) -eq 0 ]; then try=0; else cat set_tags_result; echo "... Will retry"; sleep 60; try=\$(( \$try - 1 )); fi; done'''
|
|
193
194
|
// }
|
|
@@ -239,4 +240,4 @@ pipeline {
|
|
|
239
240
|
}
|
|
240
241
|
}
|
|
241
242
|
}
|
|
242
|
-
}
|
|
243
|
+
}
|
package/jest-addon.config.js
CHANGED
|
@@ -5,6 +5,7 @@ module.exports = {
|
|
|
5
5
|
'!src/**/*.d.ts',
|
|
6
6
|
],
|
|
7
7
|
moduleNameMapper: {
|
|
8
|
+
'\\.(css|less|scss|sass)$': 'identity-obj-proxy',
|
|
8
9
|
'@plone/volto/cypress': '<rootDir>/node_modules/@plone/volto/cypress',
|
|
9
10
|
'@plone/volto/babel': '<rootDir>/node_modules/@plone/volto/babel',
|
|
10
11
|
'@plone/volto/(.*)$': '<rootDir>/node_modules/@plone/volto/src/$1',
|
|
@@ -14,7 +15,6 @@ module.exports = {
|
|
|
14
15
|
'<rootDir>/src/addons/volto-clms-theme/src/$1',
|
|
15
16
|
'@eeacms/volto-clms-utils/(.*)$':
|
|
16
17
|
'<rootDir>/node_modules/@eeacms/volto-clms-utils/src/$1',
|
|
17
|
-
'\\.(css|less|scss|sass)$': 'identity-obj-proxy',
|
|
18
18
|
'@plone/volto-slate':
|
|
19
19
|
'<rootDir>/node_modules/@plone/volto/packages/volto-slate/src',
|
|
20
20
|
'~/(.*)$': '<rootDir>/src/$1',
|
package/package.json
CHANGED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Get cart selection to downloadtool.
|
|
3
|
+
* @module actions/getDatasetTimeseries
|
|
4
|
+
*/
|
|
5
|
+
export const DATASET_TIMESERIES = 'DATASET_TIMESERIES';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Get cart selection to downloadtool.
|
|
9
|
+
* @function getDatasetTimeseries
|
|
10
|
+
* @returns {Object} Get extra items action.
|
|
11
|
+
*/
|
|
12
|
+
export function getDatasetTimeseries(uid) {
|
|
13
|
+
return {
|
|
14
|
+
type: DATASET_TIMESERIES,
|
|
15
|
+
uid: uid,
|
|
16
|
+
request: {
|
|
17
|
+
op: 'get',
|
|
18
|
+
path: '/@get-time-series-metadata?dataset=' + uid,
|
|
19
|
+
},
|
|
20
|
+
};
|
|
21
|
+
}
|
package/src/actions/index.js
CHANGED
|
@@ -59,6 +59,11 @@ export {
|
|
|
59
59
|
getDatasetsByUid,
|
|
60
60
|
} from './datasets_by_uid/datasets_by_uid';
|
|
61
61
|
|
|
62
|
+
export {
|
|
63
|
+
DATASET_TIMESERIES,
|
|
64
|
+
getDatasetTimeseries,
|
|
65
|
+
} from './dataset_timeseries/dataset_timeseries';
|
|
66
|
+
|
|
62
67
|
export { GET_PROJECTIONS, getProjections } from './projections/get_projections';
|
|
63
68
|
|
|
64
69
|
export { GET_REGISTRY, getRegistry } from './registry/registry';
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import
|
|
2
|
+
import { useDispatch, useSelector } from 'react-redux';
|
|
3
|
+
|
|
4
|
+
import { getVocabulary } from '@plone/volto/actions';
|
|
3
5
|
import ConditionalLink from '@plone/volto/components/manage/ConditionalLink/ConditionalLink';
|
|
6
|
+
import UniversalLink from '@plone/volto/components/manage/UniversalLink/UniversalLink';
|
|
4
7
|
import { flattenToAppURL } from '@plone/volto/helpers';
|
|
5
|
-
// import { ConditionalLink, UniversalLink } from '@plone/volto/components';
|
|
6
8
|
import { isInternalURL } from '@plone/volto/helpers/Url/Url';
|
|
7
|
-
import { useSelector } from 'react-redux';
|
|
8
|
-
import UniversalLink from '@plone/volto/components/manage/UniversalLink/UniversalLink';
|
|
9
|
-
|
|
10
9
|
import CclCard from '@eeacms/volto-clms-theme/components/CclCard/CclCard';
|
|
11
10
|
|
|
11
|
+
import PropTypes from 'prop-types';
|
|
12
|
+
|
|
12
13
|
const CclListingCards = (props) => {
|
|
13
14
|
const {
|
|
14
15
|
items,
|
|
@@ -18,8 +19,14 @@ const CclListingCards = (props) => {
|
|
|
18
19
|
variation = 'doc',
|
|
19
20
|
showDates = true,
|
|
20
21
|
} = props;
|
|
22
|
+
const dispatch = useDispatch();
|
|
21
23
|
let link = null;
|
|
22
24
|
let href = linkHref?.[0]?.['@id'] || '';
|
|
25
|
+
const CATEGORIZATION_VOCABULARY_NAME =
|
|
26
|
+
'collective.taxonomy.technical_library_categorization';
|
|
27
|
+
const vocabularies_state = useSelector(
|
|
28
|
+
(state) => state.vocabularies[CATEGORIZATION_VOCABULARY_NAME],
|
|
29
|
+
);
|
|
23
30
|
const user = useSelector((state) => state.users.user);
|
|
24
31
|
if (isInternalURL(href)) {
|
|
25
32
|
link = (
|
|
@@ -36,6 +43,17 @@ const CclListingCards = (props) => {
|
|
|
36
43
|
} else if (!['line', 'doc', 'globalSearch'].includes(variation)) {
|
|
37
44
|
containerClass = 'card-container';
|
|
38
45
|
}
|
|
46
|
+
const hasTL = items.find(
|
|
47
|
+
(i) => i?.taxonomy_technical_library_categorization?.length > 0,
|
|
48
|
+
);
|
|
49
|
+
React.useEffect(() => {
|
|
50
|
+
if (hasTL && !vocabularies_state?.loaded) {
|
|
51
|
+
dispatch(
|
|
52
|
+
getVocabulary({ vocabNameOrURL: CATEGORIZATION_VOCABULARY_NAME }),
|
|
53
|
+
);
|
|
54
|
+
}
|
|
55
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
56
|
+
}, [hasTL, dispatch]);
|
|
39
57
|
return (
|
|
40
58
|
<>
|
|
41
59
|
<div className={containerClass}>
|
|
@@ -24,6 +24,13 @@ const store = mockStore({
|
|
|
24
24
|
roles: ['Manager'],
|
|
25
25
|
},
|
|
26
26
|
},
|
|
27
|
+
vocabularies: {
|
|
28
|
+
'collective.taxonomy.technical_library_categorization': {
|
|
29
|
+
loaded: false,
|
|
30
|
+
loading: false,
|
|
31
|
+
items: [],
|
|
32
|
+
},
|
|
33
|
+
},
|
|
27
34
|
});
|
|
28
35
|
const internalLink = [{ '@id': '/news' }];
|
|
29
36
|
const externalLink = [{ '@id': 'https://wwww.google.com' }];
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export const AreaNaming = (areaProps) => {
|
|
2
|
+
const { item } = areaProps;
|
|
3
|
+
switch (item.area?.type) {
|
|
4
|
+
case 'polygon':
|
|
5
|
+
return (
|
|
6
|
+
<>
|
|
7
|
+
<span>Bounding Box</span>
|
|
8
|
+
<br />
|
|
9
|
+
<span className="cart-bounding-boxes">
|
|
10
|
+
<span className="cart-bounding-box-row">
|
|
11
|
+
<span>{`N: ${item.area.value[1].toFixed(1)}º `}</span>
|
|
12
|
+
<span>{`E: ${item.area.value[2].toFixed(1)}º `}</span>
|
|
13
|
+
</span>
|
|
14
|
+
<span className="cart-bounding-box-row">
|
|
15
|
+
<span>{`S: ${item.area.value[3].toFixed(1)}º `}</span>
|
|
16
|
+
<span>{`W: ${item.area.value[0].toFixed(1)}º `}</span>
|
|
17
|
+
</span>
|
|
18
|
+
</span>
|
|
19
|
+
</>
|
|
20
|
+
);
|
|
21
|
+
case 'nuts':
|
|
22
|
+
return 'NUTS: ' + (item.area.valueName || item.area.value);
|
|
23
|
+
case undefined:
|
|
24
|
+
return item.area || item.file || '-';
|
|
25
|
+
case typeof item.area === 'string':
|
|
26
|
+
return item.area || item.file || '-';
|
|
27
|
+
default:
|
|
28
|
+
return '-';
|
|
29
|
+
}
|
|
30
|
+
};
|
|
@@ -1,37 +1,42 @@
|
|
|
1
1
|
import React, { useEffect, useState } from 'react';
|
|
2
2
|
import { useDispatch, useSelector } from 'react-redux';
|
|
3
|
+
import { toast } from 'react-toastify';
|
|
3
4
|
import { Checkbox, Modal, Segment, Select } from 'semantic-ui-react';
|
|
4
5
|
|
|
5
6
|
import { Icon } from '@plone/volto/components';
|
|
6
7
|
import { Toast } from '@plone/volto/components';
|
|
7
|
-
import removeSVG from '@plone/volto/icons/delete.svg';
|
|
8
8
|
import addDocumentSVG from '@plone/volto/icons/add-document.svg';
|
|
9
|
+
import removeSVG from '@plone/volto/icons/delete.svg';
|
|
9
10
|
import CclButton from '@eeacms/volto-clms-theme/components/CclButton/CclButton';
|
|
10
11
|
import useCartState from '@eeacms/volto-clms-utils/cart/useCartState';
|
|
11
12
|
import { cleanDuplicatesEntries } from '@eeacms/volto-clms-utils/utils';
|
|
12
13
|
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
|
13
14
|
|
|
14
15
|
import { getDownloadtool, postDownloadtool } from '../../actions';
|
|
16
|
+
import './cart-table.less';
|
|
15
17
|
import {
|
|
16
18
|
getDownloadToolPostBody,
|
|
17
|
-
formatNaming,
|
|
18
|
-
originalFormatNaming,
|
|
19
|
-
getCollectionByItem,
|
|
20
19
|
duplicateCartItem,
|
|
21
20
|
concatRequestedCartItem,
|
|
21
|
+
isChecked,
|
|
22
|
+
contentOrDash,
|
|
22
23
|
} from './cartUtils';
|
|
23
|
-
import {
|
|
24
|
-
|
|
24
|
+
import {
|
|
25
|
+
TypeNaming,
|
|
26
|
+
AreaNaming,
|
|
27
|
+
CollectionNaming,
|
|
28
|
+
FormatNaming,
|
|
29
|
+
LayerNaming,
|
|
30
|
+
TimeseriesPicker,
|
|
31
|
+
} from '.';
|
|
25
32
|
|
|
26
|
-
import './cart-table.less';
|
|
27
33
|
/* eslint-disable react-hooks/exhaustive-deps */
|
|
28
34
|
/**
|
|
29
35
|
* CLMSCartContent container.
|
|
30
36
|
* @module components/CLMSDownloadCartView/CLMSCartContent
|
|
31
37
|
*/
|
|
32
|
-
|
|
33
38
|
const CLMSCartContent = (props) => {
|
|
34
|
-
const { localSessionCart } = props;
|
|
39
|
+
const { localSessionCart, getNutsIDList } = props;
|
|
35
40
|
const dispatch = useDispatch();
|
|
36
41
|
const { removeCartItem, /* removeCartItems, */ updateCart } = useCartState();
|
|
37
42
|
|
|
@@ -41,6 +46,7 @@ const CLMSCartContent = (props) => {
|
|
|
41
46
|
(state) => state.downloadtool.post_download_in_progress,
|
|
42
47
|
);
|
|
43
48
|
const downloadtool_state = useSelector((state) => state.downloadtool);
|
|
49
|
+
const datasetTimeseries = useSelector((state) => state.datasetTimeseries);
|
|
44
50
|
|
|
45
51
|
// component states
|
|
46
52
|
const [openedModal, setOpenedModal] = useState(false);
|
|
@@ -56,8 +62,7 @@ const CLMSCartContent = (props) => {
|
|
|
56
62
|
const projections = useSelector(
|
|
57
63
|
(state) => state.downloadtool.projections_in_progress,
|
|
58
64
|
);
|
|
59
|
-
const nutsnames = useSelector((state) => state.nutsnames
|
|
60
|
-
|
|
65
|
+
const nutsnames = useSelector((state) => state.nutsnames);
|
|
61
66
|
useEffect(() => {
|
|
62
67
|
setCartItemInProgress(post_download_in_progress.unique_ids || '');
|
|
63
68
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
@@ -70,10 +75,14 @@ const CLMSCartContent = (props) => {
|
|
|
70
75
|
array_ids.includes(item.unique_id),
|
|
71
76
|
);
|
|
72
77
|
setCartItems(cleanDuplicatesEntries(newCart));
|
|
78
|
+
let localsessionNutsIDList = [...new Set(getNutsIDList(cart))];
|
|
79
|
+
|
|
73
80
|
if (
|
|
74
81
|
datasets_items?.length > 0 &&
|
|
75
82
|
cart.length > 0 &&
|
|
76
|
-
cart.length !== newCart.length
|
|
83
|
+
cart.length !== newCart.length &&
|
|
84
|
+
((localsessionNutsIDList.length > 0 && nutsnames.loaded) ||
|
|
85
|
+
!nutsnames.loading)
|
|
77
86
|
) {
|
|
78
87
|
concatRequestedCartItem(
|
|
79
88
|
cartItems,
|
|
@@ -81,10 +90,10 @@ const CLMSCartContent = (props) => {
|
|
|
81
90
|
localSessionCart,
|
|
82
91
|
datasets_items,
|
|
83
92
|
projections,
|
|
84
|
-
nutsnames,
|
|
93
|
+
nutsnames.nutsnames,
|
|
85
94
|
);
|
|
86
95
|
}
|
|
87
|
-
}, [cart, datasets_items]);
|
|
96
|
+
}, [cart, datasets_items, nutsnames]);
|
|
88
97
|
|
|
89
98
|
const selectAllCart = (checked) => {
|
|
90
99
|
if (checked && cartItems.length > 0) {
|
|
@@ -185,228 +194,10 @@ const CLMSCartContent = (props) => {
|
|
|
185
194
|
setCartItems([...cartItems]);
|
|
186
195
|
};
|
|
187
196
|
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
.map((item, key) => item.unique_id)
|
|
193
|
-
.every(function (val) {
|
|
194
|
-
return cartSelectionCh.indexOf(val) !== -1;
|
|
195
|
-
})
|
|
196
|
-
: false;
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
const AreaNaming = (areaProps) => {
|
|
200
|
-
const { item } = areaProps;
|
|
201
|
-
switch (item.area?.type) {
|
|
202
|
-
case 'polygon':
|
|
203
|
-
return (
|
|
204
|
-
<>
|
|
205
|
-
<span>Bounding Box</span>
|
|
206
|
-
<br />
|
|
207
|
-
<span className="cart-bounding-boxes">
|
|
208
|
-
<span className="cart-bounding-box-row">
|
|
209
|
-
<span>{`N: ${item.area.value[0].toFixed(1)}º `}</span>
|
|
210
|
-
<span>{`E: ${item.area.value[1].toFixed(1)}º `}</span>
|
|
211
|
-
</span>
|
|
212
|
-
<span className="cart-bounding-box-row">
|
|
213
|
-
<span>{`S: ${item.area.value[2].toFixed(1)}º `}</span>
|
|
214
|
-
<span>{`W: ${item.area.value[3].toFixed(1)}º `}</span>
|
|
215
|
-
</span>
|
|
216
|
-
</span>
|
|
217
|
-
</>
|
|
218
|
-
);
|
|
219
|
-
case 'nuts':
|
|
220
|
-
return 'NUTS: ' + (item.area.valueName || item.area.value);
|
|
221
|
-
case undefined:
|
|
222
|
-
return item.area || item.file || '-';
|
|
223
|
-
case typeof item.area === 'string':
|
|
224
|
-
return item.area || item.file || '-';
|
|
225
|
-
default:
|
|
226
|
-
return '-';
|
|
227
|
-
}
|
|
228
|
-
};
|
|
229
|
-
|
|
230
|
-
const TypeNaming = ({ item }) => {
|
|
231
|
-
const types_options =
|
|
232
|
-
item?.type_options?.length > 0
|
|
233
|
-
? [...new Set(item.type_options.map((ddi) => ddi.name))]
|
|
234
|
-
: [];
|
|
235
|
-
if (item.file_id) {
|
|
236
|
-
return (
|
|
237
|
-
<span className={'tag tag-' + item?.type?.toLowerCase()}>
|
|
238
|
-
{contentOrDash(item.type)}
|
|
239
|
-
</span>
|
|
240
|
-
);
|
|
241
|
-
} else if (!item.type) {
|
|
242
|
-
return '-';
|
|
243
|
-
} else {
|
|
244
|
-
let defaultType = getCollectionByItem(item);
|
|
245
|
-
return types_options.length > 1 ? (
|
|
246
|
-
<Select
|
|
247
|
-
placeholder="Select type"
|
|
248
|
-
value={defaultType.name}
|
|
249
|
-
options={
|
|
250
|
-
types_options.length > 0
|
|
251
|
-
? types_options.map((option) => {
|
|
252
|
-
return {
|
|
253
|
-
key: option,
|
|
254
|
-
value: option,
|
|
255
|
-
text: option,
|
|
256
|
-
};
|
|
257
|
-
})
|
|
258
|
-
: []
|
|
259
|
-
}
|
|
260
|
-
onChange={(e, data) => {
|
|
261
|
-
const new_cartItems = [...cartItems];
|
|
262
|
-
const objIndex = new_cartItems.findIndex(
|
|
263
|
-
(obj) => obj.unique_id === item.unique_id,
|
|
264
|
-
);
|
|
265
|
-
const first_type_id = item.type_options.filter(
|
|
266
|
-
(t_o) => t_o.name === data.value,
|
|
267
|
-
)[0].id;
|
|
268
|
-
new_cartItems[objIndex].type = first_type_id;
|
|
269
|
-
const dataset = datasets_items
|
|
270
|
-
? datasets_items.find((req) => req.UID === item.dataset_uid)
|
|
271
|
-
: false;
|
|
272
|
-
const format_item = dataset.dataset_download_information.items.find(
|
|
273
|
-
(item) => item['@id'] === first_type_id,
|
|
274
|
-
);
|
|
275
|
-
new_cartItems[objIndex].format = format_item.full_format;
|
|
276
|
-
setCartItems([...new_cartItems]);
|
|
277
|
-
}}
|
|
278
|
-
/>
|
|
279
|
-
) : (
|
|
280
|
-
defaultType.name
|
|
281
|
-
);
|
|
282
|
-
}
|
|
283
|
-
};
|
|
284
|
-
|
|
285
|
-
const CollectionNaming = ({ item }) => {
|
|
286
|
-
if (item.file_id) {
|
|
287
|
-
return '-';
|
|
288
|
-
} else if (!item.type) {
|
|
289
|
-
return '-';
|
|
290
|
-
}
|
|
291
|
-
const this_type_collections = item?.type_options.filter(
|
|
292
|
-
(o) =>
|
|
293
|
-
o.name === item?.type_options.find((t_o) => t_o.id === item.type).name,
|
|
294
|
-
);
|
|
295
|
-
return this_type_collections.length > 1 ? (
|
|
296
|
-
<Select
|
|
297
|
-
placeholder="Select type"
|
|
298
|
-
value={
|
|
299
|
-
item.type
|
|
300
|
-
? item.type
|
|
301
|
-
: item.type_options.length > 0 && item.type_options[0].id
|
|
302
|
-
}
|
|
303
|
-
options={
|
|
304
|
-
item?.type_options?.length > 0 &&
|
|
305
|
-
this_type_collections.map((option) => {
|
|
306
|
-
return {
|
|
307
|
-
key: option.id,
|
|
308
|
-
value: option.id,
|
|
309
|
-
text: option.collection ?? '-',
|
|
310
|
-
};
|
|
311
|
-
})
|
|
312
|
-
}
|
|
313
|
-
onChange={(e, data) => {
|
|
314
|
-
const new_cartItems = [...cartItems];
|
|
315
|
-
const objIndex = new_cartItems.findIndex(
|
|
316
|
-
(obj) => obj.unique_id === item.unique_id,
|
|
317
|
-
);
|
|
318
|
-
new_cartItems[objIndex].type = data.value;
|
|
319
|
-
const dataset = datasets_items
|
|
320
|
-
? datasets_items.find((req) => req.UID === item.dataset_uid)
|
|
321
|
-
: false;
|
|
322
|
-
const format_item = dataset.dataset_download_information.items.find(
|
|
323
|
-
(item) => item['@id'] === data.value,
|
|
324
|
-
);
|
|
325
|
-
new_cartItems[objIndex].format = format_item.full_format;
|
|
326
|
-
setCartItems([...new_cartItems]);
|
|
327
|
-
}}
|
|
328
|
-
/>
|
|
329
|
-
) : (
|
|
330
|
-
getCollectionByItem(item).collection ?? '-'
|
|
331
|
-
);
|
|
332
|
-
};
|
|
333
|
-
const FormatNaming = ({ item, formatConversionTable }) => {
|
|
334
|
-
const format_options = getAvailableConversion(
|
|
335
|
-
formatConversionTable,
|
|
336
|
-
originalFormatNaming(item),
|
|
337
|
-
);
|
|
338
|
-
const item_format_name = formatNaming(item);
|
|
339
|
-
return !item.file_id ? (
|
|
340
|
-
format_options.length > 1 ? (
|
|
341
|
-
<Select
|
|
342
|
-
placeholder="Select format"
|
|
343
|
-
value={item_format_name}
|
|
344
|
-
options={format_options}
|
|
345
|
-
onChange={(e, data) => {
|
|
346
|
-
const objIndex = cartItems.findIndex(
|
|
347
|
-
(obj) => obj.unique_id === item.unique_id,
|
|
348
|
-
);
|
|
349
|
-
cartItems[objIndex].format = data.value;
|
|
350
|
-
setCartItems([...cartItems]);
|
|
351
|
-
}}
|
|
352
|
-
/>
|
|
353
|
-
) : (
|
|
354
|
-
item_format_name
|
|
355
|
-
)
|
|
356
|
-
) : (
|
|
357
|
-
item_format_name
|
|
358
|
-
);
|
|
359
|
-
};
|
|
360
|
-
|
|
361
|
-
const LayerNaming = ({ item }) => {
|
|
362
|
-
if (item.file_id) {
|
|
363
|
-
return '-';
|
|
364
|
-
} else if (!item.type) {
|
|
365
|
-
return '-';
|
|
366
|
-
}
|
|
367
|
-
|
|
368
|
-
const this_type_layers = item?.type_options.filter(
|
|
369
|
-
(o) =>
|
|
370
|
-
o.collection ===
|
|
371
|
-
item?.type_options.find((t_o) => t_o.id === item.type).collection,
|
|
372
|
-
);
|
|
373
|
-
|
|
374
|
-
return this_type_layers.length > 0 &&
|
|
375
|
-
this_type_layers[0].layers.length > 0 ? (
|
|
376
|
-
<Select
|
|
377
|
-
placeholder="Select layer"
|
|
378
|
-
value={
|
|
379
|
-
item.layer
|
|
380
|
-
? item.layer
|
|
381
|
-
: this_type_layers[0].layers.length > 0 &&
|
|
382
|
-
this_type_layers[0].layers[0]
|
|
383
|
-
}
|
|
384
|
-
options={
|
|
385
|
-
this_type_layers[0]?.layers.length > 0 &&
|
|
386
|
-
this_type_layers[0].layers.map((option) => {
|
|
387
|
-
return {
|
|
388
|
-
key: option,
|
|
389
|
-
value: option,
|
|
390
|
-
text: option,
|
|
391
|
-
};
|
|
392
|
-
})
|
|
393
|
-
}
|
|
394
|
-
onChange={(e, data) => {
|
|
395
|
-
const new_cartItems = [...cartItems];
|
|
396
|
-
const objIndex = new_cartItems.findIndex(
|
|
397
|
-
(obj) => obj.unique_id === item.unique_id,
|
|
398
|
-
);
|
|
399
|
-
new_cartItems[objIndex].layer = data.value;
|
|
400
|
-
setCartItems([...new_cartItems]);
|
|
401
|
-
}}
|
|
402
|
-
/>
|
|
403
|
-
) : (
|
|
404
|
-
'-'
|
|
405
|
-
);
|
|
406
|
-
};
|
|
407
|
-
|
|
408
|
-
const contentOrDash = (content) => {
|
|
409
|
-
return content || '-';
|
|
197
|
+
const setTimeseriesValue = (unique_id, value) => {
|
|
198
|
+
const objIndex = cartItems.findIndex((obj) => obj.unique_id === unique_id);
|
|
199
|
+
cartItems[objIndex].TemporalFilter = value;
|
|
200
|
+
setCartItems([...cartItems]);
|
|
410
201
|
};
|
|
411
202
|
|
|
412
203
|
return (
|
|
@@ -437,6 +228,7 @@ const CLMSCartContent = (props) => {
|
|
|
437
228
|
<th>Format</th>
|
|
438
229
|
<th>Layer/Band</th>
|
|
439
230
|
<th>Projection</th>
|
|
231
|
+
<th>Timeseries</th>
|
|
440
232
|
<th></th>
|
|
441
233
|
<th></th>
|
|
442
234
|
</tr>
|
|
@@ -490,21 +282,37 @@ const CLMSCartContent = (props) => {
|
|
|
490
282
|
<AreaNaming item={item} />
|
|
491
283
|
</td>
|
|
492
284
|
<td>
|
|
493
|
-
<TypeNaming
|
|
285
|
+
<TypeNaming
|
|
286
|
+
item={item}
|
|
287
|
+
datasets_items={datasets_items}
|
|
288
|
+
cartItems={cartItems}
|
|
289
|
+
setCartItems={setCartItems}
|
|
290
|
+
/>
|
|
494
291
|
</td>
|
|
495
292
|
<td>
|
|
496
|
-
<CollectionNaming
|
|
293
|
+
<CollectionNaming
|
|
294
|
+
item={item}
|
|
295
|
+
datasets_items={datasets_items}
|
|
296
|
+
cartItems={cartItems}
|
|
297
|
+
setCartItems={setCartItems}
|
|
298
|
+
/>
|
|
497
299
|
</td>
|
|
498
300
|
<td className="table-td-format">
|
|
499
301
|
{formatConversionTable && item && (
|
|
500
302
|
<FormatNaming
|
|
501
303
|
item={item}
|
|
304
|
+
cartItems={cartItems}
|
|
305
|
+
setCartItems={setCartItems}
|
|
502
306
|
formatConversionTable={formatConversionTable}
|
|
503
307
|
/>
|
|
504
308
|
)}
|
|
505
309
|
</td>
|
|
506
310
|
<td className="table-td-format">
|
|
507
|
-
<LayerNaming
|
|
311
|
+
<LayerNaming
|
|
312
|
+
item={item}
|
|
313
|
+
cartItems={cartItems}
|
|
314
|
+
setCartItems={setCartItems}
|
|
315
|
+
/>
|
|
508
316
|
</td>
|
|
509
317
|
<td className="table-td-projections">
|
|
510
318
|
{!item.file_id ? (
|
|
@@ -529,6 +337,22 @@ const CLMSCartContent = (props) => {
|
|
|
529
337
|
'-'
|
|
530
338
|
)}
|
|
531
339
|
</td>
|
|
340
|
+
<td>
|
|
341
|
+
{datasetTimeseries.datasets[item.dataset_uid]?.start ? (
|
|
342
|
+
<TimeseriesPicker
|
|
343
|
+
start={
|
|
344
|
+
datasetTimeseries.datasets[item.dataset_uid].start
|
|
345
|
+
}
|
|
346
|
+
end={
|
|
347
|
+
datasetTimeseries.datasets[item.dataset_uid].end
|
|
348
|
+
}
|
|
349
|
+
item={item}
|
|
350
|
+
setTimeseriesValue={setTimeseriesValue}
|
|
351
|
+
/>
|
|
352
|
+
) : (
|
|
353
|
+
<>-</>
|
|
354
|
+
)}
|
|
355
|
+
</td>
|
|
532
356
|
<td>
|
|
533
357
|
{item.task_in_progress ? (
|
|
534
358
|
<FontAwesomeIcon icon="spinner" spin />
|
|
@@ -14,7 +14,11 @@ import {
|
|
|
14
14
|
getExtraBreadcrumbItems,
|
|
15
15
|
getNutsNames,
|
|
16
16
|
} from '../../actions';
|
|
17
|
-
import {
|
|
17
|
+
import {
|
|
18
|
+
getFormatConversionTable,
|
|
19
|
+
getProjections,
|
|
20
|
+
getDatasetTimeseries,
|
|
21
|
+
} from '../../actions';
|
|
18
22
|
import CLMSCartContent from './CLMSCartContent';
|
|
19
23
|
|
|
20
24
|
/**
|
|
@@ -27,6 +31,7 @@ const CLMSDownloadCartView = (props) => {
|
|
|
27
31
|
const locale = useSelector((state) => state.intl?.locale);
|
|
28
32
|
const cart = useSelector((state) => state.cart_items.items);
|
|
29
33
|
const content = useSelector((state) => state.content.data);
|
|
34
|
+
const datasetTimeseries = useSelector((state) => state.datasetTimeseries);
|
|
30
35
|
const { isLoggedIn } = useCartState();
|
|
31
36
|
const { formatMessage } = useIntl();
|
|
32
37
|
const messages = defineMessages({
|
|
@@ -69,6 +74,14 @@ const CLMSDownloadCartView = (props) => {
|
|
|
69
74
|
let uidsList = [...new Set(localsessionUidsList)];
|
|
70
75
|
if (uidsList.length > 0) {
|
|
71
76
|
dispatch(getDatasetsByUid(uidsList));
|
|
77
|
+
uidsList.forEach((uid) => {
|
|
78
|
+
if (
|
|
79
|
+
!datasetTimeseries.loading &&
|
|
80
|
+
datasetTimeseries?.datasets[uid] === undefined
|
|
81
|
+
) {
|
|
82
|
+
dispatch(getDatasetTimeseries(uid));
|
|
83
|
+
}
|
|
84
|
+
});
|
|
72
85
|
}
|
|
73
86
|
if (localsessionNutsIDList.length > 0) {
|
|
74
87
|
dispatch(getNutsNames(localsessionNutsIDList));
|
|
@@ -133,7 +146,10 @@ const CLMSDownloadCartView = (props) => {
|
|
|
133
146
|
</ul>
|
|
134
147
|
</div>
|
|
135
148
|
</div>
|
|
136
|
-
<CLMSCartContent
|
|
149
|
+
<CLMSCartContent
|
|
150
|
+
localSessionCart={cart}
|
|
151
|
+
getNutsIDList={getNutsIDList}
|
|
152
|
+
/>
|
|
137
153
|
</div>
|
|
138
154
|
</>
|
|
139
155
|
)}
|