@eeacms/volto-globalsearch 1.1.0 → 2.0.1
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/.eslintrc.js +65 -0
- package/CHANGELOG.md +33 -0
- package/jest-addon.config.js +18 -4
- package/jest.setup.js +65 -0
- package/package.json +2 -1
- package/src/components/MasonryLandingPage.jsx +4 -3
- package/src/config/clusters.js +3 -1
- package/src/config/download.js +3 -1
- package/src/config/facets.js +3 -1
- package/src/config/filters.js +3 -1
- package/src/config/index.js +4 -6
- package/src/config/query.js +3 -1
- package/src/config/views.js +3 -1
- package/src/config/vocabulary.js +3 -1
- package/src/index.js +3 -1
- package/src/utils.js +127 -130
- package/.project.eslintrc.js +0 -53
package/.eslintrc.js
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
const fs = require('fs');
|
|
2
|
+
const path = require('path');
|
|
3
|
+
const projectRootPath = fs.realpathSync(__dirname + '/../../../');
|
|
4
|
+
|
|
5
|
+
let voltoPath = path.join(projectRootPath, 'node_modules/@plone/volto');
|
|
6
|
+
let configFile;
|
|
7
|
+
if (fs.existsSync(`${projectRootPath}/tsconfig.json`))
|
|
8
|
+
configFile = `${projectRootPath}/tsconfig.json`;
|
|
9
|
+
else if (fs.existsSync(`${projectRootPath}/jsconfig.json`))
|
|
10
|
+
configFile = `${projectRootPath}/jsconfig.json`;
|
|
11
|
+
|
|
12
|
+
if (configFile) {
|
|
13
|
+
const jsConfig = require(configFile).compilerOptions;
|
|
14
|
+
const pathsConfig = jsConfig.paths;
|
|
15
|
+
if (pathsConfig['@plone/volto'])
|
|
16
|
+
voltoPath = `./${jsConfig.baseUrl}/${pathsConfig['@plone/volto'][0]}`;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const AddonConfigurationRegistry = require(`${voltoPath}/addon-registry.js`);
|
|
20
|
+
const reg = new AddonConfigurationRegistry(projectRootPath);
|
|
21
|
+
|
|
22
|
+
// Extends ESlint configuration for adding the aliases to `src` directories in Volto addons
|
|
23
|
+
const addonAliases = Object.keys(reg.packages).map((o) => [
|
|
24
|
+
o,
|
|
25
|
+
reg.packages[o].modulePath,
|
|
26
|
+
]);
|
|
27
|
+
|
|
28
|
+
const addonExtenders = reg.getEslintExtenders().map((m) => require(m));
|
|
29
|
+
|
|
30
|
+
const defaultConfig = {
|
|
31
|
+
extends: `${voltoPath}/.eslintrc`,
|
|
32
|
+
settings: {
|
|
33
|
+
'import/resolver': {
|
|
34
|
+
alias: {
|
|
35
|
+
map: [
|
|
36
|
+
['@plone/volto', '@plone/volto/src'],
|
|
37
|
+
['@plone/volto-slate', '@plone/volto/packages/volto-slate/src'],
|
|
38
|
+
...addonAliases,
|
|
39
|
+
['@package', `${__dirname}/src`],
|
|
40
|
+
['@root', `${__dirname}/src`],
|
|
41
|
+
['~', `${__dirname}/src`],
|
|
42
|
+
],
|
|
43
|
+
extensions: ['.js', '.jsx', '.json'],
|
|
44
|
+
},
|
|
45
|
+
'babel-plugin-root-import': {
|
|
46
|
+
rootPathSuffix: 'src',
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
rules: {
|
|
51
|
+
'react/jsx-no-target-blank': [
|
|
52
|
+
'error',
|
|
53
|
+
{
|
|
54
|
+
allowReferrer: true,
|
|
55
|
+
},
|
|
56
|
+
],
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
const config = addonExtenders.reduce(
|
|
61
|
+
(acc, extender) => extender.modify(acc),
|
|
62
|
+
defaultConfig,
|
|
63
|
+
);
|
|
64
|
+
|
|
65
|
+
module.exports = config;
|
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,25 @@ 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
|
+
### [2.0.1](https://github.com/eea/volto-globalsearch/compare/2.0.0...2.0.1) - 14 October 2024
|
|
8
|
+
|
|
9
|
+
#### :house: Internal changes
|
|
10
|
+
|
|
11
|
+
- chore: added water.europa.eu to thumbUrl list [laszlocseh - [`eec02dd`](https://github.com/eea/volto-globalsearch/commit/eec02dd4c2e09c3ae668d4424c1db9da1c0a04bf)]
|
|
12
|
+
|
|
13
|
+
#### :hammer_and_wrench: Others
|
|
14
|
+
|
|
15
|
+
- Add Sonarqube tag using insitu-frontend addons list [EEA Jenkins - [`5c6aa68`](https://github.com/eea/volto-globalsearch/commit/5c6aa68b0677dca98776114e69275ade89dcdf25)]
|
|
16
|
+
## [2.0.0](https://github.com/eea/volto-globalsearch/compare/1.1.0...2.0.0) - 22 April 2024
|
|
17
|
+
|
|
18
|
+
#### :rocket: New Features
|
|
19
|
+
|
|
20
|
+
- feat: Release 2.0.0 - Volto 17 support [alin - [`3b0dfda`](https://github.com/eea/volto-globalsearch/commit/3b0dfda9e0801c52509f81c285f2e531ef0787d1)]
|
|
21
|
+
- feat: Volto 17 support - refs #264527 [EEA Jenkins - [`ebfe19f`](https://github.com/eea/volto-globalsearch/commit/ebfe19fb45f303647810c850891165182d5e64be)]
|
|
22
|
+
|
|
23
|
+
#### :hammer_and_wrench: Others
|
|
24
|
+
|
|
25
|
+
- Add Sonarqube tag using freshwater-frontend addons list [EEA Jenkins - [`d37a6cb`](https://github.com/eea/volto-globalsearch/commit/d37a6cbbe18e53abed600c082d7d23f8907fd7d3)]
|
|
7
26
|
### [1.1.0](https://github.com/eea/volto-globalsearch/compare/1.0.22...1.1.0) - 16 January 2024
|
|
8
27
|
|
|
9
28
|
#### :hammer_and_wrench: Others
|
|
@@ -17,6 +36,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
|
17
36
|
|
|
18
37
|
#### :house: Internal changes
|
|
19
38
|
|
|
39
|
+
- chore: [JENKINS] Refactor automated testing [valentinab25 - [`af030b5`](https://github.com/eea/volto-globalsearch/commit/af030b5cc8780353dd67f30857fd20edf746d5a0)]
|
|
20
40
|
- chore: husky, lint-staged use fixed versions [valentinab25 - [`866609d`](https://github.com/eea/volto-globalsearch/commit/866609d540bd0efe4bab088305bb2127105d8df7)]
|
|
21
41
|
- chore:volto 16 in tests, update docs, fix stylelint overrides [valentinab25 - [`e09f5e2`](https://github.com/eea/volto-globalsearch/commit/e09f5e2c1161b4b867c04eb1c0421274bd6c7110)]
|
|
22
42
|
|
|
@@ -24,6 +44,11 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
|
24
44
|
|
|
25
45
|
- removed try/catch [Zoltan Szabo - [`86cec5d`](https://github.com/eea/volto-globalsearch/commit/86cec5d49d06d41541dc6d42464e9b95769da745)]
|
|
26
46
|
- avoid async promise executor functions [Zoltan Szabo - [`61012e3`](https://github.com/eea/volto-globalsearch/commit/61012e331776fadaa9eafe9f7667b18d08b2351a)]
|
|
47
|
+
- test: [JENKINS] Use java17 for sonarqube scanner [valentinab25 - [`693b9c7`](https://github.com/eea/volto-globalsearch/commit/693b9c7f8c9d96533f04f5ae165e7e63b753222d)]
|
|
48
|
+
- test: [JENKINS] Run cypress in started frontend container [valentinab25 - [`66db063`](https://github.com/eea/volto-globalsearch/commit/66db0635134d95f57c913c400902096980f2b66b)]
|
|
49
|
+
- test: [JENKINS] Add cpu limit on cypress docker [valentinab25 - [`4b8920b`](https://github.com/eea/volto-globalsearch/commit/4b8920b5456e5a7f0ef355a0aa208267b50d395f)]
|
|
50
|
+
- test: [JENKINS] Increase shm-size to cypress docker [valentinab25 - [`5ea9790`](https://github.com/eea/volto-globalsearch/commit/5ea97905931323146c33be941646fab45643b18b)]
|
|
51
|
+
- test: [JENKINS] Improve cypress time [valentinab25 - [`1b94a8c`](https://github.com/eea/volto-globalsearch/commit/1b94a8c137d6c4961f811bbc4596da93d2b588bd)]
|
|
27
52
|
### [1.0.21](https://github.com/eea/volto-globalsearch/compare/1.0.20...1.0.21) - 29 September 2023
|
|
28
53
|
|
|
29
54
|
#### :house: Internal changes
|
|
@@ -86,11 +111,13 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
|
86
111
|
|
|
87
112
|
#### :house: Internal changes
|
|
88
113
|
|
|
114
|
+
- chore: [JENKINS] Deprecate circularity website [valentinab25 - [`ae6efed`](https://github.com/eea/volto-globalsearch/commit/ae6efed386f8fd053972a388a3f8714ff36cf575)]
|
|
89
115
|
|
|
90
116
|
#### :hammer_and_wrench: Others
|
|
91
117
|
|
|
92
118
|
- added missing logo [Zoltan Szabo - [`94684b9`](https://github.com/eea/volto-globalsearch/commit/94684b979698c47de353ecc2a9014a8f70d7ecc1)]
|
|
93
119
|
- updated frontend with configuration for 'Climate Advisory Board' [Zoltan Szabo - [`28cf22c`](https://github.com/eea/volto-globalsearch/commit/28cf22c93237226c3957223b497a33ab3cb73623)]
|
|
120
|
+
- Add Sonarqube tag using cca-frontend addons list [EEA Jenkins - [`b655d51`](https://github.com/eea/volto-globalsearch/commit/b655d51fa3631ae42c89eb85bdcc850f70d9c72c)]
|
|
94
121
|
### [1.0.15](https://github.com/eea/volto-globalsearch/compare/1.0.14...1.0.15) - 14 March 2023
|
|
95
122
|
|
|
96
123
|
#### :hammer_and_wrench: Others
|
|
@@ -110,6 +137,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
|
110
137
|
#### :hammer_and_wrench: Others
|
|
111
138
|
|
|
112
139
|
- set the middleware proxy address for globalsearchbase [Zoltan Szabo - [`d0a0802`](https://github.com/eea/volto-globalsearch/commit/d0a08026fa73ce8fd15b666c922e7db71104a5d1)]
|
|
140
|
+
- Add Sonarqube tag using eea-website-frontend addons list [EEA Jenkins - [`b710a4f`](https://github.com/eea/volto-globalsearch/commit/b710a4f73f61e164ecf502a83e7f07d0daf578b3)]
|
|
113
141
|
### [1.0.12](https://github.com/eea/volto-globalsearch/compare/1.0.11...1.0.12) - 1 March 2023
|
|
114
142
|
|
|
115
143
|
#### :hammer_and_wrench: Others
|
|
@@ -177,12 +205,14 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
|
177
205
|
- Make last 2 years default [Tiberiu Ichim - [`ff765e2`](https://github.com/eea/volto-globalsearch/commit/ff765e24a1d93c60f091aeffa7c3156d8fb98e49)]
|
|
178
206
|
- Add compact listing, placeholder for now [Tiberiu Ichim - [`3f6104f`](https://github.com/eea/volto-globalsearch/commit/3f6104fb1725f7e3c22736a30629f64e4882242a)]
|
|
179
207
|
- test(Jenkins): Run tests and cypress with latest canary @plone/volto [Alin Voinea - [`8120264`](https://github.com/eea/volto-globalsearch/commit/812026495c31b272e6ae6415642cf1a6b2f783cf)]
|
|
208
|
+
- yarn 3 [Alin Voinea - [`b61ad50`](https://github.com/eea/volto-globalsearch/commit/b61ad5075a79bebfce1044a6cd4978c92d98fbdc)]
|
|
180
209
|
### [1.0.1](https://github.com/eea/volto-globalsearch/compare/1.0.0...1.0.1) - 16 November 2022
|
|
181
210
|
|
|
182
211
|
#### :hammer_and_wrench: Others
|
|
183
212
|
|
|
184
213
|
- Fix eslint [Tiberiu Ichim - [`cf2886b`](https://github.com/eea/volto-globalsearch/commit/cf2886b412013f9427cf5d39cdf00004bdd9f80b)]
|
|
185
214
|
- test(estlint): Fix .project.eslintrc.js [Alin Voinea - [`40c08d2`](https://github.com/eea/volto-globalsearch/commit/40c08d2d4eda81ce306225a81f09e0bcfe6794eb)]
|
|
215
|
+
- Add Sonarqube tag using circularity-frontend addons list [EEA Jenkins - [`af6e020`](https://github.com/eea/volto-globalsearch/commit/af6e020794798c1f69fee8c08bdf71fc3992230a)]
|
|
186
216
|
## [1.0.0](https://github.com/eea/volto-globalsearch/compare/0.1.7...1.0.0) - 28 October 2022
|
|
187
217
|
|
|
188
218
|
#### :nail_care: Enhancements
|
|
@@ -201,6 +231,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
|
201
231
|
#### :hammer_and_wrench: Others
|
|
202
232
|
|
|
203
233
|
- Fix dependencies [kreafox - [`50ad307`](https://github.com/eea/volto-globalsearch/commit/50ad307d64140c43df9dded27c0b532923885764)]
|
|
234
|
+
- Add Sonarqube tag using eea-website-frontend addons list [EEA Jenkins - [`c2d848e`](https://github.com/eea/volto-globalsearch/commit/c2d848e1efa456f53d883c50769882101e1ce19f)]
|
|
204
235
|
### [0.1.5](https://github.com/eea/volto-globalsearch/compare/0.1.4...0.1.5) - 28 July 2022
|
|
205
236
|
|
|
206
237
|
#### :hammer_and_wrench: Others
|
|
@@ -213,6 +244,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
|
213
244
|
|
|
214
245
|
#### :hammer_and_wrench: Others
|
|
215
246
|
|
|
247
|
+
- Add Sonarqube tag using eea-website-frontend addons list [EEA Jenkins - [`5dce07b`](https://github.com/eea/volto-globalsearch/commit/5dce07ba7d1e82776a426e9746d5dab1b0acf738)]
|
|
216
248
|
### [0.1.3](https://github.com/eea/volto-globalsearch/compare/0.1.2...0.1.3) - 10 June 2022
|
|
217
249
|
|
|
218
250
|
### [0.1.2](https://github.com/eea/volto-globalsearch/compare/0.1.1...0.1.2) - 10 June 2022
|
|
@@ -235,6 +267,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
|
235
267
|
- ignore eslint for *.json files [Zoltan Szabo - [`e18919e`](https://github.com/eea/volto-globalsearch/commit/e18919e1255818c5cf33bf769cca078d75ca3422)]
|
|
236
268
|
- formatting [Zoltan Szabo - [`18282ed`](https://github.com/eea/volto-globalsearch/commit/18282ed159865bcbc50e2fd17417cf6d90d3e593)]
|
|
237
269
|
- updated dependencies [Zoltan Szabo - [`cfcf46e`](https://github.com/eea/volto-globalsearch/commit/cfcf46ee33b23bb31f76955c12a857411f042daf)]
|
|
270
|
+
- [JENKINSFILE] fix after bootstrap [valentinab25 - [`61c8c46`](https://github.com/eea/volto-globalsearch/commit/61c8c46891edf3b52768f12cf7505c034ef7bb89)]
|
|
238
271
|
### 0.0.1 - 19 May 2022
|
|
239
272
|
|
|
240
273
|
#### :hammer_and_wrench: Others
|
package/jest-addon.config.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
require('dotenv').config({ path: __dirname + '/.env' });
|
|
2
|
+
|
|
1
3
|
module.exports = {
|
|
2
4
|
testMatch: ['**/src/addons/**/?(*.)+(spec|test).[jt]s?(x)'],
|
|
3
5
|
collectCoverageFrom: [
|
|
@@ -9,20 +11,27 @@ module.exports = {
|
|
|
9
11
|
'@plone/volto/cypress': '<rootDir>/node_modules/@plone/volto/cypress',
|
|
10
12
|
'@plone/volto/babel': '<rootDir>/node_modules/@plone/volto/babel',
|
|
11
13
|
'@plone/volto/(.*)$': '<rootDir>/node_modules/@plone/volto/src/$1',
|
|
12
|
-
'@package/(.*)$': '<rootDir>/src/$1',
|
|
13
|
-
'@root/(.*)$': '<rootDir>/src/$1',
|
|
14
|
+
'@package/(.*)$': '<rootDir>/node_modules/@plone/volto/src/$1',
|
|
15
|
+
'@root/(.*)$': '<rootDir>/node_modules/@plone/volto/src/$1',
|
|
14
16
|
'@plone/volto-quanta/(.*)$': '<rootDir>/src/addons/volto-quanta/src/$1',
|
|
17
|
+
'@eeacms/search/(.*)$':
|
|
18
|
+
'<rootDir>/node_modules/@eeacms/volto-searchlib/src/$1',
|
|
15
19
|
'@eeacms/search': '<rootDir>/node_modules/@eeacms/volto-searchlib/src',
|
|
16
20
|
'@eeacms/(.*?)/(.*)$': '<rootDir>/node_modules/@eeacms/$1/src/$2',
|
|
17
|
-
'@plone/volto-slate':
|
|
21
|
+
'@plone/volto-slate$':
|
|
18
22
|
'<rootDir>/node_modules/@plone/volto/packages/volto-slate/src',
|
|
23
|
+
'@plone/volto-slate/(.*)$':
|
|
24
|
+
'<rootDir>/node_modules/@plone/volto/packages/volto-slate/src/$1',
|
|
19
25
|
'~/(.*)$': '<rootDir>/src/$1',
|
|
20
26
|
'load-volto-addons':
|
|
21
27
|
'<rootDir>/node_modules/@plone/volto/jest-addons-loader.js',
|
|
22
28
|
},
|
|
23
|
-
transformIgnorePatterns: [
|
|
29
|
+
transformIgnorePatterns: [
|
|
30
|
+
'/node_modules/(?!(@plone|@root|@package|@eeacms)/).*/',
|
|
31
|
+
],
|
|
24
32
|
transform: {
|
|
25
33
|
'^.+\\.js(x)?$': 'babel-jest',
|
|
34
|
+
'^.+\\.ts(x)?$': 'babel-jest',
|
|
26
35
|
'^.+\\.(png)$': 'jest-file',
|
|
27
36
|
'^.+\\.(jpg)$': 'jest-file',
|
|
28
37
|
'^.+\\.(svg)$': './node_modules/@plone/volto/jest-svgsystem-transform.js',
|
|
@@ -35,4 +44,9 @@ module.exports = {
|
|
|
35
44
|
statements: 5,
|
|
36
45
|
},
|
|
37
46
|
},
|
|
47
|
+
...(process.env.JEST_USE_SETUP === 'ON' && {
|
|
48
|
+
setupFilesAfterEnv: [
|
|
49
|
+
'<rootDir>/node_modules/@eeacms/volto-globalsearch/jest.setup.js',
|
|
50
|
+
],
|
|
51
|
+
}),
|
|
38
52
|
};
|
package/jest.setup.js
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { jest } from '@jest/globals';
|
|
2
|
+
import configureStore from 'redux-mock-store';
|
|
3
|
+
import thunk from 'redux-thunk';
|
|
4
|
+
import { blocksConfig } from '@plone/volto/config/Blocks';
|
|
5
|
+
import installSlate from '@plone/volto-slate/index';
|
|
6
|
+
|
|
7
|
+
var mockSemanticComponents = jest.requireActual('semantic-ui-react');
|
|
8
|
+
var mockComponents = jest.requireActual('@plone/volto/components');
|
|
9
|
+
var config = jest.requireActual('@plone/volto/registry').default;
|
|
10
|
+
|
|
11
|
+
config.blocks.blocksConfig = {
|
|
12
|
+
...blocksConfig,
|
|
13
|
+
...config.blocks.blocksConfig,
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
jest.doMock('semantic-ui-react', () => ({
|
|
17
|
+
__esModule: true,
|
|
18
|
+
...mockSemanticComponents,
|
|
19
|
+
Popup: ({ content, trigger }) => {
|
|
20
|
+
return (
|
|
21
|
+
<div className="popup">
|
|
22
|
+
<div className="trigger">{trigger}</div>
|
|
23
|
+
<div className="content">{content}</div>
|
|
24
|
+
</div>
|
|
25
|
+
);
|
|
26
|
+
},
|
|
27
|
+
}));
|
|
28
|
+
|
|
29
|
+
jest.doMock('@plone/volto/components', () => {
|
|
30
|
+
return {
|
|
31
|
+
__esModule: true,
|
|
32
|
+
...mockComponents,
|
|
33
|
+
SidebarPortal: ({ children }) => <div id="sidebar">{children}</div>,
|
|
34
|
+
};
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
jest.doMock('@plone/volto/registry', () =>
|
|
38
|
+
[installSlate].reduce((acc, apply) => apply(acc), config),
|
|
39
|
+
);
|
|
40
|
+
|
|
41
|
+
const mockStore = configureStore([thunk]);
|
|
42
|
+
|
|
43
|
+
global.fetch = jest.fn(() =>
|
|
44
|
+
Promise.resolve({
|
|
45
|
+
json: () => Promise.resolve({}),
|
|
46
|
+
}),
|
|
47
|
+
);
|
|
48
|
+
|
|
49
|
+
global.store = mockStore({
|
|
50
|
+
intl: {
|
|
51
|
+
locale: 'en',
|
|
52
|
+
messages: {},
|
|
53
|
+
formatMessage: jest.fn(),
|
|
54
|
+
},
|
|
55
|
+
content: {
|
|
56
|
+
create: {},
|
|
57
|
+
subrequests: [],
|
|
58
|
+
},
|
|
59
|
+
connected_data_parameters: {},
|
|
60
|
+
screen: {
|
|
61
|
+
page: {
|
|
62
|
+
width: 768,
|
|
63
|
+
},
|
|
64
|
+
},
|
|
65
|
+
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eeacms/volto-globalsearch",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.1",
|
|
4
4
|
"description": "@eeacms/volto-globalsearch: Volto add-on",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"author": "European Environment Agency: IDM2 A-Team",
|
|
@@ -28,6 +28,7 @@
|
|
|
28
28
|
"@cypress/code-coverage": "^3.10.0",
|
|
29
29
|
"@plone/scripts": "*",
|
|
30
30
|
"babel-plugin-transform-class-properties": "^6.24.1",
|
|
31
|
+
"dotenv": "^16.3.2",
|
|
31
32
|
"husky": "^8.0.3",
|
|
32
33
|
"lint-staged": "^14.0.1",
|
|
33
34
|
"md5": "^2.3.0"
|
|
@@ -200,9 +200,10 @@ const LandingPage = (props) => {
|
|
|
200
200
|
landingDataAggs.aggregations.organisations.buckets.length;
|
|
201
201
|
const topics = landingDataAggs.aggregations.topics.buckets.length;
|
|
202
202
|
const languages = landingDataAggs.aggregations.languages.buckets.length;
|
|
203
|
-
const content_types =
|
|
204
|
-
|
|
205
|
-
|
|
203
|
+
const content_types =
|
|
204
|
+
landingDataAggs.aggregations.content_types.buckets.filter(
|
|
205
|
+
(bucket) => objectProvidesWhitelist.indexOf(bucket.key) !== -1,
|
|
206
|
+
).length;
|
|
206
207
|
const countries = landingDataAggs.aggregations.countries.buckets.filter(
|
|
207
208
|
(bucket) => spatialWhitelist.indexOf(bucket.key) !== -1,
|
|
208
209
|
).length;
|
package/src/config/clusters.js
CHANGED
|
@@ -70,7 +70,7 @@ export const clusters = {
|
|
|
70
70
|
|
|
71
71
|
export const clusterIcons = get_cluster_icons(clusters);
|
|
72
72
|
|
|
73
|
-
|
|
73
|
+
const config = {
|
|
74
74
|
icons: {
|
|
75
75
|
'Content types': get_cluster_icons_dict(clusters),
|
|
76
76
|
Sources: {
|
|
@@ -168,6 +168,8 @@ export default {
|
|
|
168
168
|
},
|
|
169
169
|
};
|
|
170
170
|
|
|
171
|
+
export default config;
|
|
172
|
+
|
|
171
173
|
export function typesForClustersOptionsFilter(options, filters) {
|
|
172
174
|
// Only display content types that belong to the currently selected cluster
|
|
173
175
|
const clusterMap = Object.assign(
|
package/src/config/download.js
CHANGED
package/src/config/facets.js
CHANGED
|
@@ -328,10 +328,12 @@ const facets = [
|
|
|
328
328
|
}),
|
|
329
329
|
];
|
|
330
330
|
|
|
331
|
-
|
|
331
|
+
const facetsWrapper = {
|
|
332
332
|
facets,
|
|
333
333
|
};
|
|
334
334
|
|
|
335
|
+
export default facetsWrapper;
|
|
336
|
+
|
|
335
337
|
// default filter values
|
|
336
338
|
// TODO: this needs to be removed and the configuration plugged into each of
|
|
337
339
|
// the facets
|
package/src/config/filters.js
CHANGED
|
@@ -25,10 +25,12 @@ function constantScore() {
|
|
|
25
25
|
}
|
|
26
26
|
constantScore.id = 'constantScore';
|
|
27
27
|
|
|
28
|
-
|
|
28
|
+
const filters = {
|
|
29
29
|
// filter values that are always added to the ES requests
|
|
30
30
|
permanentFilters: [
|
|
31
31
|
{ term: { hasWorkflowState: 'published' } },
|
|
32
32
|
constantScore,
|
|
33
33
|
],
|
|
34
34
|
};
|
|
35
|
+
|
|
36
|
+
export default filters;
|
package/src/config/index.js
CHANGED
|
@@ -112,12 +112,10 @@ export default function install(config) {
|
|
|
112
112
|
|
|
113
113
|
config.resolve.getGlobalSearchHealthcheck = healthcheck;
|
|
114
114
|
|
|
115
|
-
config.resolve.getGlobalsearchIconUrl =
|
|
116
|
-
contentTypeNormalize
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
contentTypeNormalize,
|
|
120
|
-
);
|
|
115
|
+
config.resolve.getGlobalsearchIconUrl =
|
|
116
|
+
getGlobalsearchIconUrl(contentTypeNormalize);
|
|
117
|
+
config.resolve.getGlobalsearchThumbUrl =
|
|
118
|
+
getGlobalsearchThumbUrl(contentTypeNormalize);
|
|
121
119
|
|
|
122
120
|
config.resolve.typesForClustersOptionsFilter = typesForClustersOptionsFilter;
|
|
123
121
|
|
package/src/config/query.js
CHANGED
package/src/config/views.js
CHANGED
package/src/config/vocabulary.js
CHANGED
package/src/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import installGlobalsearch from './config';
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
const config = (config) => {
|
|
4
4
|
config.settings.searchlib = installGlobalsearch(config.settings.searchlib);
|
|
5
5
|
|
|
6
6
|
const { globalsearch, globalsearchbase } = config.settings.searchlib.searchui;
|
|
@@ -14,3 +14,5 @@ export default (config) => {
|
|
|
14
14
|
|
|
15
15
|
return config;
|
|
16
16
|
};
|
|
17
|
+
|
|
18
|
+
export default config;
|
package/src/utils.js
CHANGED
|
@@ -63,158 +63,155 @@ export function getTodayWithTime() {
|
|
|
63
63
|
return output;
|
|
64
64
|
}
|
|
65
65
|
|
|
66
|
-
export const getGlobalsearchIconUrl =
|
|
67
|
-
result,
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
let _type;
|
|
98
|
-
let _typeClass;
|
|
99
|
-
let _contentType = 'generic';
|
|
66
|
+
export const getGlobalsearchIconUrl =
|
|
67
|
+
(contentTypeNormalize) => (result, config, fallback) => {
|
|
68
|
+
let image = fallback;
|
|
69
|
+
let has_img = false;
|
|
70
|
+
if (
|
|
71
|
+
result.about.raw.startsWith('http://www.eea.europa.eu/help/glossary/') ||
|
|
72
|
+
result.about.raw.startsWith('https://www.eea.europa.eu/help/glossary/')
|
|
73
|
+
) {
|
|
74
|
+
image = 'https://www.eea.europa.eu/portal_depiction/term/image_thumb';
|
|
75
|
+
has_img = true;
|
|
76
|
+
}
|
|
77
|
+
if (
|
|
78
|
+
result.objectProvides &&
|
|
79
|
+
result.objectProvides.raw.indexOf('Country profile') !== -1
|
|
80
|
+
) {
|
|
81
|
+
image =
|
|
82
|
+
'https://www.eea.europa.eu/portal_depiction/country-profile/image_thumb';
|
|
83
|
+
has_img = true;
|
|
84
|
+
}
|
|
85
|
+
if (
|
|
86
|
+
result.about &&
|
|
87
|
+
result.about.raw.indexOf('://land.copernicus.eu') !== -1
|
|
88
|
+
) {
|
|
89
|
+
image = 'https://www.eea.europa.eu/portal_depiction/data/image_thumb';
|
|
90
|
+
has_img = true;
|
|
91
|
+
} else {
|
|
92
|
+
if (!has_img) {
|
|
93
|
+
let contentTypes = contentTypeNormalize;
|
|
94
|
+
let _type;
|
|
95
|
+
let _typeClass;
|
|
96
|
+
let _contentType = 'generic';
|
|
100
97
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
98
|
+
if (!result.objectProvides) {
|
|
99
|
+
return image;
|
|
100
|
+
}
|
|
104
101
|
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
102
|
+
if (!Array.isArray(result.objectProvides?.raw)) {
|
|
103
|
+
result.objectProvides.raw = [result.objectProvides.raw];
|
|
104
|
+
}
|
|
105
|
+
if (result.objectProvides?.raw?.length > 0) {
|
|
106
|
+
var pos = result.objectProvides.raw.length - 1;
|
|
107
|
+
while (true) {
|
|
108
|
+
_type = result.objectProvides.raw[pos];
|
|
109
|
+
_typeClass = _type.toLowerCase().replace(/\s/g, '-');
|
|
110
|
+
if (contentTypes[_typeClass]) {
|
|
111
|
+
_contentType = contentTypes[_typeClass];
|
|
112
|
+
break;
|
|
113
|
+
}
|
|
114
|
+
pos--;
|
|
115
|
+
if (pos < 0) {
|
|
116
|
+
break;
|
|
117
|
+
}
|
|
120
118
|
}
|
|
121
119
|
}
|
|
120
|
+
image =
|
|
121
|
+
'https://www.eea.europa.eu/portal_depiction/' +
|
|
122
|
+
_contentType +
|
|
123
|
+
'/image_thumb';
|
|
122
124
|
}
|
|
123
|
-
image =
|
|
124
|
-
'https://www.eea.europa.eu/portal_depiction/' +
|
|
125
|
-
_contentType +
|
|
126
|
-
'/image_thumb';
|
|
127
125
|
}
|
|
128
|
-
}
|
|
129
126
|
|
|
130
|
-
|
|
131
|
-
};
|
|
127
|
+
return image;
|
|
128
|
+
};
|
|
132
129
|
|
|
133
|
-
export const getGlobalsearchThumbUrl =
|
|
134
|
-
result,
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
)
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
if (result.site_id?.raw === 'sdi' && result['overview.url']) {
|
|
141
|
-
has_img = false;
|
|
142
|
-
/* if (!Array.isArray(result['overview.url']?.raw)) {
|
|
130
|
+
export const getGlobalsearchThumbUrl =
|
|
131
|
+
(contentTypeNormalize) => (result, config, fallback) => {
|
|
132
|
+
let image = fallback;
|
|
133
|
+
let has_img = false;
|
|
134
|
+
if (result.site_id?.raw === 'sdi' && result['overview.url']) {
|
|
135
|
+
has_img = false;
|
|
136
|
+
/* if (!Array.isArray(result['overview.url']?.raw)) {
|
|
143
137
|
result['overview.url'].raw = [result['overview.url']?.raw];
|
|
144
138
|
}
|
|
145
139
|
if (result['overview.url']?.raw.length > 0) {
|
|
146
140
|
image = result['overview.url']?.raw[0];
|
|
147
141
|
}
|
|
148
142
|
has_img = true;*/
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
if (result.about?.raw?.indexOf('://land.copernicus.eu') !== -1) {
|
|
163
|
-
image = result?.about?.raw + '/image_preview';
|
|
164
|
-
has_img = true;
|
|
165
|
-
}
|
|
166
|
-
if (
|
|
167
|
-
result.about?.raw?.indexOf('://biodiversity.europa.eu') !== -1 ||
|
|
168
|
-
result.about?.raw?.indexOf('://forest.eea.europa.eu') !== -1 ||
|
|
169
|
-
result.about?.raw?.indexOf('://climate-energy.eea.europa.eu') !== -1 ||
|
|
170
|
-
result.about?.raw?.indexOf('://industry.eea.europa.eu') !== -1 ||
|
|
171
|
-
result.about?.raw?.indexOf('://www.eea.europa.eu/en/') !== -1
|
|
172
|
-
) {
|
|
173
|
-
if (result.image_preview) {
|
|
174
|
-
image = result.image_preview.raw;
|
|
143
|
+
}
|
|
144
|
+
if (
|
|
145
|
+
result.about?.raw?.startsWith(
|
|
146
|
+
'http://www.eea.europa.eu/help/glossary/',
|
|
147
|
+
) ||
|
|
148
|
+
result.about?.raw?.startsWith('https://www.eea.europa.eu/help/glossary/')
|
|
149
|
+
) {
|
|
150
|
+
image = 'https://www.eea.europa.eu/portal_depiction/term/image_preview';
|
|
151
|
+
has_img = true;
|
|
152
|
+
}
|
|
153
|
+
if (result.objectProvides?.raw?.indexOf('Country profile') !== -1) {
|
|
154
|
+
image =
|
|
155
|
+
'https://www.eea.europa.eu/portal_depiction/country-profile/image_preview';
|
|
175
156
|
has_img = true;
|
|
176
157
|
}
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
result.objectProvides.raw = [result.objectProvides.raw];
|
|
158
|
+
if (result.about?.raw?.indexOf('://land.copernicus.eu') !== -1) {
|
|
159
|
+
image = result?.about?.raw + '/image_preview';
|
|
160
|
+
has_img = true;
|
|
161
|
+
}
|
|
162
|
+
if (
|
|
163
|
+
result.about?.raw?.indexOf('://biodiversity.europa.eu') !== -1 ||
|
|
164
|
+
result.about?.raw?.indexOf('://forest.eea.europa.eu') !== -1 ||
|
|
165
|
+
result.about?.raw?.indexOf('://climate-energy.eea.europa.eu') !== -1 ||
|
|
166
|
+
result.about?.raw?.indexOf('://industry.eea.europa.eu') !== -1 ||
|
|
167
|
+
result.about?.raw?.indexOf('://www.eea.europa.eu/en/') !== -1 ||
|
|
168
|
+
result.about?.raw?.indexOf('://water.europa.eu') !== -1
|
|
169
|
+
) {
|
|
170
|
+
if (result.image_preview) {
|
|
171
|
+
image = result.image_preview.raw;
|
|
172
|
+
has_img = true;
|
|
193
173
|
}
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
174
|
+
}
|
|
175
|
+
if (
|
|
176
|
+
(result.about?.raw?.startsWith('http://www.eea.europa.eu') ||
|
|
177
|
+
result.about?.raw?.startsWith('https://www.eea.europa.eu')) &&
|
|
178
|
+
result.about?.raw?.indexOf('://www.eea.europa.eu/en/') === -1
|
|
179
|
+
) {
|
|
180
|
+
image = result.about.raw + '/image_preview';
|
|
181
|
+
has_img = true;
|
|
182
|
+
} else {
|
|
183
|
+
if (!has_img) {
|
|
184
|
+
let contentTypes = contentTypeNormalize;
|
|
185
|
+
let _type;
|
|
186
|
+
let _typeClass;
|
|
187
|
+
let _contentType = 'generic';
|
|
188
|
+
if (!Array.isArray(result.objectProvides?.raw)) {
|
|
189
|
+
result.objectProvides.raw = [result.objectProvides.raw];
|
|
190
|
+
}
|
|
191
|
+
if (result.objectProvides.raw.length > 0) {
|
|
192
|
+
var pos = result.objectProvides.raw.length - 1;
|
|
193
|
+
while (true) {
|
|
194
|
+
_type = result.objectProvides.raw[pos];
|
|
195
|
+
_typeClass = _type.toLowerCase().replace(/\s/g, '-');
|
|
196
|
+
if (contentTypes[_typeClass]) {
|
|
197
|
+
_contentType = contentTypes[_typeClass];
|
|
198
|
+
break;
|
|
199
|
+
}
|
|
200
|
+
pos--;
|
|
201
|
+
if (pos < 0) {
|
|
202
|
+
break;
|
|
203
|
+
}
|
|
206
204
|
}
|
|
207
205
|
}
|
|
206
|
+
image =
|
|
207
|
+
'https://www.eea.europa.eu/portal_depiction/' +
|
|
208
|
+
_contentType +
|
|
209
|
+
'/image_preview';
|
|
208
210
|
}
|
|
209
|
-
image =
|
|
210
|
-
'https://www.eea.europa.eu/portal_depiction/' +
|
|
211
|
-
_contentType +
|
|
212
|
-
'/image_preview';
|
|
213
211
|
}
|
|
214
|
-
}
|
|
215
212
|
|
|
216
|
-
|
|
217
|
-
};
|
|
213
|
+
return image;
|
|
214
|
+
};
|
|
218
215
|
|
|
219
216
|
export const get_cluster_icons = (settings) => {
|
|
220
217
|
const icons = {
|
package/.project.eslintrc.js
DELETED
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
const fs = require('fs');
|
|
2
|
-
const path = require('path');
|
|
3
|
-
|
|
4
|
-
const projectRootPath = fs.existsSync('./project')
|
|
5
|
-
? fs.realpathSync('./project')
|
|
6
|
-
: fs.realpathSync('./../../../');
|
|
7
|
-
const packageJson = require(path.join(projectRootPath, 'package.json'));
|
|
8
|
-
const jsConfig = require(path.join(projectRootPath, 'jsconfig.json'))
|
|
9
|
-
.compilerOptions;
|
|
10
|
-
|
|
11
|
-
const pathsConfig = jsConfig.paths;
|
|
12
|
-
|
|
13
|
-
let voltoPath = path.join(projectRootPath, 'node_modules/@plone/volto');
|
|
14
|
-
|
|
15
|
-
Object.keys(pathsConfig).forEach((pkg) => {
|
|
16
|
-
if (pkg === '@plone/volto') {
|
|
17
|
-
voltoPath = `./${jsConfig.baseUrl}/${pathsConfig[pkg][0]}`;
|
|
18
|
-
}
|
|
19
|
-
});
|
|
20
|
-
const AddonConfigurationRegistry = require(`${voltoPath}/addon-registry.js`);
|
|
21
|
-
const reg = new AddonConfigurationRegistry(projectRootPath);
|
|
22
|
-
|
|
23
|
-
// Extends ESlint configuration for adding the aliases to `src` directories in Volto addons
|
|
24
|
-
const addonAliases = Object.keys(reg.packages).map((o) => [
|
|
25
|
-
o,
|
|
26
|
-
reg.packages[o].modulePath,
|
|
27
|
-
]);
|
|
28
|
-
|
|
29
|
-
const voltoSearchlibPath = path.dirname(
|
|
30
|
-
reg.packages['@eeacms/volto-searchlib'].modulePath,
|
|
31
|
-
);
|
|
32
|
-
const searchlibPath = path.resolve(`${voltoSearchlibPath}/searchlib`);
|
|
33
|
-
|
|
34
|
-
module.exports = {
|
|
35
|
-
extends: `${projectRootPath}/node_modules/@plone/volto/.eslintrc`,
|
|
36
|
-
settings: {
|
|
37
|
-
'import/resolver': {
|
|
38
|
-
alias: {
|
|
39
|
-
map: [
|
|
40
|
-
['@plone/volto', '@plone/volto/src'],
|
|
41
|
-
...addonAliases,
|
|
42
|
-
['@eeacms/search', searchlibPath],
|
|
43
|
-
['@package', `${__dirname}/src`],
|
|
44
|
-
['~', `${__dirname}/src`],
|
|
45
|
-
],
|
|
46
|
-
extensions: ['.js', '.jsx', '.json'],
|
|
47
|
-
},
|
|
48
|
-
'babel-plugin-root-import': {
|
|
49
|
-
rootPathSuffix: 'src',
|
|
50
|
-
},
|
|
51
|
-
},
|
|
52
|
-
},
|
|
53
|
-
};
|