Skip to content

Commit

Permalink
Merge pull request #329 from eea/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
tiberiuichim authored Sep 24, 2024
2 parents 3c548c4 + 4898e84 commit f3eba59
Show file tree
Hide file tree
Showing 3 changed files with 89 additions and 4 deletions.
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,17 @@ 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.67](https://github.com/eea/volto-cca-policy/compare/0.2.66...0.2.67) - 24 September 2024

#### :house: Internal changes

- style: Automated code fix [eea-jenkins - [`a43e832`](https://github.com/eea/volto-cca-policy/commit/a43e8329fa87902c295d862c03119b0ed85075d9)]

#### :hammer_and_wrench: Others

- Refs #277611 - view combine odl and new style for c3s indicator [Tripon Eugen - [`e693f6f`](https://github.com/eea/volto-cca-policy/commit/e693f6f782aab535f21b76f70e64b40a185e1665)]
- c3s display iframe URL depending on ecde_identifier [Tripon Eugen - [`067d162`](https://github.com/eea/volto-cca-policy/commit/067d1620c69acdd967f22c88fbbbaaed6694424c)]
- c3s new variable and iframe [Tripon Eugen - [`6a825b3`](https://github.com/eea/volto-cca-policy/commit/6a825b31888c49432272fed7d9be68422ca942b3)]
### [0.2.66](https://github.com/eea/volto-cca-policy/compare/0.2.65...0.2.66) - 23 September 2024

#### :house: Internal changes
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-cca-policy",
"version": "0.2.66",
"version": "0.2.67",
"description": "@eeacms/volto-cca-policy: Volto add-on",
"main": "src/index.js",
"author": "European Environment Agency: IDM2 A-Team",
Expand Down
80 changes: 77 additions & 3 deletions src/components/theme/Views/C3SIndicatorView.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,58 @@ if (!__SERVER__) {
};
}

const createIframe = (div_id, details_url, details_params, spinner_url) => {
const createIframeOld = (div_id, details_url, details_params, spinner_url) => {
return `
<iframe width="100%" height="800px" srcdoc="<html><head>
<title>CDS integration test</title>
<meta charset='utf-8' />
<meta http-equiv='Content-Type' content='text/html; charset=utf-8' />
<script>
window.cds_toolbox = { cds_public_path: 'https://cds.climate.copernicus.eu/toolbox/' };
</script>
<script type='text/javascript' src='https://cds.climate.copernicus.eu/toolbox/toolbox-latest.js'></script>
</head>
<body>
<div class='t-ct'>
<div id='${div_id}'>
<div class='pre-app-loading'>
<img src='${spinner_url}' alt='Loading'>
<div>
...loading configuration...
</div>
</div>
</div>
</div>
<script type='text/javascript'>
document.addEventListener('DOMContentLoaded',
function () {
window.cds_toolbox.runApp(
'${div_id}',
'${details_url}',
${details_params}
);
}, false);
</script>
</body></html>"
/>`;
};

const createIframe = (
div_id,
details_url,
details_params,
ecde_identifier,
spinner_url,
) => {
// return '<iframe src="http://ecde-dev.copernicus-climate.eu/apps/ecde/?disabled=true&theme=eea&indicator=18_consecutive_dry_days" style="width: 100%; border: 0; height: min(800px, 80vh);"/>';
if (typeof ecde_identifier !== 'undefined' && ecde_identifier) {
return (
// '<iframe src="http://ecde-dev.copernicus-climate.eu/apps/ecde/?disabled=true&theme=eea&indicator=' +
'<iframe src="https://apps.copernicus-climate.eu/ecde/?disabled=true&theme=eea&indicator=' +
ecde_identifier +
'" style="width: 100%; border: 0; height: min(800px, 80vh);"/>'
);
}
return `
<iframe width="100%" height="800px" srcdoc="<html><head>
<title>CDS integration test</title>
Expand Down Expand Up @@ -62,8 +113,14 @@ const createIframe = (div_id, details_url, details_params, spinner_url) => {

const Overview = (props) => {
const { content } = props;
const { overview_app_toolbox_url, overview_app_parameters } = content;
const {
overview_app_toolbox_url,
overview_app_toolbox_url_v2,
overview_app_parameters,
overview_app_ecde_identifier,
} = content;
const c3s_overview_url = overview_app_toolbox_url;
const c3s_ecde_identifier = overview_app_ecde_identifier;
const c3s_overview_params = JSON.stringify(overview_app_parameters).replace(
/"/g,
"'",
Expand All @@ -74,11 +131,28 @@ const Overview = (props) => {
setSpinnerUrl(spinner);
}, []);

if (overview_app_ecde_identifier) {
return (
<div
className="iframe-container div-chart-container"
dangerouslySetInnerHTML={{
__html: createIframe(
'toolbox-app-overview',
overview_app_toolbox_url_v2,
c3s_overview_params,
c3s_ecde_identifier,
spinnerUrl,
),
}}
/>
);
}

return (
<div
className="iframe-container div-chart-container"
dangerouslySetInnerHTML={{
__html: createIframe(
__html: createIframeOld(
'toolbox-app-overview',
c3s_overview_url,
c3s_overview_params,
Expand Down

0 comments on commit f3eba59

Please sign in to comment.