@eeacms/volto-clms-theme 1.0.80 → 1.0.81

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -4,8 +4,27 @@ 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.81](https://github.com/eea/volto-clms-theme/compare/1.0.80...1.0.81)
8
+
9
+ - new status [`#230`](https://github.com/eea/volto-clms-theme/pull/230)
10
+ - Dataset extra formats [`#229`](https://github.com/eea/volto-clms-theme/pull/229)
11
+ - Prepackaged table columns [`#228`](https://github.com/eea/volto-clms-theme/pull/228)
12
+ - fix tests [`326f571`](https://github.com/eea/volto-clms-theme/commit/326f57114023154467af0357f56aa35feb21f66a)
13
+ - add new values to initial state [`2c2bff9`](https://github.com/eea/volto-clms-theme/commit/2c2bff92440565e9f5fe8ccb173a5f8f73ccc175)
14
+ - fix [`f91ae0b`](https://github.com/eea/volto-clms-theme/commit/f91ae0b9b4c041c865fde9cad1462c9d770454ee)
15
+ - tests [`2f6d48e`](https://github.com/eea/volto-clms-theme/commit/2f6d48ed551df5b1620b69f440d6c802216ab38b)
16
+ - Cart modifications for extra formats [`7406959`](https://github.com/eea/volto-clms-theme/commit/74069598e41d40ccfb411a166040be151829c970)
17
+ - new widget for extra formats [`0b8ed19`](https://github.com/eea/volto-clms-theme/commit/0b8ed19faba3bbe24fdb1ad9b29685d2ac7dc101)
18
+ - remove some fields [`fad800e`](https://github.com/eea/volto-clms-theme/commit/fad800e836686c847e5afbdfa8fc4c4729a9e8ff)
19
+ - conditioned columns [`e0c1126`](https://github.com/eea/volto-clms-theme/commit/e0c1126ce17359037d7e1ac8b7132006a242845f)
20
+ - widget modification [`17e991c`](https://github.com/eea/volto-clms-theme/commit/17e991ceed4b832fe8dc7292c20b8c6c33f2da1f)
21
+ - prepackaged cart modifications [`f9c72f0`](https://github.com/eea/volto-clms-theme/commit/f9c72f0b0893baaf6985cce4bfe623e1cb29e8af)
22
+
7
23
  #### [1.0.80](https://github.com/eea/volto-clms-theme/compare/1.0.79...1.0.80)
8
24
 
25
+ > 7 March 2022
26
+
27
+ - New release [`#227`](https://github.com/eea/volto-clms-theme/pull/227)
9
28
  - Card image border [`#226`](https://github.com/eea/volto-clms-theme/pull/226)
10
29
  - pre-download modal [`d91209f`](https://github.com/eea/volto-clms-theme/commit/d91209f1b01f47217eb7ca330f5bfdcae0d10c74)
11
30
  - hide text when not logged in [`c4b88e5`](https://github.com/eea/volto-clms-theme/commit/c4b88e5d4960d5b3d752d9d8852bfe1bb0911bca)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eeacms/volto-clms-theme",
3
- "version": "1.0.80",
3
+ "version": "1.0.81",
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",
@@ -199,13 +199,45 @@ const CLMSCartContent = (props) => {
199
199
 
200
200
  const AreaNaming = (areaProps) => {
201
201
  const { item } = areaProps;
202
- function nutsName(nItem) {
203
- return nItem.area?.type === 'nuts'
204
- ? 'NUTS: ' + (nItem.area.valueName || nItem.area.value)
205
- : '-';
202
+ switch (item.area?.type) {
203
+ case 'polygon':
204
+ return 'Bounding Box';
205
+ case 'nuts':
206
+ return 'NUTS: ' + (item.area.valueName || item.area.value);
207
+ case undefined:
208
+ return item.area || '-';
209
+ default:
210
+ return '-';
206
211
  }
212
+ };
213
+
214
+ const TypeNaming = (typeProps) => {
215
+ const { item } = typeProps;
216
+ if (item.file_id) {
217
+ return (
218
+ <span className={'tag tag-' + item?.type?.toLowerCase()}>
219
+ {contentOrDash(item.type)}
220
+ </span>
221
+ );
222
+ } else if (!item.type) {
223
+ return '-';
224
+ }
225
+
207
226
  return (
208
- <>{item.area?.type === 'polygon' ? 'Bounding Box' : nutsName(item)}</>
227
+ <Select
228
+ placeholder="Select type"
229
+ value={item.type_options.length > 0 && item.type_options[0].id}
230
+ options={item.type_options.map((option) => {
231
+ return { key: option.id, value: option.id, text: option.name };
232
+ })}
233
+ onChange={(e, data) => {
234
+ const objIndex = cartItems.findIndex(
235
+ (obj) => obj.unique_id === item.unique_id,
236
+ );
237
+ cartItems[objIndex].type = data.value;
238
+ setCartItems([...cartItems]);
239
+ }}
240
+ />
209
241
  );
210
242
  };
211
243
 
@@ -243,8 +275,6 @@ const CLMSCartContent = (props) => {
243
275
  <th>Type</th>
244
276
  <th>Format</th>
245
277
  <th>Projection</th>
246
- <th>Version</th>
247
- <th>Size</th>
248
278
  <th></th>
249
279
  </tr>
250
280
  </thead>
@@ -285,17 +315,19 @@ const CLMSCartContent = (props) => {
285
315
  </div>
286
316
  </div>
287
317
  </td>
288
- <td>{contentOrDash(item.name)}</td>
318
+ {item.title ? (
319
+ <td>
320
+ {item.title} ({contentOrDash(item.name)})
321
+ </td>
322
+ ) : (
323
+ <td>{contentOrDash(item.name)}</td>
324
+ )}
289
325
  <td>{contentOrDash(item.source)}</td>
290
326
  <td>
291
327
  <AreaNaming item={item} />
292
328
  </td>
293
329
  <td>
294
- <span
295
- className={'tag tag-' + item?.type?.toLowerCase()}
296
- >
297
- {contentOrDash(item.type)}
298
- </span>
330
+ <TypeNaming item={item} />
299
331
  </td>
300
332
  <td className="table-td-format">
301
333
  {!item.file_id ? (
@@ -335,11 +367,9 @@ const CLMSCartContent = (props) => {
335
367
  }}
336
368
  />
337
369
  ) : (
338
- item.projection
370
+ '-'
339
371
  )}
340
372
  </td>
341
- <td>{item.version}</td>
342
- <td>{item.size}</td>
343
373
  <td>
344
374
  {item.task_in_progress ? (
345
375
  <FontAwesomeIcon icon="spinner" spin />
@@ -19,9 +19,12 @@ export const getDownloadToolPostBody = (selectedItems) => {
19
19
  if (item.format) {
20
20
  body_extras['OutputFormat'] = item.format;
21
21
  }
22
- if (item.format) {
22
+ if (item.projection) {
23
23
  body_extras['OutputGCS'] = item.projection;
24
24
  }
25
+ if (item.type) {
26
+ body_extras['DatasetDownloadInformationID'] = item.type;
27
+ }
25
28
  }
26
29
  return { DatasetID: item.dataset_uid, ...body_extras };
27
30
  });
@@ -33,6 +36,7 @@ export const getDownloadToolPostBody = (selectedItems) => {
33
36
  export const getCartObjectFromPrepackaged = (file_data, dataset_data) => {
34
37
  return {
35
38
  name: dataset_data.title,
39
+ title: file_data.title,
36
40
  area: file_data.area,
37
41
  format: file_data.format?.token || file_data.format,
38
42
  resolution: file_data.resolution,
@@ -59,6 +63,12 @@ export const getCartObjectFromMapviewer = (
59
63
  if (area?.type === 'nuts' && Object.keys(nutsnames).includes(area.value)) {
60
64
  area.valueName = nutsnames[area.value];
61
65
  }
66
+ const type_options = [];
67
+ if (dataset_data.dataset_download_information?.items.length > 0) {
68
+ dataset_data.dataset_download_information.items.forEach((item) => {
69
+ type_options.push({ id: item['@id'], name: item.name });
70
+ });
71
+ }
62
72
  return {
63
73
  name: dataset_data.dataResourceTitle || '-',
64
74
  area: area || '-',
@@ -69,7 +79,8 @@ export const getCartObjectFromMapviewer = (
69
79
  resolution: dataset_data.resolution || '-',
70
80
  size: dataset_data.size || '-',
71
81
  source: 'Map viewer',
72
- type: dataset_data.dataResourceType || '-',
82
+ type: type_options.length > 0 ? type_options[0].id : null,
83
+ type_options: type_options,
73
84
  version: dataset_data.version || '-',
74
85
  year: dataset_data.year || '-',
75
86
  id: local_cart_data.id,
@@ -13,13 +13,14 @@ import { Grid } from 'semantic-ui-react';
13
13
 
14
14
  const CLMSDownloadTasks = (props) => {
15
15
  const dispatch = useDispatch();
16
+ const [queued, setQueued] = useState([]);
16
17
  const [taskInProgress, setTaskInProgress] = useState([]);
17
18
  const [finishedOKTasks, setFinishedOKTasks] = useState([]);
18
19
  const [finishedNOKTasks, setFinishedNOKTasks] = useState([]);
19
20
  const [rejectedTasks, setRejectedTasks] = useState([]);
21
+ const [cancelled, setCancelled] = useState([]);
20
22
  const [showDeleteTaskLoading, setShowDeleteTaskLoading] = useState(false);
21
23
  const downloadtool = useSelector((state) => state.downloadtool);
22
-
23
24
  const user_id = useSelector((state) => state.users.user.id);
24
25
  const datasets = useSelector((state) => state.datasetsByUid.datasets.items);
25
26
  const nutsnames = useSelector((state) => state.nutsnames.nutsnames);
@@ -29,28 +30,34 @@ const CLMSDownloadTasks = (props) => {
29
30
  }, [dispatch]);
30
31
 
31
32
  useEffect(() => {
33
+ setQueued(downloadtool.download_queued);
32
34
  setTaskInProgress(downloadtool.download_in_progress);
33
35
  setFinishedOKTasks(downloadtool.download_finished_ok);
34
36
  setFinishedNOKTasks(downloadtool.download_finished_nok);
35
37
  setRejectedTasks(downloadtool.download_rejected);
38
+ setCancelled(downloadtool.download_cancelled);
36
39
  }, [downloadtool]);
37
40
 
38
41
  useEffect(() => {
39
42
  if (datasets?.length > 0) {
43
+ addDatasetName(queued, setQueued);
40
44
  addDatasetName(taskInProgress, setTaskInProgress);
41
45
  addDatasetName(finishedOKTasks, setFinishedOKTasks);
42
46
  addDatasetName(finishedNOKTasks, setFinishedNOKTasks);
43
47
  addDatasetName(rejectedTasks, setRejectedTasks);
48
+ addDatasetName(cancelled, setCancelled);
44
49
  }
45
50
  // eslint-disable-next-line react-hooks/exhaustive-deps
46
51
  }, [datasets]);
47
52
 
48
53
  useEffect(() => {
49
54
  if (Object.keys(nutsnames).length > 0) {
55
+ addNutsName(queued, setQueued);
50
56
  addNutsName(taskInProgress, setTaskInProgress);
51
57
  addNutsName(finishedOKTasks, setFinishedOKTasks);
52
58
  addNutsName(finishedNOKTasks, setFinishedNOKTasks);
53
59
  addNutsName(rejectedTasks, setRejectedTasks);
60
+ addNutsName(cancelled, setCancelled);
54
61
  }
55
62
  // eslint-disable-next-line react-hooks/exhaustive-deps
56
63
  }, [nutsnames]);
@@ -111,6 +118,25 @@ const CLMSDownloadTasks = (props) => {
111
118
  };
112
119
  return (
113
120
  <Grid columns={1} stackable padded="vertically">
121
+ <Grid.Column>
122
+ <h2>
123
+ <FormattedMessage id="queued" defaultMessage="Queued" />
124
+ </h2>
125
+ {queued?.length !== 0 ? (
126
+ <MapTasks
127
+ tasks={queued}
128
+ showDel={showDeleteTaskLoading}
129
+ delTask={deleteTaskInProgress}
130
+ />
131
+ ) : (
132
+ <p>
133
+ <FormattedMessage
134
+ id="There are no tasks queued"
135
+ defaultMessage="There are no tasks queued"
136
+ />
137
+ </p>
138
+ )}
139
+ </Grid.Column>
114
140
  <Grid.Column>
115
141
  <h2>
116
142
  <FormattedMessage id="In progress" defaultMessage="In progress" />
@@ -190,6 +216,21 @@ const CLMSDownloadTasks = (props) => {
190
216
  </p>
191
217
  )}
192
218
  </Grid.Column>
219
+ <Grid.Column>
220
+ <h2>
221
+ <FormattedMessage id="Cancelled" defaultMessage="Cancelled" />
222
+ </h2>
223
+ {cancelled?.length !== 0 ? (
224
+ <MapTasks tasks={cancelled} showDel={showDeleteTaskLoading} />
225
+ ) : (
226
+ <p>
227
+ <FormattedMessage
228
+ id="There are no cancelled tasks"
229
+ defaultMessage="There are no cancelled tasks"
230
+ />
231
+ </p>
232
+ )}
233
+ </Grid.Column>
193
234
  </Grid>
194
235
  );
195
236
  };
@@ -71,22 +71,30 @@ const CLMSDownloadsView = (props) => {
71
71
 
72
72
  useEffect(() => {
73
73
  if (
74
+ downloadtool?.download_queued &&
74
75
  downloadtool?.download_in_progress &&
75
76
  downloadtool?.download_finished_ok &&
76
77
  downloadtool?.download_finished_nok &&
77
- downloadtool?.download_rejected
78
+ downloadtool?.download_rejected &&
79
+ downloadtool?.download_cancelled
78
80
  ) {
81
+ let queuedUidsList = getUIDList(downloadtool.download_queued);
79
82
  let downloadInProgressUidsList = getUIDList(
80
83
  downloadtool?.download_in_progress,
81
84
  );
82
85
  let finishedOKUidsList = getUIDList(downloadtool?.download_finished_ok);
83
86
  let finishedNOKUidsList = getUIDList(downloadtool?.download_finished_nok);
84
87
  let rejectedUidsList = getUIDList(downloadtool?.download_rejected);
88
+ let cancelledUidsList = getUIDList(downloadtool?.download_cancelled);
85
89
  let uidsList = [
86
90
  ...new Set(
87
91
  rejectedUidsList.concat(
88
92
  finishedNOKUidsList.concat(
89
- finishedOKUidsList.concat(downloadInProgressUidsList),
93
+ finishedOKUidsList.concat(
94
+ downloadInProgressUidsList.concat(
95
+ queuedUidsList.concat(cancelledUidsList),
96
+ ),
97
+ ),
90
98
  ),
91
99
  ),
92
100
  ),
@@ -64,15 +64,15 @@ const FileCard = (props) => {
64
64
  <Grid
65
65
  divided
66
66
  centered
67
- columns={item?.Status !== 'In_progress' ? 2 : 3}
67
+ columns={['In_progress', 'Queued'].includes(item?.Status) ? 2 : 3}
68
68
  padded
69
69
  className="filecard"
70
70
  >
71
71
  <Grid.Row>
72
72
  <Grid.Column verticalAlign="middle" textAlign="center" width={2}>
73
- {item?.Status === 'In_progress' && (
73
+ {['In_progress', 'Queued'].includes(item?.Status) && (
74
74
  <Popup
75
- content="In progress"
75
+ content="Preparing download files"
76
76
  size="small"
77
77
  trigger={<Loader active inline indeterminate size="medium" />}
78
78
  />
@@ -120,7 +120,9 @@ const FileCard = (props) => {
120
120
  />
121
121
  )}
122
122
  </Grid.Column>
123
- <Grid.Column width={item?.Status === 'In_progress' ? 8 : 10}>
123
+ <Grid.Column
124
+ width={['In_progress', 'Queued'].includes(item?.Status) ? 8 : 10}
125
+ >
124
126
  <Header as="h3">{`Task ID: ${item?.TaskID}`}</Header>
125
127
  <Segment basic className="file-datetimes">
126
128
  Start date:{' '}
@@ -176,7 +178,7 @@ const FileCard = (props) => {
176
178
  </Segment>
177
179
  )}
178
180
  </Grid.Column>
179
- {item?.Status === 'In_progress' && (
181
+ {['In_progress', 'Queued'].includes(item?.Status) && (
180
182
  <Grid.Column
181
183
  width={2}
182
184
  verticalAlign="middle"
@@ -193,7 +195,7 @@ const FileCard = (props) => {
193
195
  />
194
196
  ) : (
195
197
  <Popup
196
- content="Remove in progress task"
198
+ content="Remove task"
197
199
  size="small"
198
200
  trigger={
199
201
  <button
@@ -214,7 +216,7 @@ const FileCard = (props) => {
214
216
  name={removeSVG}
215
217
  size={30}
216
218
  color="#e40166"
217
- title={'Remove in progress task'}
219
+ title={'Remove task'}
218
220
  />
219
221
  </button>
220
222
  }
@@ -128,6 +128,7 @@ function CclDownloadTable(props) {
128
128
  .map((item) => ({
129
129
  UID: item.UID,
130
130
  file_id: item['@id'],
131
+ area: item.area,
131
132
  unique_id: item.unique_id,
132
133
  }));
133
134
  addCartItem(selectedCartItems);
@@ -151,6 +152,27 @@ function CclDownloadTable(props) {
151
152
  );
152
153
  };
153
154
 
155
+ const contentOrDash = (content) => {
156
+ return content || '-';
157
+ };
158
+
159
+ const hasSome = (field) => {
160
+ return prePackagedCollection.filter((ppItem) => ppItem[field]).length > 0
161
+ ? field
162
+ : '';
163
+ };
164
+
165
+ const columns = [
166
+ hasSome('title'),
167
+ hasSome('area'),
168
+ hasSome('year'),
169
+ hasSome('version'),
170
+ hasSome('resolution'),
171
+ hasSome('type'),
172
+ hasSome('format'),
173
+ hasSome('size'),
174
+ ];
175
+
154
176
  return (
155
177
  <div className="dataset-download-table">
156
178
  <Toast message="Added to cart" time={5000}></Toast>
@@ -203,12 +225,14 @@ function CclDownloadTable(props) {
203
225
  <HeaderCheckbox />{' '}
204
226
  </th>
205
227
  )}
206
- <th>Year</th>
207
- <th>Resolution</th>
208
- <th>Type</th>
209
- <th>Format</th>
210
- <th>Version</th>
211
- <th>Size</th>
228
+ {columns.includes('title') && <th>Title</th>}
229
+ {columns.includes('area') && <th>Area of interest</th>}
230
+ {columns.includes('year') && <th>Year</th>}
231
+ {columns.includes('version') && <th>Version</th>}
232
+ {columns.includes('resolution') && <th>Resolution</th>}
233
+ {columns.includes('type') && <th>Type</th>}
234
+ {columns.includes('format') && <th>Format</th>}
235
+ {columns.includes('size') && <th>Size</th>}
212
236
  </tr>
213
237
  </thead>
214
238
  <tbody>
@@ -229,21 +253,39 @@ function CclDownloadTable(props) {
229
253
  />
230
254
  </td>
231
255
  )}
232
- <td>{dataset_file?.year || 'YYYY'}</td>
233
- <td>{dataset_file?.resolution || '000m'}</td>
234
- <td>
235
- <span
236
- className={
237
- 'tag tag-' +
238
- (dataset_file?.type?.toLowerCase() || 'raster')
239
- }
240
- >
241
- {dataset_file?.type || 'Raster'}
242
- </span>
243
- </td>
244
- <td>{dataset_file?.format || 'Format'}</td>
245
- <td>{dataset_file?.version || 'v0.0'}</td>
246
- <td>{dataset_file?.size || '000.0MB'}</td>
256
+ {columns.includes('title') && (
257
+ <td>{contentOrDash(dataset_file?.title)}</td>
258
+ )}
259
+ {columns.includes('area') && (
260
+ <td>{contentOrDash(dataset_file?.area)}</td>
261
+ )}
262
+ {columns.includes('year') && (
263
+ <td>{contentOrDash(dataset_file?.year)}</td>
264
+ )}
265
+ {columns.includes('version') && (
266
+ <td>{contentOrDash(dataset_file?.version)}</td>
267
+ )}
268
+ {columns.includes('resolution') && (
269
+ <td>{contentOrDash(dataset_file?.resolution)}</td>
270
+ )}
271
+ {columns.includes('type') && (
272
+ <td>
273
+ <span
274
+ className={
275
+ 'tag tag-' +
276
+ (dataset_file?.type?.toLowerCase() || 'raster')
277
+ }
278
+ >
279
+ {contentOrDash(dataset_file?.type)}
280
+ </span>
281
+ </td>
282
+ )}
283
+ {columns.includes('format') && (
284
+ <td>{contentOrDash(dataset_file?.format)}</td>
285
+ )}
286
+ {columns.includes('size') && (
287
+ <td>{contentOrDash(dataset_file?.size)}</td>
288
+ )}
247
289
  </tr>
248
290
  );
249
291
  })
@@ -0,0 +1,75 @@
1
+ import React from 'react';
2
+ import ObjectListWidget from '@plone/volto/components/manage/Widgets/ObjectListWidget';
3
+
4
+ const ItemSchema = () => ({
5
+ title: 'Dataset Download Information',
6
+ properties: {
7
+ name: {
8
+ title: 'Name',
9
+ description: '',
10
+ type: 'string',
11
+ },
12
+ full_path: {
13
+ title: 'Enter the path to the full dataset download file',
14
+ description:
15
+ 'This is used when requesting the download from the map viewer',
16
+ type: 'string',
17
+ },
18
+ full_format: {
19
+ title: 'Enter the format of the full dataset file',
20
+ description: '',
21
+ choices: [
22
+ ['Shapefile', 'Shapefile'],
23
+ ['GDB', 'GDB'],
24
+ ['GPKG', 'GPKG'],
25
+ ['Geojson', 'Geojson'],
26
+ ['Geotiff', 'Geotiff'],
27
+ ['Netcdf', 'Netcdf'],
28
+ ['GML', 'GML'],
29
+ ['WFS', 'WFS'],
30
+ ],
31
+ },
32
+ full_source: {
33
+ title: 'Enter the source of the full dataset file',
34
+ description: '',
35
+ choices: [
36
+ ['WEKEO', 'WEKEO'],
37
+ ['EEA', 'EEA'],
38
+ ['LANDCOVER', 'LANDCOVER'],
39
+ ['LEGACY', 'LEGACY'],
40
+ ],
41
+ },
42
+ wekeo_choices: {
43
+ title: 'WEKEO choices',
44
+ description: '',
45
+ type: 'string',
46
+ },
47
+ },
48
+ fieldsets: [
49
+ {
50
+ id: 'default',
51
+ title: 'File',
52
+ fields: [
53
+ 'name',
54
+ 'full_path',
55
+ 'full_format',
56
+ 'full_source',
57
+ 'wekeo_choices',
58
+ ],
59
+ },
60
+ ],
61
+ required: [],
62
+ });
63
+
64
+ const DatasetDownloadInformationWidget = (props) => {
65
+ return (
66
+ <ObjectListWidget
67
+ schema={ItemSchema()}
68
+ {...props}
69
+ value={props.value?.items || props.default?.items || []}
70
+ onChange={(id, value) => props.onChange(id, { items: value })}
71
+ />
72
+ );
73
+ };
74
+
75
+ export default DatasetDownloadInformationWidget;
@@ -1,14 +1,16 @@
1
- import { getFormatConversionTable, getProjections } from '../../actions';
2
- import { useDispatch, useSelector } from 'react-redux';
3
-
4
- import ObjectListWidget from '@plone/volto/components/manage/Widgets/ObjectListWidget';
5
1
  import React from 'react';
2
+ import ObjectListWidget from '@plone/volto/components/manage/Widgets/ObjectListWidget';
6
3
 
7
- const ItemSchema = (format_choices, projection_choices) => ({
4
+ const ItemSchema = () => ({
8
5
  title: 'Downloadable File',
9
6
  properties: {
7
+ title: {
8
+ title: 'Title',
9
+ description: 'Enter the title of this file.',
10
+ type: 'string',
11
+ },
10
12
  area: {
11
- title: 'Area',
13
+ title: 'Area of interest',
12
14
  description: 'Enter the area of this file.',
13
15
  type: 'string',
14
16
  },
@@ -17,6 +19,11 @@ const ItemSchema = (format_choices, projection_choices) => ({
17
19
  description: 'Enter the year of this file.',
18
20
  type: 'number',
19
21
  },
22
+ version: {
23
+ title: 'Version',
24
+ description: 'Enter the version of this file.',
25
+ type: 'string',
26
+ },
20
27
  resolution: {
21
28
  title: 'Resolution',
22
29
  description: 'Enter the resolution of this file. Ex.: 100m',
@@ -35,16 +42,6 @@ const ItemSchema = (format_choices, projection_choices) => ({
35
42
  format: {
36
43
  title: 'Format',
37
44
  description: 'Enter the format of this file.',
38
- choices: format_choices,
39
- },
40
- projection: {
41
- title: 'Projection',
42
- description: 'Enter the projection of this file.',
43
- choices: projection_choices,
44
- },
45
- version: {
46
- title: 'Version',
47
- description: 'Enter the version of this file.',
48
45
  type: 'string',
49
46
  },
50
47
  size: {
@@ -52,12 +49,6 @@ const ItemSchema = (format_choices, projection_choices) => ({
52
49
  description: 'Enter the size of this file. Ex.: 3.5 GB',
53
50
  type: 'string',
54
51
  },
55
- source: {
56
- title: 'Source',
57
- description: 'Enter the source of this file.',
58
- type: 'string',
59
- // controlled vocabulary: values to be provided by the user
60
- },
61
52
  path: {
62
53
  title: 'Path',
63
54
  description: 'Enter the absolute path of this file in the storage',
@@ -69,15 +60,14 @@ const ItemSchema = (format_choices, projection_choices) => ({
69
60
  id: 'default',
70
61
  title: 'File',
71
62
  fields: [
63
+ 'title',
72
64
  'area',
73
65
  'year',
66
+ 'version',
74
67
  'resolution',
75
68
  'type',
76
69
  'format',
77
- 'projection',
78
- 'version',
79
70
  'size',
80
- 'source',
81
71
  'path',
82
72
  ],
83
73
  },
@@ -86,28 +76,9 @@ const ItemSchema = (format_choices, projection_choices) => ({
86
76
  });
87
77
 
88
78
  const DownloadableFilesWidget = (props) => {
89
- // format_conversion_table_in_progress
90
- const dispatch = useDispatch();
91
- React.useEffect(() => {
92
- dispatch(getFormatConversionTable());
93
- dispatch(getProjections());
94
- }, [dispatch]);
95
- const format_conversion_table_in_progress = useSelector(
96
- (state) => state.downloadtool.format_conversion_table_in_progress,
97
- );
98
- const projections_in_progress = useSelector(
99
- (state) => state.downloadtool.projections_in_progress,
100
- );
101
- let format_choices = Object.keys(
102
- format_conversion_table_in_progress,
103
- ).map((key) => [key, key]);
104
- let projection_choices = [];
105
- if (projections_in_progress.length > 0) {
106
- projection_choices = projections_in_progress.map((key) => [key, key]);
107
- }
108
79
  return (
109
80
  <ObjectListWidget
110
- schema={ItemSchema(format_choices, projection_choices)}
81
+ schema={ItemSchema()}
111
82
  {...props}
112
83
  value={props.value?.items || props.default?.items || []}
113
84
  onChange={(id, value) => props.onChange(id, { items: value })}
package/src/index.js CHANGED
@@ -30,6 +30,7 @@ import DownloadableFilesWidget from './components/Widgets/DownloadableFilesWidge
30
30
  import GeonetworkIdentifiersWidget from './components/Widgets/GeonetworkIdentifiersWidget';
31
31
  import MapLayersWidget from './components/Widgets/MapLayersWidget';
32
32
  import TaxonomyWidget from './components/Widgets/TaxonomyWidget';
33
+ import DatasetDownloadInformationWidget from './components/Widgets/DatasetDownloadInformationWidget';
33
34
  // CUSTOM REDUCERS IMPORT
34
35
  import reducers from './reducers';
35
36
 
@@ -67,6 +68,7 @@ const applyConfig = (config) => {
67
68
  distribution_info_widget: DistributionInfoWidget,
68
69
  geonetwork_identifiers_widget: GeonetworkIdentifiersWidget,
69
70
  text_link_widget: TextLinkWidget,
71
+ dataset_download_information_widget: DatasetDownloadInformationWidget,
70
72
  };
71
73
  config.widgets.id = {
72
74
  ...config.widgets.id,
@@ -15,10 +15,12 @@ const getInitialState = {
15
15
  error: null,
16
16
  loaded: false,
17
17
  loading: false,
18
+ download_queued: {},
18
19
  download_in_progress: {},
19
20
  download_finished_ok: {},
20
21
  download_finished_nok: {},
21
22
  download_rejected: {},
23
+ download_cancelled: {},
22
24
  delete_download_in_progress: {},
23
25
  post_download_in_progress: {},
24
26
  format_conversion_table_in_progress: {},
@@ -59,6 +61,7 @@ export const downloadtoolReducer = (state = getInitialState, action = {}) => {
59
61
  TaskID: progress_key,
60
62
  });
61
63
  });
64
+ var queued = tasks_array.filter((task) => task.Status === 'Queued');
62
65
  var in_progress = tasks_array.filter(
63
66
  (task) => task.Status === 'In_progress',
64
67
  );
@@ -69,15 +72,18 @@ export const downloadtoolReducer = (state = getInitialState, action = {}) => {
69
72
  (task) => task.Status === 'Finished_nok',
70
73
  );
71
74
  var rejected = tasks_array.filter((task) => task.Status === 'Rejected');
75
+ var cancelled = tasks_array.filter((task) => task.Status === 'Cancelled');
72
76
  return {
73
77
  ...state,
74
78
  error: null,
75
79
  loaded: true,
76
80
  loading: false,
81
+ download_queued: queued,
77
82
  download_in_progress: in_progress,
78
83
  download_finished_ok: finished_ok,
79
84
  download_finished_nok: finished_nok,
80
85
  download_rejected: rejected,
86
+ download_cancelled: cancelled,
81
87
  };
82
88
  case `${POST_DOWNLOADTOOL}_SUCCESS`:
83
89
  return {
@@ -14,8 +14,10 @@ describe('downloadtoolReducer', () => {
14
14
  error: null,
15
15
  loaded: false,
16
16
  loading: false,
17
+ download_queued: {},
17
18
  download_in_progress: {},
18
19
  download_finished_ok: {},
20
+ download_cancelled: {},
19
21
  download_finished_nok: {},
20
22
  download_rejected: {},
21
23
  delete_download_in_progress: {},
@@ -32,6 +34,7 @@ describe('downloadtoolReducer', () => {
32
34
  error: null,
33
35
  loaded: false,
34
36
  loading: false,
37
+ download_queued: {},
35
38
  download_in_progress: {},
36
39
  download_finished_ok: {
37
40
  '1': {
@@ -47,6 +50,7 @@ describe('downloadtoolReducer', () => {
47
50
  },
48
51
  download_finished_nok: {},
49
52
  download_rejected: {},
53
+ download_cancelled: {},
50
54
  delete_download_in_progress: {},
51
55
  post_download_in_progress: {},
52
56
  format_conversion_table_in_progress: {},
@@ -72,8 +76,10 @@ describe('downloadtoolReducer', () => {
72
76
  error: null,
73
77
  loaded: true,
74
78
  loading: false,
79
+ download_queued: [],
75
80
  download_in_progress: [],
76
81
  download_finished_ok: [],
82
+ download_cancelled: [],
77
83
  download_finished_nok: [],
78
84
  download_rejected: [],
79
85
  delete_download_in_progress: {},
@@ -122,6 +128,7 @@ describe('downloadtoolReducer', () => {
122
128
  error: null,
123
129
  loaded: false,
124
130
  loading: false,
131
+ download_queued: {},
125
132
  download_in_progress: {},
126
133
  download_finished_ok: {},
127
134
  download_finished_nok: {},
@@ -152,6 +159,7 @@ describe('downloadtoolReducer', () => {
152
159
  error: null,
153
160
  loaded: true,
154
161
  loading: false,
162
+ download_queued: {},
155
163
  download_in_progress: {},
156
164
  download_finished_ok: {},
157
165
  download_finished_nok: {},