@eeacms/volto-arcgis-block 0.1.21 → 0.1.25

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 CHANGED
@@ -4,8 +4,64 @@ 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.25](https://github.com/eea/volto-arcgis-block/compare/0.1.24...0.1.25)
8
+
9
+ - Bugs n improvements [`#82`](https://github.com/eea/volto-arcgis-block/pull/82)
10
+ - ESLint fix [`c129348`](https://github.com/eea/volto-arcgis-block/commit/c129348ee3886e0419029dd2bfe835c28878444c)
11
+ - Filter by product and dataset [`c89711a`](https://github.com/eea/volto-arcgis-block/commit/c89711acf4f46c8426c7e34add2baf4debe67697)
12
+ - ESLint fix [`406842a`](https://github.com/eea/volto-arcgis-block/commit/406842a54f1964bf2b4b0e709719028a5a47a903)
13
+ - Timeslider bug fixing [`c7a8345`](https://github.com/eea/volto-arcgis-block/commit/c7a834538a54a8c48e2e34259d3d733a1194007a)
14
+
15
+ #### [0.1.24](https://github.com/eea/volto-arcgis-block/compare/0.1.23...0.1.24)
16
+
17
+ > 21 December 2021
18
+
19
+ - Develop [`#77`](https://github.com/eea/volto-arcgis-block/pull/77)
20
+ - Bugs n improvements [`#80`](https://github.com/eea/volto-arcgis-block/pull/80)
21
+ - The area array to a json object and added a unique_id to the cart [`#79`](https://github.com/eea/volto-arcgis-block/pull/79)
22
+ - Remove Global from legend [`#76`](https://github.com/eea/volto-arcgis-block/pull/76)
23
+ - ESLint fix [`974d62b`](https://github.com/eea/volto-arcgis-block/commit/974d62bd5b66025e12fa85dffcd0d1a5ae04cba4)
24
+ - ESLint fix [`5c4b0d7`](https://github.com/eea/volto-arcgis-block/commit/5c4b0d76de50edd85809c35449f2fb364a9e9312)
25
+ - ESLint fix [`d57d144`](https://github.com/eea/volto-arcgis-block/commit/d57d144fd0e3dbbbbc95195f289d50e6c4b03375)
26
+ - ESLint fix [`9eb0a0c`](https://github.com/eea/volto-arcgis-block/commit/9eb0a0c17d018ac1b25bde422ac149b46b146ff4)
27
+ - ESLint fix [`5fd3772`](https://github.com/eea/volto-arcgis-block/commit/5fd3772f197a3a380067962a5638dbf901a4624e)
28
+ - Pixel info [`1ccef39`](https://github.com/eea/volto-arcgis-block/commit/1ccef39a9adcc3ee94655c77a5a166b613600a08)
29
+ - NUTS bug fix [`37fe7f3`](https://github.com/eea/volto-arcgis-block/commit/37fe7f3fad2c005e3b7c234b3b0564d5df92fa8c)
30
+
31
+ #### [0.1.23](https://github.com/eea/volto-arcgis-block/compare/0.1.22...0.1.23)
32
+
33
+ > 17 December 2021
34
+
35
+ - Develop [`#75`](https://github.com/eea/volto-arcgis-block/pull/75)
36
+ - Use cases region highlight [`#71`](https://github.com/eea/volto-arcgis-block/pull/71)
37
+ - Bugs n improvements [`#74`](https://github.com/eea/volto-arcgis-block/pull/74)
38
+ - Add NUTS 2 in the Map viewer [`#72`](https://github.com/eea/volto-arcgis-block/pull/72)
39
+ - Mapviewer menu widget correction [`#73`](https://github.com/eea/volto-arcgis-block/pull/73)
40
+ - Update highlight service [`fbec327`](https://github.com/eea/volto-arcgis-block/commit/fbec3279c44900ec1100affed350a517133997fb)
41
+ - ESLint fix [`4a695e3`](https://github.com/eea/volto-arcgis-block/commit/4a695e39ab3d276483ad2922e7ee2b446826db2c)
42
+ - ESLint fix [`62e6a10`](https://github.com/eea/volto-arcgis-block/commit/62e6a1034a6317a0a45f682248ef1c1bc12081a6)
43
+ - NUTS layer order [`4942c25`](https://github.com/eea/volto-arcgis-block/commit/4942c25ef0fe7c7f239015f8d14910b3ac2238fe)
44
+ - Remove debugger [`bcbb107`](https://github.com/eea/volto-arcgis-block/commit/bcbb1076f80fe773ff3dd2ffb5dc038e5c8f4733)
45
+ - Update layers array key values to unique IDs [`066951d`](https://github.com/eea/volto-arcgis-block/commit/066951d571fc77a96b98cc0650d36d1a22665e49)
46
+ - Remove unused variable [`830349f`](https://github.com/eea/volto-arcgis-block/commit/830349f17e8549f8883acd805302ecb65d35dec4)
47
+ - Add individual region highlight [`6e4cb62`](https://github.com/eea/volto-arcgis-block/commit/6e4cb62d26a493da83e53a10bba8f64ea9df80e3)
48
+ - Update LegendWidget.jsx [`3273d53`](https://github.com/eea/volto-arcgis-block/commit/3273d53183ef17328ddfce7913910671eb5a43a9)
49
+ - Change legend text [`09eb6e0`](https://github.com/eea/volto-arcgis-block/commit/09eb6e08e4199cab914d6300c62af633876579cb)
50
+
51
+ #### [0.1.22](https://github.com/eea/volto-arcgis-block/compare/0.1.21...0.1.22)
52
+
53
+ > 10 December 2021
54
+
55
+ - Develop [`#70`](https://github.com/eea/volto-arcgis-block/pull/70)
56
+ - ESLint fix [`#69`](https://github.com/eea/volto-arcgis-block/pull/69)
57
+ - Bugs n improvements [`#68`](https://github.com/eea/volto-arcgis-block/pull/68)
58
+ - Change services URLs to discomap [`ed4dc62`](https://github.com/eea/volto-arcgis-block/commit/ed4dc62df3af66a71acbe981b3e74a4a621ef2c4)
59
+
7
60
  #### [0.1.21](https://github.com/eea/volto-arcgis-block/compare/0.1.20...0.1.21)
8
61
 
62
+ > 3 December 2021
63
+
64
+ - Develop [`#66`](https://github.com/eea/volto-arcgis-block/pull/66)
9
65
  - Bugs n improvements [`#65`](https://github.com/eea/volto-arcgis-block/pull/65)
10
66
  - ESLint fix [`758889e`](https://github.com/eea/volto-arcgis-block/commit/758889e6443cad21af9115d12f521170388fef77)
11
67
  - Download message bug fix [`4ff3ba4`](https://github.com/eea/volto-arcgis-block/commit/4ff3ba4c94eb4463474369fb21727a617a9ee666)
package/Jenkinsfile CHANGED
@@ -4,18 +4,35 @@ pipeline {
4
4
  environment {
5
5
  GIT_NAME = "volto-arcgis-block"
6
6
  NAMESPACE = "@eeacms"
7
- SONARQUBE_TAGS = "volto.eea.europa.eu,clms.land.copernicus.eu"
7
+ SONARQUBE_TAGS = "volto.eea.europa.eu,clms.land.copernicus.eu,water.europa.eu-freshwater"
8
8
  DEPENDENCIES = ""
9
9
  }
10
10
 
11
11
  stages {
12
12
 
13
+ stage('Release') {
14
+ when {
15
+ allOf {
16
+ environment name: 'CHANGE_ID', value: ''
17
+ branch 'master'
18
+ }
19
+ }
20
+ steps {
21
+ node(label: 'docker') {
22
+ withCredentials([string(credentialsId: 'eea-jenkins-token', variable: 'GITHUB_TOKEN'),string(credentialsId: 'eea-jenkins-npm-token', variable: 'NPM_TOKEN')]) {
23
+ sh '''docker pull eeacms/gitflow'''
24
+ sh '''docker run -i --rm --name="$BUILD_TAG-gitflow-master" -e GIT_BRANCH="$BRANCH_NAME" -e GIT_NAME="$GIT_NAME" -e GIT_TOKEN="$GITHUB_TOKEN" -e NPM_TOKEN="$NPM_TOKEN" -e LANGUAGE=javascript eeacms/gitflow'''
25
+ }
26
+ }
27
+ }
28
+ }
29
+
13
30
  stage('Code') {
14
31
  when {
15
32
  allOf {
16
33
  environment name: 'CHANGE_ID', value: ''
17
- not { branch 'master' }
18
34
  not { changelog '.*^Automated release [0-9\\.]+$' }
35
+ not { branch 'master' }
19
36
  }
20
37
  }
21
38
  steps {
@@ -46,8 +63,10 @@ pipeline {
46
63
  when {
47
64
  allOf {
48
65
  environment name: 'CHANGE_ID', value: ''
49
- not { branch 'master' }
50
- not { changelog '.*^Automated release [0-9\\.]+$' }
66
+ anyOf {
67
+ not { changelog '.*^Automated release [0-9\\.]+$' }
68
+ branch 'master'
69
+ }
51
70
  }
52
71
  }
53
72
  steps {
@@ -92,8 +111,10 @@ pipeline {
92
111
  when {
93
112
  allOf {
94
113
  environment name: 'CHANGE_ID', value: ''
95
- not { branch 'master' }
96
- not { changelog '.*^Automated release [0-9\\.]+$' }
114
+ anyOf {
115
+ not { changelog '.*^Automated release [0-9\\.]+$' }
116
+ branch 'master'
117
+ }
97
118
  }
98
119
  }
99
120
  steps {
@@ -103,7 +124,7 @@ pipeline {
103
124
  node(label: 'docker') {
104
125
  script {
105
126
  try {
106
- sh '''docker pull plone; docker run -d --name="$BUILD_TAG-plone" -e SITE="Plone" -e PROFILES="profile-plone.restapi:blocks" plone fg'''
127
+ sh '''docker pull plone; docker run -d --rm --name="$BUILD_TAG-plone" -e SITE="Plone" -e PROFILES="profile-plone.restapi:blocks" plone fg'''
107
128
  sh '''docker pull plone/volto-addon-ci; docker run -i --name="$BUILD_TAG-cypress" --link $BUILD_TAG-plone:plone -e NAMESPACE="$NAMESPACE" -e GIT_NAME=$GIT_NAME -e GIT_BRANCH="$BRANCH_NAME" -e GIT_CHANGE_ID="$CHANGE_ID" -e DEPENDENCIES="$DEPENDENCIES" -e NODE_ENV=test plone/volto-addon-ci cypress'''
108
129
  } finally {
109
130
  try {
@@ -121,7 +142,8 @@ pipeline {
121
142
  reportName: 'CypressCoverage',
122
143
  reportTitles: 'Integration Tests Code Coverage'])
123
144
  }
124
- archiveArtifacts artifacts: 'cypress-reports/videos/*.mp4', fingerprint: true
145
+ sh '''touch empty_file; for ok_test in $(grep -E 'file=.*failures="0"' $(grep 'testsuites .*failures="0"' $(find cypress-results -name *.xml) empty_file | awk -F: '{print $1}') empty_file | sed 's/.* file="\\(.*\\)" time.*/\\1/' | sed 's#^cypress/integration/##g' | sed 's#^../../../node_modules/@eeacms/##g'); do rm -f cypress-reports/videos/$ok_test.mp4; rm -f cypress-reports/$ok_test.mp4; done'''
146
+ archiveArtifacts artifacts: 'cypress-reports/**/*.mp4', fingerprint: true, allowEmptyArchive: true
125
147
  stash name: "cypress-coverage", includes: "cypress-coverage/**", allowEmpty: true
126
148
  }
127
149
  finally {
@@ -144,12 +166,16 @@ pipeline {
144
166
 
145
167
  stage('Report to SonarQube') {
146
168
  when {
169
+ allOf {
147
170
  environment name: 'CHANGE_ID', value: ''
148
171
  anyOf {
149
172
  branch 'master'
150
- branch 'develop'
173
+ allOf {
174
+ branch 'develop'
175
+ not { changelog '.*^Automated release [0-9\\.]+$' }
176
+ }
151
177
  }
152
- not { changelog '.*^Automated release [0-9\\.]+$' }
178
+ }
153
179
  }
154
180
  steps {
155
181
  node(label: 'swarm') {
@@ -191,23 +217,6 @@ pipeline {
191
217
  }
192
218
  }
193
219
 
194
- stage('Release') {
195
- when {
196
- allOf {
197
- environment name: 'CHANGE_ID', value: ''
198
- branch 'master'
199
- }
200
- }
201
- steps {
202
- node(label: 'docker') {
203
- withCredentials([string(credentialsId: 'eea-jenkins-token', variable: 'GITHUB_TOKEN'),string(credentialsId: 'eea-jenkins-npm-token', variable: 'NPM_TOKEN')]) {
204
- sh '''docker pull eeacms/gitflow'''
205
- sh '''docker run -i --rm --name="$BUILD_TAG-gitflow-master" -e GIT_BRANCH="$BRANCH_NAME" -e GIT_NAME="$GIT_NAME" -e GIT_TOKEN="$GITHUB_TOKEN" -e NPM_TOKEN="$NPM_TOKEN" -e LANGUAGE=javascript eeacms/gitflow'''
206
- }
207
- }
208
- }
209
- }
210
-
211
220
  }
212
221
 
213
222
  post {
package/README.md CHANGED
@@ -1,7 +1,18 @@
1
1
  # [WIP] Volto Arcgis Block
2
+
2
3
  [![Releases](https://img.shields.io/github/v/release/eea/volto-arcgis-block)](https://github.com/eea/volto-arcgis-block/releases)
4
+
3
5
  [![Pipeline](https://ci.eionet.europa.eu/buildStatus/icon?job=volto-addons%2Fvolto-arcgis-block%2Fmaster&subject=master)](https://ci.eionet.europa.eu/view/Github/job/volto-addons/job/volto-arcgis-block/job/master/display/redirect)
6
+ [![Lines of Code](https://sonarqube.eea.europa.eu/api/project_badges/measure?project=volto-arcgis-block-master&metric=ncloc)](https://sonarqube.eea.europa.eu/dashboard?id=volto-arcgis-block-master)
7
+ [![Coverage](https://sonarqube.eea.europa.eu/api/project_badges/measure?project=volto-arcgis-block-master&metric=coverage)](https://sonarqube.eea.europa.eu/dashboard?id=volto-arcgis-block-master)
8
+ [![Bugs](https://sonarqube.eea.europa.eu/api/project_badges/measure?project=volto-arcgis-block-master&metric=bugs)](https://sonarqube.eea.europa.eu/dashboard?id=volto-arcgis-block-master)
9
+ [![Duplicated Lines (%)](https://sonarqube.eea.europa.eu/api/project_badges/measure?project=volto-arcgis-block-master&metric=duplicated_lines_density)](https://sonarqube.eea.europa.eu/dashboard?id=volto-arcgis-block-master)
10
+
4
11
  [![Pipeline](https://ci.eionet.europa.eu/buildStatus/icon?job=volto-addons%2Fvolto-arcgis-block%2Fdevelop&subject=develop)](https://ci.eionet.europa.eu/view/Github/job/volto-addons/job/volto-arcgis-block/job/develop/display/redirect)
12
+ [![Lines of Code](https://sonarqube.eea.europa.eu/api/project_badges/measure?project=volto-arcgis-block-develop&metric=ncloc)](https://sonarqube.eea.europa.eu/dashboard?id=volto-arcgis-block-develop)
13
+ [![Coverage](https://sonarqube.eea.europa.eu/api/project_badges/measure?project=volto-arcgis-block-develop&metric=coverage)](https://sonarqube.eea.europa.eu/dashboard?id=volto-arcgis-block-develop)
14
+ [![Bugs](https://sonarqube.eea.europa.eu/api/project_badges/measure?project=volto-arcgis-block-develop&metric=bugs)](https://sonarqube.eea.europa.eu/dashboard?id=volto-arcgis-block-develop)
15
+ [![Duplicated Lines (%)](https://sonarqube.eea.europa.eu/api/project_badges/measure?project=volto-arcgis-block-develop&metric=duplicated_lines_density)](https://sonarqube.eea.europa.eu/dashboard?id=volto-arcgis-block-develop)
5
16
 
6
17
  ## ArcGIS Map integration for Volto blocks
7
18
  ****This product is in development, at this time it is not recommended to use it.***
@@ -64,4 +75,84 @@ const customBlocks = (config) => ({
64
75
  "@eeacms/volto-clms-theme"
65
76
  ],
66
77
  ````
67
- ![Style example volto-arcgis-block](docs/styles_example.gif)
78
+ ![Style example volto-arcgis-block](docs/styles_example.gif)
79
+
80
+ ## Release
81
+
82
+ ### Automatic release using Jenkins
83
+
84
+ * The automatic release is started by creating a [Pull Request](../../compare/master...develop) from `develop` to `master`. The pull request status checks correlated to the branch and PR Jenkins jobs need to be processed successfully. 1 review from a github user with rights is mandatory.
85
+ * It runs on every commit on `master` branch, which is protected from direct commits, only allowing pull request merge commits.
86
+ * The automatic release is done by [Jenkins](https://ci.eionet.europa.eu). The status of the release job can be seen both in the Readme.md badges and the green check/red cross/yellow circle near the last commit information. If you click on the icon, you will have the list of checks that were run. The `continuous-integration/jenkins/branch` link goes to the Jenkins job execution webpage.
87
+ * Automated release scripts are located in the `eeacms/gitflow` docker image, specifically [js-release.sh](https://github.com/eea/eea.docker.gitflow/blob/master/src/js-release.sh) script. It uses the `release-it` tool.
88
+ * As long as a PR request is open from develop to master, the PR Jenkins job will automatically re-create the CHANGELOG.md and package.json files to be production-ready.
89
+ * The version format must be MAJOR.MINOR.PATCH. By default, next release is set to next minor version (with patch 0).
90
+ * You can manually change the version in `package.json`. The new version must not be already present in the tags/releases of the repository, otherwise it will be automatically increased by the script. Any changes to the version will trigger a `CHANGELOG.md` re-generation.
91
+ * Automated commits and commits with [JENKINS] or [YARN] in the commit log are excluded from `CHANGELOG.md` file.
92
+
93
+ ### Manual release from the develop branch ( beta release )
94
+
95
+ #### Installation and configuration of release-it
96
+
97
+ You need to first install the [release-it](https://github.com/release-it/release-it) client.
98
+
99
+ ```
100
+ npm install -g release-it
101
+ ```
102
+
103
+ Release-it uses the configuration written in the [`.release-it.json`](./.release-it.json) file located in the root of the repository.
104
+
105
+ Release-it is a tool that automates 4 important steps in the release process:
106
+
107
+ 1. Version increase in `package.json` ( increased from the current version in `package.json`)
108
+ 2. `CHANGELOG.md` automatic generation from commit messages ( grouped by releases )
109
+ 3. GitHub release on the commit with the changelog and package.json modification on the develop branch
110
+ 4. NPM release ( by default it's disabled, but can be enabled in the configuration file )
111
+
112
+ To configure the authentification, you need to export GITHUB_TOKEN for [GitHub](https://github.com/settings/tokens)
113
+
114
+ ```
115
+ export GITHUB_TOKEN=XXX-XXXXXXXXXXXXXXXXXXXXXX
116
+ ```
117
+
118
+ To configure npm, you can use the `npm login` command or use a configuration file with a TOKEN :
119
+
120
+ ```
121
+ echo "//registry.npmjs.org/:_authToken=YYYYYYYYYYYYYYYYYYYYYYYYYYYYYY" > .npmrc
122
+ ```
123
+
124
+ #### Using release-it tool
125
+
126
+ There are 3 yarn scripts that can be run to do the release
127
+
128
+ ##### yarn release-beta
129
+
130
+ Automatically calculates and presents 3 beta versions - patch, minor and major for you to choose ( or Other for manual input).
131
+
132
+ ```
133
+ ? Select increment (next version):
134
+ ❯ prepatch (0.1.1-beta.0)
135
+ preminor (0.2.0-beta.0)
136
+ premajor (1.0.0-beta.0)
137
+ Other, please specify...
138
+ ```
139
+
140
+ ##### yarn release-major-beta
141
+
142
+ Same as `yarn release-beta`, but with premajor version pre-selected.
143
+
144
+ ##### yarn release
145
+
146
+ Generic command, does not automatically add the `beta` to version, but you can still manually write it if you choose Other.
147
+
148
+ #### Important notes
149
+
150
+ > Do not use release-it tool on master branch, the commit on CHANGELOG.md file and the version increase in the package.json file can't be done without a PULL REQUEST.
151
+
152
+ > Do not keep Pull Requests from develop to master branches open when you are doing beta releases from the develop branch. As long as a PR to master is open, an automatic script will run on every commit and will update both the version and the changelog to a production-ready state - ( MAJOR.MINOR.PATCH mandatory format for version).
153
+
154
+
155
+ ## How to contribute
156
+
157
+ See [DEVELOP.md](https://github.com/eea/volto-arcgis-block/blob/master/DEVELOP.md).
158
+
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eeacms/volto-arcgis-block",
3
- "version": "0.1.21",
3
+ "version": "0.1.25",
4
4
  "description": "volto-arcgis-block: Volto add-on",
5
5
  "main": "src/index.js",
6
6
  "author": "European Environment Agency: CodeSyntax",
@@ -21,6 +21,8 @@
21
21
  "scripts": {
22
22
  "i18n": "NODE_ENV=production node src/i18n.js",
23
23
  "release": "release-it",
24
+ "release-major-beta": "release-it major --preRelease=beta",
25
+ "release-beta": "release-it --preRelease=beta",
24
26
  "bootstrap": "npm install -g ejs; npm link ejs; node bootstrap",
25
27
  "stylelint": "../../../node_modules/stylelint/bin/stylelint.js --allow-empty-input 'src/**/*.{css,less}'",
26
28
  "stylelint:overrides": "../../../node_modules/.bin/stylelint --syntax less --allow-empty-input 'theme/**/*.overrides' 'src/**/*.overrides'",
@@ -38,7 +40,9 @@
38
40
  "@fortawesome/fontawesome-svg-core": "1.2.35",
39
41
  "@fortawesome/free-solid-svg-icons": "5.15.3",
40
42
  "@fortawesome/react-fontawesome": "0.1.14",
41
- "@eeacms/volto-clms-utils": "0.1.1"
43
+ "@eeacms/volto-clms-utils": "0.1.1",
44
+ "highcharts": "^9.3.2",
45
+ "highcharts-react-official": "^3.1.0"
42
46
  },
43
47
  "devDependencies": {
44
48
  "@cypress/code-coverage": "^3.9.5",
@@ -1,7 +1,4 @@
1
1
  import React, { createRef } from 'react';
2
- //import "@arcgis/core/assets/esri/css/main.css";
3
- //import "./css/ArcgisMap.css";
4
- //import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
5
2
  import { loadModules } from 'esri-loader';
6
3
 
7
4
  var Graphic,
@@ -111,6 +108,9 @@ class AreaWidget extends React.Component {
111
108
  nuts1handler(e) {
112
109
  this.loadNutsService(e.target.value, 1);
113
110
  }
111
+ nuts2handler(e) {
112
+ this.loadNutsService(e.target.value, 2);
113
+ }
114
114
  nuts3handler(e) {
115
115
  this.loadNutsService(e.target.value, 3);
116
116
  }
@@ -118,7 +118,7 @@ class AreaWidget extends React.Component {
118
118
  this.clearWidget();
119
119
 
120
120
  var url =
121
- 'https://bm-eugis.tk/arcgis/rest/services/CLMS/NUTS_2021/MapServer/0';
121
+ 'https://trial.discomap.eea.europa.eu/arcgis/rest/services/CLMS/NUTS_2021/MapServer/0';
122
122
  var layer = new FeatureLayer({
123
123
  url: url,
124
124
  id: id,
@@ -127,6 +127,18 @@ class AreaWidget extends React.Component {
127
127
  definitionExpression: 'LEVL_CODE=' + level,
128
128
  });
129
129
  this.nutsGroupLayer.add(layer);
130
+ let index = this.getHighestIndex();
131
+ this.props.map.reorder(this.nutsGroupLayer, index + 1);
132
+ }
133
+ getHighestIndex() {
134
+ let index = 0;
135
+ document.querySelectorAll('.active-layer').forEach((layer) => {
136
+ let value = parseInt(layer.getAttribute('layer-order'));
137
+ if (value > index) {
138
+ index = value;
139
+ }
140
+ });
141
+ return index;
130
142
  }
131
143
  rectanglehandler() {
132
144
  this.clearWidget();
@@ -187,33 +199,43 @@ class AreaWidget extends React.Component {
187
199
  });
188
200
  this.props.map.add(this.nutsGroupLayer);
189
201
  this.props.view.on('click', (event) => {
190
- this.props.view.hitTest(event).then((response) => {
191
- if (response.results.length > 0) {
192
- let graphic = response.results.filter((result) => {
193
- let layer;
194
- if ('nuts0 nuts1 nuts3'.includes(result.graphic.layer.id)) {
195
- layer = result.graphic;
196
- }
197
- return layer;
198
- })[0].graphic;
199
- if (graphic) {
200
- let geometry = graphic.geometry;
201
- if (geometry.type === 'polygon') {
202
- let nuts = graphic.attributes.NUTS_ID;
203
- this.props.updateArea(nuts);
204
- let symbol = new SimpleFillSymbol(
205
- 'solid',
206
- new SimpleLineSymbol('solid', new Color([232, 104, 80]), 2),
207
- new Color([232, 104, 80, 0.25]),
208
- );
209
- let highlight = new Graphic(geometry, symbol);
210
- this.props.view.graphics.removeAll();
211
- this.props.view.graphics.add(highlight);
202
+ if (
203
+ (this.props.mapViewer.activeWidget === this || this.props.download) &&
204
+ (this.props.mapViewer.activeWidget
205
+ ? !this.props.mapViewer.activeWidget.container.current.classList.contains(
206
+ 'info-container',
207
+ )
208
+ : true)
209
+ ) {
210
+ this.props.view.hitTest(event).then((response) => {
211
+ if (response.results.length > 0) {
212
+ let graphic = response.results.filter((result) => {
213
+ let layer;
214
+ if ('nuts0 nuts1 nuts2 nuts3'.includes(result.graphic.layer.id)) {
215
+ layer = result.graphic;
216
+ }
217
+ return layer;
218
+ })[0].graphic;
219
+ if (graphic) {
220
+ let geometry = graphic.geometry;
221
+ if (geometry.type === 'polygon') {
222
+ let nuts = graphic.attributes.NUTS_ID;
223
+ this.props.updateArea(nuts);
224
+ let symbol = new SimpleFillSymbol(
225
+ 'solid',
226
+ new SimpleLineSymbol('solid', new Color([232, 104, 80]), 2),
227
+ new Color([232, 104, 80, 0.25]),
228
+ );
229
+ let highlight = new Graphic(geometry, symbol);
230
+ this.props.view.graphics.removeAll();
231
+ this.props.view.graphics.add(highlight);
232
+ }
212
233
  }
213
234
  }
214
- }
215
- });
235
+ });
236
+ }
216
237
  });
238
+
217
239
  this.props.download
218
240
  ? this.props.view.ui.add(this.container)
219
241
  : this.props.view.ui.add(this.container.current, 'top-right');
@@ -284,6 +306,22 @@ class AreaWidget extends React.Component {
284
306
  <span>NUTS 1</span>
285
307
  </label>
286
308
  </div>
309
+ <div className="ccl-form-group">
310
+ <input
311
+ type="radio"
312
+ id="download_area_select_nuts2"
313
+ name="downloadAreaSelect"
314
+ value="nuts2"
315
+ className="ccl-checkbox ccl-required ccl-form-check-input"
316
+ onClick={this.nuts2handler.bind(this)}
317
+ ></input>
318
+ <label
319
+ className="ccl-form-radio-label"
320
+ htmlFor="download_area_select_nuts2"
321
+ >
322
+ <span>NUTS 2</span>
323
+ </label>
324
+ </div>
287
325
  <div className="ccl-form-group">
288
326
  <input
289
327
  type="radio"