@eeacms/volto-clms-theme 1.0.110 → 1.0.113

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 (39) hide show
  1. package/CHANGELOG.md +33 -0
  2. package/package.json +2 -2
  3. package/src/actions/import_wms_fields/import_wms_fields.js +20 -0
  4. package/src/actions/index.js +5 -0
  5. package/src/components/Blocks/CclHomeSearchBlock/CclHomeSearchBlockView.jsx +0 -19
  6. package/src/components/Blocks/CclHomeSearchBlock/HomeSearchSchema.js +1 -14
  7. package/src/components/Blocks/CustomTemplates/VoltoSearchBlock/AccordionFacet.jsx +41 -33
  8. package/src/components/Blocks/CustomTemplates/VoltoSearchBlock/CheckboxTreeFacet.jsx +15 -15
  9. package/src/components/Blocks/CustomTemplates/VoltoSearchBlock/CheckboxTreeParentFacet.jsx +15 -16
  10. package/src/components/Blocks/CustomTemplates/VoltoSearchBlock/utils.js +11 -0
  11. package/src/components/Blocks/customBlocks.js +3 -3
  12. package/src/components/CLMSDatasetDetailView/CLMSDatasetDetailView.jsx +108 -1
  13. package/src/components/CLMSDatasetDetailView/DataSetInfoContent.jsx +5 -2
  14. package/src/components/CLMSDatasetDetailView/RelatedNews.jsx +51 -0
  15. package/src/components/CLMSDatasetDetailView/RelatedUseCases.jsx +51 -0
  16. package/src/components/CLMSDatasetDetailView/index.js +2 -0
  17. package/src/components/CLMSMeetingView/CLMSMeetingView.jsx +3 -6
  18. package/src/components/CLMSNewsItemView/CLMSNewsItemView.jsx +0 -1
  19. package/src/components/CLMSProfileView/CLMSProfileView.jsx +1 -1
  20. package/src/components/CLMSRelatedItems/CLMSRelatedItems.jsx +6 -2
  21. package/src/components/CLMSSubscriptionView/SubscriptionView.jsx +103 -18
  22. package/src/components/CLMSSubscriptionView/subscription_utils.js +3 -3
  23. package/src/components/CLMSUseCasesView/CLMSUseCasesView.jsx +177 -0
  24. package/src/components/CclTab/CclTabs.jsx +5 -4
  25. package/src/components/Widgets/MapLayersWidget.jsx +14 -1
  26. package/src/customizations/volto/components/manage/UniversalLink/UniversalLink.jsx +158 -0
  27. package/src/customizations/volto/components/manage/UniversalLink/UniversalLink.stories.mdx +64 -0
  28. package/src/customizations/volto/components/manage/UniversalLink/UniversalLink.test.jsx +193 -0
  29. package/src/customizations/volto/components/manage/Widgets/TextWidget.jsx +133 -0
  30. package/src/customizations/volto/components/manage/Widgets/TextareaWidget.jsx +98 -0
  31. package/src/customizations/volto/components/theme/Footer/Footer.jsx +1 -1
  32. package/src/index.js +2 -0
  33. package/src/reducers/import_wms_fields/import_wms_fields_reducer.js +44 -0
  34. package/src/reducers/index.js +2 -0
  35. package/theme/clms/css/ccl.less +1 -0
  36. package/theme/clms/css/forms.css +1 -1
  37. package/theme/clms/css/maps.less +0 -4
  38. package/theme/clms/css/styles.less +5 -0
  39. package/theme/clms/css/volto-block-style-override.css +284 -0
package/CHANGELOG.md CHANGED
@@ -4,8 +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.113](https://github.com/eea/volto-clms-theme/compare/1.0.112...1.0.113)
8
+
9
+ - Area widget explanation [`#286`](https://github.com/eea/volto-clms-theme/pull/286)
10
+ - UniversalLink override to download files in case user is not Manager [`dd206ae`](https://github.com/eea/volto-clms-theme/commit/dd206ae6040fe927d2895c00beeaf55e1fd0a6fe)
11
+ - fix profile subscribe checkbox checking [`62facfa`](https://github.com/eea/volto-clms-theme/commit/62facfa2db2ba518f421eca0002c2774c080d1da)
12
+ - some changes [`8b27aeb`](https://github.com/eea/volto-clms-theme/commit/8b27aeb01df2a04c4331ca5e4c83150957ff076c)
13
+ - edit and add form dropdown overflow, override volto-block-style product css [`468ce5d`](https://github.com/eea/volto-clms-theme/commit/468ce5d51cffe86844fea63ac9640561d51a9dbd)
14
+ - Rename Register to this meeting to simple Register [`563e0f8`](https://github.com/eea/volto-clms-theme/commit/563e0f8a46040decc68247c17f134573d5bfb4bf)
15
+
16
+ #### [1.0.112](https://github.com/eea/volto-clms-theme/compare/1.0.111...1.0.112)
17
+
18
+ > 3 August 2022
19
+
20
+ - Develop [`#285`](https://github.com/eea/volto-clms-theme/pull/285)
21
+ - import fields [`#284`](https://github.com/eea/volto-clms-theme/pull/284)
22
+ - search filters checkbox unification [`0cd48bc`](https://github.com/eea/volto-clms-theme/commit/0cd48bc9a873ec1b3c4a082c4ec3519fbc3cef6d)
23
+ - check also childless parents CLMS-987 [`641a887`](https://github.com/eea/volto-clms-theme/commit/641a887e9e36f0f2e04aa8eb5362065ed53380a3)
24
+ - User profile form changes [`a7f7a63`](https://github.com/eea/volto-clms-theme/commit/a7f7a63a288f35037fc42a7af6761071c889e7ad)
25
+ - added UniversalLink to relatedItems [`46cb0c5`](https://github.com/eea/volto-clms-theme/commit/46cb0c5e6abb6658d0ec8108ba1eb1cf136d5e2f)
26
+
27
+ #### [1.0.111](https://github.com/eea/volto-clms-theme/compare/1.0.110...1.0.111)
28
+
29
+ > 2 August 2022
30
+
31
+ - Develop [`#283`](https://github.com/eea/volto-clms-theme/pull/283)
32
+ - bump accordion block [`f64f037`](https://github.com/eea/volto-clms-theme/commit/f64f037cbcb1200f15d70590beaf4131f7bf464d)
33
+ - Use Case view [`c60b74f`](https://github.com/eea/volto-clms-theme/commit/c60b74f110f98faff7d15a42167e45e410efeec1)
34
+ - textWidget limit to 1000 characters and textAreaWidget show error with more than 8000 characters [`662f035`](https://github.com/eea/volto-clms-theme/commit/662f035fa9ecd7b61b7bb8aa17acb0ce89718df8)
35
+ - relationship between Datasets Use Cases/News [`b1f1848`](https://github.com/eea/volto-clms-theme/commit/b1f184858685783b3ea408930b9e3b1884b381a8)
36
+
7
37
  #### [1.0.110](https://github.com/eea/volto-clms-theme/compare/1.0.109...1.0.110)
8
38
 
39
+ > 28 July 2022
40
+
41
+ - Develop [`#282`](https://github.com/eea/volto-clms-theme/pull/282)
9
42
  - Subscription header [`#281`](https://github.com/eea/volto-clms-theme/pull/281)
10
43
  - eea.meeting editor box condition [`1cb1361`](https://github.com/eea/volto-clms-theme/commit/1cb13611bee071293875e5425a4e63fa689ae640)
11
44
  - fix contents invalid time error [`87dc051`](https://github.com/eea/volto-clms-theme/commit/87dc051c8f8eb0278c0372685adf7a0e3ee2fc09)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eeacms/volto-clms-theme",
3
- "version": "1.0.110",
3
+ "version": "1.0.113",
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",
@@ -34,7 +34,7 @@
34
34
  ],
35
35
  "dependencies": {
36
36
  "volto-cookie-banner": "2.1.0",
37
- "@eeacms/volto-accordion-block": "3.4.13",
37
+ "@eeacms/volto-accordion-block": "3.5.0",
38
38
  "@eeacms/volto-arcgis-block": "*",
39
39
  "@eeacms/volto-clms-utils": "0.1.6",
40
40
  "@eeacms/volto-columns-block": "4.4.3",
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Post meeting register actions.
3
+ * @module actions/postImportGeonetwork
4
+ */
5
+ export const POST_IMPORT_WMS_FIELDS = 'POST_IMPORT_WMS_FIELDS';
6
+
7
+ /**
8
+ * Post import geonetwork.
9
+ * @function postImportWMSFields
10
+ * @returns {Object} Get extra items action.
11
+ */
12
+ export function postImportWMSFields(url, id, type) {
13
+ return {
14
+ type: POST_IMPORT_WMS_FIELDS,
15
+ request: {
16
+ op: 'post',
17
+ path: `${url}/@import-wms-fields`,
18
+ },
19
+ };
20
+ }
@@ -87,3 +87,8 @@ export {
87
87
  POST_IMPORT_WMS_LAYERS,
88
88
  postImportWMSLayers,
89
89
  } from './import_wms_layers/import_wms_layers';
90
+
91
+ export {
92
+ POST_IMPORT_WMS_FIELDS,
93
+ postImportWMSFields,
94
+ } from './import_wms_fields/import_wms_fields';
@@ -1,6 +1,5 @@
1
1
  import { defineMessages, useIntl } from 'react-intl';
2
2
 
3
- import { Link } from 'react-router-dom';
4
3
  import React from 'react';
5
4
 
6
5
  const messages = defineMessages({
@@ -14,20 +13,10 @@ const messages = defineMessages({
14
13
  },
15
14
  });
16
15
 
17
- function hasProtocol(url) {
18
- if (url) {
19
- return url.startsWith('https://') || url.startsWith('http://')
20
- ? true
21
- : false;
22
- }
23
- return false;
24
- }
25
-
26
16
  const CclHomeSearchBlockView = (props) => {
27
17
  const { data, searchText } = props;
28
18
  var SearchText = searchText || '';
29
19
  const intl = useIntl();
30
- let url = data?.link?.[0]?.['@id'];
31
20
 
32
21
  function handleChange(event) {
33
22
  SearchText = event.target.value;
@@ -68,14 +57,6 @@ const CclHomeSearchBlockView = (props) => {
68
57
  </button>
69
58
  </form>
70
59
  </div>
71
- <div className="home-datasets-text">
72
- <span>{intl.formatMessage(messages.countText, { count: 999 })}</span>
73
- {url && hasProtocol(url) ? (
74
- <a href={url}>{data.linkText}</a>
75
- ) : (
76
- <Link to={url}>{data.linkText}</Link>
77
- )}
78
- </div>
79
60
  </div>
80
61
  </div>
81
62
  );
@@ -4,7 +4,7 @@ export const HomeSearchSchema = () => ({
4
4
  {
5
5
  id: 'default',
6
6
  title: 'Default',
7
- fields: ['title', 'linkText', 'link'],
7
+ fields: ['title'],
8
8
  },
9
9
  ],
10
10
  properties: {
@@ -12,19 +12,6 @@ export const HomeSearchSchema = () => ({
12
12
  title: 'Title',
13
13
  type: 'string',
14
14
  },
15
- linkText: {
16
- title: 'Link text',
17
- description: 'Text for the link to the catalogue',
18
- type: 'string',
19
- },
20
- link: {
21
- title: 'Link',
22
- description: 'Select site content or paste external url',
23
- widget: 'object_browser',
24
- mode: 'link',
25
- selectedItemAttrs: ['Title', 'Description', '@type', '@id'],
26
- allowExternals: true,
27
- },
28
15
  },
29
16
  required: ['title'],
30
17
  });
@@ -1,4 +1,4 @@
1
- import { Checkbox } from 'semantic-ui-react';
1
+ import { Checkbox, List } from 'semantic-ui-react';
2
2
  import React from 'react';
3
3
  import {
4
4
  selectFacetSchemaEnhancer,
@@ -47,38 +47,46 @@ const AccordionFacet = (props) => {
47
47
  <legend className="ccl-form-legend">{facet.title}</legend>
48
48
  </div>
49
49
  <Wrapper typeName={typeName}>
50
- {choices.map((choice, i) => (
51
- <div
52
- className={
53
- typeName === 'checkbox' ? 'ccl-form-group' : 'filters-tag'
54
- }
55
- key={choice.value}
56
- >
57
- <Checkbox
58
- disabled={isEditMode}
59
- label={choice.label}
60
- radio={!isMulti}
61
- checked={
62
- isMulti
63
- ? !!facetValue?.find((f) => f.value === choice.value)
64
- : facetValue && facetValue.value === choice.value
65
- }
66
- onChange={(e, { checked }) =>
67
- onChange(
68
- facet.field.value,
69
- isMulti
70
- ? [
71
- ...facetValue
72
- .filter((f) => f.value !== choice.value)
73
- .map((f) => f.value),
74
- ...(checked ? [choice.value] : []),
75
- ]
76
- : isChoiceValue(checked, choice.value),
77
- )
78
- }
79
- />
80
- </div>
81
- ))}
50
+ <List>
51
+ {choices.map((choice, i) => (
52
+ <List.Item
53
+ key={choice.value}
54
+ style={{
55
+ paddingLeft: '15px',
56
+ paddingBottom: '15px',
57
+ paddingTop: '10px',
58
+ }}
59
+ >
60
+ <List.Content>
61
+ <List.Header>
62
+ <Checkbox
63
+ disabled={isEditMode}
64
+ label={choice.label}
65
+ radio={!isMulti}
66
+ checked={
67
+ isMulti
68
+ ? !!facetValue?.find((f) => f.value === choice.value)
69
+ : facetValue && facetValue.value === choice.value
70
+ }
71
+ onChange={(e, { checked }) =>
72
+ onChange(
73
+ facet.field.value,
74
+ isMulti
75
+ ? [
76
+ ...facetValue
77
+ .filter((f) => f.value !== choice.value)
78
+ .map((f) => f.value),
79
+ ...(checked ? [choice.value] : []),
80
+ ]
81
+ : isChoiceValue(checked, choice.value),
82
+ )
83
+ }
84
+ />
85
+ </List.Header>
86
+ </List.Content>
87
+ </List.Item>
88
+ ))}
89
+ </List>
82
90
  </Wrapper>
83
91
  </fieldset>
84
92
  );
@@ -10,6 +10,7 @@ import {
10
10
  selectFacetStateToValue,
11
11
  selectFacetValueToQuery,
12
12
  } from '@plone/volto/components/manage/Blocks/Search/components/base';
13
+ import { checkAllChildren } from './utils';
13
14
 
14
15
  const hasAllChildrensSelected = (value, childrens) => {
15
16
  var result = true;
@@ -24,20 +25,21 @@ const hasAllChildrensSelected = (value, childrens) => {
24
25
  return result;
25
26
  };
26
27
 
27
- const checkAllChildren = (value, childrens) => {
28
- if (!childrens || childrens.length === 0) {
29
- return value;
28
+ const Wrapper = ({ typeName, children }) => {
29
+ if (typeName === 'checkbox') {
30
+ return <div className="ccl-form">{children}</div>;
31
+ } else if (typeName === 'label') {
32
+ return (
33
+ <div>
34
+ <div className="filters-tag-container">{children}</div>
35
+ </div>
36
+ );
30
37
  }
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
  };
38
39
 
39
40
  const CheckboxTreeFacet = (props) => {
40
- const { facet, choices, onChange, value } = props;
41
+ const { facet, choices, onChange, value, typeName } = props;
42
+
41
43
  const facetValue = value;
42
44
  var [open, setOpen] = useState(false);
43
45
  let options = [];
@@ -56,7 +58,7 @@ const CheckboxTreeFacet = (props) => {
56
58
  >
57
59
  <legend className="ccl-form-legend">{facet.title}</legend>
58
60
  </div>
59
- <div>
61
+ <Wrapper typeName={typeName}>
60
62
  <List>
61
63
  {options.map((option) => (
62
64
  <CheckboxListParent
@@ -68,7 +70,7 @@ const CheckboxTreeFacet = (props) => {
68
70
  />
69
71
  ))}
70
72
  </List>
71
- </div>
73
+ </Wrapper>
72
74
  </fieldset>
73
75
  );
74
76
  };
@@ -88,9 +90,7 @@ const CheckboxListParent = ({ option, key, onChange, value, id }) => {
88
90
  checked
89
91
  ? onChange(id, [
90
92
  // if this option has children, check them all
91
- ...checkAllChildren(value, option.childrens).map(
92
- (f) => f.value,
93
- ),
93
+ ...checkAllChildren(value, option).map((f) => f.value),
94
94
  ])
95
95
  : onChange(id, [
96
96
  ...value
@@ -10,6 +10,7 @@ import {
10
10
  selectFacetStateToValue,
11
11
  selectFacetValueToQuery,
12
12
  } from '@plone/volto/components/manage/Blocks/Search/components/base';
13
+ import { checkAllChildren } from './utils';
13
14
 
14
15
  const hasAllChildrensSelected = (value, childrens) => {
15
16
  var result = true;
@@ -24,20 +25,20 @@ const hasAllChildrensSelected = (value, childrens) => {
24
25
  return result;
25
26
  };
26
27
 
27
- const checkAllChildren = (value, childrens) => {
28
- if (!childrens || childrens.length === 0) {
29
- return value;
28
+ const Wrapper = ({ typeName, children }) => {
29
+ if (typeName === 'checkbox') {
30
+ return <div className="ccl-form">{children}</div>;
31
+ } else if (typeName === 'label') {
32
+ return (
33
+ <div>
34
+ <div className="filters-tag-container">{children}</div>
35
+ </div>
36
+ );
30
37
  }
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
  };
38
39
 
39
40
  const CheckboxTreeParentFacet = (props) => {
40
- const { facet, choices, onChange, value } = props;
41
+ const { facet, choices, onChange, value, typeName } = props;
41
42
  const facetValue = value;
42
43
  var [open, setOpen] = useState(false);
43
44
  let options = [];
@@ -56,7 +57,7 @@ const CheckboxTreeParentFacet = (props) => {
56
57
  >
57
58
  <legend className="ccl-form-legend">{facet.title}</legend>
58
59
  </div>
59
- <div>
60
+ <Wrapper typeName={typeName}>
60
61
  <List>
61
62
  {options.map((option) => (
62
63
  <CheckboxListParent
@@ -68,7 +69,7 @@ const CheckboxTreeParentFacet = (props) => {
68
69
  />
69
70
  ))}
70
71
  </List>
71
- </div>
72
+ </Wrapper>
72
73
  </fieldset>
73
74
  );
74
75
  };
@@ -85,12 +86,10 @@ const CheckboxListParent = ({ option, key, onChange, value, id }) => {
85
86
  key={option.value}
86
87
  name={`field-${option.value}`}
87
88
  onChange={(event, { checked }) => {
88
- checked
89
+ return checked
89
90
  ? onChange(id, [
90
91
  // if this option has children, check them all
91
- ...checkAllChildren(value, option.childrens).map(
92
- (f) => f.value,
93
- ),
92
+ ...checkAllChildren(value, option).map((f) => f.value),
94
93
  ])
95
94
  : onChange(id, [
96
95
  ...value
@@ -0,0 +1,11 @@
1
+ export const checkAllChildren = (value, option) => {
2
+ if (!option?.childrens || option.childrens.length === 0) {
3
+ return [...value, { label: option.label, value: option.value }];
4
+ }
5
+ option.childrens.forEach((ch) => {
6
+ if (value.filter((v) => v.value === ch.value).length === 0) {
7
+ value.push(ch);
8
+ }
9
+ });
10
+ return value;
11
+ };
@@ -328,7 +328,7 @@ const customBlocks = (config) => ({
328
328
  {
329
329
  id: 'doubleRangeFacet',
330
330
  title: 'Double Range',
331
- view: DoubleRangeFacet,
331
+ view: WithType(DoubleRangeFacet, 'range'),
332
332
  isDefault: false,
333
333
  schemaEnhancer: DoubleRangeFacet.schemaEnhancer,
334
334
  stateToValue: DoubleRangeFacet.stateToValue,
@@ -338,7 +338,7 @@ const customBlocks = (config) => ({
338
338
  {
339
339
  id: 'checkboxTreeFacet',
340
340
  title: 'Checkbox Tree',
341
- view: CheckboxTreeFacet,
341
+ view: WithType(CheckboxTreeFacet, 'checkbox'),
342
342
  isDefault: false,
343
343
  schemaEnhancer: CheckboxTreeFacet.schemaEnhancer,
344
344
  stateToValue: CheckboxTreeFacet.stateToValue,
@@ -348,7 +348,7 @@ const customBlocks = (config) => ({
348
348
  {
349
349
  id: 'checkboxTreeParentFacet',
350
350
  title: 'Checkbox Tree Parents',
351
- view: CheckboxTreeParentFacet,
351
+ view: WithType(CheckboxTreeParentFacet, 'checkbox'),
352
352
  isDefault: false,
353
353
  schemaEnhancer: CheckboxTreeParentFacet.schemaEnhancer,
354
354
  stateToValue: CheckboxTreeParentFacet.stateToValue,
@@ -6,10 +6,16 @@
6
6
  import {
7
7
  DataSetInfoContent,
8
8
  DownloadDataSetContent,
9
+ RelatedNews,
10
+ RelatedUseCases,
9
11
  } from '@eeacms/volto-clms-theme/components/CLMSDatasetDetailView';
10
12
  import { Modal, Segment } from 'semantic-ui-react';
11
13
  import { connect, useDispatch, useSelector } from 'react-redux';
12
- import { postImportGeonetwork, postImportWMSLayers } from '../../actions';
14
+ import {
15
+ postImportGeonetwork,
16
+ postImportWMSLayers,
17
+ postImportWMSFields,
18
+ } from '../../actions';
13
19
 
14
20
  import CclButton from '@eeacms/volto-clms-theme/components/CclButton/CclButton';
15
21
  import CclTabs from '@eeacms/volto-clms-theme/components/CclTab/CclTabs';
@@ -35,6 +41,7 @@ const CLMSDatasetDetailView = ({ content, token }) => {
35
41
  (state) => state.geonetwork_importation,
36
42
  );
37
43
  const wms_layers_importation = useSelector((state) => state.importWMSLayers);
44
+ const wms_fields_importation = useSelector((state) => state.importWMSFields);
38
45
  const user = useSelector((state) => state.users?.user);
39
46
  React.useEffect(() => {
40
47
  dispatch(getUser(token));
@@ -48,6 +55,10 @@ const CLMSDatasetDetailView = ({ content, token }) => {
48
55
  dispatch(postImportWMSLayers(location.pathname));
49
56
  }
50
57
 
58
+ function handleWMSFieldimport() {
59
+ dispatch(postImportWMSFields(location.pathname));
60
+ }
61
+
51
62
  const [open, setOpen] = React.useState({});
52
63
  const locale = useSelector((state) => state.intl.locale);
53
64
 
@@ -280,8 +291,104 @@ const CLMSDatasetDetailView = ({ content, token }) => {
280
291
  </Segment.Group>
281
292
  )}
282
293
 
294
+ {user?.roles && user.roles.includes('Manager') && (
295
+ <Segment.Group compact horizontal>
296
+ <Segment
297
+ padded={'very'}
298
+ color={'olive'}
299
+ key={'wms-fields-import'}
300
+ loading={wms_fields_importation?.loading}
301
+ circular
302
+ >
303
+ <Modal
304
+ onClose={() => {
305
+ setOpen({ ...open, 'wms-fields-import': false });
306
+ }}
307
+ onOpen={() => {
308
+ setOpen({ ...open, 'wms-fields-import': true });
309
+ }}
310
+ open={open['wms-fields-import']}
311
+ trigger={
312
+ <CclButton>
313
+ <FormattedMessage
314
+ id="Import WMS Fields"
315
+ defaultMessage="Import WMS Fields"
316
+ />
317
+ </CclButton>
318
+ }
319
+ className={'modal-clms'}
320
+ >
321
+ <div className={'modal-clms-background'}>
322
+ <div className={'modal-clms-container'}>
323
+ <div className={'modal-close modal-clms-close'}>
324
+ <span
325
+ className="ccl-icon-close"
326
+ aria-label="Close"
327
+ onClick={() => {
328
+ setOpen({ ...open, 'wms-fields-import': false });
329
+ }}
330
+ onKeyDown={() => {
331
+ setOpen({ ...open, 'wms-fields-import': false });
332
+ }}
333
+ tabIndex="0"
334
+ role="button"
335
+ ></span>
336
+ </div>
337
+ <div className="modal-login-text">
338
+ <h1>
339
+ <FormattedMessage
340
+ id="Import WMS Fields"
341
+ defaultMessage="Import WMS Fields"
342
+ />
343
+ </h1>
344
+ This action will import the WMS Fields from the view service
345
+ defined in the dataset if this WMS service is Arcgis based
346
+ <br />
347
+ <br />
348
+ </div>
349
+ <CclButton
350
+ onClick={() => {
351
+ handleWMSFieldimport();
352
+ setOpen({ ...open, 'wms-fields-import': false });
353
+ }}
354
+ mode="filled"
355
+ >
356
+ <FormattedMessage
357
+ id="Import data"
358
+ defaultMessage="Import data"
359
+ />
360
+ </CclButton>
361
+ </div>
362
+ </div>
363
+ </Modal>
364
+ {wms_fields_importation?.imported_wms_fields?.status && (
365
+ <p>
366
+ {wms_fields_importation?.loaded &&
367
+ wms_fields_importation?.error === null && (
368
+ <strong>
369
+ {' '}
370
+ {wms_fields_importation?.imported_wms_fields?.message}
371
+ </strong>
372
+ )}
373
+ </p>
374
+ )}
375
+ {wms_fields_importation?.imported_wms_fields?.status ===
376
+ 'error' && (
377
+ <p>
378
+ <strong>
379
+ {' '}
380
+ {wms_fields_importation?.imported_wms_fields?.message}
381
+ </strong>
382
+ </p>
383
+ )}
384
+ </Segment>
385
+ </Segment.Group>
386
+ )}
387
+
283
388
  <CclTabs routing={true}>
284
389
  <div tabTitle="General Info">{DataSetInfoContent(content)}</div>
390
+ <div tabTitle="Use cases">{RelatedUseCases(content)}</div>
391
+ <div tabTitle="News">{RelatedNews(content)}</div>
285
392
  {content?.downloadable_dataset &&
286
393
  content?.downloadable_files?.items?.length > 0 && (
287
394
  <div tabTitle="Download">{DownloadDataSetContent(content)}</div>
@@ -10,6 +10,7 @@ import React from 'react';
10
10
  import { StringToHTML } from '@eeacms/volto-clms-theme/components/CclUtils';
11
11
  import config from '@plone/volto/registry';
12
12
  import { searchContent } from '@plone/volto/actions';
13
+ import { useLocation } from 'react-router-dom';
13
14
 
14
15
  const DataSetInfoContent = (props) => {
15
16
  const dispatch = useDispatch();
@@ -22,12 +23,13 @@ const DataSetInfoContent = (props) => {
22
23
  geonetwork_identifiers,
23
24
  citation,
24
25
  } = props;
26
+ const location = useLocation();
25
27
  const searchSubrequests = useSelector((state) => state.search.subrequests);
26
28
  let libraries = searchSubrequests?.[id]?.items || [];
27
29
  let librariesPending = searchSubrequests?.[id]?.loading;
28
30
  const user = useSelector((state) => state.users.user);
29
31
  React.useEffect(() => {
30
- UID &&
32
+ if (location.hash === '#GeneralInfo' && UID) {
31
33
  dispatch(
32
34
  searchContent(
33
35
  '',
@@ -40,7 +42,8 @@ const DataSetInfoContent = (props) => {
40
42
  id,
41
43
  ),
42
44
  );
43
- }, [id, UID, dispatch]);
45
+ }
46
+ }, [id, UID, dispatch, location]);
44
47
 
45
48
  const [activeIndex, setActiveIndex] = React.useState([99]);
46
49
 
@@ -0,0 +1,51 @@
1
+ import { Loader } from 'semantic-ui-react';
2
+ import { useDispatch, useSelector } from 'react-redux';
3
+
4
+ import CclCard from '@eeacms/volto-clms-theme/components/CclCard/CclCard';
5
+ import React from 'react';
6
+ import { searchContent } from '@plone/volto/actions';
7
+ import { useLocation } from 'react-router-dom';
8
+
9
+ const RelatedNews = (props) => {
10
+ const dispatch = useDispatch();
11
+ const { UID, id } = props;
12
+ const searchSubrequests = useSelector((state) => state.search.subrequests);
13
+ let libraries = searchSubrequests?.[id]?.items || [];
14
+ let librariesPending = searchSubrequests?.[id]?.loading;
15
+ const location = useLocation();
16
+ React.useEffect(() => {
17
+ if (location.hash === '#News' && UID) {
18
+ dispatch(
19
+ searchContent(
20
+ '',
21
+ {
22
+ fullobjects: 1,
23
+ portal_type: 'News Item',
24
+ path: '/',
25
+ associated_datasets: UID,
26
+ },
27
+ id,
28
+ ),
29
+ );
30
+ }
31
+ }, [id, UID, dispatch, location]);
32
+
33
+ return (
34
+ <div>
35
+ {librariesPending && <Loader active inline="centered" />}
36
+ {libraries.length > 0 ? (
37
+ libraries.map((item, index) => (
38
+ <CclCard
39
+ key={index}
40
+ type={null}
41
+ card={{ Type: item['@type'], ...item }}
42
+ />
43
+ ))
44
+ ) : (
45
+ <p>There are no related items.</p>
46
+ )}
47
+ </div>
48
+ );
49
+ };
50
+
51
+ export default RelatedNews;