Skip to content

Commit

Permalink
Merge pull request #71 from eea/develop
Browse files Browse the repository at this point in the history
PP screenshot to mapserver jsapi app
  • Loading branch information
avoinea committed Jan 17, 2024
2 parents 7c5bda9 + f0fbe7f commit bd7efef
Show file tree
Hide file tree
Showing 9 changed files with 66 additions and 50 deletions.
30 changes: 15 additions & 15 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,24 @@ All notable changes to this project will be documented in this file. Dates are d

Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).

### [3.2.1](https://github.com/eea/volto-eea-map/compare/3.2.0...3.2.1) - 13 December 2023
### [3.3.0](https://github.com/eea/volto-eea-map/compare/3.2.1...3.3.0) - 17 January 2024

#### :rocket: New Features

- feat: show embed error + always show sources [Razvan - [`35f5465`](https://github.com/eea/volto-eea-map/commit/35f546574d347716ce043a482e7eda55a0180d44)]

#### :house: Internal changes


#### :hammer_and_wrench: Others

- fix [Miu Razvan - [`a76939e`](https://github.com/eea/volto-eea-map/commit/a76939e8c317cbcc44874c3f14fd22d7e521c1e9)]
- Release 3.3.0 [Alin Voinea - [`8b21828`](https://github.com/eea/volto-eea-map/commit/8b2182871b3d13d0e9164d99d2964e3999e8cc48)]
- use arcgis map for screenshot [andreiggr - [`94cc865`](https://github.com/eea/volto-eea-map/commit/94cc8651667ab351fc761b810634f3b124d6e6bb)]
- update checks to support older javascript engines(screenshoter) [andreiggr - [`7b58516`](https://github.com/eea/volto-eea-map/commit/7b5851628160a8ff474c6405a0285014eb7da05f)]
- better check map layers [andreiggr - [`d3e7d6b`](https://github.com/eea/volto-eea-map/commit/d3e7d6bfaa2e06b5de40c1e13bf9d39241d2c0c0)]
- PP screenshot to mapserver jsapi app [andreiggr - [`a0b4dd4`](https://github.com/eea/volto-eea-map/commit/a0b4dd4033e43bc34b11ede95435a7c76a0cb6b8)]
### [3.2.1](https://github.com/eea/volto-eea-map/compare/3.2.0...3.2.1) - 13 December 2023

### [3.2.0](https://github.com/eea/volto-eea-map/compare/3.1.0...3.2.0) - 13 December 2023

#### :bug: Bug Fixes
Expand Down Expand Up @@ -54,8 +67,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
- fix prettier [Dobricean Ioan Dorian - [`78fc2ba`](https://github.com/eea/volto-eea-map/commit/78fc2baa2f5264ca1bba61b70bc0bdc5b2788e67)]
- Fix Sonorqube [dobri1408 - [`e04011a`](https://github.com/eea/volto-eea-map/commit/e04011aa811422f865d0bbb1e66af558a4310e77)]
- adapt embedeeamap to use serialized data [Dobricean Ioan Dorian - [`005965c`](https://github.com/eea/volto-eea-map/commit/005965c6793a9a9977fef52c08ba9a3173eec348)]
- test: [JENKINS] Use java17 for sonarqube scanner [valentinab25 - [`de2f4f6`](https://github.com/eea/volto-eea-map/commit/de2f4f6f516c2c9f7c2b4ea84373f4b1a21cd0af)]
- test: [JENKINS] Run cypress in started frontend container [valentinab25 - [`4722984`](https://github.com/eea/volto-eea-map/commit/47229842132b406101c340ab200c193925b784ad)]
### [2.0.7](https://github.com/eea/volto-eea-map/compare/2.0.6...2.0.7) - 10 November 2023

#### :rocket: New Features
Expand All @@ -72,7 +83,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).

#### :house: Internal changes

- chore: [JENKINS] Refactor automated testing [valentinab25 - [`7afd81a`](https://github.com/eea/volto-eea-map/commit/7afd81a76bf407b07a94228daf3ab0415fbe4621)]
- chore: husky, lint-staged use fixed versions [valentinab25 - [`0ee38a7`](https://github.com/eea/volto-eea-map/commit/0ee38a7bee84694a5e0230e2d17083fbc071f0c8)]
- chore:volto 16 in tests, update docs, fix stylelint overrides [valentinab25 - [`8efeb44`](https://github.com/eea/volto-eea-map/commit/8efeb4423da70e421a88cabdeb559eb3613fb96e)]
- chore: display legend for content type item, fix case when no note is set [dana-cfc4 - [`ae630a8`](https://github.com/eea/volto-eea-map/commit/ae630a88cffa2a8ef60e0bbfead392508b015497)]
Expand All @@ -82,10 +92,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).

#### :hammer_and_wrench: Others

- test: [JENKINS] Add cpu limit on cypress docker [valentinab25 - [`335133d`](https://github.com/eea/volto-eea-map/commit/335133dc5186a53c1077bbead36100101bd9af45)]
- Refs #260203: make background_image required [laszlocseh - [`baa5c4f`](https://github.com/eea/volto-eea-map/commit/baa5c4fa2fe618af51df12d48b4512ecafc357a8)]
- test: [JENKINS] Increase shm-size to cypress docker [valentinab25 - [`4874649`](https://github.com/eea/volto-eea-map/commit/48746492a2b32a82d33d1c6415eab8a6f6b9f5be)]
- test: [JENKINS] Improve cypress time [valentinab25 - [`7fa0b83`](https://github.com/eea/volto-eea-map/commit/7fa0b837b24f41a01285fd1b17daeefde99a9c76)]
- use toolbar from volto-embed [Miu Razvan - [`29b73fb`](https://github.com/eea/volto-eea-map/commit/29b73fb8378ca56b3634bf1f7d57ce69a242b18e)]
### [2.0.6](https://github.com/eea/volto-eea-map/compare/2.0.5...2.0.6) - 29 September 2023

Expand All @@ -102,7 +109,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).

- test: EN locales, pre-commit fix, feature PRs checks Refs #257193 [valentinab25 - [`4c6d141`](https://github.com/eea/volto-eea-map/commit/4c6d1413b67ffc3fe27a7d09dcc99ef98867cec9)]
- test: Fix package.json scripts to use makefile [Alin Voinea - [`1cd6751`](https://github.com/eea/volto-eea-map/commit/1cd675118165d8631c41d35c00a8c902c7edd803)]
- test: Fix eslint and yarn i18n [Alin Voinea - [`0184641`](https://github.com/eea/volto-eea-map/commit/018464116ba5b86b2c1e0a4ebc9b2fd95b772b66)]
- i18n: Add en [Alin Voinea - [`1d29304`](https://github.com/eea/volto-eea-map/commit/1d293049a21e138fa933cd5ed9a04cceac1a5cff)]
### [2.0.5](https://github.com/eea/volto-eea-map/compare/2.0.4...2.0.5) - 23 August 2023

Expand Down Expand Up @@ -159,14 +165,11 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
#### :hammer_and_wrench: Others

- Release 2.0.0 [Alin Voinea - [`7be280d`](https://github.com/eea/volto-eea-map/commit/7be280d4809186e663f422687aca3c33dd732904)]
- Add Sonarqube tag using eea-website-frontend addons list [EEA Jenkins - [`ba6ed22`](https://github.com/eea/volto-eea-map/commit/ba6ed22118406db979457384d4739cced2096137)]
### [1.0.2](https://github.com/eea/volto-eea-map/compare/1.0.1...1.0.2) - 21 July 2023

#### :hammer_and_wrench: Others

- Allow blocks in content type [Tiberiu Ichim - [`2ac09a6`](https://github.com/eea/volto-eea-map/commit/2ac09a613aba07f6cbaf42c386660f2d7d09bd13)]
- Add Sonarqube tag using eea-website-frontend addons list [EEA Jenkins - [`403b4c0`](https://github.com/eea/volto-eea-map/commit/403b4c009e5aaded58203bc292ba3baa4631488b)]
- Add Sonarqube tag using eea-website-frontend addons list [EEA Jenkins - [`aedb654`](https://github.com/eea/volto-eea-map/commit/aedb6544fd45b147a3385425aba46ffba108f5ca)]
### [1.0.1](https://github.com/eea/volto-eea-map/compare/1.0.0...1.0.1) - 22 June 2023

#### :rocket: New Features
Expand Down Expand Up @@ -227,7 +230,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).

- chore: clear unused #254131 [andreiggr - [`ccec2ea`](https://github.com/eea/volto-eea-map/commit/ccec2eaab173c905cd4ea0190a9c6cfd630250f9)]
- chore: clear block style #254131 [andreiggr - [`af500bc`](https://github.com/eea/volto-eea-map/commit/af500bc10a5f280eff0335f45bae1596d66a7e6b)]
- chore: [JENKINS] Remove alpha testing version [valentinab25 - [`76b29e5`](https://github.com/eea/volto-eea-map/commit/76b29e510f5156590723831a524bc39dfba6deba)]

#### :hammer_and_wrench: Others

Expand All @@ -237,15 +239,13 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
- * versions [andreiggr - [`6d9ff2b`](https://github.com/eea/volto-eea-map/commit/6d9ff2b26a236b6445678e3d84698d1c3c0826f4)]
- add razzle-plugin-scss dep [andreiggr - [`d74cee5`](https://github.com/eea/volto-eea-map/commit/d74cee51d30c866afe55730e5b25e0bf11d2caea)]
- volto-object-widget [andreiggr - [`18d0ed7`](https://github.com/eea/volto-eea-map/commit/18d0ed72c1ba7b0f7159a0eefc09ccea9acee5cb)]
- Add Sonarqube tag using bise-frontend addons list [EEA Jenkins - [`5911d01`](https://github.com/eea/volto-eea-map/commit/5911d01f7f3bc79a2c834fab75a9a4ac05d2d042)]
### [0.1.32](https://github.com/eea/volto-eea-map/compare/0.1.31...0.1.32) - 20 February 2023

#### :hammer_and_wrench: Others

- remove console.log [tedw87 - [`3aeb3e8`](https://github.com/eea/volto-eea-map/commit/3aeb3e8ec5474387f3cd22eb9b387c6681e17120)]
- refactor code [tedw87 - [`6d7830e`](https://github.com/eea/volto-eea-map/commit/6d7830eb934f56c255eea5642bdefba30d892946)]
- add Blossom basemap layer [tedw87 - [`5226ee2`](https://github.com/eea/volto-eea-map/commit/5226ee218df3401cf467afbc7a4d720dc30719e1)]
- Add Sonarqube tag using cca-frontend addons list [EEA Jenkins - [`1dad5c6`](https://github.com/eea/volto-eea-map/commit/1dad5c6617096ff85223165a6dd2b1d5d7deea6a)]
### [0.1.31](https://github.com/eea/volto-eea-map/compare/0.1.30...0.1.31) - 11 November 2022

#### :hammer_and_wrench: Others
Expand Down
9 changes: 8 additions & 1 deletion Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -238,12 +238,19 @@ pipeline {
script {
def scannerHome = tool 'SonarQubeScanner'
def nodeJS = tool 'NodeJS'
sh "pwd"
withSonarQubeEnv('Sonarqube') {
sh '''sed -i "s#/app/src/addons/${GIT_NAME}/##g" xunit-reports/coverage/lcov.info'''
sh '''sed -i "s#src/addons/${GIT_NAME}/##g" xunit-reports/coverage/lcov.info'''
sh "export PATH=${scannerHome}/bin:${nodeJS}/bin:$PATH; sonar-scanner -Dsonar.javascript.lcov.reportPaths=./xunit-reports/coverage/lcov.info,./cypress-coverage/coverage/lcov.info -Dsonar.sources=./src -Dsonar.projectKey=$GIT_NAME-$BRANCH_NAME -Dsonar.projectVersion=$BRANCH_NAME-$BUILD_NUMBER"
sh '''try=5; while [ \$try -gt 0 ]; do curl -s -XPOST -u "${SONAR_AUTH_TOKEN}:" "${SONAR_HOST_URL}api/project_tags/set?project=${GIT_NAME}-${BRANCH_NAME}&tags=${SONARQUBE_TAGS},${BRANCH_NAME}" > set_tags_result; if [ \$(grep -ic error set_tags_result ) -eq 0 ]; then try=0; else cat set_tags_result; echo "... Will retry"; sleep 15; try=\$(( \$try - 1 )); fi; done'''
sh '''try=5; while [ \$try -gt 0 ]; do curl -s -XPOST -u "${SONAR_AUTH_TOKEN}:" "${SONAR_HOST_URL}api/project_tags/set?project=${GIT_NAME}-${BRANCH_NAME}&tags=${SONARQUBE_TAGS},${BRANCH_NAME}" > set_tags_result; cat set_tags_result; if [ \$(grep -ic error set_tags_result ) -eq 0 ]; then try=0; else cat set_tags_result; echo "... Will retry"; sleep 15; try=\$(( \$try - 1 )); fi; done; echo "finished"'''
sh "pwd"
}
withSonarQubeEnv('Sonarqube') {
sh "pwd"
}
sh "pwd"
sh "ls -ltr /var/jenkins_home/worker/workspace/lto-addons_volto-eea-map_develop"
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@eeacms/volto-eea-map",
"version": "3.2.1",
"version": "3.3.0",
"description": "@eeacms/volto-eea-map: Volto add-on",
"main": "src/index.js",
"author": "European Environment Agency: IDM2 A-Team",
Expand Down
5 changes: 2 additions & 3 deletions src/components/Blocks/EmbedEEAMap/Edit.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ const Edit = (props) => {
enable_queries,
show_legend = true,
show_note = true,
show_sources = true,
show_more_info = true,
show_share = true,
dataprotection = { enabled: true },
Expand Down Expand Up @@ -66,7 +65,7 @@ const Edit = (props) => {

useEffect(() => {
const mapVisId = flattenToAppURL(map_visualization_data['@id'] || '');
if (vis_url && vis_url !== mapVisId) {
if (!map_visualization_data?.error && vis_url && vis_url !== mapVisId) {
getContent(vis_url, null, id);
}
if (!vis_url) {
Expand Down Expand Up @@ -118,7 +117,7 @@ const Edit = (props) => {
...data,
show_legend,
show_note,
show_sources,
show_sources: true,
show_more_info,
show_share,
dataprotection,
Expand Down
1 change: 0 additions & 1 deletion src/components/Blocks/EmbedEEAMap/Schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ export const Schema = (props) => {
'show_legend',
'show_viewer',
'show_note',
'show_sources',
'show_more_info',
'show_share',
],
Expand Down
16 changes: 13 additions & 3 deletions src/components/Blocks/EmbedEEAMap/View.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ const View = (props) => {
enable_queries,
show_legend = true,
show_note = true,
show_sources = true,
show_more_info = true,
show_share = true,
dataprotection = { enabled: true },
Expand All @@ -35,11 +34,22 @@ const View = (props) => {
setMapData(updatedMapData);
}, [map_visualization_data, data_query_params, enable_queries]);

const mapUrl = map_visualization_data?.layers?.map_layers[0]?.map_layer
?.map_service_url
? `${map_visualization_data.layers.map_layers[0].map_layer.map_service_url}?f=jsapi`
: '';

if (map_visualization_data?.error) {
return (
<p dangerouslySetInnerHTML={{ __html: map_visualization_data.error }} />
);
}

return (
<PrivacyProtection
data={data}
className="embed-map-visualization"
{...props}
data={mapUrl ? { ...data, url: mapUrl } : data}
>
{!!mapData && (
<>
Expand All @@ -49,7 +59,7 @@ const View = (props) => {
...data,
show_legend,
show_note,
show_sources,
show_sources: true,
show_more_info,
show_share,
dataprotection,
Expand Down
11 changes: 7 additions & 4 deletions src/components/LegendView.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@ import codeSVG from '@eeacms/volto-eea-map/static/code-line.svg';
const LayerLegend = ({ data, show_viewer }) => {
const [legendRows, setLegendRows] = React.useState([]);

const { map_service_url = '', layer = {} } = data;
const map_service_url =
data && data.map_service_url ? data.map_service_url : '';

const layer = data && data.layer ? data.layer : {};
const { id, name } = layer || {};

const fetchLegend = async (url, activeLayerID) => {
Expand All @@ -23,11 +26,11 @@ const LayerLegend = ({ data, show_viewer }) => {
};

React.useEffect(() => {
if (data.map_service_url && id !== undefined) {
if (data?.map_service_url && id !== undefined) {
fetchLegend(`${data.map_service_url}/legend`, id);
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [id, data.map_service_url]);
}, [id, data]);

return (
<Grid.Column>
Expand Down Expand Up @@ -61,7 +64,7 @@ const LayerLegend = ({ data, show_viewer }) => {
</a>
)}
</div>
{data.description && serializeNodes(data.description)}
{data?.description && serializeNodes(data.description)}
<div style={{ display: 'flex', flexDirection: 'column' }}>
{legendRows.length > 0 &&
legendRows.map((item, i) => {
Expand Down
35 changes: 15 additions & 20 deletions src/components/Webmap.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,25 +21,20 @@ const MODULES = [
];

const Webmap = (props) => {
const { editMode, height, id } = props;

const device = React.useMemo(() => props.device || {}, [props.device]);

const data = React.useMemo(() => props.data || {}, [props.data]);

const layers = React.useMemo(() => props?.data?.layers || {}, [
props.data?.layers,
]);
const base = React.useMemo(() => props?.data?.base || {}, [props.data.base]);

const general = React.useMemo(() => props?.data?.general || {}, [
props.data?.general,
]);
const styles = React.useMemo(() => props?.data?.styles || {}, [
props.data?.styles,
]);

const { base_layer = '' } = base;
const editMode = props && props.editMode ? props.editMode : false;
const height = props && props.height ? props.height : '';
const id = props && props.id ? props.id : '';
const device = props && props.device ? props.device : {};
const data = props && props.data ? props.data : {};

const layers =
props && props.data && props.data.layers ? props.data.layers : {};
const base = props && props.data && props.data.base ? props.data.base : {};
const general =
props && props.data && props.data.general ? props.data.general : {};
const styles =
props && props.data && props.data.styles ? props.data.styles : {};
const base_layer = base && base.base_layer ? base.base_layer : '';

const map_layers =
layers &&
Expand Down Expand Up @@ -146,7 +141,7 @@ const Webmap = (props) => {
.map(
(
{
map_service_url,
map_service_url = '',
layer,
fullLayer,
query = '',
Expand Down
7 changes: 5 additions & 2 deletions src/components/visualization/VisualizationView.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,12 @@ import Webmap from '../Webmap';
import ExtraViews from '../ExtraViews';

const VisualizationView = (props) => {
const { content = {} } = props;
const content = props && props.content ? props.content : {};

const { map_visualization_data = {} } = content;
const map_visualization_data =
content && content.map_visualization_data
? content.map_visualization_data
: {};

return (
<div id="page-document" className="view-viewarcgismap">
Expand Down

0 comments on commit bd7efef

Please sign in to comment.