@eeacms/volto-clms-theme 1.1.80 → 1.1.81

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,21 @@ 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.81](https://github.com/eea/volto-clms-theme/compare/1.1.80...1.1.81) - 20 November 2023
8
+
9
+ #### :rocket: New Features
10
+
11
+ - feat: add a component to show admins the sorting information of this technical library item [Mikel Larreategi - [`21fa335`](https://github.com/eea/volto-clms-theme/commit/21fa3350cc711de14c64ead304787cbccc76d9d9)]
12
+
13
+ #### :bug: Bug Fixes
14
+
15
+ - fix: if logged in users is not manager no button is shown [Unai - [`7084fa3`](https://github.com/eea/volto-clms-theme/commit/7084fa340c14906f89b8c845986c75b2fe1f3e6c)]
16
+
17
+ #### :hammer_and_wrench: Others
18
+
19
+ - to render nothing, return null [Mikel Larreategi - [`2fb3580`](https://github.com/eea/volto-clms-theme/commit/2fb35802b23e3aba5fd166aeefd103c929ffb5d1)]
20
+ - simplify condtioin [Mikel Larreategi - [`f9b43da`](https://github.com/eea/volto-clms-theme/commit/f9b43da91d360e0028402f9a7ba762f16b0d9b22)]
21
+ - test: [JENKINS] Use java17 for sonarqube scanner [valentinab25 - [`7c6e9ca`](https://github.com/eea/volto-clms-theme/commit/7c6e9cac9da0c06d0f24711303404f5055fba7d1)]
7
22
  ### [1.1.80](https://github.com/eea/volto-clms-theme/compare/1.1.79...1.1.80) - 17 November 2023
8
23
 
9
24
  #### :bug: Bug Fixes
package/Jenkinsfile CHANGED
@@ -1,4 +1,7 @@
1
1
  pipeline {
2
+ tools {
3
+ jdk 'Java17'
4
+ }
2
5
  agent {
3
6
  node { label 'docker-host' }
4
7
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eeacms/volto-clms-theme",
3
- "version": "1.1.80",
3
+ "version": "1.1.81",
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",
@@ -0,0 +1,50 @@
1
+ import { useSelector, useDispatch } from 'react-redux';
2
+ import { getContent } from '@plone/volto/actions';
3
+ import React, { useState } from 'react';
4
+ import { Button } from 'semantic-ui-react';
5
+
6
+ const CLMSTechnicalLibraryAdminInfo = (props) => {
7
+ const { uid, id } = props;
8
+ const [showThis, setShowThis] = useState({});
9
+ const isLoggedIn = useSelector((state) => state.userSession?.token);
10
+ const user = useSelector((state) => state.users?.user);
11
+ const isManager = user?.roles ? user?.roles.includes('Manager') : false;
12
+ const dispatch = useDispatch();
13
+ const contents = useSelector((state) => state.content?.subrequests);
14
+ const queryItem = contents?.[`${uid}`];
15
+ const item = queryItem?.data;
16
+
17
+ showThis?.[`${uid}`] &&
18
+ !queryItem?.loading &&
19
+ !queryItem?.loaded &&
20
+ dispatch(getContent(id, null, uid));
21
+
22
+ return isLoggedIn && isManager ? (
23
+ <>
24
+ {showThis[`${uid}`] && item ? (
25
+ <>
26
+ <br />
27
+ <Button onClick={() => setShowThis({ ...showThis, [uid]: false })}>
28
+ Hide
29
+ </Button>
30
+ <br />
31
+ <strong>Categorization</strong>
32
+ <ul>
33
+ {item?.taxonomy_technical_library_categorization.map((item) => (
34
+ <li>{item.title}</li>
35
+ ))}
36
+ </ul>
37
+ </>
38
+ ) : (
39
+ <>
40
+ <br />
41
+ <Button onClick={() => setShowThis({ ...showThis, [uid]: true })}>
42
+ Show extra data
43
+ </Button>
44
+ </>
45
+ )}
46
+ </>
47
+ ) : null;
48
+ };
49
+
50
+ export { CLMSTechnicalLibraryAdminInfo };
@@ -0,0 +1,3 @@
1
+ import { CLMSTechnicalLibraryAdminInfo } from './CLMSTechnicalLibraryAdminInfo';
2
+
3
+ export { CLMSTechnicalLibraryAdminInfo };
@@ -17,6 +17,7 @@ import { FormattedMessage } from 'react-intl';
17
17
  import CclLoginModal from '@eeacms/volto-clms-theme/components/CclLoginModal/CclLoginModal';
18
18
  import CclButton from '@eeacms/volto-clms-theme/components/CclButton/CclButton';
19
19
  import { flattenToAppURL } from '@plone/volto/helpers/Url/Url';
20
+ import { CLMSTechnicalLibraryAdminInfo } from '../CLMSTechnicalLibraryAdminInfo';
20
21
 
21
22
  const CardImage = ({ card, size = 'preview', isCustomCard }) => {
22
23
  return card?.image_field ? (
@@ -108,6 +109,7 @@ const DocCard = ({ card, url, showEditor, children }) => {
108
109
  )}
109
110
  </div>
110
111
  )}
112
+ <CLMSTechnicalLibraryAdminInfo uid={card.UID} id={card['@id']} />
111
113
  <div className="card-doc-description">{card?.description}</div>
112
114
  {children}
113
115
  </>