@eeacms/volto-globalsearch 1.0.19 → 1.0.21
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/.eslintignore +1 -0
- package/.husky/pre-commit +2 -0
- package/CHANGELOG.md +43 -9
- package/DEVELOP.md +60 -6
- package/README.md +18 -2
- package/cypress.config.js +2 -2
- package/docker-compose.yml +32 -0
- package/jest-addon.config.js +2 -0
- package/locales/de/LC_MESSAGES/volto.po +14 -0
- package/locales/en/LC_MESSAGES/volto.po +14 -0
- package/locales/it/LC_MESSAGES/volto.po +14 -0
- package/locales/ro/LC_MESSAGES/volto.po +14 -0
- package/locales/volto.pot +16 -0
- package/package.json +26 -2
- package/src/components/MasonryLandingPage.test.jsx +99 -0
- package/src/config/facets.js +1 -1
- package/src/config/filters.js +26 -22
- package/src/config/global-search-config.js +20 -0
- package/src/config/healthcheck.js +315 -10
- package/src/config/healthcheck.test.js +300 -0
- package/src/config/healthcheck_queries/empty_resp.json +18 -0
- package/src/config/healthcheck_queries/failed_scheduled_atempts_since_last_started.json +36 -0
- package/src/config/healthcheck_queries/failed_scheduled_atempts_since_last_started_resp.json +41 -0
- package/src/config/healthcheck_queries/failed_site_since_last_started.json +31 -0
- package/src/config/healthcheck_queries/last_scheduled_indexing.json +28 -0
- package/src/config/healthcheck_queries/last_scheduled_started_indexing.json +29 -0
- package/src/config/healthcheck_queries/last_scheduled_started_indexing_resp.json +41 -0
- package/src/config/healthcheck_queries/last_sync_task_since_last_start.json +36 -0
- package/src/config/healthcheck_queries/last_sync_task_since_last_start_resp.json +63 -0
- package/src/config/healthcheck_queries/latest_tasks_for_site.json +23 -0
- package/src/config/healthcheck_queries/latest_tasks_for_site_resp.json +70 -0
- package/src/config/healthcheck_queries/started_or_finished_site_since_last_started.json +35 -0
- package/src/config/healthcheck_queries/started_or_finished_site_since_last_started_resp.json +36 -0
- package/src/config/index.test.js +191 -0
- package/src/utils.test.js +435 -0
- package/.i18n.babel.config.js +0 -1
package/.eslintignore
CHANGED
package/CHANGELOG.md
CHANGED
|
@@ -4,7 +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
|
-
### [1.0.
|
|
7
|
+
### [1.0.21](https://github.com/eea/volto-globalsearch/compare/1.0.20...1.0.21) - 29 September 2023
|
|
8
|
+
|
|
9
|
+
#### :house: Internal changes
|
|
10
|
+
|
|
11
|
+
- style: lint-staged reorder in package.json [Alin Voinea - [`06a080f`](https://github.com/eea/volto-globalsearch/commit/06a080f12993015398d29cba5c0629247512833b)]
|
|
12
|
+
|
|
13
|
+
#### :house: Documentation changes
|
|
14
|
+
|
|
15
|
+
- docs: Update README and DEVELOP [Alin Voinea - [`decd2dc`](https://github.com/eea/volto-globalsearch/commit/decd2dcc9719917d5718545bc114d6095a9ce2d9)]
|
|
16
|
+
- docs: Update DEVELOP [Alin Voinea - [`63221f1`](https://github.com/eea/volto-globalsearch/commit/63221f15c1ae25f2de80e7fad0fcde98991945ab)]
|
|
17
|
+
|
|
18
|
+
#### :hammer_and_wrench: Others
|
|
19
|
+
|
|
20
|
+
- typo [Zoltan Szabo - [`0464524`](https://github.com/eea/volto-globalsearch/commit/0464524e8b956f059903ed1a9b89d25067a31dcb)]
|
|
21
|
+
- added more tests [Zoltan Szabo - [`236e4f2`](https://github.com/eea/volto-globalsearch/commit/236e4f2fbb2931dd3a1dff75b8d41135c5925af3)]
|
|
22
|
+
- added more tests [Zoltan Szabo - [`a46e825`](https://github.com/eea/volto-globalsearch/commit/a46e82505eb9a9b0131da77e3f38b8b22f8bd062)]
|
|
23
|
+
- prettier jsons [Zoltan Szabo - [`b3617b2`](https://github.com/eea/volto-globalsearch/commit/b3617b263262210c38989814f620701012b35fab)]
|
|
24
|
+
- added missing files [Zoltan Szabo - [`9d99b47`](https://github.com/eea/volto-globalsearch/commit/9d99b4791dde155ebaa8746afe3fae76717f110a)]
|
|
25
|
+
- refactor, and updated tests [Zoltan Szabo - [`e8ee669`](https://github.com/eea/volto-globalsearch/commit/e8ee669a99b3827f4b74dc4fba463a22163d2444)]
|
|
26
|
+
- removed debug code [Zoltan Szabo - [`e776630`](https://github.com/eea/volto-globalsearch/commit/e776630d1a6842cc750b6091f9d4692bc47410cb)]
|
|
27
|
+
- added more tests for healthcheck [Zoltan Szabo - [`bb38530`](https://github.com/eea/volto-globalsearch/commit/bb3853004af289a73bf6b5343bac92f4a559cf0d)]
|
|
28
|
+
- added more tests for healthcheck [Zoltan Szabo - [`3254d57`](https://github.com/eea/volto-globalsearch/commit/3254d57f7afac5410f54b86f91ae1257490fa201)]
|
|
29
|
+
- added tests for healthcheck [Zoltan Szabo - [`7d42dfc`](https://github.com/eea/volto-globalsearch/commit/7d42dfc481a3a355d54c2d679f0fb83c702190e8)]
|
|
30
|
+
- made queries prettier [Zoltan Szabo - [`f5b3f1e`](https://github.com/eea/volto-globalsearch/commit/f5b3f1e65108df9b0e5fe749de80cb8a1581e9db)]
|
|
31
|
+
- fixed eslints [Zoltan Szabo - [`c1f0cb5`](https://github.com/eea/volto-globalsearch/commit/c1f0cb52edd363ef8db748d9d7141eac40a8dec6)]
|
|
32
|
+
- test: EN locales, pre-commit fix, feature PRs checks Refs #257193 [valentinab25 - [`a4633e7`](https://github.com/eea/volto-globalsearch/commit/a4633e770e0b4c211dbdda83fe5005bcb74895bd)]
|
|
33
|
+
- updated labels for reading time aggregations [Zoltan Szabo - [`4061905`](https://github.com/eea/volto-globalsearch/commit/4061905d84b38364d5ac8dbf13665b1fb7130969)]
|
|
34
|
+
- i18n: Add en [Alin Voinea - [`3359382`](https://github.com/eea/volto-globalsearch/commit/33593824d993c09ca3530e6fe29d6e4a8770f110)]
|
|
35
|
+
- test: Update Makefile and docker-compose to align it with Jenkinsfile [valentinab25 - [`fcf08e3`](https://github.com/eea/volto-globalsearch/commit/fcf08e34e4cb504bc65233b8cde37dbc5f69efe6)]
|
|
36
|
+
- remove debugger [Zoltan Szabo - [`d8fed25`](https://github.com/eea/volto-globalsearch/commit/d8fed255f24bf3be9d50295906c38b95888baffd)]
|
|
37
|
+
- updated tests [Zoltan Szabo - [`6712800`](https://github.com/eea/volto-globalsearch/commit/6712800eee7cfc9ded4f2eed15ec61f19091eb27)]
|
|
38
|
+
- added new permanent filter, so we can exclude some documents from global search [Zoltan Szabo - [`4a1095b`](https://github.com/eea/volto-globalsearch/commit/4a1095bedc3970ee14728ee1e90b30223e50913e)]
|
|
39
|
+
### [1.0.20](https://github.com/eea/volto-globalsearch/compare/1.0.19...1.0.20) - 17 August 2023
|
|
40
|
+
|
|
41
|
+
#### :house: Documentation changes
|
|
42
|
+
|
|
43
|
+
- docs: Cleanup Makefile, update DEVELOP documentation, i18n - refs #254894 [valentinab25 - [`6e565ca`](https://github.com/eea/volto-globalsearch/commit/6e565ca8130e5af4b48fe13fb210665f1c874b5b)]
|
|
44
|
+
|
|
45
|
+
#### :hammer_and_wrench: Others
|
|
46
|
+
|
|
47
|
+
- test: increase test coverage - refs #254313 [ana-oprea - [`889180c`](https://github.com/eea/volto-globalsearch/commit/889180c682cfb503d0d09580cbdc7b6dac932c8c)]
|
|
48
|
+
- instead of returning numeric values for healthcheck, return OK/WARNING/CRITICAL [Zoltan Szabo - [`9107f3b`](https://github.com/eea/volto-globalsearch/commit/9107f3beeb76cb801cd902e4843189d378a4e07b)]
|
|
49
|
+
### [1.0.19](https://github.com/eea/volto-globalsearch/compare/1.0.18...1.0.19) - 26 July 2023
|
|
8
50
|
|
|
9
51
|
#### :hammer_and_wrench: Others
|
|
10
52
|
|
|
@@ -24,13 +66,11 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
|
24
66
|
|
|
25
67
|
#### :house: Internal changes
|
|
26
68
|
|
|
27
|
-
- chore: [JENKINS] Deprecate circularity website [valentinab25 - [`ae6efed`](https://github.com/eea/volto-globalsearch/commit/ae6efed386f8fd053972a388a3f8714ff36cf575)]
|
|
28
69
|
|
|
29
70
|
#### :hammer_and_wrench: Others
|
|
30
71
|
|
|
31
72
|
- added missing logo [Zoltan Szabo - [`94684b9`](https://github.com/eea/volto-globalsearch/commit/94684b979698c47de353ecc2a9014a8f70d7ecc1)]
|
|
32
73
|
- updated frontend with configuration for 'Climate Advisory Board' [Zoltan Szabo - [`28cf22c`](https://github.com/eea/volto-globalsearch/commit/28cf22c93237226c3957223b497a33ab3cb73623)]
|
|
33
|
-
- Add Sonarqube tag using cca-frontend addons list [EEA Jenkins - [`b655d51`](https://github.com/eea/volto-globalsearch/commit/b655d51fa3631ae42c89eb85bdcc850f70d9c72c)]
|
|
34
74
|
### [1.0.15](https://github.com/eea/volto-globalsearch/compare/1.0.14...1.0.15) - 14 March 2023
|
|
35
75
|
|
|
36
76
|
#### :hammer_and_wrench: Others
|
|
@@ -50,7 +90,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
|
50
90
|
#### :hammer_and_wrench: Others
|
|
51
91
|
|
|
52
92
|
- set the middleware proxy address for globalsearchbase [Zoltan Szabo - [`d0a0802`](https://github.com/eea/volto-globalsearch/commit/d0a08026fa73ce8fd15b666c922e7db71104a5d1)]
|
|
53
|
-
- Add Sonarqube tag using eea-website-frontend addons list [EEA Jenkins - [`b710a4f`](https://github.com/eea/volto-globalsearch/commit/b710a4f73f61e164ecf502a83e7f07d0daf578b3)]
|
|
54
93
|
### [1.0.12](https://github.com/eea/volto-globalsearch/compare/1.0.11...1.0.12) - 1 March 2023
|
|
55
94
|
|
|
56
95
|
#### :hammer_and_wrench: Others
|
|
@@ -118,14 +157,12 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
|
118
157
|
- Make last 2 years default [Tiberiu Ichim - [`ff765e2`](https://github.com/eea/volto-globalsearch/commit/ff765e24a1d93c60f091aeffa7c3156d8fb98e49)]
|
|
119
158
|
- Add compact listing, placeholder for now [Tiberiu Ichim - [`3f6104f`](https://github.com/eea/volto-globalsearch/commit/3f6104fb1725f7e3c22736a30629f64e4882242a)]
|
|
120
159
|
- test(Jenkins): Run tests and cypress with latest canary @plone/volto [Alin Voinea - [`8120264`](https://github.com/eea/volto-globalsearch/commit/812026495c31b272e6ae6415642cf1a6b2f783cf)]
|
|
121
|
-
- yarn 3 [Alin Voinea - [`b61ad50`](https://github.com/eea/volto-globalsearch/commit/b61ad5075a79bebfce1044a6cd4978c92d98fbdc)]
|
|
122
160
|
### [1.0.1](https://github.com/eea/volto-globalsearch/compare/1.0.0...1.0.1) - 16 November 2022
|
|
123
161
|
|
|
124
162
|
#### :hammer_and_wrench: Others
|
|
125
163
|
|
|
126
164
|
- Fix eslint [Tiberiu Ichim - [`cf2886b`](https://github.com/eea/volto-globalsearch/commit/cf2886b412013f9427cf5d39cdf00004bdd9f80b)]
|
|
127
165
|
- test(estlint): Fix .project.eslintrc.js [Alin Voinea - [`40c08d2`](https://github.com/eea/volto-globalsearch/commit/40c08d2d4eda81ce306225a81f09e0bcfe6794eb)]
|
|
128
|
-
- Add Sonarqube tag using circularity-frontend addons list [EEA Jenkins - [`af6e020`](https://github.com/eea/volto-globalsearch/commit/af6e020794798c1f69fee8c08bdf71fc3992230a)]
|
|
129
166
|
## [1.0.0](https://github.com/eea/volto-globalsearch/compare/0.1.7...1.0.0) - 28 October 2022
|
|
130
167
|
|
|
131
168
|
#### :nail_care: Enhancements
|
|
@@ -144,7 +181,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
|
144
181
|
#### :hammer_and_wrench: Others
|
|
145
182
|
|
|
146
183
|
- Fix dependencies [kreafox - [`50ad307`](https://github.com/eea/volto-globalsearch/commit/50ad307d64140c43df9dded27c0b532923885764)]
|
|
147
|
-
- Add Sonarqube tag using eea-website-frontend addons list [EEA Jenkins - [`c2d848e`](https://github.com/eea/volto-globalsearch/commit/c2d848e1efa456f53d883c50769882101e1ce19f)]
|
|
148
184
|
### [0.1.5](https://github.com/eea/volto-globalsearch/compare/0.1.4...0.1.5) - 28 July 2022
|
|
149
185
|
|
|
150
186
|
#### :hammer_and_wrench: Others
|
|
@@ -157,7 +193,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
|
157
193
|
|
|
158
194
|
#### :hammer_and_wrench: Others
|
|
159
195
|
|
|
160
|
-
- Add Sonarqube tag using eea-website-frontend addons list [EEA Jenkins - [`5dce07b`](https://github.com/eea/volto-globalsearch/commit/5dce07ba7d1e82776a426e9746d5dab1b0acf738)]
|
|
161
196
|
### [0.1.3](https://github.com/eea/volto-globalsearch/compare/0.1.2...0.1.3) - 10 June 2022
|
|
162
197
|
|
|
163
198
|
### [0.1.2](https://github.com/eea/volto-globalsearch/compare/0.1.1...0.1.2) - 10 June 2022
|
|
@@ -180,7 +215,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
|
180
215
|
- ignore eslint for *.json files [Zoltan Szabo - [`e18919e`](https://github.com/eea/volto-globalsearch/commit/e18919e1255818c5cf33bf769cca078d75ca3422)]
|
|
181
216
|
- formatting [Zoltan Szabo - [`18282ed`](https://github.com/eea/volto-globalsearch/commit/18282ed159865bcbc50e2fd17417cf6d90d3e593)]
|
|
182
217
|
- updated dependencies [Zoltan Szabo - [`cfcf46e`](https://github.com/eea/volto-globalsearch/commit/cfcf46ee33b23bb31f76955c12a857411f042daf)]
|
|
183
|
-
- [JENKINSFILE] fix after bootstrap [valentinab25 - [`61c8c46`](https://github.com/eea/volto-globalsearch/commit/61c8c46891edf3b52768f12cf7505c034ef7bb89)]
|
|
184
218
|
### 0.0.1 - 19 May 2022
|
|
185
219
|
|
|
186
220
|
#### :hammer_and_wrench: Others
|
package/DEVELOP.md
CHANGED
|
@@ -2,6 +2,30 @@
|
|
|
2
2
|
|
|
3
3
|
## Develop
|
|
4
4
|
|
|
5
|
+
1. Make sure you have `docker` and `docker compose` installed and running on your machine:
|
|
6
|
+
|
|
7
|
+
```Bash
|
|
8
|
+
git clone https://github.com/eea/volto-globalsearch.git
|
|
9
|
+
cd volto-globalsearch
|
|
10
|
+
git checkout -b bugfix-123456 develop
|
|
11
|
+
make
|
|
12
|
+
make start
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
1. Wait for `Volto started at 0.0.0.0:3000` meesage
|
|
16
|
+
|
|
17
|
+
1. Go to http://localhost:3000
|
|
18
|
+
|
|
19
|
+
1. Initialize git hooks
|
|
20
|
+
|
|
21
|
+
```Bash
|
|
22
|
+
yarn prepare
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
1. Happy hacking!
|
|
26
|
+
|
|
27
|
+
### Or add @eeacms/volto-globalsearch to your Volto project
|
|
28
|
+
|
|
5
29
|
Before starting make sure your development environment is properly set. See [Volto Developer Documentation](https://docs.voltocms.com/getting-started/install/)
|
|
6
30
|
|
|
7
31
|
1. Make sure you have installed `yo`, `@plone/generator-volto` and `mrs-developer`
|
|
@@ -26,18 +50,15 @@ Before starting make sure your development environment is properly set. See [Vol
|
|
|
26
50
|
|
|
27
51
|
1. Install
|
|
28
52
|
|
|
29
|
-
|
|
53
|
+
make develop
|
|
30
54
|
yarn
|
|
31
55
|
|
|
32
56
|
1. Start backend
|
|
33
57
|
|
|
34
|
-
docker pull plone
|
|
35
|
-
docker run -d --name plone -p 8080:8080 -e SITE=Plone -e PROFILES="profile-plone.restapi:blocks" plone
|
|
58
|
+
docker run --pull always -it --rm --name plone -p 8080:8080 -e SITE=Plone plone/plone-backend
|
|
36
59
|
|
|
37
60
|
...wait for backend to setup and start - `Ready to handle requests`:
|
|
38
61
|
|
|
39
|
-
docker logs -f plone
|
|
40
|
-
|
|
41
62
|
...you can also check http://localhost:8080/Plone
|
|
42
63
|
|
|
43
64
|
1. Start frontend
|
|
@@ -49,4 +70,37 @@ Before starting make sure your development environment is properly set. See [Vol
|
|
|
49
70
|
1. Happy hacking!
|
|
50
71
|
|
|
51
72
|
cd src/addons/volto-globalsearch/
|
|
52
|
-
|
|
73
|
+
|
|
74
|
+
## Cypress
|
|
75
|
+
|
|
76
|
+
To run cypress locally, first make sure you don't have any Volto/Plone running on ports `8080` and `3000`.
|
|
77
|
+
|
|
78
|
+
You don't have to be in a `clean-volto-project`, you can be in any Volto Frontend
|
|
79
|
+
project where you added `volto-globalsearch` to `mrs.developer.json`
|
|
80
|
+
|
|
81
|
+
Go to:
|
|
82
|
+
|
|
83
|
+
```BASH
|
|
84
|
+
cd src/addons/volto-globalsearch/
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
Start:
|
|
88
|
+
|
|
89
|
+
```Bash
|
|
90
|
+
make
|
|
91
|
+
make start
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
This will build and start with Docker a clean `Plone backend` and `Volto Frontend` with `volto-globalsearch` block installed.
|
|
95
|
+
|
|
96
|
+
Open Cypress Interface:
|
|
97
|
+
|
|
98
|
+
```Bash
|
|
99
|
+
make cypress-open
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
Or run it:
|
|
103
|
+
|
|
104
|
+
```Bash
|
|
105
|
+
make cypress-run
|
|
106
|
+
```
|
package/README.md
CHANGED
|
@@ -14,19 +14,35 @@
|
|
|
14
14
|
[](https://sonarqube.eea.europa.eu/dashboard?id=volto-globalsearch-develop)
|
|
15
15
|
[](https://sonarqube.eea.europa.eu/dashboard?id=volto-globalsearch-develop)
|
|
16
16
|
|
|
17
|
-
|
|
18
17
|
EEA Elastic Search Block with NLP integration [Volto](https://github.com/plone/volto) add-on
|
|
19
18
|
|
|
19
|
+
## Features
|
|
20
|
+
|
|
21
|
+

|
|
22
|
+
|
|
20
23
|
## Demo
|
|
21
24
|
|
|
22
25
|
- https://demo-www.eea.europa.eu/en/advanced-search
|
|
23
26
|
|
|
24
27
|
## Getting started
|
|
25
28
|
|
|
29
|
+
### Try volto-globalsearch with Docker
|
|
30
|
+
|
|
31
|
+
git clone https://github.com/eea/volto-globalsearch.git
|
|
32
|
+
cd volto-globalsearch
|
|
33
|
+
make
|
|
34
|
+
make start
|
|
35
|
+
|
|
36
|
+
Go to http://localhost:3000
|
|
37
|
+
|
|
26
38
|
### Add volto-globalsearch to your Volto project
|
|
27
39
|
|
|
28
40
|
1. Make sure you have a [Plone backend](https://plone.org/download) up-and-running at http://localhost:8080/Plone
|
|
29
41
|
|
|
42
|
+
```Bash
|
|
43
|
+
docker compose up backend
|
|
44
|
+
```
|
|
45
|
+
|
|
30
46
|
1. Start Volto frontend
|
|
31
47
|
|
|
32
48
|
* If you already have a volto project, just update `package.json`:
|
|
@@ -45,7 +61,7 @@ EEA Elastic Search Block with NLP integration [Volto](https://github.com/plone/v
|
|
|
45
61
|
|
|
46
62
|
```
|
|
47
63
|
npm install -g yo @plone/generator-volto
|
|
48
|
-
yo @plone/volto my-volto-project --addon @eeacms/volto-globalsearch
|
|
64
|
+
yo @plone/volto my-volto-project --canary --addon @eeacms/volto-globalsearch
|
|
49
65
|
cd my-volto-project
|
|
50
66
|
```
|
|
51
67
|
|
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:
|
|
5
|
+
defaultCommandTimeout: 5000,
|
|
6
6
|
chromeWebSecurity: false,
|
|
7
7
|
reporter: 'junit',
|
|
8
8
|
video: true,
|
|
9
9
|
retries: {
|
|
10
|
-
runMode:
|
|
10
|
+
runMode: 1,
|
|
11
11
|
openMode: 0,
|
|
12
12
|
},
|
|
13
13
|
reporterOptions: {
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
version: "3"
|
|
2
|
+
services:
|
|
3
|
+
backend:
|
|
4
|
+
image: eeacms/plone-backend
|
|
5
|
+
ports:
|
|
6
|
+
- "8080:8080"
|
|
7
|
+
environment:
|
|
8
|
+
SITE: "Plone"
|
|
9
|
+
PROFILES: "eea.kitkat:testing"
|
|
10
|
+
|
|
11
|
+
frontend:
|
|
12
|
+
build:
|
|
13
|
+
context: ./
|
|
14
|
+
dockerfile: ./Dockerfile
|
|
15
|
+
args:
|
|
16
|
+
ADDON_NAME: "${ADDON_NAME}"
|
|
17
|
+
ADDON_PATH: "${ADDON_PATH}"
|
|
18
|
+
VOLTO_VERSION: ${VOLTO_VERSION:-16}
|
|
19
|
+
ports:
|
|
20
|
+
- "3000:3000"
|
|
21
|
+
- "3001:3001"
|
|
22
|
+
depends_on:
|
|
23
|
+
- backend
|
|
24
|
+
volumes:
|
|
25
|
+
- ./:/app/src/addons/${ADDON_PATH}
|
|
26
|
+
environment:
|
|
27
|
+
CI: "true"
|
|
28
|
+
NODE_ENV: "development"
|
|
29
|
+
RAZZLE_JEST_CONFIG: "src/addons/${ADDON_PATH}/jest-addon.config.js"
|
|
30
|
+
RAZZLE_INTERNAL_API_PATH: "http://backend:8080/Plone"
|
|
31
|
+
RAZZLE_DEV_PROXY_API_PATH: "http://backend:8080/Plone"
|
|
32
|
+
HOST: "0.0.0.0"
|
package/jest-addon.config.js
CHANGED
|
@@ -12,6 +12,7 @@ module.exports = {
|
|
|
12
12
|
'@package/(.*)$': '<rootDir>/src/$1',
|
|
13
13
|
'@root/(.*)$': '<rootDir>/src/$1',
|
|
14
14
|
'@plone/volto-quanta/(.*)$': '<rootDir>/src/addons/volto-quanta/src/$1',
|
|
15
|
+
'@eeacms/search': '<rootDir>/node_modules/@eeacms/volto-searchlib/src',
|
|
15
16
|
'@eeacms/(.*?)/(.*)$': '<rootDir>/node_modules/@eeacms/$1/src/$2',
|
|
16
17
|
'@plone/volto-slate':
|
|
17
18
|
'<rootDir>/node_modules/@plone/volto/packages/volto-slate/src',
|
|
@@ -19,6 +20,7 @@ module.exports = {
|
|
|
19
20
|
'load-volto-addons':
|
|
20
21
|
'<rootDir>/node_modules/@plone/volto/jest-addons-loader.js',
|
|
21
22
|
},
|
|
23
|
+
transformIgnorePatterns: ['node_modules/(?!@eeacms)/volto-listing-block'],
|
|
22
24
|
transform: {
|
|
23
25
|
'^.+\\.js(x)?$': 'babel-jest',
|
|
24
26
|
'^.+\\.(png)$': 'jest-file',
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
msgid ""
|
|
2
|
+
msgstr ""
|
|
3
|
+
"Project-Id-Version: \n"
|
|
4
|
+
"Report-Msgid-Bugs-To: \n"
|
|
5
|
+
"POT-Creation-Date: \n"
|
|
6
|
+
"PO-Revision-Date: \n"
|
|
7
|
+
"Last-Translator: \n"
|
|
8
|
+
"Language: \n"
|
|
9
|
+
"Language-Team: \n"
|
|
10
|
+
"Content-Type: \n"
|
|
11
|
+
"Content-Transfer-Encoding: \n"
|
|
12
|
+
"Plural-Forms: \n"
|
|
13
|
+
|
|
14
|
+
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
msgid ""
|
|
2
|
+
msgstr ""
|
|
3
|
+
"Project-Id-Version: \n"
|
|
4
|
+
"Report-Msgid-Bugs-To: \n"
|
|
5
|
+
"POT-Creation-Date: \n"
|
|
6
|
+
"PO-Revision-Date: \n"
|
|
7
|
+
"Last-Translator: \n"
|
|
8
|
+
"Language: \n"
|
|
9
|
+
"Language-Team: \n"
|
|
10
|
+
"Content-Type: \n"
|
|
11
|
+
"Content-Transfer-Encoding: \n"
|
|
12
|
+
"Plural-Forms: \n"
|
|
13
|
+
|
|
14
|
+
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
msgid ""
|
|
2
|
+
msgstr ""
|
|
3
|
+
"Project-Id-Version: \n"
|
|
4
|
+
"Report-Msgid-Bugs-To: \n"
|
|
5
|
+
"POT-Creation-Date: \n"
|
|
6
|
+
"PO-Revision-Date: \n"
|
|
7
|
+
"Last-Translator: \n"
|
|
8
|
+
"Language: \n"
|
|
9
|
+
"Language-Team: \n"
|
|
10
|
+
"Content-Type: \n"
|
|
11
|
+
"Content-Transfer-Encoding: \n"
|
|
12
|
+
"Plural-Forms: \n"
|
|
13
|
+
|
|
14
|
+
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
msgid ""
|
|
2
|
+
msgstr ""
|
|
3
|
+
"Project-Id-Version: \n"
|
|
4
|
+
"Report-Msgid-Bugs-To: \n"
|
|
5
|
+
"POT-Creation-Date: \n"
|
|
6
|
+
"PO-Revision-Date: \n"
|
|
7
|
+
"Last-Translator: \n"
|
|
8
|
+
"Language: \n"
|
|
9
|
+
"Language-Team: \n"
|
|
10
|
+
"Content-Type: \n"
|
|
11
|
+
"Content-Transfer-Encoding: \n"
|
|
12
|
+
"Plural-Forms: \n"
|
|
13
|
+
|
|
14
|
+
|
package/locales/volto.pot
CHANGED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
msgid ""
|
|
2
|
+
msgstr ""
|
|
3
|
+
"Project-Id-Version: Plone\n"
|
|
4
|
+
"POT-Creation-Date: 2023-06-28T10:48:22.678Z\n"
|
|
5
|
+
"Last-Translator: Plone i18n <plone-i18n@lists.sourceforge.net>\n"
|
|
6
|
+
"Language-Team: Plone i18n <plone-i18n@lists.sourceforge.net>\n"
|
|
7
|
+
"MIME-Version: 1.0\n"
|
|
8
|
+
"Content-Type: text/plain; charset=utf-8\n"
|
|
9
|
+
"Content-Transfer-Encoding: 8bit\n"
|
|
10
|
+
"Plural-Forms: nplurals=1; plural=0;\n"
|
|
11
|
+
"Language-Code: en\n"
|
|
12
|
+
"Language-Name: English\n"
|
|
13
|
+
"Preferred-Encodings: utf-8\n"
|
|
14
|
+
"Domain: volto\n"
|
|
15
|
+
|
|
16
|
+
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eeacms/volto-globalsearch",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.21",
|
|
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,8 +28,31 @@
|
|
|
28
28
|
"@cypress/code-coverage": "^3.10.0",
|
|
29
29
|
"@plone/scripts": "*",
|
|
30
30
|
"babel-plugin-transform-class-properties": "^6.24.1",
|
|
31
|
+
"husky": "*",
|
|
32
|
+
"lint-staged": "*",
|
|
31
33
|
"md5": "^2.3.0"
|
|
32
34
|
},
|
|
35
|
+
"lint-staged": {
|
|
36
|
+
"src/**/*.{js,jsx,ts,tsx,json}": [
|
|
37
|
+
"make lint-fix",
|
|
38
|
+
"make prettier-fix"
|
|
39
|
+
],
|
|
40
|
+
"src/**/*.{jsx}": [
|
|
41
|
+
"make i18n"
|
|
42
|
+
],
|
|
43
|
+
"theme/**/*.{css,less}": [
|
|
44
|
+
"make stylelint-fix"
|
|
45
|
+
],
|
|
46
|
+
"src/**/*.{css,less}": [
|
|
47
|
+
"make stylelint-fix"
|
|
48
|
+
],
|
|
49
|
+
"theme/**/*.overrides": [
|
|
50
|
+
"make stylelint-fix"
|
|
51
|
+
],
|
|
52
|
+
"src/**/*.overrides": [
|
|
53
|
+
"make stylelint-fix"
|
|
54
|
+
]
|
|
55
|
+
},
|
|
33
56
|
"scripts": {
|
|
34
57
|
"release": "release-it",
|
|
35
58
|
"release-major-beta": "release-it major --preRelease=beta",
|
|
@@ -47,6 +70,7 @@
|
|
|
47
70
|
"lint:fix": "make lint-fix",
|
|
48
71
|
"i18n": "make i18n",
|
|
49
72
|
"cypress:run": "make cypress-run",
|
|
50
|
-
"cypress:open": "make cypress-open"
|
|
73
|
+
"cypress:open": "make cypress-open",
|
|
74
|
+
"prepare": "husky install"
|
|
51
75
|
}
|
|
52
76
|
}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { render } from '@testing-library/react';
|
|
3
|
+
import LandingPage from './MasonryLandingPage';
|
|
4
|
+
import { runRequest } from '@eeacms/search';
|
|
5
|
+
import '@testing-library/jest-dom/extend-expect';
|
|
6
|
+
|
|
7
|
+
jest.mock('@eeacms/search', () => ({
|
|
8
|
+
runRequest: jest.fn(),
|
|
9
|
+
}));
|
|
10
|
+
|
|
11
|
+
describe('LandingPage', () => {
|
|
12
|
+
it('renders loading state', () => {
|
|
13
|
+
runRequest.mockReturnValue(new Promise(() => {}));
|
|
14
|
+
const { container } = render(<LandingPage appConfig={{}} />);
|
|
15
|
+
expect(container.innerHTML).toBe('');
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
it('renders based on fetched data', async () => {
|
|
19
|
+
const landingDataAggs = {
|
|
20
|
+
hits: { total: { value: 100 } },
|
|
21
|
+
aggregations: {
|
|
22
|
+
min_timecoverage: { value: 2000 },
|
|
23
|
+
max_timecoverage: { value: 2020 },
|
|
24
|
+
organisations: { buckets: [] },
|
|
25
|
+
topics: { buckets: [] },
|
|
26
|
+
languages: { buckets: [] },
|
|
27
|
+
content_types: { buckets: [] },
|
|
28
|
+
countries: { buckets: [] },
|
|
29
|
+
},
|
|
30
|
+
};
|
|
31
|
+
const landingDataRes = {
|
|
32
|
+
hits: { hits: [] },
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
runRequest
|
|
36
|
+
.mockReturnValueOnce(Promise.resolve({ body: landingDataAggs }))
|
|
37
|
+
.mockReturnValueOnce(Promise.resolve({ body: landingDataRes }));
|
|
38
|
+
|
|
39
|
+
const { getByText } = render(<LandingPage appConfig={{}} />);
|
|
40
|
+
|
|
41
|
+
// Use setTimeout to wait for the promises to resolve
|
|
42
|
+
await new Promise((resolve) => setTimeout(resolve, 0));
|
|
43
|
+
|
|
44
|
+
expect(
|
|
45
|
+
getByText(
|
|
46
|
+
'Instantly search over 20 years of environmental knowledge by EEA',
|
|
47
|
+
),
|
|
48
|
+
).toBeInTheDocument();
|
|
49
|
+
expect(getByText('Documents')).toBeInTheDocument();
|
|
50
|
+
expect(getByText('100')).toBeInTheDocument();
|
|
51
|
+
expect(getByText('Languages')).toBeInTheDocument();
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
it('renders based on fetched data', async () => {
|
|
55
|
+
const landingDataAggs = {
|
|
56
|
+
hits: { total: { value: 100 } },
|
|
57
|
+
aggregations: {
|
|
58
|
+
min_timecoverage: { value: 2000 },
|
|
59
|
+
max_timecoverage: { value: 2020 },
|
|
60
|
+
organisations: { buckets: [] },
|
|
61
|
+
topics: { buckets: [] },
|
|
62
|
+
languages: { buckets: [] },
|
|
63
|
+
content_types: { buckets: [{ key: 'Document' }, { key: 'Image' }] },
|
|
64
|
+
countries: { buckets: [{ key: 'Romania' }, { key: 'Belgium' }] },
|
|
65
|
+
},
|
|
66
|
+
};
|
|
67
|
+
const landingDataRes = {
|
|
68
|
+
hits: {
|
|
69
|
+
hits: [
|
|
70
|
+
{
|
|
71
|
+
_source: {
|
|
72
|
+
title: 'Document 1',
|
|
73
|
+
about: 'test',
|
|
74
|
+
issued: '07/08/2023',
|
|
75
|
+
},
|
|
76
|
+
},
|
|
77
|
+
],
|
|
78
|
+
},
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
runRequest
|
|
82
|
+
.mockReturnValueOnce(Promise.resolve({ body: landingDataAggs }))
|
|
83
|
+
.mockReturnValueOnce(Promise.resolve({ body: landingDataRes }));
|
|
84
|
+
|
|
85
|
+
const { getByText } = render(<LandingPage appConfig={{}} />);
|
|
86
|
+
|
|
87
|
+
// Use setTimeout to wait for the promises to resolve
|
|
88
|
+
await new Promise((resolve) => setTimeout(resolve, 0));
|
|
89
|
+
|
|
90
|
+
expect(
|
|
91
|
+
getByText(
|
|
92
|
+
'Instantly search over 20 years of environmental knowledge by EEA',
|
|
93
|
+
),
|
|
94
|
+
).toBeInTheDocument();
|
|
95
|
+
expect(getByText('Documents')).toBeInTheDocument();
|
|
96
|
+
expect(getByText('100')).toBeInTheDocument();
|
|
97
|
+
expect(getByText('Languages')).toBeInTheDocument();
|
|
98
|
+
});
|
|
99
|
+
});
|
package/src/config/facets.js
CHANGED
|
@@ -223,7 +223,7 @@ const facets = [
|
|
|
223
223
|
{ from: 0, to: 4.99999, key: 'Short (<5 minutes)' },
|
|
224
224
|
{ from: 5, to: 24.9999, key: 'Medium (5-25 minutes)' },
|
|
225
225
|
{ from: 25, to: 10000, key: 'Large (25+ minutes)' },
|
|
226
|
-
|
|
226
|
+
{ to: -0.0001, key: 'Not applicable' },
|
|
227
227
|
],
|
|
228
228
|
// factory: 'ModalFixedRangeFacet',
|
|
229
229
|
default: {
|
package/src/config/filters.js
CHANGED
|
@@ -1,30 +1,34 @@
|
|
|
1
1
|
import { getTodayWithTime } from '../utils';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
bool: {
|
|
14
|
-
must_not: {
|
|
15
|
-
exists: {
|
|
16
|
-
field: 'issued',
|
|
17
|
-
},
|
|
2
|
+
function constantScore() {
|
|
3
|
+
return {
|
|
4
|
+
constant_score: {
|
|
5
|
+
filter: {
|
|
6
|
+
bool: {
|
|
7
|
+
should: [
|
|
8
|
+
{
|
|
9
|
+
bool: {
|
|
10
|
+
must_not: {
|
|
11
|
+
exists: {
|
|
12
|
+
field: 'issued',
|
|
18
13
|
},
|
|
19
14
|
},
|
|
20
15
|
},
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
},
|
|
24
|
-
|
|
25
|
-
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
range: { 'issued.date': { lte: getTodayWithTime() } },
|
|
19
|
+
},
|
|
20
|
+
],
|
|
26
21
|
},
|
|
27
22
|
},
|
|
28
|
-
}
|
|
23
|
+
},
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
constantScore.id = 'constantScore';
|
|
27
|
+
|
|
28
|
+
export default {
|
|
29
|
+
// filter values that are always added to the ES requests
|
|
30
|
+
permanentFilters: [
|
|
31
|
+
{ term: { hasWorkflowState: 'published' } },
|
|
32
|
+
constantScore,
|
|
29
33
|
],
|
|
30
34
|
};
|
|
@@ -9,4 +9,24 @@ globalSearchConfig.facets = globalSearchConfig.facets.filter(
|
|
|
9
9
|
(facet) => facet['field'] !== 'subject.keyword',
|
|
10
10
|
);
|
|
11
11
|
|
|
12
|
+
// customize permanent filters
|
|
13
|
+
const index = globalSearchConfig.permanentFilters.findIndex(
|
|
14
|
+
(f) => f.id === 'constantScore',
|
|
15
|
+
);
|
|
16
|
+
const baseConstantScore = globalSearchConfig.permanentFilters[index];
|
|
17
|
+
|
|
18
|
+
function updatedConstantScore() {
|
|
19
|
+
const base = baseConstantScore();
|
|
20
|
+
base.constant_score.filter.bool.must_not = {
|
|
21
|
+
exists: {
|
|
22
|
+
field: 'exclude_from_globalsearch',
|
|
23
|
+
},
|
|
24
|
+
};
|
|
25
|
+
return base;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
updatedConstantScore.id = 'constantScore';
|
|
29
|
+
|
|
30
|
+
globalSearchConfig.permanentFilters[index] = updatedConstantScore;
|
|
31
|
+
|
|
12
32
|
export default globalSearchConfig;
|