@eeacms/volto-cca-policy 0.1.53 → 0.1.54
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 +30 -0
- package/package.json +1 -1
- package/src/components/manage/Blocks/RASTBlock/ContextNavigation.jsx +5 -1
- package/src/components/manage/Blocks/RASTBlock/RASTAccordion.jsx +9 -19
- package/src/components/manage/Blocks/RASTBlock/RASTAccordion.test.jsx +2 -0
- package/src/components/manage/Blocks/RASTBlock/RASTAccordionContent.jsx +21 -22
- package/src/components/manage/Blocks/RASTBlock/styles.less +4 -0
- package/src/components/theme/Views/AdaptationOptionView.jsx +1 -2
- package/src/search/config.js +1 -13
- package/src/search/{config-health.js → health_observatory/config-health.js} +1 -10
- package/src/search/{facets-health.js → health_observatory/facets-health.js} +1 -1
- package/src/search/index.js +9 -18
- package/src/search/mission_projects/config-projects.js +69 -0
- package/src/search/mission_projects/facets-projects.js +30 -0
- package/src/search/{config-mission-stories.js → mission_stories/config-stories.js} +2 -10
- package/src/search/utils.js +7 -0
- package/src/search/utils.test.js +11 -0
- /package/src/search/{views-health.js → health_observatory/views-health.js} +0 -0
- /package/src/search/{facets-mission-stories.js → mission_stories/facets-stories.js} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,36 @@ 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.54](https://github.com/eea/volto-cca-policy/compare/0.1.53...0.1.54) - 20 December 2023
|
|
8
|
+
|
|
9
|
+
#### :rocket: New Features
|
|
10
|
+
|
|
11
|
+
- feat: add mission projects search config + code refactoring [kreafox - [`bdc1e73`](https://github.com/eea/volto-cca-policy/commit/bdc1e7310e9bc8b3d66f2c63f1955c25ca233be6)]
|
|
12
|
+
|
|
13
|
+
#### :bug: Bug Fixes
|
|
14
|
+
|
|
15
|
+
- fix: import [kreafox - [`93e2726`](https://github.com/eea/volto-cca-policy/commit/93e2726b93385bda46b27bab9d8f910d939c4099)]
|
|
16
|
+
|
|
17
|
+
#### :nail_care: Enhancements
|
|
18
|
+
|
|
19
|
+
- change: update mission projects facets [kreafox - [`843a297`](https://github.com/eea/volto-cca-policy/commit/843a29710677a10e8714bbf5a2892841bfb1e029)]
|
|
20
|
+
|
|
21
|
+
#### :house: Internal changes
|
|
22
|
+
|
|
23
|
+
- style: Automated code fix [eea-jenkins - [`8fb22ff`](https://github.com/eea/volto-cca-policy/commit/8fb22ffe57b6be84ed4720a21836579839ecb7ae)]
|
|
24
|
+
- style: Automated code fix [eea-jenkins - [`8bf77c8`](https://github.com/eea/volto-cca-policy/commit/8bf77c8839cec40389a99fae3ab685ed5b69d146)]
|
|
25
|
+
|
|
26
|
+
#### :hammer_and_wrench: Others
|
|
27
|
+
|
|
28
|
+
- Refs #259267 - test [Tripon Eugen - [`74e7710`](https://github.com/eea/volto-cca-policy/commit/74e77106b923a9e146e5d30d9f2410cb06e2c34c)]
|
|
29
|
+
- Refs #259267 - test [Tripon Eugen - [`84039ba`](https://github.com/eea/volto-cca-policy/commit/84039bad25b855a708a601891796da4ff2ac8e71)]
|
|
30
|
+
- Refs #260715 - requested updates [Tripon Eugen - [`89214f6`](https://github.com/eea/volto-cca-policy/commit/89214f6e1b032372a40006706e142f98fb42fa12)]
|
|
31
|
+
- Refs #260715 - requested updates [Tripon Eugen - [`c0353d8`](https://github.com/eea/volto-cca-policy/commit/c0353d8a8016d5c51a0fc6d546f5487080ae253c)]
|
|
32
|
+
- Refs #260715 - requested updates [Tripon Eugen - [`a561804`](https://github.com/eea/volto-cca-policy/commit/a561804bfe548678ae7b497f6d0f645ce0ca928b)]
|
|
33
|
+
- test: fix duplications [kreafox - [`bdea7b7`](https://github.com/eea/volto-cca-policy/commit/bdea7b7fbe01a1f7e591c39010ae8c03b7bbcbe2)]
|
|
34
|
+
- test: increase code coverage [kreafox - [`794d1aa`](https://github.com/eea/volto-cca-policy/commit/794d1aafe7c5577aae089cd781dc997e015ea3a2)]
|
|
35
|
+
- Refs #260715 - filter getContent response to get only folders and test [Tripon Eugen - [`cc967d7`](https://github.com/eea/volto-cca-policy/commit/cc967d7c540d9725993ffe0f227f31ef1bd5a317)]
|
|
36
|
+
- Refs #260715 - filter getContent response to get only folders [Tripon Eugen - [`80b5866`](https://github.com/eea/volto-cca-policy/commit/80b58661648f9caf13b28dab8382d4058d070bd5)]
|
|
7
37
|
### [0.1.53](https://github.com/eea/volto-cca-policy/compare/0.1.52...0.1.53) - 19 December 2023
|
|
8
38
|
|
|
9
39
|
#### :hammer_and_wrench: Others
|
package/package.json
CHANGED
|
@@ -32,7 +32,11 @@ export function ContextNavigationComponent(props) {
|
|
|
32
32
|
activeMenu={activeMenu}
|
|
33
33
|
/>
|
|
34
34
|
{items.length ? (
|
|
35
|
-
<RASTAccordion
|
|
35
|
+
<RASTAccordion
|
|
36
|
+
items={items}
|
|
37
|
+
curent_location={curent_location}
|
|
38
|
+
activeMenu={activeMenu}
|
|
39
|
+
/>
|
|
36
40
|
) : null}
|
|
37
41
|
</>
|
|
38
42
|
);
|
|
@@ -1,33 +1,22 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { Accordion, Icon } from 'semantic-ui-react';
|
|
3
3
|
import RASTAccordionContent from './RASTAccordionContent';
|
|
4
|
+
import { useHistory } from 'react-router-dom';
|
|
4
5
|
|
|
5
6
|
const RASTAccordion = (props) => {
|
|
6
|
-
const { items = {}, activeMenu } = props;
|
|
7
|
+
const { items = {}, curent_location, activeMenu } = props;
|
|
7
8
|
|
|
8
|
-
const
|
|
9
|
+
const history = useHistory();
|
|
9
10
|
|
|
10
|
-
const
|
|
11
|
-
|
|
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);
|
|
11
|
+
const handleClick = (e, item) => {
|
|
12
|
+
let itemUrl = '/' + item['@id'].split('/').slice(3).join('/');
|
|
13
|
+
history.push(itemUrl);
|
|
25
14
|
};
|
|
26
15
|
return (
|
|
27
16
|
<>
|
|
28
17
|
{items.map((item, index) => {
|
|
29
18
|
const { id } = item;
|
|
30
|
-
const active =
|
|
19
|
+
const active = activeMenu === index;
|
|
31
20
|
|
|
32
21
|
return (
|
|
33
22
|
<Accordion id={id} key={index} className="secondary">
|
|
@@ -37,7 +26,7 @@ const RASTAccordion = (props) => {
|
|
|
37
26
|
active={active}
|
|
38
27
|
aria-expanded={active}
|
|
39
28
|
index={index}
|
|
40
|
-
onClick={(e) => handleClick(e,
|
|
29
|
+
onClick={(e) => handleClick(e, item)}
|
|
41
30
|
onKeyDown={(e) => {
|
|
42
31
|
if (e.keyCode === 13 || e.keyCode === 32) {
|
|
43
32
|
e.preventDefault();
|
|
@@ -54,6 +43,7 @@ const RASTAccordion = (props) => {
|
|
|
54
43
|
</Accordion.Title>
|
|
55
44
|
<Accordion.Content active={active}>
|
|
56
45
|
<RASTAccordionContent
|
|
46
|
+
curent_location={curent_location}
|
|
57
47
|
key={index}
|
|
58
48
|
main={{
|
|
59
49
|
title: item.title,
|
|
@@ -8,7 +8,7 @@ import { getContent } from '@plone/volto/actions';
|
|
|
8
8
|
// import useChildren from './RASTView';
|
|
9
9
|
|
|
10
10
|
const RASTAccordionContent = (props) => {
|
|
11
|
-
const { main } = props;
|
|
11
|
+
const { main, curent_location } = props;
|
|
12
12
|
const dispatch = useDispatch();
|
|
13
13
|
const location = main.url;
|
|
14
14
|
let items = [];
|
|
@@ -22,31 +22,30 @@ const RASTAccordionContent = (props) => {
|
|
|
22
22
|
(state) => state.content?.subrequests?.[location]?.data?.items || [],
|
|
23
23
|
);
|
|
24
24
|
// const items = useChildren(location);
|
|
25
|
-
|
|
26
25
|
return (
|
|
27
26
|
<div className="dataset-content">
|
|
28
27
|
<div>
|
|
29
|
-
<List.Item key={'0'}>
|
|
30
|
-
<List.Content>
|
|
31
|
-
<div className="dataset-item">
|
|
32
|
-
<Link to={flattenToAppURL(getBaseUrl(main.href))}>
|
|
33
|
-
{main.title}
|
|
34
|
-
</Link>
|
|
35
|
-
</div>
|
|
36
|
-
</List.Content>
|
|
37
|
-
</List.Item>
|
|
38
28
|
{items.length
|
|
39
|
-
? items
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
29
|
+
? items
|
|
30
|
+
.filter((item) => item['@type'] === 'Folder')
|
|
31
|
+
.map((item) => (
|
|
32
|
+
<List.Item
|
|
33
|
+
key={item.id}
|
|
34
|
+
className={`${
|
|
35
|
+
item['@id'].endsWith(curent_location.pathname)
|
|
36
|
+
? 'active'
|
|
37
|
+
: ''
|
|
38
|
+
}`}
|
|
39
|
+
>
|
|
40
|
+
<List.Content>
|
|
41
|
+
<div className="dataset-item">
|
|
42
|
+
<Link to={flattenToAppURL(getBaseUrl(item['@id']))}>
|
|
43
|
+
{item.title}
|
|
44
|
+
</Link>
|
|
45
|
+
</div>
|
|
46
|
+
</List.Content>
|
|
47
|
+
</List.Item>
|
|
48
|
+
))
|
|
50
49
|
: null}
|
|
51
50
|
</div>
|
|
52
51
|
</div>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { Fragment } from 'react';
|
|
2
2
|
import {
|
|
3
3
|
HTMLField,
|
|
4
4
|
ContentMetadata,
|
|
@@ -7,7 +7,6 @@ import {
|
|
|
7
7
|
ShareInfo,
|
|
8
8
|
} from '@eeacms/volto-cca-policy/helpers';
|
|
9
9
|
import { Grid } from 'semantic-ui-react';
|
|
10
|
-
import { Fragment } from 'react';
|
|
11
10
|
|
|
12
11
|
const dataDisplay = [
|
|
13
12
|
{
|
package/src/search/config.js
CHANGED
|
@@ -1,19 +1,9 @@
|
|
|
1
1
|
import { mergeConfig } from '@eeacms/search';
|
|
2
2
|
import { build_runtime_mappings } from '@eeacms/volto-globalsearch/utils';
|
|
3
|
+
import { getClientProxyAddress } from './utils';
|
|
3
4
|
|
|
4
5
|
import facets from './facets';
|
|
5
6
|
|
|
6
|
-
// import views from './views';
|
|
7
|
-
// import filters from './filters';
|
|
8
|
-
// import vocabs from './vocabulary';
|
|
9
|
-
|
|
10
|
-
const getClientProxyAddress = () => {
|
|
11
|
-
const url = new URL(window.location);
|
|
12
|
-
url.pathname = '';
|
|
13
|
-
url.search = '';
|
|
14
|
-
return url.toString();
|
|
15
|
-
};
|
|
16
|
-
|
|
17
7
|
const ccaConfig = {
|
|
18
8
|
title: 'ClimateAdapt Main',
|
|
19
9
|
};
|
|
@@ -186,7 +176,5 @@ export default function installMainSearch(config) {
|
|
|
186
176
|
process.env.RAZZLE_ES_PROXY_ADDR || getClientProxyAddress();
|
|
187
177
|
}
|
|
188
178
|
|
|
189
|
-
// console.log(config.searchui.ccaSearch);
|
|
190
|
-
|
|
191
179
|
return config;
|
|
192
180
|
}
|
|
@@ -1,19 +1,10 @@
|
|
|
1
1
|
import { mergeConfig } from '@eeacms/search';
|
|
2
2
|
import { build_runtime_mappings } from '@eeacms/volto-globalsearch/utils';
|
|
3
|
+
import { getClientProxyAddress } from './../utils';
|
|
3
4
|
|
|
4
5
|
import facets from './facets-health';
|
|
5
6
|
import views from './views-health';
|
|
6
7
|
|
|
7
|
-
// import filters from './filters';
|
|
8
|
-
// import vocabs from './vocabulary';
|
|
9
|
-
|
|
10
|
-
const getClientProxyAddress = () => {
|
|
11
|
-
const url = new URL(window.location);
|
|
12
|
-
url.pathname = '';
|
|
13
|
-
url.search = '';
|
|
14
|
-
return url.toString();
|
|
15
|
-
};
|
|
16
|
-
|
|
17
8
|
const ccaConfig = {
|
|
18
9
|
title: 'ClimateAdapt Health',
|
|
19
10
|
...views,
|
package/src/search/index.js
CHANGED
|
@@ -1,30 +1,21 @@
|
|
|
1
1
|
import installMainSearch from './config';
|
|
2
|
-
import installHealthSearch from './config-health';
|
|
3
|
-
import installMissionStoriesSearch from './config-
|
|
4
|
-
|
|
5
|
-
// import DatahubCardItem from './components/Result/DatahubCardItem';
|
|
6
|
-
// import DatahubItemView from './components/ItemView/ItemView';
|
|
7
|
-
//
|
|
8
|
-
// import { DatahubResultModel } from './config/models';
|
|
9
|
-
//
|
|
10
|
-
// import { datahub_results } from './store';
|
|
11
|
-
|
|
12
|
-
// function tweakForNLPService(body, config) {
|
|
13
|
-
// if (!config.enableNLP) {
|
|
14
|
-
// delete body.source;
|
|
15
|
-
// delete body.index;
|
|
16
|
-
// return body;
|
|
17
|
-
// }
|
|
18
|
-
// return body;
|
|
19
|
-
// }
|
|
2
|
+
import installHealthSearch from './health_observatory/config-health';
|
|
3
|
+
import installMissionStoriesSearch from './mission_stories/config-stories';
|
|
4
|
+
import installMissionProjectsSearch from './mission_projects/config-projects';
|
|
20
5
|
|
|
21
6
|
const applyConfig = (config) => {
|
|
22
7
|
config.settings.searchlib = installHealthSearch(
|
|
23
8
|
installMainSearch(config.settings.searchlib),
|
|
24
9
|
);
|
|
10
|
+
|
|
25
11
|
config.settings.searchlib = installMissionStoriesSearch(
|
|
26
12
|
config.settings.searchlib,
|
|
27
13
|
);
|
|
14
|
+
|
|
15
|
+
config.settings.searchlib = installMissionProjectsSearch(
|
|
16
|
+
installMainSearch(config.settings.searchlib),
|
|
17
|
+
);
|
|
18
|
+
|
|
28
19
|
return config;
|
|
29
20
|
};
|
|
30
21
|
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { mergeConfig } from '@eeacms/search';
|
|
2
|
+
import { build_runtime_mappings } from '@eeacms/volto-globalsearch/utils';
|
|
3
|
+
import { getClientProxyAddress } from './../utils';
|
|
4
|
+
|
|
5
|
+
import facets from './facets-projects';
|
|
6
|
+
|
|
7
|
+
const missionProjectsConfig = {
|
|
8
|
+
title: 'Mission Projects',
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export const clusters = {
|
|
12
|
+
name: 'op_cluster',
|
|
13
|
+
field: 'objectProvides',
|
|
14
|
+
clusters: [
|
|
15
|
+
// {
|
|
16
|
+
// name: 'Type1',
|
|
17
|
+
// icon: { name: 'bullhorn' },
|
|
18
|
+
// values: ['Video', 'Guidance'],
|
|
19
|
+
// defaultResultView: 'horizontalCard',
|
|
20
|
+
// },
|
|
21
|
+
],
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export default function installMainSearch(config) {
|
|
25
|
+
const envConfig = process.env.RAZZLE_ENV_CONFIG
|
|
26
|
+
? JSON.parse(process.env.RAZZLE_ENV_CONFIG)
|
|
27
|
+
: missionProjectsConfig;
|
|
28
|
+
|
|
29
|
+
const pjson = require('@eeacms/volto-cca-policy/../package.json');
|
|
30
|
+
|
|
31
|
+
envConfig.app_name = pjson.name;
|
|
32
|
+
envConfig.app_version = pjson.version;
|
|
33
|
+
|
|
34
|
+
config.searchui.missionProjects = {
|
|
35
|
+
...mergeConfig(envConfig, config.searchui.globalsearchbase),
|
|
36
|
+
elastic_index: '_es/globalsearch',
|
|
37
|
+
index_name: 'data_searchui',
|
|
38
|
+
host: process.env.RAZZLE_ES_PROXY_ADDR || 'http://localhost:3000',
|
|
39
|
+
vocab: {
|
|
40
|
+
cluster_name: {
|
|
41
|
+
cca: 'Climate-ADAPT',
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
runtime_mappings: build_runtime_mappings(clusters),
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
const { missionProjects } = config.searchui;
|
|
48
|
+
|
|
49
|
+
missionProjects.permanentFilters.push({
|
|
50
|
+
term: {
|
|
51
|
+
cca_include_in_mission: 'true',
|
|
52
|
+
},
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
missionProjects.permanentFilters.push({
|
|
56
|
+
terms: {
|
|
57
|
+
objectProvides: ['Research and knowledge project'],
|
|
58
|
+
},
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
missionProjects.facets = facets;
|
|
62
|
+
|
|
63
|
+
if (typeof window !== 'undefined') {
|
|
64
|
+
config.searchui.missionProjects.host =
|
|
65
|
+
process.env.RAZZLE_ES_PROXY_ADDR || getClientProxyAddress();
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
return config;
|
|
69
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { multiTermFacet } from '@eeacms/search';
|
|
2
|
+
|
|
3
|
+
import globalSearchBaseConfig from '@eeacms/volto-globalsearch/config/global-search-base-config.js';
|
|
4
|
+
|
|
5
|
+
const facets = [
|
|
6
|
+
...globalSearchBaseConfig.facets,
|
|
7
|
+
multiTermFacet({
|
|
8
|
+
field: 'cca_adaptation_sectors.keyword',
|
|
9
|
+
isFilterable: false,
|
|
10
|
+
isMulti: true,
|
|
11
|
+
label: 'Sectors',
|
|
12
|
+
alwaysVisible: false,
|
|
13
|
+
}),
|
|
14
|
+
multiTermFacet({
|
|
15
|
+
field: 'cca_climate_impacts.keyword',
|
|
16
|
+
isFilterable: false,
|
|
17
|
+
isMulti: true,
|
|
18
|
+
label: 'Climate impacts',
|
|
19
|
+
alwaysVisible: false,
|
|
20
|
+
}),
|
|
21
|
+
multiTermFacet({
|
|
22
|
+
field: 'cca_adaptation_elements.keyword',
|
|
23
|
+
isFilterable: false,
|
|
24
|
+
isMulti: true,
|
|
25
|
+
label: 'Adaptation Elements',
|
|
26
|
+
alwaysVisible: false,
|
|
27
|
+
}),
|
|
28
|
+
];
|
|
29
|
+
|
|
30
|
+
export default facets;
|
|
@@ -1,18 +1,10 @@
|
|
|
1
1
|
import { mergeConfig } from '@eeacms/search';
|
|
2
|
-
|
|
3
|
-
import facets from './facets-
|
|
4
|
-
|
|
5
|
-
const getClientProxyAddress = () => {
|
|
6
|
-
const url = new URL(window.location);
|
|
7
|
-
url.pathname = '';
|
|
8
|
-
url.search = '';
|
|
9
|
-
return url.toString();
|
|
10
|
-
};
|
|
2
|
+
import { getClientProxyAddress } from './../utils';
|
|
3
|
+
import facets from './facets-stories';
|
|
11
4
|
|
|
12
5
|
const missionStoriesConfig = {
|
|
13
6
|
title: 'Mission stories',
|
|
14
7
|
...facets,
|
|
15
|
-
// ...views,
|
|
16
8
|
};
|
|
17
9
|
|
|
18
10
|
export default function installMissionStoriesSearch(config) {
|
package/src/search/utils.js
CHANGED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { getTodayWithTime } from './utils';
|
|
2
|
+
import '@testing-library/jest-dom/extend-expect';
|
|
3
|
+
|
|
4
|
+
describe('getTodayWithTime', () => {
|
|
5
|
+
it('should return the current date in UTC format', () => {
|
|
6
|
+
const output = getTodayWithTime();
|
|
7
|
+
|
|
8
|
+
expect(typeof output).toBe('string');
|
|
9
|
+
expect(output).toMatch(/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}Z$/);
|
|
10
|
+
});
|
|
11
|
+
});
|
|
File without changes
|
|
File without changes
|