@eeacms/volto-clms-theme 1.1.67 → 1.1.68

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,6 +4,18 @@ 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.1.68](https://github.com/eea/volto-clms-theme/compare/1.1.67...1.1.68) - 24 October 2023
8
+
9
+ #### :rocket: New Features
10
+
11
+ - feat: copy to clipboard labeled [Ion Lizarazu - [`8ec0ce1`](https://github.com/eea/volto-clms-theme/commit/8ec0ce1bb28e7e2c3b8f8acb4297e035d4117840)]
12
+
13
+ #### :hammer_and_wrench: Others
14
+
15
+ - remove unneeded imports [Ion Lizarazu - [`b18c5fc`](https://github.com/eea/volto-clms-theme/commit/b18c5fc4e7557d9fea90a0c3a1f2e3956f9145d0)]
16
+ - enable apiExpanders call by default [Mikel Larreategi - [`796acab`](https://github.com/eea/volto-clms-theme/commit/796acabd9c86edd27a075370f61cc634a41b139e)]
17
+ - style components [Mikel Larreategi - [`7c5fc8a`](https://github.com/eea/volto-clms-theme/commit/7c5fc8a004eed8c30781a0e0c239de143ff08cce)]
18
+ - CLMS-2658 CLMS-2656 show new fields in the dataset view [Mikel Larreategi - [`452b387`](https://github.com/eea/volto-clms-theme/commit/452b38762329ebc9e8a199041c4d7745eedb7511)]
7
19
  ### [1.1.67](https://github.com/eea/volto-clms-theme/compare/1.1.66...1.1.67) - 23 October 2023
8
20
 
9
21
  #### :hammer_and_wrench: Others
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eeacms/volto-clms-theme",
3
- "version": "1.1.67",
3
+ "version": "1.1.68",
4
4
  "description": "volto-clms-theme: Volto theme for CLMS site",
5
5
  "main": "src/index.js",
6
6
  "author": "CodeSyntax for the European Environment Agency",
@@ -16,27 +16,22 @@ const CclRelatedListingEdit = (props) => {
16
16
  let libraries = searchSubrequests?.[props.id]?.items || [];
17
17
  const variationsConfig =
18
18
  config.blocks.blocksConfig['relatedListing'].variations;
19
- let TemplateView = '';
19
+ let TemplateView = <></>;
20
20
  let template_id = '';
21
- for (let variation in variationsConfig) {
22
- if (!data?.variation && variationsConfig[variation].isDefault) {
23
- TemplateView = variationsConfig[variation].template;
24
- template_id = variationsConfig[variation].id;
25
- data.variation = template_id;
26
- }
27
- if (variationsConfig[variation].id === data?.variation) {
28
- TemplateView = variationsConfig[variation].template;
29
- template_id = variationsConfig[variation].id;
30
- }
31
- }
32
- if (template_id === '') {
33
- for (let variation in variationsConfig) {
34
- if (variationsConfig[variation].isDefault) {
35
- TemplateView = variationsConfig[variation].template;
36
- template_id = variationsConfig[variation].id;
37
- data.variation = template_id;
38
- }
39
- }
21
+
22
+ var defaultVariation = variationsConfig.find(
23
+ (configVar) => configVar.isDefault,
24
+ );
25
+ if (variationsConfig.some((variation) => variation.id === data.variation)) {
26
+ const theVariation = variationsConfig.find(
27
+ (variation) => variation.id === data.variation,
28
+ );
29
+ TemplateView = theVariation?.template;
30
+ template_id = theVariation.templateId;
31
+ } else {
32
+ TemplateView = defaultVariation.template;
33
+ template_id = defaultVariation.id;
34
+ data.variation = template_id;
40
35
  }
41
36
  if (!data.content_type) {
42
37
  data.content_type = 'News Item';
@@ -45,7 +40,7 @@ const CclRelatedListingEdit = (props) => {
45
40
  <>
46
41
  <div className="technical-libraries">
47
42
  <h2>Related Listings</h2>
48
- {libraries.length > 0 ? (
43
+ {libraries.length > 0 && template_id ? (
49
44
  <TemplateView items={libraries} variation={template_id} />
50
45
  ) : (
51
46
  <p>There are no related {data.content_type} items.</p>
@@ -46,30 +46,25 @@ const CclRelatedListingView = (props) => {
46
46
  let libraries = searchSubrequests?.items || [];
47
47
  const variationsConfig =
48
48
  config.blocks.blocksConfig['relatedListing'].variations;
49
- let TemplateView = '';
49
+ let TemplateView = <></>;
50
50
  let template_id = '';
51
- var defaultVariation = variationsConfig.filter(
51
+ var defaultVariation = variationsConfig.find(
52
52
  (configVar) => configVar.isDefault,
53
- )[0];
53
+ );
54
54
 
55
- if (!data?.variation) {
56
- TemplateView = defaultVariation.template;
57
- template_id = defaultVariation.id;
58
- data.variation = template_id;
59
- } else {
60
- var variation = variationsConfig.filter(
55
+ if (variationsConfig.some((configVar1) => configVar1.id === data.variation)) {
56
+ var variation = variationsConfig.find(
61
57
  (configVar1) => configVar1.id === data.variation,
62
- )[0];
58
+ );
63
59
  TemplateView = variation.template;
64
60
  template_id = variation.id;
65
61
  data.variation = template_id;
66
- }
67
-
68
- if (template_id === '') {
62
+ } else {
69
63
  TemplateView = defaultVariation.template;
70
64
  template_id = defaultVariation.id;
71
65
  data.variation = template_id;
72
66
  }
67
+
73
68
  if (!data.content_type) {
74
69
  data.content_type = 'News Item';
75
70
  }
@@ -25,7 +25,6 @@ const Schema = (props) => {
25
25
  },
26
26
  variation: {
27
27
  title: 'Variation',
28
- type: 'array',
29
28
  choices: [...variations],
30
29
  },
31
30
  },
@@ -3,7 +3,9 @@ import { FormattedMessage } from 'react-intl';
3
3
  import { connect, useDispatch, useSelector } from 'react-redux';
4
4
  import { useLocation } from 'react-router-dom';
5
5
  import { compose } from 'redux';
6
- import { Modal, Segment, Grid } from 'semantic-ui-react';
6
+ import { Modal, Segment, Grid, Icon, Label } from 'semantic-ui-react';
7
+ import { toast } from 'react-toastify';
8
+ import { Toast } from '@plone/volto/components';
7
9
 
8
10
  import { getUser } from '@plone/volto/actions';
9
11
  import CclButton from '@eeacms/volto-clms-theme/components/CclButton/CclButton';
@@ -19,6 +21,8 @@ import { GeonetworkImporterButtons } from './GeonetworkImporterButtons';
19
21
  import jwtDecode from 'jwt-decode';
20
22
  import PropTypes from 'prop-types';
21
23
 
24
+ import './styles.less';
25
+
22
26
  /**
23
27
  * Full view component.
24
28
  * @module components/theme/View/CLMSDatasetDetailView
@@ -63,6 +67,36 @@ const CLMSDatasetDetailView = ({ content, token }) => {
63
67
  )
64
68
  : false;
65
69
 
70
+ const ClickableUrl = ({ title, url }) => {
71
+ return (
72
+ url && (
73
+ <Grid.Row className="characteristic-row">
74
+ <strong>{title}: </strong>
75
+ <br />
76
+ <Label basic size="large">
77
+ {url}
78
+ <Icon
79
+ name="copy"
80
+ size="large"
81
+ style={{ cursor: 'pointer' }}
82
+ onClick={() => {
83
+ navigator.clipboard.writeText(url);
84
+ toast.success(
85
+ <Toast
86
+ success
87
+ autoClose={5000}
88
+ title={'URL copied to clipboard'}
89
+ content={`The ${title} URL has been successfully copied to clipboard`}
90
+ />,
91
+ );
92
+ }}
93
+ ></Icon>
94
+ </Label>
95
+ </Grid.Row>
96
+ )
97
+ );
98
+ };
99
+
66
100
  return (
67
101
  <div className="ccl-container ">
68
102
  <h1 className="page-title">{content.title}</h1>
@@ -318,6 +352,21 @@ const CLMSDatasetDetailView = ({ content, token }) => {
318
352
  </CclButton>
319
353
  </div>
320
354
  )}
355
+
356
+ {(content?.metadata_wms_url ||
357
+ content?.metadata_wmts_url ||
358
+ content?.metadata_rest_api_url) && (
359
+ <div className="url-container">
360
+ <div className="citation-title">Services</div>
361
+
362
+ <ClickableUrl title="WMS" url={content.metadata_wms_url} />
363
+ <ClickableUrl title="WMTS" url={content.metadata_wmts_url} />
364
+ <ClickableUrl
365
+ title="REST API"
366
+ url={content.metadata_rest_api_url}
367
+ />
368
+ </div>
369
+ )}
321
370
  </nav>
322
371
  </div>
323
372
  </CclTabs>
@@ -166,7 +166,10 @@ const DataSetInfoContent = (props) => {
166
166
  <CharacteristicsMetadata
167
167
  title="Release / Major version"
168
168
  value={props?.characteristics_release_major_version}
169
- extraSpace={true}
169
+ />
170
+ <CharacteristicsMetadata
171
+ title="Projection"
172
+ value={props?.characteristics_projection}
170
173
  />
171
174
  <CharacteristicsMetadata
172
175
  title="Spatial coverage"
@@ -0,0 +1,3 @@
1
+ .url-container {
2
+ word-break: break-word;
3
+ }
package/src/index.js CHANGED
@@ -182,6 +182,20 @@ const applyConfig = (config) => {
182
182
  showTags: false,
183
183
  ownDomain: 'land.copernicus.eu',
184
184
  track_search_paths: ['/en/global-search', '/en/dataset-catalog'],
185
+ apiExpanders: [
186
+ ...config.settings.apiExpanders,
187
+ {
188
+ match: '',
189
+ GET_CONTENT: ['breadcrumbs', 'actions', 'types', 'translations'],
190
+ },
191
+ {
192
+ match: '',
193
+ GET_CONTENT: ['navigation'],
194
+ querystring: (config) => ({
195
+ 'expand.navigation.depth': config.settings.navDepth,
196
+ }),
197
+ },
198
+ ],
185
199
  };
186
200
 
187
201
  config.settings.slate.toolbarButtons = [