@eeacms/volto-clms-theme 1.0.101 → 1.0.104

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.
Files changed (28) hide show
  1. package/CHANGELOG.md +39 -0
  2. package/package.json +1 -1
  3. package/src/components/Blocks/CclHomeProductsBlock/CclHomeProductsBlockView.jsx +11 -4
  4. package/src/components/Blocks/CclHomeProductsBlock/HomeProductsSchema.js +5 -5
  5. package/src/components/Blocks/CustomTemplates/VoltoFormBlock/VocabularyWidget.jsx +67 -0
  6. package/src/components/Blocks/CustomTemplates/VoltoSearchBlock/CheckboxTreeFacet.jsx +44 -8
  7. package/src/components/Blocks/CustomTemplates/VoltoSearchBlock/FilterList.jsx +10 -2
  8. package/src/components/Blocks/CustomTemplates/VoltoSearchBlock/RightModalFacets.jsx +11 -3
  9. package/src/components/Blocks/CustomTemplates/VoltoSearchBlock/SearchInput.jsx +59 -0
  10. package/src/components/Blocks/customBlocks.js +13 -0
  11. package/src/components/CLMSDownloadCartView/CLMSCartContent.jsx +9 -1
  12. package/src/components/CLMSDownloadCartView/cartUtils.js +1 -0
  13. package/src/components/CLMSDownloadsView/CLMSDownloadTasks.jsx +74 -119
  14. package/src/components/CLMSDownloadsView/FileCard.jsx +27 -27
  15. package/src/components/CLMSMeetingView/CLMSMeetingView.jsx +12 -8
  16. package/src/components/CLMSNewsItemView/CLMSNewsItemView.jsx +11 -8
  17. package/src/components/CLMSSubscriptionView/SubscriptionView.jsx +36 -10
  18. package/src/components/CLMSWorkOpportunityView/WorkOpportunityView.jsx +57 -0
  19. package/src/components/CclDownloadTable/CclDownloadTable.jsx +12 -3
  20. package/src/components/CclLoginModal/CclLoginModal.jsx +3 -2
  21. package/src/components/CclLoginModal/ccl-login-modal.css +5 -0
  22. package/src/components/Widgets/DatasetDownloadInformationWidget.jsx +6 -0
  23. package/src/customizations/volto/components/manage/Blocks/Search/components/Facets.jsx +100 -0
  24. package/src/customizations/volto/components/theme/Footer/Footer.jsx +36 -6
  25. package/src/customizations/volto/components/theme/Logout/Logout.jsx +2 -15
  26. package/src/customizations/volto/components/theme/Unauthorized/Unauthorized.jsx +59 -0
  27. package/src/customizations/volto/components/theme/Unauthorized/Unauthorized.test.jsx +32 -0
  28. package/src/index.js +3 -0
package/CHANGELOG.md CHANGED
@@ -4,8 +4,47 @@ 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.104](https://github.com/eea/volto-clms-theme/compare/1.0.103...1.0.104)
8
+
9
+ - use a combined vocabulary of Products and Datasets [`9f9d0c6`](https://github.com/eea/volto-clms-theme/commit/9f9d0c693a1e870614eb8adc07c58657d9d72a06)
10
+ - allow multiple values [`1edb5dd`](https://github.com/eea/volto-clms-theme/commit/1edb5dd166f31ade19bdcae0b7fa92836dbad420)
11
+ - Products Vocabulary for volto-form-block CLMS-747 [`3f48358`](https://github.com/eea/volto-clms-theme/commit/3f48358dab6a3c20a8367bf4be93c94af6c86350)
12
+ - CLMS-935 and input limitation at 8000 [`9971910`](https://github.com/eea/volto-clms-theme/commit/9971910fbe3c291faed7c0c7d458ae34597e7dc4)
13
+
14
+ #### [1.0.103](https://github.com/eea/volto-clms-theme/compare/1.0.102...1.0.103)
15
+
16
+ > 29 June 2022
17
+
18
+ - Develop [`#269`](https://github.com/eea/volto-clms-theme/pull/269)
19
+ - footer button disabled if email is not valid and privacy check is not clicked [`ab6a061`](https://github.com/eea/volto-clms-theme/commit/ab6a06174dd3cd5fb38bd5ae35cc530a7d3baf4e)
20
+ - download table change and home product block fix [`480d83f`](https://github.com/eea/volto-clms-theme/commit/480d83f1772b3cdfe9b2906edfc7505dac420c8e)
21
+ - rename Sort on selection texts CLMS-745 [`2e2f8c6`](https://github.com/eea/volto-clms-theme/commit/2e2f8c60bce7c09844f4e8f17d79f91de47d134b)
22
+ - remove Searched for text CLMS-746 [`ac36c64`](https://github.com/eea/volto-clms-theme/commit/ac36c6461464e52e214989e56c8b7c3b2df83190)
23
+ - remove Search Facets ordering CLMS-743 [`ee9a138`](https://github.com/eea/volto-clms-theme/commit/ee9a138b55517350e5566d54d0946a8ceefd2f90)
24
+ - remove base filter from currentFilters list CLMS-755 [`38c2b8e`](https://github.com/eea/volto-clms-theme/commit/38c2b8e65fed847470aebaed3f2ad141f17e1fd8)
25
+ - Checkbox tree facet selection CLMS-761 [`46e03b5`](https://github.com/eea/volto-clms-theme/commit/46e03b51e193381bf6d899f4a85334801ec969f6)
26
+ - styling differences fixed [`ec7558d`](https://github.com/eea/volto-clms-theme/commit/ec7558d7b7532226722c64da29ec56a1f5da493f)
27
+ - popup unification CLMS-938 [`2757b51`](https://github.com/eea/volto-clms-theme/commit/2757b519d44dc44a8db341c834578438affea124)
28
+ - ESLint fix [`427d34c`](https://github.com/eea/volto-clms-theme/commit/427d34ca20f5a0b8dca5da13a4eb36fdc17dac0f)
29
+ - unautorized page change and log out redirection [`737b53f`](https://github.com/eea/volto-clms-theme/commit/737b53ff09c8ef595c71c92a270b7c6ddc394e55)
30
+ - doubling DownloadTask card CLMS-939 [`86dd1e7`](https://github.com/eea/volto-clms-theme/commit/86dd1e777f927dd33b0835da7483271ab4d0d71b)
31
+
32
+ #### [1.0.102](https://github.com/eea/volto-clms-theme/compare/1.0.101...1.0.102)
33
+
34
+ > 23 June 2022
35
+
36
+ - Develop [`#268`](https://github.com/eea/volto-clms-theme/pull/268)
37
+ - minor improvements to file listing in Event and News Items [`f67f15b`](https://github.com/eea/volto-clms-theme/commit/f67f15b95a96d6104f016ea26a4d2dcfd9ad9610)
38
+ - polish the downloads list: remove the Finished Not OK tasks, and extract the 'no tasks' message to the component. Extract also the filtering function [`d31b94f`](https://github.com/eea/volto-clms-theme/commit/d31b94f20775d1947545f0618b005db594806e95)
39
+ - improve messages [`f7df892`](https://github.com/eea/volto-clms-theme/commit/f7df892e5f1562e55705f3e1a5960d3013e72b28)
40
+ - save and show the collection [`ae7d2f1`](https://github.com/eea/volto-clms-theme/commit/ae7d2f1df0392044ea0c48aabe21e1995811895e)
41
+ - new field collection [`7a6da24`](https://github.com/eea/volto-clms-theme/commit/7a6da24f00a0c7e9b9785cff4a1e143010339aef)
42
+
7
43
  #### [1.0.101](https://github.com/eea/volto-clms-theme/compare/1.0.100...1.0.101)
8
44
 
45
+ > 23 June 2022
46
+
47
+ - Develop [`#267`](https://github.com/eea/volto-clms-theme/pull/267)
9
48
  - Sprint 27 [`67c5d34`](https://github.com/eea/volto-clms-theme/commit/67c5d340fe2b4bbab19d52936e4e5013040c0f65)
10
49
  - some corrections of Sprint 27 [`9bb92da`](https://github.com/eea/volto-clms-theme/commit/9bb92dac754a5c7969b2e78c958918d5099a6d29)
11
50
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eeacms/volto-clms-theme",
3
- "version": "1.0.101",
3
+ "version": "1.0.104",
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",
@@ -1,4 +1,5 @@
1
1
  import React from 'react';
2
+ import { isUrl } from '@plone/volto/helpers';
2
3
 
3
4
  const CclHomeProductsBlockView = (props) => {
4
5
  const { data } = props;
@@ -18,12 +19,18 @@ const CclHomeProductsBlockView = (props) => {
18
19
  }
19
20
  tabIndex={0}
20
21
  onClick={() => {
21
- window.location.href =
22
- product?.linkSelector[0]['@id'] || props.path;
22
+ window.location.href = isUrl(product?.linkSelector)
23
+ ? product.linkSelector
24
+ : isUrl('http://' + product?.linkSelector)
25
+ ? 'http://' + product.linkSelector
26
+ : '#';
23
27
  }}
24
28
  onKeyDown={() => {
25
- window.location.href =
26
- product?.linkSelector[0]['@id'] || props.path;
29
+ window.location.href = isUrl(product?.linkSelector)
30
+ ? product.linkSelector
31
+ : isUrl('http://' + product?.linkSelector)
32
+ ? 'http://' + product.linkSelector
33
+ : '#';
27
34
  }}
28
35
  id={product.productIcon === 'iconless' ? '' : product.productIcon}
29
36
  >
@@ -52,12 +52,12 @@ export const ProductSchema = () => ({
52
52
  ],
53
53
  },
54
54
  linkSelector: {
55
- title: 'Product link selector',
56
- description: 'Select site content or paste external url',
57
- widget: 'object_browser',
58
- mode: 'link',
55
+ title: 'Url',
56
+ description: 'Paste external url',
57
+ /* mode: 'link',
58
+ widget: 'url',
59
59
  selectedItemAttrs: ['Title', 'Description', '@type', '@id'],
60
- allowExternals: true,
60
+ allowExternals: true, */
61
61
  },
62
62
  },
63
63
  required: [],
@@ -0,0 +1,67 @@
1
+ import React, { useEffect } from 'react';
2
+ import SelectWidget from '@plone/volto/components/manage/Widgets/SelectWidget';
3
+ import { useIntl, defineMessages } from 'react-intl';
4
+ import { getVocabulary } from '@plone/volto/actions';
5
+ import { useDispatch, useSelector } from 'react-redux';
6
+
7
+ const messages = defineMessages({
8
+ select_a_value: {
9
+ id: 'form_select_a_value',
10
+ defaultMessage: 'Select a value',
11
+ },
12
+ });
13
+
14
+ const VocabularyWidget = ({
15
+ name,
16
+ label,
17
+ description,
18
+ value,
19
+ onChange,
20
+ disabled,
21
+ invalid,
22
+ title,
23
+ required,
24
+ vocabulary,
25
+ isMulti,
26
+ }) => {
27
+ const intl = useIntl();
28
+ const dispatch = useDispatch();
29
+ useEffect(() => {
30
+ dispatch(
31
+ getVocabulary({
32
+ vocabNameOrURL: vocabulary,
33
+ size: -1,
34
+ }),
35
+ );
36
+ }, [dispatch, vocabulary]);
37
+ const vocabItems = useSelector((state) => state.vocabularies[vocabulary]);
38
+ return (
39
+ <SelectWidget
40
+ id={name}
41
+ name={name}
42
+ title={title}
43
+ required={required}
44
+ description={description}
45
+ getVocabulary={() => {}}
46
+ getVocabularyTokenTitle={() => {}}
47
+ choices={
48
+ vocabItems?.loaded && [
49
+ ...vocabItems.items.map((item) => {
50
+ return [item.label, item.label];
51
+ }),
52
+ ]
53
+ }
54
+ value={value}
55
+ onChange={onChange}
56
+ placeholder={intl.formatMessage(messages.select_a_value)}
57
+ aria-label={intl.formatMessage(messages.select_a_value)}
58
+ classNamePrefix="react-select"
59
+ isDisabled={disabled}
60
+ invalid={invalid}
61
+ isMulti={isMulti}
62
+ {...(invalid === 'true' ? { className: 'is-invalid' } : {})}
63
+ />
64
+ );
65
+ };
66
+
67
+ export default VocabularyWidget;
@@ -11,6 +11,31 @@ import {
11
11
  selectFacetValueToQuery,
12
12
  } from '@plone/volto/components/manage/Blocks/Search/components/base';
13
13
 
14
+ const hasAllChildrensSelected = (value, childrens) => {
15
+ var result = true;
16
+ if (!childrens || childrens.length === 0) {
17
+ result = false;
18
+ }
19
+ childrens.forEach((ch) => {
20
+ if (value.filter((v) => v.value === ch.value).length === 0) {
21
+ result = false;
22
+ }
23
+ });
24
+ return result;
25
+ };
26
+
27
+ const checkAllChildren = (value, childrens) => {
28
+ if (!childrens || childrens.length === 0) {
29
+ return value;
30
+ }
31
+ childrens.forEach((ch) => {
32
+ if (value.filter((v) => v.value === ch.value).length === 0) {
33
+ value.push(ch);
34
+ }
35
+ });
36
+ return value;
37
+ };
38
+
14
39
  const CheckboxTreeFacet = (props) => {
15
40
  const { facet, choices, onChange, value } = props;
16
41
  const facetValue = value;
@@ -62,20 +87,31 @@ const CheckboxListParent = ({ option, key, onChange, value, id }) => {
62
87
  onChange={(event, { checked }) => {
63
88
  checked
64
89
  ? onChange(id, [
90
+ // if this option has children, check them all
91
+ ...checkAllChildren(value, option.childrens).map(
92
+ (f) => f.value,
93
+ ),
94
+ ])
95
+ : onChange(id, [
65
96
  ...value
66
- .filter((f) => f.value !== option.value)
97
+ .filter((item) => item.value !== option.value)
98
+ .filter(
99
+ (item) =>
100
+ option.childrens?.length > 0 &&
101
+ !option.childrens
102
+ .map((ch) => ch.value)
103
+ .includes(item.value),
104
+ )
67
105
  .map((f) => f.value),
68
- ...(checked ? [option.value] : []),
69
- ])
70
- : onChange(
71
- id,
72
- value.filter((item) => item.value !== option.value),
73
- );
106
+ ]);
74
107
  }}
75
108
  label={
76
109
  <label htmlFor={`field-${option.value}`}>{option.label}</label>
77
110
  }
78
- checked={value.some((item) => item.value === option.value)}
111
+ checked={
112
+ value.some((item) => item.value === option.value) ||
113
+ hasAllChildrensSelected(value, option.childrens)
114
+ }
79
115
  value={option.value}
80
116
  />
81
117
  </List.Header>
@@ -14,11 +14,19 @@ const messages = defineMessages({
14
14
  });
15
15
 
16
16
  const FilterList = (props) => {
17
- const { facets, setFacets, isEditMode } = props;
17
+ const { facets, setFacets, isEditMode, data } = props;
18
18
  const showFilterList = !Object.values(facets).every((facet) => !facet.length);
19
19
 
20
+ const baseFacets = data.facets;
20
21
  const currentFilters = Object.fromEntries(
21
- Object.entries(facets).filter((v) => v[1] && v[0] !== 'SearchableText'),
22
+ Object.entries(facets)
23
+ .filter((v) => v[1] && v[0] !== 'SearchableText')
24
+ .filter(
25
+ (v) =>
26
+ v[1] &&
27
+ baseFacets.length > 0 &&
28
+ !baseFacets.map((bf) => bf.field?.value).includes(v[0]),
29
+ ),
22
30
  );
23
31
 
24
32
  const totalFilters = [].concat.apply([], Object.values(currentFilters))
@@ -2,11 +2,10 @@ import { Button, Grid, Segment } from 'semantic-ui-react';
2
2
  import {
3
3
  Facets,
4
4
  SearchDetails,
5
- SearchInput,
6
5
  SortOn,
7
6
  } from '@plone/volto/components/manage/Blocks/Search/components';
8
7
  import { defineMessages, useIntl } from 'react-intl';
9
-
8
+ import SearchInput from './SearchInput';
10
9
  import FilterList from './FilterList';
11
10
  import CclFiltersModal from '@eeacms/volto-clms-theme/components/CclFiltersModal/CclFiltersModal';
12
11
  import { Icon } from '@plone/volto/components';
@@ -59,6 +58,15 @@ const RightModalFacets = (props) => {
59
58
  const { showSearchButton } = data;
60
59
  const isLive = !showSearchButton;
61
60
  const intl = useIntl();
61
+ if (querystring?.sortable_indexes?.effective?.title) {
62
+ querystring.sortable_indexes.effective.title = 'Publication date';
63
+ }
64
+ if (querystring?.sortable_indexes?.sortable_title?.title) {
65
+ querystring.sortable_indexes.sortable_title.title = 'Sort by title';
66
+ }
67
+ if (querystring?.sortable_indexes?.modified?.title) {
68
+ querystring.sortable_indexes.modified.title = 'Last edited';
69
+ }
62
70
  return (
63
71
  <Grid className="searchBlock-facets right-column-facets" stackable>
64
72
  {data?.headline && (
@@ -104,7 +112,7 @@ const RightModalFacets = (props) => {
104
112
  </div>
105
113
 
106
114
  <div className="search-results-count-sort search-filters">
107
- <SearchDetails text={searchedText} total={totalItems} />
115
+ <SearchDetails total={totalItems} />
108
116
  <div className="filters-container">
109
117
  {data.showSortOn && (
110
118
  <SortOn
@@ -0,0 +1,59 @@
1
+ import React, { useEffect } from 'react';
2
+ import { Button, Input } from 'semantic-ui-react';
3
+ import { defineMessages, useIntl } from 'react-intl';
4
+ import { Icon } from '@plone/volto/components';
5
+ import loupeSVG from '@plone/volto/icons/zoom.svg';
6
+
7
+ const messages = defineMessages({
8
+ search: {
9
+ id: 'Search',
10
+ defaultMessage: 'Search',
11
+ },
12
+ });
13
+
14
+ const SearchInput = (props) => {
15
+ const {
16
+ data,
17
+ searchText,
18
+ setSearchText,
19
+ isLive,
20
+ onTriggerSearch,
21
+ ...rest
22
+ } = props;
23
+ const intl = useIntl();
24
+
25
+ useEffect(() => {
26
+ onTriggerSearch(rest.searchedText);
27
+ setSearchText(rest.searchedText);
28
+ }, [rest.searchedText, onTriggerSearch, setSearchText]);
29
+
30
+ return (
31
+ <div className="search-input">
32
+ <Input
33
+ maxLength="8000"
34
+ id={`${props.id}-searchtext`}
35
+ value={searchText}
36
+ placeholder={
37
+ data.searchInputPrompt || intl.formatMessage(messages.search)
38
+ }
39
+ fluid
40
+ onKeyPress={(event) => {
41
+ if (isLive || event.key === 'Enter') onTriggerSearch(searchText);
42
+ }}
43
+ onChange={(event, { value }) => {
44
+ setSearchText(value);
45
+ if (isLive) {
46
+ onTriggerSearch(searchText);
47
+ }
48
+ }}
49
+ />
50
+ {isLive && (
51
+ <Button basic icon className="search-input-live-icon-button">
52
+ <Icon name={loupeSVG} />
53
+ </Button>
54
+ )}
55
+ </div>
56
+ );
57
+ };
58
+
59
+ export default SearchInput;
@@ -59,6 +59,7 @@ import SubscriptionBlockView from '@eeacms/volto-clms-theme/components/Blocks/Cc
59
59
  import SubscriptionBlockEdit from '@eeacms/volto-clms-theme/components/Blocks/CclSubscriptionBlock/SubscriptionEdit';
60
60
  import containerSVG from '@plone/volto/icons/apps.svg';
61
61
  import customIdFieldSchema from '@eeacms/volto-clms-theme/components/Blocks/CustomTemplates/VoltoFormBlock/customIdFieldSchema';
62
+ import VocabularyWidget from '@eeacms/volto-clms-theme/components/Blocks/CustomTemplates/VoltoFormBlock/VocabularyWidget';
62
63
  import downSVG from '@plone/volto/icons/down-key.svg';
63
64
  import homeBand from '@plone/volto/icons/image-wide.svg';
64
65
  import linkSVG from '@plone/volto/icons/link.svg';
@@ -462,6 +463,18 @@ const customBlocks = (config) => ({
462
463
  form: {
463
464
  ...config.blocks.blocksConfig.form,
464
465
  fieldSchema: customIdFieldSchema,
466
+ additionalFields: [
467
+ {
468
+ id: 'product_vocabulary',
469
+ label: 'Products Vocabulary',
470
+ component: (props) =>
471
+ VocabularyWidget({
472
+ ...props,
473
+ vocabulary: 'clms.types.ProductsAndDatasetsVocabulary',
474
+ isMulti: true,
475
+ }),
476
+ },
477
+ ],
465
478
  },
466
479
  });
467
480
 
@@ -234,7 +234,15 @@ const CLMSCartContent = (props) => {
234
234
  : item.type_options.length > 0 && item.type_options[0].id
235
235
  }
236
236
  options={item.type_options.map((option) => {
237
- return { key: option.id, value: option.id, text: option.name };
237
+ return {
238
+ key: option.id,
239
+ value: option.id,
240
+ text:
241
+ option.name +
242
+ ((option.collection !== undefined &&
243
+ ' (' + option.collection + ')') ||
244
+ ''),
245
+ };
238
246
  })}
239
247
  onChange={(e, data) => {
240
248
  const objIndex = cartItems.findIndex(
@@ -78,6 +78,7 @@ export const getCartObjectFromMapviewer = (
78
78
  id: item['@id'],
79
79
  name: item.name,
80
80
  full_format: item.full_format,
81
+ collection: item.collection,
81
82
  });
82
83
  });
83
84
  }
@@ -62,40 +62,58 @@ const CLMSDownloadTasks = (props) => {
62
62
  // eslint-disable-next-line react-hooks/exhaustive-deps
63
63
  }, [nutsnames]);
64
64
 
65
+ const filterItemByDate = (item) => {
66
+ let FinalizationDate =
67
+ item?.FinalizationDateTime !== undefined
68
+ ? new Date(Date.parse(item?.FinalizationDateTime))
69
+ : ['In_progress', 'Queued'].includes(item.Status)
70
+ ? new Date(Date.parse('3999-12-31T23:59:59.999Z'))
71
+ : new Date(Date.parse('1970-01-01T00:00:00.000Z'));
72
+ let today = new Date();
73
+ let daysDiff = Math.floor(
74
+ (today.getTime() - (FinalizationDate.getTime() || 0)) /
75
+ (1000 * 3600 * 24),
76
+ );
77
+ return daysDiff - 10 < -1;
78
+ };
79
+
65
80
  const MapTasks = (mapProps) => {
66
81
  const { tasks, showDel, delTask } = mapProps;
67
- return (
68
- <Grid columns={2}>
69
- {tasks?.length > 0 &&
70
- tasks
71
- .map((item) => {
72
- if (!item.RegistrationDateTime) {
73
- item.RegistrationDateTime = '1970-01-01T00:00:00.000Z';
74
- }
75
- return item;
76
- })
77
- .sort(dynamicSort('-RegistrationDateTime'))
78
- .filter((item) => {
79
- var FinalizationDate = new Date(
80
- Date.parse(item?.FinalizationDateTime),
81
- );
82
- var today = new Date();
83
- var daysDiff = Math.floor(
84
- (today.getTime() - (FinalizationDate.getTime() || 0)) /
85
- (1000 * 3600 * 24),
86
- );
87
- return daysDiff - 10 < -1;
88
- })
89
- .map((item, key) => (
90
- <Grid.Column key={key}>
91
- <FileCard
92
- item={item}
93
- showDeleteTaskLoading={showDel}
94
- deleteTaskInProgress={delTask}
95
- />
96
- </Grid.Column>
97
- ))}
82
+ // Sometimes we are receiving an empty object {}
83
+ // here instead of an array, weird...
84
+ const filtered_tasks = Array.isArray(tasks)
85
+ ? tasks
86
+ .map((item) => {
87
+ if (!item.RegistrationDateTime) {
88
+ item.RegistrationDateTime = '1970-01-01T00:00:00.000Z';
89
+ }
90
+ return item;
91
+ })
92
+ .sort(dynamicSort('-RegistrationDateTime'))
93
+ .filter((item) => {
94
+ return filterItemByDate(item);
95
+ })
96
+ : [];
97
+
98
+ return filtered_tasks.length > 0 ? (
99
+ <Grid doubling columns={2}>
100
+ {filtered_tasks.map((item, key) => (
101
+ <Grid.Column key={key}>
102
+ <FileCard
103
+ item={item}
104
+ showDeleteTaskLoading={showDel}
105
+ deleteTaskInProgress={delTask}
106
+ />
107
+ </Grid.Column>
108
+ ))}
98
109
  </Grid>
110
+ ) : (
111
+ <p>
112
+ <FormattedMessage
113
+ id="There are no tasks"
114
+ defaultMessage="There are no tasks"
115
+ />
116
+ </p>
99
117
  );
100
118
  };
101
119
 
@@ -151,120 +169,57 @@ const CLMSDownloadTasks = (props) => {
151
169
  setShowDeleteTaskLoading(false);
152
170
  }, 1000); // We need delete response to check if remove_task request is completed successfully
153
171
  };
172
+
154
173
  return (
155
174
  <Grid columns={1} stackable padded="vertically">
156
175
  <Grid.Column>
157
176
  <h2>
158
177
  <FormattedMessage id="queued" defaultMessage="Queued" />
159
178
  </h2>
160
- {queued?.length !== 0 ? (
161
- <MapTasks
162
- tasks={queued}
163
- showDel={showDeleteTaskLoading}
164
- delTask={deleteTaskInProgress}
165
- />
166
- ) : (
167
- <p>
168
- <FormattedMessage
169
- id="There are no tasks queued"
170
- defaultMessage="There are no tasks queued"
171
- />
172
- </p>
173
- )}
179
+
180
+ <MapTasks
181
+ tasks={queued}
182
+ showDel={showDeleteTaskLoading}
183
+ delTask={deleteTaskInProgress}
184
+ />
174
185
  </Grid.Column>
175
186
  <Grid.Column>
176
187
  <h2>
177
188
  <FormattedMessage id="In progress" defaultMessage="In progress" />
178
189
  </h2>
179
- {taskInProgress?.length !== 0 ? (
180
- <MapTasks
181
- tasks={taskInProgress}
182
- showDel={showDeleteTaskLoading}
183
- delTask={deleteTaskInProgress}
184
- />
185
- ) : (
186
- <p>
187
- <FormattedMessage
188
- id="There are no tasks in progress"
189
- defaultMessage="There are no tasks in progress"
190
- />
191
- </p>
192
- )}
190
+ <MapTasks
191
+ tasks={taskInProgress}
192
+ showDel={showDeleteTaskLoading}
193
+ delTask={deleteTaskInProgress}
194
+ />
193
195
  </Grid.Column>
194
196
  <Grid.Column>
195
197
  <h2>
196
198
  <FormattedMessage id="Completed" defaultMessage="Completed" />
197
199
  </h2>
198
- {finishedOKTasks?.length !== 0 ? (
199
- <MapTasks
200
- tasks={finishedOKTasks}
201
- showDel={showDeleteTaskLoading}
202
- delTask={deleteTaskInProgress}
203
- />
204
- ) : (
205
- <p>
206
- <FormattedMessage
207
- id="There are no completed tasks"
208
- defaultMessage="There are no completed tasks"
209
- />
210
- </p>
211
- )}
212
- </Grid.Column>
213
- <Grid.Column>
214
- <h2>
215
- <FormattedMessage
216
- id="Finished with errors"
217
- defaultMessage="Finished with errors"
218
- />
219
- </h2>
220
- {finishedNOKTasks?.length !== 0 ? (
221
- <MapTasks
222
- tasks={finishedNOKTasks}
223
- showDel={showDeleteTaskLoading}
224
- delTask={deleteTaskInProgress}
225
- />
226
- ) : (
227
- <p>
228
- <FormattedMessage
229
- id="There are no tasks finished with errors"
230
- defaultMessage="There are no tasks finished with errors"
231
- />
232
- </p>
233
- )}
200
+
201
+ <MapTasks
202
+ tasks={finishedOKTasks}
203
+ showDel={showDeleteTaskLoading}
204
+ delTask={deleteTaskInProgress}
205
+ />
234
206
  </Grid.Column>
235
207
  <Grid.Column>
236
208
  <h2>
237
209
  <FormattedMessage id="Rejected" defaultMessage="Rejected" />
238
210
  </h2>
239
- {rejectedTasks?.length !== 0 ? (
240
- <MapTasks
241
- tasks={rejectedTasks}
242
- showDel={showDeleteTaskLoading}
243
- delTask={deleteTaskInProgress}
244
- />
245
- ) : (
246
- <p>
247
- <FormattedMessage
248
- id="There are no rejected tasks"
249
- defaultMessage="There are no rejected tasks"
250
- />
251
- </p>
252
- )}
211
+
212
+ <MapTasks
213
+ tasks={rejectedTasks}
214
+ showDel={showDeleteTaskLoading}
215
+ delTask={deleteTaskInProgress}
216
+ />
253
217
  </Grid.Column>
254
218
  <Grid.Column>
255
219
  <h2>
256
220
  <FormattedMessage id="Cancelled" defaultMessage="Cancelled" />
257
221
  </h2>
258
- {cancelled?.length > 0 ? (
259
- <MapTasks tasks={cancelled} showDel={showDeleteTaskLoading} />
260
- ) : (
261
- <p>
262
- <FormattedMessage
263
- id="There are no cancelled tasks"
264
- defaultMessage="There are no cancelled tasks"
265
- />
266
- </p>
267
- )}
222
+ <MapTasks tasks={cancelled} showDel={showDeleteTaskLoading} />
268
223
  </Grid.Column>
269
224
  </Grid>
270
225
  );