Skip to content

Commit

Permalink
Merge pull request #356 from eea/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
tiberiuichim authored Dec 16, 2024
2 parents e68e92e + babacde commit a7d4127
Show file tree
Hide file tree
Showing 6 changed files with 79 additions and 38 deletions.
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,19 @@ 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).

### [0.2.83](https://github.com/eea/volto-cca-policy/compare/0.2.82...0.2.83) - 16 December 2024

#### :rocket: Dependency updates

- Release @eeacms/volto-searchlib@2.0.5 [EEA Jenkins - [`4adc1dc`](https://github.com/eea/volto-cca-policy/commit/4adc1dc79bca9439b2bd5b79d231c1e2243fc74b)]
- Release @eeacms/volto-searchlib@2.0.4 [EEA Jenkins - [`3b5547c`](https://github.com/eea/volto-cca-policy/commit/3b5547c8a7be40a44fd978efe9ea4736e3fa7bed)]

#### :hammer_and_wrench: Others

- Don't expose all the languages [Tiberiu Ichim - [`80e20af`](https://github.com/eea/volto-cca-policy/commit/80e20af2f56d164e6efbd90370307f7317c38909)]
- Add 2 new fields to download [Tiberiu Ichim - [`c8f71ba`](https://github.com/eea/volto-cca-policy/commit/c8f71ba52d8e39568e3ad00cf6e6bc45650e66b8)]
- Ad Maps/Graphs height, handle iframe src and URL for indicators [kreafox - [`4f314c0`](https://github.com/eea/volto-cca-policy/commit/4f314c0f8b5e316d67f3c871276e92128ebf129b)]
- Set download fields [Tiberiu Ichim - [`6677ee0`](https://github.com/eea/volto-cca-policy/commit/6677ee0fa1f863387488db9adb2d5730b4099016)]
### [0.2.82](https://github.com/eea/volto-cca-policy/compare/0.2.81...0.2.82) - 12 December 2024

#### :hammer_and_wrench: Others
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@eeacms/volto-cca-policy",
"version": "0.2.82",
"version": "0.2.83",
"description": "@eeacms/volto-cca-policy: Volto add-on",
"main": "src/index.js",
"author": "European Environment Agency: IDM2 A-Team",
Expand Down Expand Up @@ -35,7 +35,7 @@
"@eeacms/volto-globalsearch": "^1.1.0",
"@eeacms/volto-hero-block": "^7.1.0",
"@eeacms/volto-openlayers-map": "*",
"@eeacms/volto-searchlib": "2.0.3",
"@eeacms/volto-searchlib": "2.0.5",
"@eeacms/volto-slate-label": "^0.6.0",
"@eeacms/volto-tabs-block": "^7.5.1",
"@elastic/search-ui": "1.21.2",
Expand Down
22 changes: 16 additions & 6 deletions src/components/theme/Views/DatabaseItemView.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -94,23 +94,33 @@ const MaybeFlourishVisualization = ({ content }) => {
};

function getFirstIframeSrc(htmlString) {
const regex = /<iframe[^>]+src=["']([^"']+)["']/;
const match = htmlString.match(regex);
return match ? match[1] : null;
const iframeRegex = /<iframe[^>]+src=["']([^"']+)["']/;

const iframeMatch = htmlString.match(iframeRegex);
if (iframeMatch) {
return iframeMatch[1];
}

try {
const url = new URL(htmlString);
return url.href;
} catch (e) {
return null;
}
}

const MaybeIframeVisualization = ({ content }) => {
const { map_graphs } = content;
const { map_graphs, map_graphs_height } = content;

const url = getFirstIframeSrc(map_graphs || '');
const height = map_graphs_height || 800;

const [isClient, setIsClient] = React.useState();

React.useEffect(() => setIsClient(true), []);

if (!(isClient && url)) return null;

// <div dangerouslySetInnerHTML={{ __html: map_graphs }} />
return (
<PrivacyProtection
data={{
Expand All @@ -119,7 +129,7 @@ const MaybeIframeVisualization = ({ content }) => {
}}
>
<iframe
height="980"
height={height}
width="100%"
src={url}
title="Interactive or visual content"
Expand Down
1 change: 1 addition & 0 deletions src/helpers/Constants.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -525,6 +525,7 @@ export const EU_COUNTRIES = [
'LV',
'MT',
'NL',
'NO',
'PL',
'PT',
'RO',
Expand Down
60 changes: 30 additions & 30 deletions src/search/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,40 +141,40 @@ export const language = {
type: 'any',
},
facetValues: [
'ar',
'sr',
'sq',
'bg',
'bs',
'cs',
'hr',
'da',
'nl',
'el',
'de',
'en',
'et',
'fi',
'es',
'fr',
'ga',
'de',
'hu',
'is',
'it',
'lv',
'lt',
'mk',
'mt',
'no',
'pl',
'pt',
'ro',
'ru',
'sh',
'sk',
'sl',
'es',
'sv',
'tr',
// 'ar',
// 'bg',
// 'bs',
// 'cs',
// 'da',
// 'el',
// 'et',
// 'fi',
// 'ga',
// 'hr',
// 'hu',
// 'is',
// 'lt',
// 'lv',
// 'mk',
// 'mt',
// 'nl',
// 'no',
// 'pt',
// 'ro',
// 'ru',
// 'sh',
// 'sk',
// 'sl',
// 'sq',
// 'sr',
// 'sv',
// 'tr',
],
sortOn: 'custom',
sortOnCustomLabel: 'Alphabetical',
Expand Down
17 changes: 17 additions & 0 deletions src/search/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,22 @@ export default function installMainSearch(config) {

// console.log('config.searchui.ccaSearch clusers', clusters);
// debugger;
config.searchui.globalsearch.download_fields = [
{ field: 'about', name: 'About' },
{ field: 'title', name: 'title' },
{ field: 'issued', name: 'Issued' },
{ field: 'objectProvides', name: 'Content type' },
{ field: 'cca_adaptation_sectors', name: 'Sectors' },
{ field: 'cca_climate_impacts', name: 'Climate impact' },
{ field: 'transnational_regions', name: 'Transnational regions' },
{ field: 'cca_adaptation_elements', name: 'Adaptation Approaches' },
{ field: 'cca_funding_programme', name: 'Funding programme' },
{ field: 'cca_key_type_measure', name: 'Key type measure' },
{ field: 'cca_geographic_countries', name: 'Countries' },
{ field: 'cca_origin_websites', name: 'Origin website' },
{ field: 'cca_health_impacts', name: 'Health impacts' },
{ field: 'cca_partner_contributors', name: 'Observatory impacts' },
];
config.searchui.ccaSearch = {
...mergeConfig(envConfig, config.searchui.globalsearchbase),
elastic_index: '_es/globalsearch',
Expand Down Expand Up @@ -206,5 +222,6 @@ export default function installMainSearch(config) {
process.env.RAZZLE_ES_PROXY_ADDR || getClientProxyAddress();
}

// console.log(config);
return config;
}

0 comments on commit a7d4127

Please sign in to comment.