@eeacms/volto-cca-policy 0.1.48 → 0.1.50

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 (32) hide show
  1. package/CHANGELOG.md +43 -0
  2. package/cypress.config.js +3 -3
  3. package/package.json +5 -3
  4. package/src/components/manage/Blocks/C3SIndicatorsGlossaryBlock/C3SIndicatorsGlossaryBlockView.jsx +1 -1
  5. package/src/components/manage/Blocks/C3SIndicatorsOverviewBlock/C3SIndicatorsOverviewBlockView.jsx +1 -1
  6. package/src/components/manage/Blocks/CaseStudyExplorer/styles.less +1 -1
  7. package/src/components/manage/Blocks/CountryMapProfile/styles.css +0 -2
  8. package/src/components/manage/Blocks/RASTBlock/ContextNavigation.jsx +49 -0
  9. package/src/components/manage/Blocks/RASTBlock/RASTAccordion.jsx +79 -0
  10. package/src/components/manage/Blocks/RASTBlock/RASTAccordion.test.jsx +42 -0
  11. package/src/components/manage/Blocks/RASTBlock/RASTAccordionContent.jsx +44 -0
  12. package/src/components/manage/Blocks/RASTBlock/RASTMap.jsx +371 -0
  13. package/src/components/manage/Blocks/RASTBlock/RASTView.jsx +12 -346
  14. package/src/components/manage/Blocks/RASTBlock/schema.js +7 -30
  15. package/src/components/manage/Blocks/SearchAceContent/SearchAceContentView.test.jsx +44 -0
  16. package/src/components/theme/Header.jsx +1 -1
  17. package/src/components/theme/Views/AdaptationOptionView.jsx +1 -1
  18. package/src/components/theme/Views/AdaptationOptionView.test.jsx +53 -0
  19. package/src/components/theme/Views/CaseStudyView.jsx +1 -1
  20. package/src/components/theme/Views/CaseStudyView.test.jsx +42 -0
  21. package/src/components/theme/Views/CcaEventView.jsx +113 -0
  22. package/src/components/theme/Views/GuidanceView.test.jsx +41 -0
  23. package/src/components/theme/Views/IndicatorView.test.jsx +41 -0
  24. package/src/components/theme/Views/InformationPortalView.test.jsx +41 -0
  25. package/src/components/theme/Views/OrganisationView.test.jsx +41 -0
  26. package/src/components/theme/Views/ProjectView.test.jsx +41 -0
  27. package/src/components/theme/Views/PublicationReportView.test.jsx +41 -0
  28. package/src/components/theme/Views/ToolView.test.jsx +41 -0
  29. package/src/components/theme/Views/VideoView.test.jsx +41 -0
  30. package/src/customizations/@plone/volto-slate/utils/blocks.js +7 -0
  31. package/src/helpers/Utils.jsx +9 -2
  32. package/src/index.js +4 -0
package/CHANGELOG.md CHANGED
@@ -4,6 +4,49 @@ 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
+ ### [0.1.50](https://github.com/eea/volto-cca-policy/compare/0.1.49...0.1.50) - 8 December 2023
8
+
9
+ #### :hammer_and_wrench: Others
10
+
11
+ - test: increase coverage [kreafox - [`b80a73b`](https://github.com/eea/volto-cca-policy/commit/b80a73b8cf69d09ca1b30ccaf73771367ffb0f35)]
12
+ - Make test pass [Tiberiu Ichim - [`9adf2ce`](https://github.com/eea/volto-cca-policy/commit/9adf2cec0d2d4f5c920a1524599765a5e0ae5508)]
13
+ - Refs #260715 rast-block jest test [Tripon Eugen - [`307a8b9`](https://github.com/eea/volto-cca-policy/commit/307a8b953c9d1ef8e51411d8e14e699aaeae235b)]
14
+ - Refs #260715 - sonar qube warnings [Tripon Eugen - [`09dfe3a`](https://github.com/eea/volto-cca-policy/commit/09dfe3a91a0ccc54f6c87ca5a8cabfcdb3e7f3e5)]
15
+ - Refs #260715 rast-block wip [Tripon Eugen - [`20955a3`](https://github.com/eea/volto-cca-policy/commit/20955a3dd39bb8ccaa807efea463b6e8b678a59b)]
16
+ - Refs #260715 rast-block wip [Tripon Eugen - [`5dd47cb`](https://github.com/eea/volto-cca-policy/commit/5dd47cbe32a78664646f9fa75f4ee2e73d0475f2)]
17
+ - Refs #260715 rast-block wip [Tripon Eugen - [`a932a26`](https://github.com/eea/volto-cca-policy/commit/a932a2619b776aab5042b9f24e29df4d6962829f)]
18
+ - Refs #260715 rast-block wip [Tripon Eugen - [`f19d54e`](https://github.com/eea/volto-cca-policy/commit/f19d54e0b9a6a86bf344eb85b6a1cda7f3de91bf)]
19
+ - Refs #260715 rast-block wip [Tripon Eugen - [`2828537`](https://github.com/eea/volto-cca-policy/commit/2828537b6c084cd1a82162d552fb4ef025b71f9f)]
20
+ - Refs #260715 rast-block updates [Tripon Eugen - [`1e803e5`](https://github.com/eea/volto-cca-policy/commit/1e803e5bd3d3fb7558f261c76c68866be7beb8b5)]
21
+ - test: [JENKINS] Use java17 for sonarqube scanner [valentinab25 - [`0a15e1b`](https://github.com/eea/volto-cca-policy/commit/0a15e1b2ad081233685e80d5b3c60a8663f6b896)]
22
+ - test: [JENKINS] Run cypress in started frontend container [valentinab25 - [`9554e44`](https://github.com/eea/volto-cca-policy/commit/9554e44c92a621a52b2adb5a4830fb084ee5734b)]
23
+ ### [0.1.49](https://github.com/eea/volto-cca-policy/compare/0.1.48...0.1.49) - 15 November 2023
24
+
25
+ #### :house: Internal changes
26
+
27
+ - chore: [JENKINS] Refactor automated testing [valentinab25 - [`7b820a6`](https://github.com/eea/volto-cca-policy/commit/7b820a6369c2ddd5203b1a4abe352cb4bb43db7a)]
28
+ - chore: husky, lint-staged use fixed versions [valentinab25 - [`f0a8061`](https://github.com/eea/volto-cca-policy/commit/f0a8061c275c236deb00087c23fac9860a073106)]
29
+
30
+ #### :hammer_and_wrench: Others
31
+
32
+ - Refs #259267 - test volto-slate blocks add createParagraph [Tripon Eugen - [`c855b41`](https://github.com/eea/volto-cca-policy/commit/c855b41cb925767a45e1b16e6f79cd7e9c602fc7)]
33
+ - Refs #259267 - test cypress config set multilingual default [Tripon Eugen - [`1d4fd5a`](https://github.com/eea/volto-cca-policy/commit/1d4fd5a712c4f3edcf9cd208b759c2a6d75eefb2)]
34
+ - Refs #259267 - jenkins cypress e2e [Tripon Eugen - [`08ea88e`](https://github.com/eea/volto-cca-policy/commit/08ea88e1e3fcf6b53c347c4a99b0c80a972f17fd)]
35
+ - Refs #259267 - backend_profiles multiple addons separated by space [Tripon Eugen - [`a2e3a85`](https://github.com/eea/volto-cca-policy/commit/a2e3a85992c5513e6d0a2c697e8770f709d70d45)]
36
+ - Refs #259267 - test cypress config [Tripon Eugen - [`1434f26`](https://github.com/eea/volto-cca-policy/commit/1434f2624035572056633c0eb2598585c7e04722)]
37
+ - Refs #259267 - remove multilingual testing version [Tripon Eugen - [`86fd752`](https://github.com/eea/volto-cca-policy/commit/86fd7524680174ac7e34aa415798427dd44b890a)]
38
+ - Refs #259267 - jenkins test add multilingual and set version [Tripon Eugen - [`9611e95`](https://github.com/eea/volto-cca-policy/commit/9611e954879e03b0ebcf95da4ea580e26e3eb765)]
39
+ - Refs #259267 - jenkins test change className condition [Tripon Eugen - [`402832a`](https://github.com/eea/volto-cca-policy/commit/402832a29a83116cd8daa30a1e5296ca54742f02)]
40
+ - Refs #259267 - jenkins test volto version and longer timeout [Tripon Eugen - [`94b042d`](https://github.com/eea/volto-cca-policy/commit/94b042de785baebd1644d5aede93908dbe2035d2)]
41
+ - Refs #259267 - jenkins test [Tripon Eugen - [`cacd31e`](https://github.com/eea/volto-cca-policy/commit/cacd31e7b1afe0983674ed5c7632d2e1d7fa752e)]
42
+ - Refs #259267 - jenkins [Tripon Eugen - [`5b3affe`](https://github.com/eea/volto-cca-policy/commit/5b3affee8401239de10097884c1b7f2349d15ec0)]
43
+ - Refs #259267 - add When, lead image and title to files [Tripon Eugen - [`2cedb23`](https://github.com/eea/volto-cca-policy/commit/2cedb237f898af9057e13fba94b615ef71077204)]
44
+ - test: [JENKINS] Add cpu limit on cypress docker [valentinab25 - [`4d607a5`](https://github.com/eea/volto-cca-policy/commit/4d607a576e9d0a5c34e48c41b409e7df616ee3d6)]
45
+ - test: [JENKINS] Increase shm-size to cypress docker [valentinab25 - [`b7f74d5`](https://github.com/eea/volto-cca-policy/commit/b7f74d53513a6edbfbca5cb6d19687929bb1e5db)]
46
+ - test: [JENKINS] Improve cypress time [valentinab25 - [`db65617`](https://github.com/eea/volto-cca-policy/commit/db656173391f65157098d95d388c25f6429753d8)]
47
+ - Refs #259267 - cca event blocks attachments and check not mandatoty fields [Tripon Eugen - [`3138e5a`](https://github.com/eea/volto-cca-policy/commit/3138e5afb5bfbdbed14e27ed457b16867b7fa414)]
48
+ - Refs #256681 - Fix error in CCA Event view menu. ([React Intl] An id must be provided to format a message.) [GhitaB - [`517eeb8`](https://github.com/eea/volto-cca-policy/commit/517eeb817264a47bbfd6b9b7d22aaf22d44ed224)]
49
+ - Refs #161485 - Fix ECDE name conflict. [GhitaB - [`8bfd99f`](https://github.com/eea/volto-cca-policy/commit/8bfd99ff68bb82a04d1c0ed625fa514fcf46289e)]
7
50
  ### [0.1.48](https://github.com/eea/volto-cca-policy/compare/0.1.47...0.1.48) - 16 October 2023
8
51
 
9
52
  #### :house: Internal changes
package/cypress.config.js CHANGED
@@ -2,12 +2,12 @@ const { defineConfig } = require('cypress');
2
2
 
3
3
  module.exports = defineConfig({
4
4
  viewportWidth: 1280,
5
- defaultCommandTimeout: 5000,
5
+ defaultCommandTimeout: 8888,
6
6
  chromeWebSecurity: false,
7
7
  reporter: 'junit',
8
- video: true,
8
+ video: false,
9
9
  retries: {
10
- runMode: 1,
10
+ runMode: 2,
11
11
  openMode: 0,
12
12
  },
13
13
  reporterOptions: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eeacms/volto-cca-policy",
3
- "version": "0.1.48",
3
+ "version": "0.1.50",
4
4
  "description": "@eeacms/volto-cca-policy: Volto add-on",
5
5
  "main": "src/index.js",
6
6
  "author": "European Environment Agency: IDM2 A-Team",
@@ -24,11 +24,13 @@
24
24
  "@eeacms/volto-accordion-block",
25
25
  "@eeacms/volto-slate-label",
26
26
  "@eeacms/volto-eea-design-system",
27
+ "@eeacms/volto-eea-website-theme",
27
28
  "@eeacms/volto-globalsearch"
28
29
  ],
29
30
  "dependencies": {
30
31
  "@eeacms/volto-accordion-block": "*",
31
32
  "@eeacms/volto-eea-design-system": "*",
33
+ "@eeacms/volto-eea-website-theme": "*",
32
34
  "@eeacms/volto-globalsearch": "*",
33
35
  "@eeacms/volto-openlayers-map": "*",
34
36
  "@eeacms/volto-slate-label": "*",
@@ -43,8 +45,8 @@
43
45
  "@plone/scripts": "*",
44
46
  "babel-plugin-transform-class-properties": "^6.24.1",
45
47
  "cypress-fail-fast": "^5.0.1",
46
- "husky": "*",
47
- "lint-staged": "*",
48
+ "husky": "^8.0.3",
49
+ "lint-staged": "^14.0.1",
48
50
  "md5": "^2.3.0"
49
51
  },
50
52
  "lint-staged": {
@@ -6,7 +6,7 @@ export default function C3SIndicatorsGlossaryBlockView(props) {
6
6
 
7
7
  const getIndicatorsData = () => {
8
8
  const url =
9
- '/++api++/en/knowledge/european-climate-data-explorer/@c3s_indicators_glossary_table';
9
+ '/++api++/en/knowledge/european-climate-data-explorer/@c3s_indicators_glossary_table_api';
10
10
 
11
11
  axios
12
12
  .get(url)
@@ -12,7 +12,7 @@ export default function C3SIndicatorsOverviewBlockView(props) {
12
12
  const url =
13
13
  '/++api++/en/knowledge/european-climate-data-explorer/' +
14
14
  category +
15
- '/@c3s_indicators_overview';
15
+ '/@c3s_indicators_overview_api';
16
16
 
17
17
  axios
18
18
  .get(url)
@@ -48,7 +48,7 @@
48
48
 
49
49
  span {
50
50
  float: left;
51
- font-family: OpenSansM;
51
+ font-family: OpenSansM, sans-serif;
52
52
  font-size: 12px;
53
53
  }
54
54
 
@@ -140,7 +140,6 @@
140
140
  }
141
141
 
142
142
  .country-noportal {
143
- //background-color: #999;
144
143
  background-color: #c0c0c0;
145
144
  }
146
145
  }
@@ -156,7 +155,6 @@
156
155
  }
157
156
 
158
157
  .country-noportal path {
159
- //fill: #999;
160
158
  cursor: pointer;
161
159
  fill: #e0e0e0;
162
160
  }
@@ -0,0 +1,49 @@
1
+ import React from 'react';
2
+ import { compose } from 'redux';
3
+ import { withRouter } from 'react-router';
4
+
5
+ import RASTMap from './RASTMap';
6
+ import RASTAccordion from './RASTAccordion';
7
+
8
+ import { withContentNavigation } from '@plone/volto/components/theme/Navigation/withContentNavigation';
9
+
10
+ import { useLocation } from 'react-router-dom';
11
+
12
+ /**
13
+ * A navigation slot implementation, similar to the classic Plone navigation
14
+ * portlet. It uses the same API, so the options are similar to
15
+ * INavigationPortlet
16
+ */
17
+ export function ContextNavigationComponent(props) {
18
+ const { navigation = {} } = props;
19
+ const { items = [] } = navigation;
20
+ let activeMenu = null;
21
+
22
+ const location = useLocation();
23
+ for (let i = 0; i < items.length; i++) {
24
+ let itemUrl = '/' + items[i].href.split('/').slice(3).join('/');
25
+ items[i].is_active = false;
26
+ if (location.pathname.includes(itemUrl)) {
27
+ activeMenu = i;
28
+ items[i].is_active = true;
29
+ }
30
+ }
31
+
32
+ return items.length ? (
33
+ <>
34
+ <RASTMap
35
+ items={items}
36
+ pathname={location.pathname}
37
+ activeMenu={activeMenu}
38
+ />
39
+ <RASTAccordion datasets={items} activeMenu={activeMenu} />
40
+ </>
41
+ ) : (
42
+ ''
43
+ );
44
+ }
45
+
46
+ export default compose(
47
+ withRouter,
48
+ withContentNavigation,
49
+ )(ContextNavigationComponent);
@@ -0,0 +1,79 @@
1
+ import React from 'react';
2
+ import { Accordion, Icon } from 'semantic-ui-react';
3
+ import RASTAccordionContent from './RASTAccordionContent';
4
+
5
+ const RASTAccordion = (props) => {
6
+ const { datasets = {}, activeMenu } = props;
7
+
8
+ const [activeIndex, setActiveIndex] = React.useState([activeMenu]);
9
+
10
+ const handleActiveIndex = (index) => {
11
+ setActiveIndex(index);
12
+ };
13
+ const handleClick = (e, titleProps) => {
14
+ const { index } = titleProps;
15
+
16
+ const newIndex =
17
+ activeIndex.indexOf(index) === -1
18
+ ? [...activeIndex, index]
19
+ : activeIndex.filter((item) => item !== index);
20
+
21
+ handleActiveIndex(newIndex);
22
+ };
23
+ const isActive = (id) => {
24
+ return activeIndex.includes(id);
25
+ };
26
+ return (
27
+ <>
28
+ {datasets.map((dataset, index) => {
29
+ const { id } = dataset;
30
+ const active = isActive(index);
31
+ let datasetPath = '/' + dataset.href.split('/').slice(3).join('/');
32
+
33
+ return (
34
+ <Accordion id={id} key={index} className="secondary">
35
+ <Accordion.Title
36
+ role="button"
37
+ tabIndex={0}
38
+ active={active}
39
+ aria-expanded={active}
40
+ index={index}
41
+ onClick={(e) => handleClick(e, { index, id, dataset })}
42
+ onKeyDown={(e) => {
43
+ if (e.keyCode === 13 || e.keyCode === 32) {
44
+ e.preventDefault();
45
+ handleClick(e, { index, id, dataset });
46
+ }
47
+ }}
48
+ >
49
+ <span className="dataset-title">{dataset.title}</span>
50
+ {active ? (
51
+ <Icon className="ri-arrow-up-s-line" />
52
+ ) : (
53
+ <Icon className="ri-arrow-down-s-line" />
54
+ )}
55
+ </Accordion.Title>
56
+ <Accordion.Content active={active}>
57
+ <RASTAccordionContent
58
+ key={index}
59
+ params={{
60
+ name: 'CurrentTitle',
61
+ includeTop: false,
62
+ currentFolderOnly: true,
63
+ topLevel: 3,
64
+ bottomLevel: 6,
65
+ rootPath: datasetPath,
66
+ title: dataset.title,
67
+ }}
68
+ location={{ pathname: datasetPath }}
69
+ main={{ title: dataset.title, href: dataset['@id'] }}
70
+ />
71
+ </Accordion.Content>
72
+ </Accordion>
73
+ );
74
+ })}
75
+ </>
76
+ );
77
+ };
78
+
79
+ export default RASTAccordion;
@@ -0,0 +1,42 @@
1
+ import React from 'react';
2
+ import { MemoryRouter } from 'react-router-dom';
3
+ import configureStore from 'redux-mock-store';
4
+ import { render } from '@testing-library/react';
5
+ import '@testing-library/jest-dom/extend-expect';
6
+ import { Provider } from 'react-intl-redux';
7
+ import RASTAccordion from './RASTAccordion';
8
+
9
+ const mockStore = configureStore();
10
+
11
+ describe('RASTAccordion', () => {
12
+ it('should render the component', () => {
13
+ const data = {
14
+ datasets: [
15
+ {
16
+ id: 'my-dataset',
17
+ title: 'Hello',
18
+ '@id': '/my-dataset',
19
+ href: '/my-dataset-href',
20
+ },
21
+ ],
22
+ activeMenu: 1,
23
+ };
24
+
25
+ const store = mockStore({
26
+ userSession: { token: '1234' },
27
+ intl: {
28
+ locale: 'en',
29
+ messages: {},
30
+ },
31
+ });
32
+
33
+ const { container } = render(
34
+ <Provider store={store}>
35
+ <MemoryRouter>
36
+ <RASTAccordion {...data} />
37
+ </MemoryRouter>
38
+ </Provider>,
39
+ );
40
+ expect(container.querySelector('.accordion')).toBeInTheDocument();
41
+ });
42
+ });
@@ -0,0 +1,44 @@
1
+ import { List } from 'semantic-ui-react';
2
+ import { Link } from 'react-router-dom';
3
+ import { compose } from 'redux';
4
+ import { flattenToAppURL, getBaseUrl } from '@plone/volto/helpers';
5
+
6
+ import { withContentNavigation } from '@plone/volto/components/theme/Navigation/withContentNavigation';
7
+
8
+ const RASTAccordionContent = (props) => {
9
+ const { main } = props;
10
+ const items = props.navigation?.items;
11
+
12
+ return (
13
+ <div className="dataset-content">
14
+ <div>
15
+ <List.Item key={'0'}>
16
+ <List.Content>
17
+ <div className="dataset-item">
18
+ <Link to={flattenToAppURL(getBaseUrl(main.href))}>
19
+ {main.title}
20
+ </Link>
21
+ </div>
22
+ </List.Content>
23
+ </List.Item>
24
+ {items
25
+ ? items.map((item, index) => {
26
+ return (
27
+ <List.Item key={item.id}>
28
+ <List.Content>
29
+ <div className="dataset-item">
30
+ <Link to={flattenToAppURL(getBaseUrl(item['@id']))}>
31
+ {item.title}
32
+ </Link>
33
+ </div>
34
+ </List.Content>
35
+ </List.Item>
36
+ );
37
+ })
38
+ : null}
39
+ </div>
40
+ </div>
41
+ );
42
+ };
43
+
44
+ export default compose(withContentNavigation)(RASTAccordionContent);