@eeacms/volto-globalsearch 1.0.20 → 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.
Files changed (29) hide show
  1. package/.eslintignore +1 -0
  2. package/.husky/pre-commit +2 -0
  3. package/CHANGELOG.md +32 -8
  4. package/DEVELOP.md +6 -8
  5. package/README.md +5 -2
  6. package/cypress.config.js +2 -2
  7. package/docker-compose.yml +5 -1
  8. package/locales/en/LC_MESSAGES/volto.po +14 -0
  9. package/package.json +26 -2
  10. package/src/config/facets.js +1 -1
  11. package/src/config/filters.js +26 -22
  12. package/src/config/global-search-config.js +20 -0
  13. package/src/config/healthcheck.js +285 -45
  14. package/src/config/healthcheck.test.js +300 -0
  15. package/src/config/healthcheck_queries/empty_resp.json +18 -0
  16. package/src/config/healthcheck_queries/failed_scheduled_atempts_since_last_started.json +36 -0
  17. package/src/config/healthcheck_queries/failed_scheduled_atempts_since_last_started_resp.json +41 -0
  18. package/src/config/healthcheck_queries/failed_site_since_last_started.json +31 -0
  19. package/src/config/healthcheck_queries/last_scheduled_indexing.json +28 -0
  20. package/src/config/healthcheck_queries/last_scheduled_started_indexing.json +29 -0
  21. package/src/config/healthcheck_queries/last_scheduled_started_indexing_resp.json +41 -0
  22. package/src/config/healthcheck_queries/last_sync_task_since_last_start.json +36 -0
  23. package/src/config/healthcheck_queries/last_sync_task_since_last_start_resp.json +63 -0
  24. package/src/config/healthcheck_queries/latest_tasks_for_site.json +23 -0
  25. package/src/config/healthcheck_queries/latest_tasks_for_site_resp.json +70 -0
  26. package/src/config/healthcheck_queries/started_or_finished_site_since_last_started.json +35 -0
  27. package/src/config/healthcheck_queries/started_or_finished_site_since_last_started_resp.json +36 -0
  28. package/src/config/index.test.js +16 -0
  29. /package/src/{utlis.test.js → utils.test.js} +0 -0
package/.eslintignore CHANGED
@@ -1 +1,2 @@
1
1
  src/config/json/*.json
2
+ src/config/healthcheck_queries/*.json
@@ -0,0 +1,2 @@
1
+ [ -n "$CI" ] && exit 0
2
+ yarn lint-staged
package/CHANGELOG.md CHANGED
@@ -4,6 +4,38 @@ 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.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)]
7
39
  ### [1.0.20](https://github.com/eea/volto-globalsearch/compare/1.0.19...1.0.20) - 17 August 2023
8
40
 
9
41
  #### :house: Documentation changes
@@ -34,13 +66,11 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
34
66
 
35
67
  #### :house: Internal changes
36
68
 
37
- - chore: [JENKINS] Deprecate circularity website [valentinab25 - [`ae6efed`](https://github.com/eea/volto-globalsearch/commit/ae6efed386f8fd053972a388a3f8714ff36cf575)]
38
69
 
39
70
  #### :hammer_and_wrench: Others
40
71
 
41
72
  - added missing logo [Zoltan Szabo - [`94684b9`](https://github.com/eea/volto-globalsearch/commit/94684b979698c47de353ecc2a9014a8f70d7ecc1)]
42
73
  - updated frontend with configuration for 'Climate Advisory Board' [Zoltan Szabo - [`28cf22c`](https://github.com/eea/volto-globalsearch/commit/28cf22c93237226c3957223b497a33ab3cb73623)]
43
- - Add Sonarqube tag using cca-frontend addons list [EEA Jenkins - [`b655d51`](https://github.com/eea/volto-globalsearch/commit/b655d51fa3631ae42c89eb85bdcc850f70d9c72c)]
44
74
  ### [1.0.15](https://github.com/eea/volto-globalsearch/compare/1.0.14...1.0.15) - 14 March 2023
45
75
 
46
76
  #### :hammer_and_wrench: Others
@@ -60,7 +90,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
60
90
  #### :hammer_and_wrench: Others
61
91
 
62
92
  - set the middleware proxy address for globalsearchbase [Zoltan Szabo - [`d0a0802`](https://github.com/eea/volto-globalsearch/commit/d0a08026fa73ce8fd15b666c922e7db71104a5d1)]
63
- - Add Sonarqube tag using eea-website-frontend addons list [EEA Jenkins - [`b710a4f`](https://github.com/eea/volto-globalsearch/commit/b710a4f73f61e164ecf502a83e7f07d0daf578b3)]
64
93
  ### [1.0.12](https://github.com/eea/volto-globalsearch/compare/1.0.11...1.0.12) - 1 March 2023
65
94
 
66
95
  #### :hammer_and_wrench: Others
@@ -128,14 +157,12 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
128
157
  - Make last 2 years default [Tiberiu Ichim - [`ff765e2`](https://github.com/eea/volto-globalsearch/commit/ff765e24a1d93c60f091aeffa7c3156d8fb98e49)]
129
158
  - Add compact listing, placeholder for now [Tiberiu Ichim - [`3f6104f`](https://github.com/eea/volto-globalsearch/commit/3f6104fb1725f7e3c22736a30629f64e4882242a)]
130
159
  - test(Jenkins): Run tests and cypress with latest canary @plone/volto [Alin Voinea - [`8120264`](https://github.com/eea/volto-globalsearch/commit/812026495c31b272e6ae6415642cf1a6b2f783cf)]
131
- - yarn 3 [Alin Voinea - [`b61ad50`](https://github.com/eea/volto-globalsearch/commit/b61ad5075a79bebfce1044a6cd4978c92d98fbdc)]
132
160
  ### [1.0.1](https://github.com/eea/volto-globalsearch/compare/1.0.0...1.0.1) - 16 November 2022
133
161
 
134
162
  #### :hammer_and_wrench: Others
135
163
 
136
164
  - Fix eslint [Tiberiu Ichim - [`cf2886b`](https://github.com/eea/volto-globalsearch/commit/cf2886b412013f9427cf5d39cdf00004bdd9f80b)]
137
165
  - test(estlint): Fix .project.eslintrc.js [Alin Voinea - [`40c08d2`](https://github.com/eea/volto-globalsearch/commit/40c08d2d4eda81ce306225a81f09e0bcfe6794eb)]
138
- - Add Sonarqube tag using circularity-frontend addons list [EEA Jenkins - [`af6e020`](https://github.com/eea/volto-globalsearch/commit/af6e020794798c1f69fee8c08bdf71fc3992230a)]
139
166
  ## [1.0.0](https://github.com/eea/volto-globalsearch/compare/0.1.7...1.0.0) - 28 October 2022
140
167
 
141
168
  #### :nail_care: Enhancements
@@ -154,7 +181,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
154
181
  #### :hammer_and_wrench: Others
155
182
 
156
183
  - Fix dependencies [kreafox - [`50ad307`](https://github.com/eea/volto-globalsearch/commit/50ad307d64140c43df9dded27c0b532923885764)]
157
- - Add Sonarqube tag using eea-website-frontend addons list [EEA Jenkins - [`c2d848e`](https://github.com/eea/volto-globalsearch/commit/c2d848e1efa456f53d883c50769882101e1ce19f)]
158
184
  ### [0.1.5](https://github.com/eea/volto-globalsearch/compare/0.1.4...0.1.5) - 28 July 2022
159
185
 
160
186
  #### :hammer_and_wrench: Others
@@ -167,7 +193,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
167
193
 
168
194
  #### :hammer_and_wrench: Others
169
195
 
170
- - Add Sonarqube tag using eea-website-frontend addons list [EEA Jenkins - [`5dce07b`](https://github.com/eea/volto-globalsearch/commit/5dce07ba7d1e82776a426e9746d5dab1b0acf738)]
171
196
  ### [0.1.3](https://github.com/eea/volto-globalsearch/compare/0.1.2...0.1.3) - 10 June 2022
172
197
 
173
198
  ### [0.1.2](https://github.com/eea/volto-globalsearch/compare/0.1.1...0.1.2) - 10 June 2022
@@ -190,7 +215,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
190
215
  - ignore eslint for *.json files [Zoltan Szabo - [`e18919e`](https://github.com/eea/volto-globalsearch/commit/e18919e1255818c5cf33bf769cca078d75ca3422)]
191
216
  - formatting [Zoltan Szabo - [`18282ed`](https://github.com/eea/volto-globalsearch/commit/18282ed159865bcbc50e2fd17417cf6d90d3e593)]
192
217
  - updated dependencies [Zoltan Szabo - [`cfcf46e`](https://github.com/eea/volto-globalsearch/commit/cfcf46ee33b23bb31f76955c12a857411f042daf)]
193
- - [JENKINSFILE] fix after bootstrap [valentinab25 - [`61c8c46`](https://github.com/eea/volto-globalsearch/commit/61c8c46891edf3b52768f12cf7505c034ef7bb89)]
194
218
  ### 0.0.1 - 19 May 2022
195
219
 
196
220
  #### :hammer_and_wrench: Others
package/DEVELOP.md CHANGED
@@ -16,12 +16,14 @@
16
16
 
17
17
  1. Go to http://localhost:3000
18
18
 
19
- 1. Happy hacking!
19
+ 1. Initialize git hooks
20
20
 
21
21
  ```Bash
22
- cd src/addons/volto-globalsearch/
22
+ yarn prepare
23
23
  ```
24
24
 
25
+ 1. Happy hacking!
26
+
25
27
  ### Or add @eeacms/volto-globalsearch to your Volto project
26
28
 
27
29
  Before starting make sure your development environment is properly set. See [Volto Developer Documentation](https://docs.voltocms.com/getting-started/install/)
@@ -48,18 +50,15 @@ Before starting make sure your development environment is properly set. See [Vol
48
50
 
49
51
  1. Install
50
52
 
51
- yarn develop
53
+ make develop
52
54
  yarn
53
55
 
54
56
  1. Start backend
55
57
 
56
- docker pull plone
57
- 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
58
59
 
59
60
  ...wait for backend to setup and start - `Ready to handle requests`:
60
61
 
61
- docker logs -f plone
62
-
63
62
  ...you can also check http://localhost:8080/Plone
64
63
 
65
64
  1. Start frontend
@@ -71,7 +70,6 @@ Before starting make sure your development environment is properly set. See [Vol
71
70
  1. Happy hacking!
72
71
 
73
72
  cd src/addons/volto-globalsearch/
74
- n-template/
75
73
 
76
74
  ## Cypress
77
75
 
package/README.md CHANGED
@@ -14,9 +14,12 @@
14
14
  [![Bugs](https://sonarqube.eea.europa.eu/api/project_badges/measure?project=volto-globalsearch-develop&metric=bugs)](https://sonarqube.eea.europa.eu/dashboard?id=volto-globalsearch-develop)
15
15
  [![Duplicated Lines (%)](https://sonarqube.eea.europa.eu/api/project_badges/measure?project=volto-globalsearch-develop&metric=duplicated_lines_density)](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
+ ![Globalsearch](https://raw.githubusercontent.com/eea/volto-globalsearch/master/docs/volto-globalsearch.gif)
22
+
20
23
  ## Demo
21
24
 
22
25
  - https://demo-www.eea.europa.eu/en/advanced-search
@@ -58,7 +61,7 @@ Go to http://localhost:3000
58
61
 
59
62
  ```
60
63
  npm install -g yo @plone/generator-volto
61
- yo @plone/volto my-volto-project --addon @eeacms/volto-globalsearch
64
+ yo @plone/volto my-volto-project --canary --addon @eeacms/volto-globalsearch
62
65
  cd my-volto-project
63
66
  ```
64
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: 8888,
5
+ defaultCommandTimeout: 5000,
6
6
  chromeWebSecurity: false,
7
7
  reporter: 'junit',
8
8
  video: true,
9
9
  retries: {
10
- runMode: 8,
10
+ runMode: 1,
11
11
  openMode: 0,
12
12
  },
13
13
  reporterOptions: {
@@ -1,11 +1,12 @@
1
1
  version: "3"
2
2
  services:
3
3
  backend:
4
- image: plone/plone-backend:${PLONE_VERSION:-6}
4
+ image: eeacms/plone-backend
5
5
  ports:
6
6
  - "8080:8080"
7
7
  environment:
8
8
  SITE: "Plone"
9
+ PROFILES: "eea.kitkat:testing"
9
10
 
10
11
  frontend:
11
12
  build:
@@ -23,6 +24,9 @@ services:
23
24
  volumes:
24
25
  - ./:/app/src/addons/${ADDON_PATH}
25
26
  environment:
27
+ CI: "true"
28
+ NODE_ENV: "development"
29
+ RAZZLE_JEST_CONFIG: "src/addons/${ADDON_PATH}/jest-addon.config.js"
26
30
  RAZZLE_INTERNAL_API_PATH: "http://backend:8080/Plone"
27
31
  RAZZLE_DEV_PROXY_API_PATH: "http://backend:8080/Plone"
28
32
  HOST: "0.0.0.0"
@@ -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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eeacms/volto-globalsearch",
3
- "version": "1.0.20",
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
  }
@@ -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
- // { to: -0.0001, key: 'Unknown' },
226
+ { to: -0.0001, key: 'Not applicable' },
227
227
  ],
228
228
  // factory: 'ModalFixedRangeFacet',
229
229
  default: {
@@ -1,30 +1,34 @@
1
1
  import { getTodayWithTime } from '../utils';
2
-
3
- export default {
4
- // filter values that are always added to the ES requests
5
- permanentFilters: [
6
- { term: { hasWorkflowState: 'published' } },
7
- () => ({
8
- constant_score: {
9
- filter: {
10
- bool: {
11
- should: [
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
- range: { 'issued.date': { lte: getTodayWithTime() } },
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;