@eeacms/volto-cca-policy 0.1.50 → 0.1.52
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 +12 -0
- package/package.json +1 -1
- package/src/components/manage/Blocks/RASTBlock/ContextNavigation.jsx +9 -14
- package/src/components/manage/Blocks/RASTBlock/RASTView.jsx +13 -4
- package/src/components/manage/Blocks/RASTBlock/schema.js +5 -4
- package/src/search/config-mission-stories.js +50 -0
- package/src/search/facets-mission-stories.js +41 -0
- package/src/search/index.js +4 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,18 @@ 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.52](https://github.com/eea/volto-cca-policy/compare/0.1.51...0.1.52) - 15 December 2023
|
|
8
|
+
|
|
9
|
+
#### :rocket: New Features
|
|
10
|
+
|
|
11
|
+
- feat: add config for mission stories [kreafox - [`781f3a7`](https://github.com/eea/volto-cca-policy/commit/781f3a7692b7609b917b458dce6ef2c7effb35a4)]
|
|
12
|
+
|
|
13
|
+
### [0.1.51](https://github.com/eea/volto-cca-policy/compare/0.1.50...0.1.51) - 12 December 2023
|
|
14
|
+
|
|
15
|
+
#### :hammer_and_wrench: Others
|
|
16
|
+
|
|
17
|
+
- Refs #260715 - rast block open current path [Tripon Eugen - [`7125d5d`](https://github.com/eea/volto-cca-policy/commit/7125d5d79a31cba7c0f00929260e2c80e323896b)]
|
|
18
|
+
- Refs #260715 - rast block depend on path [Tripon Eugen - [`1c4950d`](https://github.com/eea/volto-cca-policy/commit/1c4950d3b1a5a9ae255ec59b33b96e6710a3258b)]
|
|
7
19
|
### [0.1.50](https://github.com/eea/volto-cca-policy/compare/0.1.49...0.1.50) - 8 December 2023
|
|
8
20
|
|
|
9
21
|
#### :hammer_and_wrench: Others
|
package/package.json
CHANGED
|
@@ -1,49 +1,44 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { compose } from 'redux';
|
|
3
|
-
import { withRouter } from 'react-router';
|
|
4
3
|
|
|
5
4
|
import RASTMap from './RASTMap';
|
|
6
5
|
import RASTAccordion from './RASTAccordion';
|
|
6
|
+
import { useLocation } from 'react-router-dom';
|
|
7
7
|
|
|
8
8
|
import { withContentNavigation } from '@plone/volto/components/theme/Navigation/withContentNavigation';
|
|
9
9
|
|
|
10
|
-
import { useLocation } from 'react-router-dom';
|
|
11
|
-
|
|
12
10
|
/**
|
|
13
11
|
* A navigation slot implementation, similar to the classic Plone navigation
|
|
14
12
|
* portlet. It uses the same API, so the options are similar to
|
|
15
13
|
* INavigationPortlet
|
|
16
14
|
*/
|
|
17
15
|
export function ContextNavigationComponent(props) {
|
|
18
|
-
const { navigation = {} } = props;
|
|
16
|
+
const { navigation = {}, location } = props;
|
|
19
17
|
const { items = [] } = navigation;
|
|
20
18
|
let activeMenu = null;
|
|
21
19
|
|
|
22
|
-
const
|
|
20
|
+
const curent_location = useLocation();
|
|
23
21
|
for (let i = 0; i < items.length; i++) {
|
|
24
22
|
let itemUrl = '/' + items[i].href.split('/').slice(3).join('/');
|
|
25
23
|
items[i].is_active = false;
|
|
26
|
-
if (
|
|
24
|
+
if (curent_location.pathname.includes(itemUrl)) {
|
|
27
25
|
activeMenu = i;
|
|
28
26
|
items[i].is_active = true;
|
|
29
27
|
}
|
|
30
28
|
}
|
|
31
29
|
|
|
32
|
-
return
|
|
30
|
+
return (
|
|
33
31
|
<>
|
|
34
32
|
<RASTMap
|
|
35
33
|
items={items}
|
|
36
34
|
pathname={location.pathname}
|
|
37
35
|
activeMenu={activeMenu}
|
|
38
36
|
/>
|
|
39
|
-
|
|
37
|
+
{items.length ? (
|
|
38
|
+
<RASTAccordion datasets={items} activeMenu={activeMenu} />
|
|
39
|
+
) : null}
|
|
40
40
|
</>
|
|
41
|
-
) : (
|
|
42
|
-
''
|
|
43
41
|
);
|
|
44
42
|
}
|
|
45
43
|
|
|
46
|
-
export default compose(
|
|
47
|
-
withRouter,
|
|
48
|
-
withContentNavigation,
|
|
49
|
-
)(ContextNavigationComponent);
|
|
44
|
+
export default compose(withContentNavigation)(ContextNavigationComponent);
|
|
@@ -4,18 +4,27 @@ import ContextNavigation from './ContextNavigation';
|
|
|
4
4
|
|
|
5
5
|
export default function RASTView(props) {
|
|
6
6
|
const { data } = props;
|
|
7
|
-
|
|
7
|
+
let root_path = data?.root_path;
|
|
8
|
+
let top_level = 1;
|
|
9
|
+
if (typeof root_path === 'undefined') {
|
|
10
|
+
root_path = '/';
|
|
11
|
+
}
|
|
12
|
+
top_level = (root_path.match(/\//g) || []).length - 1;
|
|
8
13
|
|
|
9
14
|
return (
|
|
10
15
|
<div className="block rast-block">
|
|
11
16
|
<ContextNavigation
|
|
12
17
|
params={{
|
|
13
18
|
// name: 'CurrentTitle',
|
|
14
|
-
includeTop: false,
|
|
15
|
-
currentFolderOnly: false,
|
|
16
|
-
topLevel: top_level
|
|
19
|
+
// includeTop: false,
|
|
20
|
+
// currentFolderOnly: false,
|
|
21
|
+
topLevel: top_level,
|
|
22
|
+
// topLevel: 2,
|
|
17
23
|
// rootPath: '/en/about/test-rast/',
|
|
18
24
|
}}
|
|
25
|
+
location={{
|
|
26
|
+
pathname: root_path,
|
|
27
|
+
}}
|
|
19
28
|
/>
|
|
20
29
|
</div>
|
|
21
30
|
);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const fields = ['
|
|
1
|
+
const fields = ['root_path'];
|
|
2
2
|
|
|
3
3
|
export default {
|
|
4
4
|
title: 'RAST',
|
|
@@ -12,10 +12,11 @@ export default {
|
|
|
12
12
|
],
|
|
13
13
|
|
|
14
14
|
properties: {
|
|
15
|
-
|
|
16
|
-
title: '
|
|
15
|
+
root_path: {
|
|
16
|
+
title: 'Rooth path',
|
|
17
17
|
type: 'string',
|
|
18
|
-
description:
|
|
18
|
+
description:
|
|
19
|
+
'Ex: /en/knowledge-and-data/regional-adaptation-support-tool',
|
|
19
20
|
required: true,
|
|
20
21
|
noValueOption: false,
|
|
21
22
|
},
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { mergeConfig } from '@eeacms/search';
|
|
2
|
+
|
|
3
|
+
import facets from './facets-mission-stories';
|
|
4
|
+
|
|
5
|
+
const getClientProxyAddress = () => {
|
|
6
|
+
const url = new URL(window.location);
|
|
7
|
+
url.pathname = '';
|
|
8
|
+
url.search = '';
|
|
9
|
+
return url.toString();
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
const missionStoriesConfig = {
|
|
13
|
+
title: 'Mission stories',
|
|
14
|
+
...facets,
|
|
15
|
+
// ...views,
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export default function installMissionStoriesSearch(config) {
|
|
19
|
+
const envConfig = process.env.RAZZLE_ENV_CONFIG
|
|
20
|
+
? JSON.parse(process.env.RAZZLE_ENV_CONFIG)
|
|
21
|
+
: missionStoriesConfig;
|
|
22
|
+
|
|
23
|
+
const pjson = require('@eeacms/volto-cca-policy/../package.json');
|
|
24
|
+
envConfig.app_name = pjson.name;
|
|
25
|
+
envConfig.app_version = pjson.version;
|
|
26
|
+
|
|
27
|
+
config.searchui.missionStoriesSearch = {
|
|
28
|
+
...mergeConfig(envConfig, config.searchui.globalsearchbase),
|
|
29
|
+
elastic_index: '_es/missionStoriesSearch',
|
|
30
|
+
index_name: 'ccatest_searchui',
|
|
31
|
+
host: process.env.RAZZLE_ES_PROXY_ADDR || 'http://localhost:3000',
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
const { missionStoriesSearch } = config.searchui;
|
|
35
|
+
|
|
36
|
+
missionStoriesSearch.permanentFilters.push({
|
|
37
|
+
terms: {
|
|
38
|
+
objectProvides: ['mission_storyy'],
|
|
39
|
+
},
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
missionStoriesSearch.facets = facets;
|
|
43
|
+
|
|
44
|
+
if (typeof window !== 'undefined') {
|
|
45
|
+
config.searchui.missionStoriesSearch.host =
|
|
46
|
+
process.env.RAZZLE_ES_PROXY_ADDR || getClientProxyAddress();
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
return config;
|
|
50
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
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: 'spatial',
|
|
9
|
+
// isFilterable: false,
|
|
10
|
+
// isMulti: true,
|
|
11
|
+
// label: 'Country',
|
|
12
|
+
// iconsFamily: 'Country',
|
|
13
|
+
// alwaysVisible: false,
|
|
14
|
+
// }),
|
|
15
|
+
multiTermFacet({
|
|
16
|
+
field: 'cca_adaptation_sectors.keyword',
|
|
17
|
+
isFilterable: false,
|
|
18
|
+
isMulti: true,
|
|
19
|
+
label: 'Sectors',
|
|
20
|
+
iconsFamily: 'Sectors',
|
|
21
|
+
alwaysVisible: false,
|
|
22
|
+
}),
|
|
23
|
+
multiTermFacet({
|
|
24
|
+
field: 'key_system.keyword',
|
|
25
|
+
isFilterable: false,
|
|
26
|
+
isMulti: true,
|
|
27
|
+
label: 'Key System',
|
|
28
|
+
iconsFamily: 'Key System',
|
|
29
|
+
alwaysVisible: false,
|
|
30
|
+
}),
|
|
31
|
+
multiTermFacet({
|
|
32
|
+
field: 'climate_threats.keyword',
|
|
33
|
+
isFilterable: false,
|
|
34
|
+
isMulti: true,
|
|
35
|
+
label: 'Hazard Type',
|
|
36
|
+
iconsFamily: 'Hazard Type',
|
|
37
|
+
alwaysVisible: false,
|
|
38
|
+
}),
|
|
39
|
+
];
|
|
40
|
+
|
|
41
|
+
export default facets;
|
package/src/search/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import installMainSearch from './config';
|
|
2
2
|
import installHealthSearch from './config-health';
|
|
3
|
+
import installMissionStoriesSearch from './config-mission-stories';
|
|
3
4
|
|
|
4
5
|
// import DatahubCardItem from './components/Result/DatahubCardItem';
|
|
5
6
|
// import DatahubItemView from './components/ItemView/ItemView';
|
|
@@ -21,7 +22,9 @@ const applyConfig = (config) => {
|
|
|
21
22
|
config.settings.searchlib = installHealthSearch(
|
|
22
23
|
installMainSearch(config.settings.searchlib),
|
|
23
24
|
);
|
|
24
|
-
|
|
25
|
+
config.settings.searchlib = installMissionStoriesSearch(
|
|
26
|
+
config.settings.searchlib,
|
|
27
|
+
);
|
|
25
28
|
return config;
|
|
26
29
|
};
|
|
27
30
|
|