@eeacms/volto-clms-theme 1.0.64 → 1.0.65

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,15 +4,41 @@ All notable changes to this project will be documented in this file. Dates are d
4
4
 
5
5
  Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
6
6
 
7
+ #### [1.0.65](https://github.com/eea/volto-clms-theme/compare/1.0.64...1.0.65)
8
+
9
+ - Download page changes [`#193`](https://github.com/eea/volto-clms-theme/pull/193)
10
+ - remove unneeded getNutsNames action dispatch [`9a1df64`](https://github.com/eea/volto-clms-theme/commit/9a1df64768757eeba697344ac0ceb3b715241baf)
11
+ - reducer parameter [`ec242bc`](https://github.com/eea/volto-clms-theme/commit/ec242bc1c4039dc67ff5e54cdd078bf56692fdb2)
12
+ - dispatch getDownloadtool when the task is deleted [`9354609`](https://github.com/eea/volto-clms-theme/commit/9354609c05a9efaae909f04af0195d27c82c076b)
13
+ - add cart-downloads route to noncontentRoute [`f1d945f`](https://github.com/eea/volto-clms-theme/commit/f1d945f278c57e142010bc170e5526dcf639b826)
14
+ - new texts [`31c96ce`](https://github.com/eea/volto-clms-theme/commit/31c96ce9de77d783768614260e319966c53fd1b9)
15
+ - card styles [`15ddb0d`](https://github.com/eea/volto-clms-theme/commit/15ddb0daea6e949c371dc32d008f189bc82b350f)
16
+ - text correction [`326f94c`](https://github.com/eea/volto-clms-theme/commit/326f94c95c37dcf5babdb157155795e6a0b33339)
17
+ - texts and columns [`053e48c`](https://github.com/eea/volto-clms-theme/commit/053e48c05bf0629f616d16484640552b6ca1f083)
18
+ - add Downloads to logged in user dropdown [`8bceefd`](https://github.com/eea/volto-clms-theme/commit/8bceefd619d31947ceed3da042c7995e1e26d86d)
19
+ - bugfixes [`f8b3dc6`](https://github.com/eea/volto-clms-theme/commit/f8b3dc674b7cbba405e641465892028e757ed468)
20
+ - subjects to taxonomy_technical_library_categorization at TL view [`73a4a25`](https://github.com/eea/volto-clms-theme/commit/73a4a252cba51e338e9c79572f92abc5c5a6ea16)
21
+ - cart and donwload progress views with the nutsname [`bb9c42c`](https://github.com/eea/volto-clms-theme/commit/bb9c42c213dead2fbebf148cd34eb3fd268761e9)
22
+ - add action and reducer for nutsnames [`67c4bee`](https://github.com/eea/volto-clms-theme/commit/67c4beea48c2833e4d77280636d2035ce901212d)
23
+ - add initial tasks states [`9f61e7c`](https://github.com/eea/volto-clms-theme/commit/9f61e7c9ac35d3206f333b2026540e53e817a174)
24
+ - replace subjects with taxonomy_technical_library_categorization [`df730eb`](https://github.com/eea/volto-clms-theme/commit/df730eb63cf096aa90be0567ceebebe0c21cf0f9)
25
+ - show extra information in the file download card [`ff80e03`](https://github.com/eea/volto-clms-theme/commit/ff80e0344bee86d857ffadeb97bc2c5592735539)
26
+ - show file size in human notation [`a5aa684`](https://github.com/eea/volto-clms-theme/commit/a5aa684f6ed6037a4a5e70c2605ba95a16fbb3b7)
27
+ - fixedWidth to comment icon [`46edf90`](https://github.com/eea/volto-clms-theme/commit/46edf90311929c0eb3f26c48f8453d54ff120ee3)
28
+ - request root breadcrumb to remove from the view and add subjects customized labels to the view [`3051e68`](https://github.com/eea/volto-clms-theme/commit/3051e68c62c040f7d2712e3b3df674b02e76607c)
29
+ - hide default tags from Volto config [`5ca6bc9`](https://github.com/eea/volto-clms-theme/commit/5ca6bc9f8ba3718bf1397cd939c20caad909ff0c)
30
+
7
31
  #### [1.0.64](https://github.com/eea/volto-clms-theme/compare/1.0.63...1.0.64)
8
32
 
33
+ > 31 January 2022
34
+
35
+ - meeting anonymous form data issue [`#191`](https://github.com/eea/volto-clms-theme/pull/191)
9
36
  - Cart download page [`#192`](https://github.com/eea/volto-clms-theme/pull/192)
10
37
  - texts for no tasks [`169cd93`](https://github.com/eea/volto-clms-theme/commit/169cd93a8519f08a365852efc27db7edc5498a53)
11
38
  - show the selected nuts ID and improve wording [`8378a73`](https://github.com/eea/volto-clms-theme/commit/8378a7307093c4f9fa90f130d9ce0438ac443f2e)
12
39
  - add a link to the download process [`444dbff`](https://github.com/eea/volto-clms-theme/commit/444dbff4cab5f0f53a307685e6ba88a808ccfa1d)
13
40
  - loading process while download request is completed [`5f82fa8`](https://github.com/eea/volto-clms-theme/commit/5f82fa84c6c513653125fe80be00255d636521c1)
14
41
  - download link and filesize only on Finished_ok files [`f68b30c`](https://github.com/eea/volto-clms-theme/commit/f68b30c1330e25e4cd400f83e582e8143dbba576)
15
- - meeting anonymous form data issue [`e99e518`](https://github.com/eea/volto-clms-theme/commit/e99e5186451de427e0f4a0661e2b9300fd13c98d)
16
42
  - reorganize reducer response and create a new route to render the Cart Download view separated from the Cart view [`9ac01f7`](https://github.com/eea/volto-clms-theme/commit/9ac01f7f0ac3b812b20a66d326034f34327ca93f)
17
43
 
18
44
  #### [1.0.63](https://github.com/eea/volto-clms-theme/compare/1.0.62...1.0.63)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eeacms/volto-clms-theme",
3
- "version": "1.0.64",
3
+ "version": "1.0.65",
4
4
  "description": "volto-clms-theme: Volto theme for CLMS site",
5
5
  "main": "src/index.js",
6
6
  "author": "CodeSyntax for the European Environment Agency",
@@ -18,3 +18,24 @@ export function getDownloadtool() {
18
18
  },
19
19
  };
20
20
  }
21
+
22
+ /**
23
+ * Get nuts name by id.
24
+ * @module actions/getNutsName
25
+ */
26
+ export const GET_NUTSNAME = 'GET_NUTSNAME';
27
+
28
+ /**
29
+ * Get cart selection to downloadtool.
30
+ * @function getNutsNames
31
+ * @returns {Object} NutsName per NutsId.
32
+ */
33
+ export function getNutsNames(nutsids) {
34
+ return {
35
+ type: GET_NUTSNAME,
36
+ request: {
37
+ op: 'get',
38
+ path: `/@nuts_name?nuts_ids=${nutsids}`,
39
+ },
40
+ };
41
+ }
@@ -40,6 +40,8 @@ export {
40
40
  export {
41
41
  GET_DOWNLOADTOOL,
42
42
  getDownloadtool,
43
+ GET_NUTSNAME,
44
+ getNutsNames,
43
45
  } from './downloadtool/get_downloadtool';
44
46
 
45
47
  export {
@@ -5,6 +5,7 @@
5
5
  */
6
6
 
7
7
  import React, { useEffect, useState } from 'react';
8
+ import { Segment, Select } from 'semantic-ui-react';
8
9
  import {
9
10
  getCartObjectFromMapviewer,
10
11
  getCartObjectFromPrepackaged,
@@ -17,14 +18,14 @@ import {
17
18
  postDownloadtool,
18
19
  } from '../../actions';
19
20
  import { useDispatch, useSelector } from 'react-redux';
20
- import { Toast } from '@plone/volto/components';
21
- import { toast } from 'react-toastify';
21
+
22
22
  import CclButton from '@eeacms/volto-clms-theme/components/CclButton/CclButton';
23
23
  import { Checkbox } from 'semantic-ui-react';
24
24
  import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
25
- import { Select, Segment } from 'semantic-ui-react';
25
+ import { Toast } from '@plone/volto/components';
26
26
  import { cleanDuplicatesEntries } from '@eeacms/volto-clms-utils/utils';
27
27
  import { getAvailableConversion } from './conversion';
28
+ import { toast } from 'react-toastify';
28
29
  import useCartState from '@eeacms/volto-clms-utils/cart/useCartState';
29
30
 
30
31
  const CLMSCartContent = (props) => {
@@ -44,6 +45,7 @@ const CLMSCartContent = (props) => {
44
45
  const projections = useSelector(
45
46
  (state) => state.downloadtool.projections_in_progress,
46
47
  );
48
+ const nutsnames = useSelector((state) => state.nutsnames.nutsnames);
47
49
 
48
50
  const [cartItems, setCartItems] = useState([]);
49
51
 
@@ -68,11 +70,17 @@ const CLMSCartContent = (props) => {
68
70
  }
69
71
  }, [cart, datasets]);
70
72
 
73
+ useEffect(() => {
74
+ if (Object.keys(nutsnames).length > 0 && cart.length > 0) {
75
+ concatRequestedCartItem();
76
+ }
77
+ }, [nutsnames]);
78
+
71
79
  function concatRequestedCartItem() {
72
80
  localSessionCart.forEach((localItem) => {
73
- const requestedItem = datasets.find(
74
- (requestedItem) => requestedItem.UID === localItem.UID,
75
- );
81
+ const requestedItem = datasets
82
+ ? datasets.find((requestedItem) => requestedItem.UID === localItem.UID)
83
+ : false;
76
84
  if (requestedItem) {
77
85
  const file_data = requestedItem?.downloadable_files?.items.find(
78
86
  (item) => item['@id'] === localItem.file_id,
@@ -84,7 +92,12 @@ const CLMSCartContent = (props) => {
84
92
  setCartItems(cleanDuplicatesEntries(cartItems));
85
93
  } else {
86
94
  cartItems.push(
87
- getCartObjectFromMapviewer(localItem, requestedItem, projections),
95
+ getCartObjectFromMapviewer(
96
+ localItem,
97
+ requestedItem,
98
+ projections,
99
+ nutsnames,
100
+ ),
88
101
  );
89
102
  setCartItems(cleanDuplicatesEntries(cartItems));
90
103
  }
@@ -129,19 +142,26 @@ const CLMSCartContent = (props) => {
129
142
 
130
143
  function startDownloading() {
131
144
  setLoadingTable(true);
145
+ window.scrollTo(0, 0);
146
+
132
147
  let selectedItems = getSelectedCartItems();
133
148
  const body = getDownloadToolPostBody(selectedItems);
134
149
  const unique_ids = selectedItems.map((item) => item.unique_id);
135
- dispatch(postDownloadtool(body, unique_ids)).then(() => {
136
- setLoadingTable(false);
137
- toast.success(
138
- <Toast
139
- success
140
- autoClose={5000}
141
- title={'Selected file(s) added to the downloading process.'}
142
- />,
143
- );
144
- });
150
+ dispatch(postDownloadtool(body, unique_ids))
151
+ .then((response) => {
152
+ setLoadingTable(false);
153
+ toast.success(
154
+ <Toast
155
+ success
156
+ autoClose={5000}
157
+ title={'Selected file(s) added to the downloading process.'}
158
+ />,
159
+ );
160
+ })
161
+ .catch(function (error) {
162
+ setLoadingTable(false);
163
+ toast.error(<Toast autoClose={5000} title={'Something went wrong.'} />);
164
+ });
145
165
  }
146
166
  const setProjectionValue = (unique_id, value) => {
147
167
  const objIndex = cartItems.findIndex((obj) => obj.unique_id === unique_id);
@@ -233,7 +253,8 @@ const CLMSCartContent = (props) => {
233
253
  {item.area?.type === 'polygon'
234
254
  ? 'Bounding Box'
235
255
  : item.area?.type === 'nuts'
236
- ? 'NUTS ID: ' + item.area.value
256
+ ? 'NUTS ID: ' +
257
+ (item.area.valueName || item.area.value)
237
258
  : '-'}
238
259
  </td>
239
260
  <td>
@@ -6,9 +6,12 @@
6
6
  import { Forbidden, Unauthorized } from '@plone/volto/components';
7
7
  import React, { useEffect, useState } from 'react';
8
8
  import { defineMessages, useIntl } from 'react-intl';
9
- import { getDatasetsByUid, getExtraBreadcrumbItems } from '../../actions';
9
+ import {
10
+ getDatasetsByUid,
11
+ getExtraBreadcrumbItems,
12
+ getNutsNames,
13
+ } from '../../actions';
10
14
  import { useDispatch, useSelector } from 'react-redux';
11
- import { Link } from 'react-router-dom';
12
15
 
13
16
  import { CART_SESSION_KEY } from '@eeacms/volto-clms-utils/cart/useCartState';
14
17
  import CLMSCartContent from './CLMSCartContent';
@@ -16,6 +19,7 @@ import CLMSCartContent from './CLMSCartContent';
16
19
  import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
17
20
  import { FormattedMessage } from 'react-intl';
18
21
  import { Helmet } from '@plone/volto/helpers';
22
+ import { Link } from 'react-router-dom';
19
23
  import useCartState from '@eeacms/volto-clms-utils/cart/useCartState';
20
24
 
21
25
  const CLMSDownloadCartView = (props) => {
@@ -67,6 +71,8 @@ const CLMSDownloadCartView = (props) => {
67
71
  ...new Set(localSessionCart.map((item) => item.UID || item.id)),
68
72
  ];
69
73
  }
74
+ let localsessionNutsIDList = [...new Set(getNutsIDList(localSessionCart))];
75
+
70
76
  // let progress_keys = Object.keys(download_in_progress);
71
77
  // if (progress_keys?.length !== 0) {
72
78
  // downloadInProgressUidsList = [
@@ -88,10 +94,22 @@ const CLMSDownloadCartView = (props) => {
88
94
  if (uidsList.length > 0) {
89
95
  dispatch(getDatasetsByUid(uidsList));
90
96
  }
97
+ if (localsessionNutsIDList.length > 0) {
98
+ dispatch(getNutsNames(localsessionNutsIDList));
99
+ }
91
100
  // eslint-disable-next-line react-hooks/exhaustive-deps
92
101
  }, [localSessionCart, dispatch]);
93
102
  // }, [download_in_progress, localSessionCart, dispatch]);
94
103
 
104
+ function getNutsIDList(cart_data) {
105
+ const nuts_ids = [];
106
+ cart_data?.length > 0 &&
107
+ cart_data.forEach((cart_item) => {
108
+ cart_item.area?.type === 'nuts' && nuts_ids.push(cart_item.area.value);
109
+ });
110
+ return nuts_ids;
111
+ }
112
+
95
113
  return (
96
114
  <>
97
115
  <Helmet title={formatMessage(messages.Cart)} />
@@ -116,38 +134,26 @@ const CLMSDownloadCartView = (props) => {
116
134
  <h1 className="page-title">
117
135
  <FormattedMessage id="Cart" defaultMessage="Cart" />
118
136
  </h1>
119
- <div className="page-description">
120
- <FormattedMessage
121
- id="Lorem"
122
- defaultMessage="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis luctus
123
- mauris ante, a iaculis leo placerat quis."
124
- />
125
- </div>
126
- <hr />
127
137
  <div className="ccl-container">
128
138
  <div className="message-block">
129
139
  <div className="message-icon">
130
- <FontAwesomeIcon
131
- icon={['far', 'comment-alt']}
132
- style={{ maxWidth: '1.5rem' }}
133
- />
140
+ <FontAwesomeIcon icon={['far', 'comment-alt']} fixedWidth />
134
141
  </div>
135
142
  <div className="message-text">
136
143
  <p>
137
- This is a warning related to the funcionality of start
138
- downloading the datasets
144
+ <FormattedMessage id="Note:" defaultMessage="Note:" />
139
145
  </p>
140
146
  <ul>
141
147
  <li>
142
148
  Select the files you want to download and click the button
143
- 'Start downloading' to start with the download process.
149
+ 'Start downloading' to start the download process.
144
150
  </li>
145
151
  <li>
146
152
  You can visit the{' '}
147
153
  <Link to={`/${locale}/cart-downloads`}>
148
154
  downloading process page
149
- </Link>
150
- .{' '}
155
+ </Link>{' '}
156
+ to check the status of your downloads.
151
157
  </li>
152
158
  </ul>
153
159
  </div>
@@ -55,10 +55,15 @@ export const getCartObjectFromMapviewer = (
55
55
  local_cart_data,
56
56
  dataset_data,
57
57
  projections,
58
+ nutsnames,
58
59
  ) => {
60
+ const area = local_cart_data.area;
61
+ if (area.type === 'nuts' && Object.keys(nutsnames).includes(area.value)) {
62
+ area.valueName = nutsnames[area.value];
63
+ }
59
64
  const mapViewer = {
60
65
  name: dataset_data.dataResourceTitle || '-',
61
- area: local_cart_data.area || '-',
66
+ area: area || '-',
62
67
  format:
63
68
  dataset_data.dataset_full_format?.token ||
64
69
  dataset_data.dataset_full_format ||
@@ -1,8 +1,15 @@
1
1
  import CclButton from '@eeacms/volto-clms-theme/components/CclButton/CclButton';
2
- import React from 'react';
2
+ import React, { useEffect } from 'react';
3
+ import { Label } from 'semantic-ui-react';
4
+ import { useDispatch } from 'react-redux';
5
+ import { getBreadcrumbs } from '@plone/volto/actions';
3
6
 
4
7
  export const CLMSDownloadableFileView = (props) => {
8
+ const dispatch = useDispatch();
5
9
  const { content } = props;
10
+ useEffect(() => {
11
+ dispatch(getBreadcrumbs('/'));
12
+ }, [dispatch]);
6
13
  return (
7
14
  <>
8
15
  <div id="page-document" className="ui container">
@@ -12,6 +19,20 @@ export const CLMSDownloadableFileView = (props) => {
12
19
  <p>{content.description}</p>
13
20
  </div>
14
21
  </div>
22
+ {content?.taxonomy_technical_library_categorization &&
23
+ content?.taxonomy_technical_library_categorization?.length > 0 && (
24
+ <Label.Group>
25
+ {content?.taxonomy_technical_library_categorization?.map(
26
+ (keyword, key) => {
27
+ return (
28
+ <Label key={key} color="olive">
29
+ {keyword.title}
30
+ </Label>
31
+ );
32
+ },
33
+ )}
34
+ </Label.Group>
35
+ )}
15
36
  <CclButton download={true} url={content?.file?.download}>
16
37
  Download file
17
38
  </CclButton>
@@ -1,17 +1,18 @@
1
1
  /**
2
- * CLMSInProgressTask container.
3
- * @module components/CLMSInProgressTask/CLMSInProgressTask
2
+ * CLMSDownloadTask container.
3
+ * @module components/CLMSDownloadTask/CLMSDownloadTask
4
4
  */
5
5
 
6
- // import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
7
- import { Grid } from 'semantic-ui-react';
8
6
  import React, { useEffect, useState } from 'react';
9
7
  import { deleteDownloadtool, getDownloadtool } from '../../actions';
10
8
  import { useDispatch, useSelector } from 'react-redux';
9
+
11
10
  import FileCard from './FileCard';
12
11
  import { FormattedMessage } from 'react-intl';
12
+ // import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
13
+ import { Grid } from 'semantic-ui-react';
13
14
 
14
- const CLMSTasksInProgress = (props) => {
15
+ const CLMSDownloadTask = (props) => {
15
16
  const dispatch = useDispatch();
16
17
  const [taskInProgress, setTaskInProgress] = useState([]);
17
18
  // const [cancelledTasks, setCancelledTasks] = useState([]);
@@ -23,6 +24,7 @@ const CLMSTasksInProgress = (props) => {
23
24
 
24
25
  const user_id = useSelector((state) => state.users.user.id);
25
26
  const datasets = useSelector((state) => state.datasetsByUid.datasets.items);
27
+ const nutsnames = useSelector((state) => state.nutsnames.nutsnames);
26
28
 
27
29
  useEffect(() => {
28
30
  dispatch(getDownloadtool());
@@ -46,6 +48,16 @@ const CLMSTasksInProgress = (props) => {
46
48
  // eslint-disable-next-line react-hooks/exhaustive-deps
47
49
  }, [datasets]);
48
50
 
51
+ useEffect(() => {
52
+ if (Object.keys(nutsnames).length > 0) {
53
+ addNutsName(taskInProgress, setTaskInProgress);
54
+ addNutsName(finishedOKTasks, setFinishedOKTasks);
55
+ addNutsName(finishedNOKTasks, setFinishedNOKTasks);
56
+ addNutsName(rejectedTasks, setRejectedTasks);
57
+ }
58
+ // eslint-disable-next-line react-hooks/exhaustive-deps
59
+ }, [nutsnames]);
60
+
49
61
  function addDatasetName(data, setter) {
50
62
  let intermediate = [...data];
51
63
  intermediate.forEach((task) => {
@@ -60,6 +72,20 @@ const CLMSTasksInProgress = (props) => {
60
72
  });
61
73
  setter(intermediate);
62
74
  }
75
+
76
+ function addNutsName(data, setter) {
77
+ let intermediate = [...data];
78
+ intermediate.forEach((task) => {
79
+ task.Datasets.forEach((dataset) => {
80
+ const requestedItem = Object.keys(nutsnames).includes(dataset.NUTSID);
81
+ if (requestedItem) {
82
+ dataset.NUTSName = nutsnames[dataset.NUTSID];
83
+ }
84
+ });
85
+ });
86
+ setter(intermediate);
87
+ }
88
+
63
89
  const deleteTaskInProgress = (task_id) => {
64
90
  setShowDeleteTaskLoading(task_id);
65
91
  dispatch(deleteDownloadtool(task_id));
@@ -72,10 +98,7 @@ const CLMSTasksInProgress = (props) => {
72
98
  <Grid columns={1} stackable padded="vertically">
73
99
  <Grid.Column>
74
100
  <h2>
75
- <FormattedMessage
76
- id="Task In Progress"
77
- defaultMessage="Task In Progress"
78
- />
101
+ <FormattedMessage id="In progress" defaultMessage="In progress" />
79
102
  </h2>
80
103
  {taskInProgress?.length !== 0 ? (
81
104
  <Grid columns={2}>
@@ -93,8 +116,8 @@ const CLMSTasksInProgress = (props) => {
93
116
  ) : (
94
117
  <p>
95
118
  <FormattedMessage
96
- id="There is no task in progress"
97
- defaultMessage="There is no task in progress"
119
+ id="There are no tasks in progress"
120
+ defaultMessage="There are no tasks in progress"
98
121
  />
99
122
  </p>
100
123
  )}
@@ -111,10 +134,7 @@ const CLMSTasksInProgress = (props) => {
111
134
  </Grid.Column>
112
135
  <Grid.Column>
113
136
  <h2>
114
- <FormattedMessage
115
- id="Finished Correctly"
116
- defaultMessage="Finished Correctly"
117
- />
137
+ <FormattedMessage id="Completed" defaultMessage="Completed" />
118
138
  </h2>
119
139
  {finishedOKTasks?.length !== 0 ? (
120
140
  <Grid columns={2}>
@@ -133,8 +153,8 @@ const CLMSTasksInProgress = (props) => {
133
153
  ) : (
134
154
  <p>
135
155
  <FormattedMessage
136
- id="There is no correctly finished task"
137
- defaultMessage="There is no correctly finished task"
156
+ id="There are no completed tasks"
157
+ defaultMessage="There are no completed tasks"
138
158
  />
139
159
  </p>
140
160
  )}
@@ -142,12 +162,12 @@ const CLMSTasksInProgress = (props) => {
142
162
  <Grid.Column>
143
163
  <h2>
144
164
  <FormattedMessage
145
- id="Finished Not Correctly"
146
- defaultMessage="Finished Not Correctly"
165
+ id="Finished with errors"
166
+ defaultMessage="Finished with errors"
147
167
  />
148
168
  </h2>
149
169
  {finishedNOKTasks?.length !== 0 ? (
150
- <Grid columns={2}>
170
+ <Grid columns={1}>
151
171
  {finishedNOKTasks?.length > 0 &&
152
172
  finishedNOKTasks.map((item, key) => (
153
173
  <Grid.Column key={key}>
@@ -163,8 +183,8 @@ const CLMSTasksInProgress = (props) => {
163
183
  ) : (
164
184
  <p>
165
185
  <FormattedMessage
166
- id="There is no incorrectly finished task"
167
- defaultMessage="There is no incorrectly finished task"
186
+ id="There are no tasks finished with errors"
187
+ defaultMessage="There are no tasks finished with errors"
168
188
  />
169
189
  </p>
170
190
  )}
@@ -174,7 +194,7 @@ const CLMSTasksInProgress = (props) => {
174
194
  <FormattedMessage id="Rejected" defaultMessage="Rejected" />
175
195
  </h2>
176
196
  {rejectedTasks?.length !== 0 ? (
177
- <Grid columns={2}>
197
+ <Grid columns={1}>
178
198
  {rejectedTasks?.length > 0 &&
179
199
  rejectedTasks.map((item, key) => (
180
200
  <Grid.Column key={key}>
@@ -190,8 +210,8 @@ const CLMSTasksInProgress = (props) => {
190
210
  ) : (
191
211
  <p>
192
212
  <FormattedMessage
193
- id="There is no rejected task"
194
- defaultMessage="There is no rejected task"
213
+ id="There are no rejected tasks"
214
+ defaultMessage="There are no rejected tasks"
195
215
  />
196
216
  </p>
197
217
  )}
@@ -199,4 +219,4 @@ const CLMSTasksInProgress = (props) => {
199
219
  </Grid>
200
220
  );
201
221
  };
202
- export default CLMSTasksInProgress;
222
+ export default CLMSDownloadTask;
@@ -6,11 +6,14 @@
6
6
  import { Forbidden, Unauthorized } from '@plone/volto/components';
7
7
  import React, { useEffect } from 'react';
8
8
  import { defineMessages, useIntl } from 'react-intl';
9
- import { getDatasetsByUid, getExtraBreadcrumbItems } from '../../actions';
9
+ import {
10
+ getDatasetsByUid,
11
+ getExtraBreadcrumbItems,
12
+ getDownloadtool,
13
+ } from '../../actions';
10
14
  import { useDispatch, useSelector } from 'react-redux';
11
15
 
12
- import CLMSTasksInProgress from './CLMSTasksInProgress';
13
- import { FormattedMessage } from 'react-intl';
16
+ import CLMSDownloadTask from './CLMSDownloadTasks';
14
17
  import { Helmet } from '@plone/volto/helpers';
15
18
  import useCartState from '@eeacms/volto-clms-utils/cart/useCartState';
16
19
 
@@ -22,8 +25,8 @@ const CLMSDownloadsView = (props) => {
22
25
  const { formatMessage } = useIntl();
23
26
  const messages = defineMessages({
24
27
  CartDownloads: {
25
- id: 'Cart Downloads',
26
- defaultMessage: 'Cart Downloads',
28
+ id: 'Downloads',
29
+ defaultMessage: 'Downloads',
27
30
  },
28
31
  });
29
32
 
@@ -98,6 +101,12 @@ const CLMSDownloadsView = (props) => {
98
101
  // eslint-disable-next-line react-hooks/exhaustive-deps
99
102
  }, [downloadtool, dispatch]);
100
103
 
104
+ useEffect(() => {
105
+ if (downloadtool.delete_download_in_progress) {
106
+ dispatch(getDownloadtool());
107
+ }
108
+ }, [dispatch, downloadtool.delete_download_in_progress]);
109
+
101
110
  return (
102
111
  <>
103
112
  <Helmet title={formatMessage(messages.CartDownloads)} />
@@ -120,15 +129,11 @@ const CLMSDownloadsView = (props) => {
120
129
  {isLoggedIn && (
121
130
  <>
122
131
  <h1 className="page-title">
123
- <FormattedMessage
124
- id="Cart Downloads"
125
- defaultMessage="Cart Downloads"
126
- />
132
+ {formatMessage(messages.CartDownloads)}
127
133
  </h1>
128
134
  <div className="ccl-container">
129
- <CLMSTasksInProgress />
135
+ <CLMSDownloadTask />
130
136
  </div>
131
- <hr />
132
137
  </>
133
138
  )}
134
139
  </div>
@@ -3,16 +3,51 @@
3
3
  * @module components/CLMSDownloadsView/FileCard
4
4
  */
5
5
 
6
- import { Loader, Popup, Segment, Grid, Header } from 'semantic-ui-react';
7
- import React from 'react';
6
+ import './filecard.less';
7
+
8
+ import { Grid, Header, Loader, Popup, Segment } from 'semantic-ui-react';
9
+ import { defineMessages, useIntl } from 'react-intl';
8
10
 
11
+ import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
9
12
  import { Icon } from '@plone/volto/components';
13
+ import React from 'react';
14
+ import alertSVG from '@plone/volto/icons/alert.svg';
15
+ import errorSVG from '@plone/volto/icons/error.svg';
16
+ import { faInfoCircle } from '@fortawesome/free-solid-svg-icons';
17
+ import packSVG from '@plone/volto/icons/pack.svg';
10
18
  // import cancelledSVG from '@plone/volto/icons/spam.svg';
11
19
  import removeSVG from '@plone/volto/icons/delete.svg';
12
- import packSVG from '@plone/volto/icons/pack.svg';
13
- import errorSVG from '@plone/volto/icons/error.svg';
14
- import alertSVG from '@plone/volto/icons/alert.svg';
15
- import { defineMessages, useIntl } from 'react-intl';
20
+
21
+ const prettyBytes = require('pretty-bytes');
22
+
23
+ const messages = defineMessages({
24
+ PrePackaged: {
25
+ id: 'Pre-packaged',
26
+ defaultMessage: 'Pre-packaged',
27
+ },
28
+ Download: {
29
+ id: 'Download file',
30
+ defaultMessage: 'Download file',
31
+ },
32
+ });
33
+
34
+ const DatasetNaming = (props) => {
35
+ const { formatMessage } = useIntl();
36
+ const { dataset } = props;
37
+ return (
38
+ <>
39
+ {`${dataset['name']} -
40
+ ${
41
+ dataset?.OutputFormat
42
+ ? dataset?.OutputFormat
43
+ : formatMessage(messages.PrePackaged)
44
+ }`}
45
+ {((dataset?.NUTSName || dataset?.NUTSID) &&
46
+ ` (NUTS: ${dataset?.NUTSName || dataset?.NUTSID})`) ||
47
+ (dataset?.BoundingBox && ' (Bounding Box)')}{' '}
48
+ </>
49
+ );
50
+ };
16
51
 
17
52
  const FileCard = (props) => {
18
53
  const { item, showDeleteTaskLoading, deleteTaskInProgress } = props;
@@ -24,16 +59,7 @@ const FileCard = (props) => {
24
59
  (today.getTime() - FinalizationDate.getTime()) / (1000 * 3600 * 24),
25
60
  );
26
61
  }
27
- const messages = defineMessages({
28
- PrePackaged: {
29
- id: 'Pre-packaged',
30
- defaultMessage: 'Pre-packaged',
31
- },
32
- Download: {
33
- id: 'Download file',
34
- defaultMessage: 'Download file',
35
- },
36
- });
62
+
37
63
  return (
38
64
  <Segment color="olive">
39
65
  <Grid
@@ -41,14 +67,15 @@ const FileCard = (props) => {
41
67
  centered
42
68
  columns={item?.Status !== 'In_progress' ? 2 : 3}
43
69
  padded
70
+ className="filecard"
44
71
  >
45
72
  <Grid.Row>
46
- <Grid.Column verticalAlign="middle" textAlign="center" width={3}>
73
+ <Grid.Column verticalAlign="middle" textAlign="center" width={2}>
47
74
  {item?.Status === 'In_progress' && (
48
75
  <Popup
49
76
  content="In progress"
50
77
  size="small"
51
- trigger={<Loader active inline indeterminate size="big" />}
78
+ trigger={<Loader active inline indeterminate size="medium" />}
52
79
  />
53
80
  )}
54
81
  {/* {item?.Status === 'Cancelled' && (
@@ -72,7 +99,7 @@ const FileCard = (props) => {
72
99
  trigger={
73
100
  <Icon
74
101
  name={packSVG}
75
- size={75}
102
+ size={50}
76
103
  color="#a0b128"
77
104
  title={'Finished correctly'}
78
105
  />
@@ -86,7 +113,7 @@ const FileCard = (props) => {
86
113
  trigger={
87
114
  <Icon
88
115
  name={errorSVG}
89
- size={75}
116
+ size={50}
90
117
  color="#e40166"
91
118
  title={'Finished with errors'}
92
119
  />
@@ -100,7 +127,7 @@ const FileCard = (props) => {
100
127
  trigger={
101
128
  <Icon
102
129
  name={alertSVG}
103
- size={75}
130
+ size={50}
104
131
  color="#e40166"
105
132
  title={'Rejected download'}
106
133
  />
@@ -108,44 +135,69 @@ const FileCard = (props) => {
108
135
  />
109
136
  )}
110
137
  </Grid.Column>
111
- <Grid.Column width={item?.Status === 'In_progress' ? 7 : 9}>
112
- <Header>{`Task ID: ${item?.TaskID}`}</Header>
113
- {item?.Datasets.length === 1 && (
114
- <p>{`${item?.Datasets[0].name} - ${
115
- item.Datasets[0]['OutputFormat']
116
- ? item.Datasets[0]['OutputFormat']
117
- : formatMessage(messages.PrePackaged)
118
- }`}</p>
119
- )}
120
- {item?.Datasets.length > 1 && (
138
+ <Grid.Column width={item?.Status === 'In_progress' ? 8 : 10}>
139
+ <Header as="h3">{`Task ID: ${item?.TaskID}`}</Header>
140
+ <Segment basic className="file-datetimes">
141
+ Start date:{' '}
142
+ {new Date(item?.RegistrationDateTime).toLocaleString('en-GB', {
143
+ timeZone: 'UTC',
144
+ })}{' '}
145
+ <span
146
+ className="info-icon"
147
+ tooltip="Dates and times are in UTC"
148
+ direction="up"
149
+ >
150
+ <FontAwesomeIcon icon={faInfoCircle} />
151
+ </span>
152
+ <br />
153
+ {item?.FinalizationDateTime && (
154
+ <>
155
+ End date:{' '}
156
+ {new Date(item?.FinalizationDateTime).toLocaleString(
157
+ 'en-GB',
158
+ {
159
+ timeZone: 'UTC',
160
+ },
161
+ )}
162
+ <span
163
+ className="info-icon"
164
+ tooltip="Dates and times are in UTC"
165
+ direction="up"
166
+ >
167
+ <FontAwesomeIcon icon={faInfoCircle} />
168
+ </span>
169
+ </>
170
+ )}
171
+ </Segment>
172
+ {item?.Datasets.length > 0 && (
121
173
  <ul>
122
174
  {item?.Datasets.map((dataset) => (
123
175
  <li>
124
- {`${dataset['name']} -
125
- ${
126
- dataset['OutputFormat']
127
- ? dataset['OutputFormat']
128
- : formatMessage(messages.PrePackaged)
129
- }`}
176
+ <DatasetNaming dataset={dataset} />
130
177
  </li>
131
178
  ))}
132
179
  </ul>
133
180
  )}
134
- {item?.Status === 'Finished_ok' && (
135
- <>
136
- {item?.FileSize && <p>{`${item.FileSize} MB`}</p>}
181
+ {item?.Status === 'Finished_ok' && 10 - daysDiff > -1 && (
182
+ <Segment basic>
137
183
  {item?.DownloadURL && (
138
184
  <a href={item.DownloadURL} target="_blank" rel="noreferrer">
139
185
  {formatMessage(messages.Download)}
140
186
  </a>
141
187
  )}
188
+ {item?.FileSize && ` (${prettyBytes(item.FileSize)})`}
142
189
  {item?.FinalizationDateTime &&
143
190
  ` | Expires in ${10 - daysDiff} days`}
144
- </>
191
+ </Segment>
145
192
  )}
146
193
  </Grid.Column>
147
194
  {item?.Status === 'In_progress' && (
148
- <Grid.Column width={2} verticalAlign="middle" textAlign="center">
195
+ <Grid.Column
196
+ width={2}
197
+ verticalAlign="middle"
198
+ textAlign="center"
199
+ className="trashcontainer"
200
+ >
149
201
  {showDeleteTaskLoading === item?.TaskID ? (
150
202
  <Loader
151
203
  active
@@ -175,7 +227,7 @@ const FileCard = (props) => {
175
227
  >
176
228
  <Icon
177
229
  name={removeSVG}
178
- size={40}
230
+ size={30}
179
231
  color="#e40166"
180
232
  title={'Remove in progress task'}
181
233
  />
@@ -0,0 +1,12 @@
1
+ .ui.column.grid.filecard li,
2
+ .ui.column.grid.filecard div {
3
+ font-size: 16px;
4
+ }
5
+
6
+ .ui.column.grid.filecard h3 {
7
+ font-size: 18px;
8
+ }
9
+
10
+ .ui.column.grid.filecard div.trashcontainer {
11
+ box-shadow: none !important;
12
+ }
@@ -162,7 +162,7 @@ class Header extends Component {
162
162
  <li className="header-vertical-line">
163
163
  <div>|</div>
164
164
  </li>
165
- {(this.props.user.id && (
165
+ {(this.props.user?.id && (
166
166
  <>
167
167
  <li className="header-dropdown">
168
168
  <>
@@ -171,8 +171,8 @@ class Header extends Component {
171
171
  icon={['fas', 'user']}
172
172
  style={{ marginRight: '0.5rem' }}
173
173
  />
174
- {this.props.user.fullname ||
175
- this.props.user.id ||
174
+ {this.props.user?.fullname ||
175
+ this.props.user?.id ||
176
176
  ''}
177
177
  <span className="ccl-icon-chevron-thin-down"></span>
178
178
  </span>
@@ -182,7 +182,15 @@ class Header extends Component {
182
182
  to={`/${this.props.locale}/profile`}
183
183
  className="header-login-link"
184
184
  >
185
- {this.props.user.id && <>{'My settings'}</>}
185
+ My settings
186
+ </Link>
187
+ </li>
188
+ <li>
189
+ <Link
190
+ to={`/${this.props.locale}/cart-downloads`}
191
+ className="header-login-link"
192
+ >
193
+ Downloads
186
194
  </Link>
187
195
  </li>
188
196
  <li>
package/src/index.js CHANGED
@@ -78,6 +78,7 @@ const applyConfig = (config) => {
78
78
  '/profile',
79
79
  '/download-by-area',
80
80
  '/cart',
81
+ '/cart-downloads',
81
82
  '/newsletter-notification-subscription',
82
83
  '/newsletter-notification-unsubscription',
83
84
  ],
@@ -112,6 +113,7 @@ const applyConfig = (config) => {
112
113
  ...config.settings.registry,
113
114
  login_url: 'clms.addon.login_url_controlpanel.login_url',
114
115
  },
116
+ showTags: false,
115
117
  };
116
118
 
117
119
  config.addonRoutes = [
@@ -16,6 +16,9 @@ const getInitialState = {
16
16
  loaded: false,
17
17
  loading: false,
18
18
  download_in_progress: {},
19
+ download_finished_ok: {},
20
+ download_finished_nok: {},
21
+ download_rejected: {},
19
22
  delete_download_in_progress: {},
20
23
  post_download_in_progress: {},
21
24
  format_conversion_table_in_progress: {},
@@ -118,7 +121,7 @@ export const downloadtoolReducer = (state = getInitialState, action = {}) => {
118
121
  error: null,
119
122
  loaded: true,
120
123
  loading: false,
121
- delete_download_in_progress: action.result,
124
+ delete_download_in_progress: true,
122
125
  };
123
126
 
124
127
  case `${GET_FORMATCONVERSIONTABLE}_PENDING`:
@@ -0,0 +1,45 @@
1
+ /**
2
+ * Downloadtool/nutsnames reducer.
3
+ * @module reducers/downloadtool/nutsnames
4
+ */
5
+
6
+ import { GET_NUTSNAME } from '../../actions';
7
+
8
+ const getInitialState = {
9
+ error: null,
10
+ loaded: false,
11
+ loading: false,
12
+ nutsnames: {},
13
+ };
14
+
15
+ export const nutsnamesReducer = (state = getInitialState, action = {}) => {
16
+ switch (action?.type) {
17
+ case `${GET_NUTSNAME}_PENDING`:
18
+ return {
19
+ ...state,
20
+ error: null,
21
+ loaded: false,
22
+ loading: true,
23
+ };
24
+
25
+ case `${GET_NUTSNAME}_FAIL`:
26
+ return {
27
+ ...state,
28
+ error: action.error,
29
+ loaded: false,
30
+ loading: false,
31
+ };
32
+
33
+ case `${GET_NUTSNAME}_SUCCESS`:
34
+ return {
35
+ ...state,
36
+ error: null,
37
+ loaded: true,
38
+ loading: false,
39
+ nutsnames: action.result,
40
+ };
41
+
42
+ default:
43
+ return state;
44
+ }
45
+ };
@@ -9,13 +9,14 @@ import { extraBreadcrumbItemsReducer } from './extra_breadcrumbs/extra_breadcrum
9
9
  import { importGeonetworkReducer } from './geonetwork/import_geonetwork_reducer';
10
10
  import { meetingRegisterReducer } from './meeting/meeting_register_reducer';
11
11
  import { meetingSubscribersReducer } from './meeting/meeting_subscribers_reducer';
12
+ // import { newsletterReducer } from './newsletter/newsletter_reducer';
13
+ import { newsletterSubscribersReducer } from './newsletter/get_newsletter_reducer';
14
+ import { nutsnamesReducer } from './downloadtool/nutsnames_reducer';
12
15
  import { registryReducer } from './registry/registry';
16
+ import { subscribeToReducer } from './subscription/subscription_reducer';
13
17
  // import defaultReducers from '@plone/volto/reducers';
14
18
  import tokens from './tokens/tokens';
15
19
  import { userschemaReducer } from './userschema/userschema';
16
- // import { newsletterReducer } from './newsletter/newsletter_reducer';
17
- import { newsletterSubscribersReducer } from './newsletter/get_newsletter_reducer';
18
- import { subscribeToReducer } from './subscription/subscription_reducer';
19
20
 
20
21
  /**
21
22
  * Root reducer.
@@ -32,6 +33,7 @@ const reducers = {
32
33
  meeting_register: meetingRegisterReducer,
33
34
  subscribers: meetingSubscribersReducer,
34
35
  downloadtool: downloadtoolReducer,
36
+ nutsnames: nutsnamesReducer,
35
37
  registry: registryReducer,
36
38
  geonetwork_importation: importGeonetworkReducer,
37
39
  userschema: userschemaReducer,