@eeacms/volto-eea-website-policy 1.12.1 → 1.13.0

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,13 +4,19 @@ 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.12.1](https://github.com/eea/volto-eea-website-policy/compare/1.13.0-beta.1...1.12.1) - 18 January 2024
7
+ ### [1.13.0](https://github.com/eea/volto-eea-website-policy/compare/1.13.0-beta.1...1.13.0) - 19 February 2024
8
8
 
9
- ### [1.13.0-beta.1](https://github.com/eea/volto-eea-website-policy/compare/1.12.0...1.13.0-beta.1) - 17 January 2024
9
+ #### :rocket: New Features
10
+
11
+ - feat: inforce required fields on workflow change - refs #262289 [dobri1408 - [`b6f939d`](https://github.com/eea/volto-eea-website-policy/commit/b6f939d4274b87607ef69adabb3c49b2b5c03354)]
10
12
 
11
13
  #### :hammer_and_wrench: Others
12
14
 
13
- - Registered login-authomatic [Alexandru Ghica - [`f9e5821`](https://github.com/eea/volto-eea-website-policy/commit/f9e58217971de1ae75b4394ca02a016d508a4edf)]
15
+ - Release 1.13.0 [alin - [`baea684`](https://github.com/eea/volto-eea-website-policy/commit/baea684dc2bb8968ddb6125c4d66bd4cb95c74c8)]
16
+ ### [1.13.0-beta.1](https://github.com/eea/volto-eea-website-policy/compare/1.12.1...1.13.0-beta.1) - 17 January 2024
17
+
18
+ ### [1.12.1](https://github.com/eea/volto-eea-website-policy/compare/1.12.0...1.12.1) - 18 January 2024
19
+
14
20
  ### [1.12.0](https://github.com/eea/volto-eea-website-policy/compare/1.12.0-beta.4...1.12.0) - 17 January 2024
15
21
 
16
22
  ### [1.12.0-beta.4](https://github.com/eea/volto-eea-website-policy/compare/1.12.0-beta.2...1.12.0-beta.4) - 12 January 2024
@@ -19,7 +25,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
19
25
 
20
26
  #### :hammer_and_wrench: Others
21
27
 
22
- - test: [JENKINS] fail with logs on coverage [valentinab25 - [`5cf68f8`](https://github.com/eea/volto-eea-website-policy/commit/5cf68f8db34448d10fe993d16541ad9732434cc8)]
23
28
  ### [1.12.0-beta.1](https://github.com/eea/volto-eea-website-policy/compare/1.11.1...1.12.0-beta.1) - 12 January 2024
24
29
 
25
30
  #### :hammer_and_wrench: Others
@@ -40,11 +45,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
40
45
  #### :hammer_and_wrench: Others
41
46
 
42
47
  - Release 1.11.0 [Alin Voinea - [`3249160`](https://github.com/eea/volto-eea-website-policy/commit/3249160422c6c6e0cf14823b614f8885101a847a)]
43
- - test: [JENKINS] Use java17 for sonarqube scanner [valentinab25 - [`8beb7e7`](https://github.com/eea/volto-eea-website-policy/commit/8beb7e7a12cbc314e56e4b1aceab5ef8d00ca6f3)]
44
- - test: [JENKINS] Run cypress in started frontend container [valentinab25 - [`12d3da1`](https://github.com/eea/volto-eea-website-policy/commit/12d3da12e9a3b0882cf55efe2d40f3032724d41b)]
45
- - test: [JENKINS] Add cpu limit on cypress docker [valentinab25 - [`0af0764`](https://github.com/eea/volto-eea-website-policy/commit/0af076467120ed9a80c697931e869837b92a0a4c)]
46
- - test: [JENKINS] Increase shm-size to cypress docker [valentinab25 - [`8662e3e`](https://github.com/eea/volto-eea-website-policy/commit/8662e3e5fc3640d678ce320eb8856a37d419306c)]
47
- - test: [JENKINS] Improve cypress time [valentinab25 - [`ef1074f`](https://github.com/eea/volto-eea-website-policy/commit/ef1074fdf968cafdf476d4ee4951eb18ebac048a)]
48
48
  ### [1.10.0](https://github.com/eea/volto-eea-website-policy/compare/1.9.2...1.10.0) - 2 November 2023
49
49
 
50
50
  #### :rocket: New Features
@@ -53,7 +53,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
53
53
 
54
54
  #### :house: Internal changes
55
55
 
56
- - chore: [JENKINS] Refactor automated testing [valentinab25 - [`8b1b422`](https://github.com/eea/volto-eea-website-policy/commit/8b1b42297b46d9fb7325589b3bd043233c0d66e9)]
57
56
  - chore: husky, lint-staged use fixed versions [valentinab25 - [`44ac62e`](https://github.com/eea/volto-eea-website-policy/commit/44ac62e6f8b7e5b7d57edfbf82812c91dc5d6bba)]
58
57
  - chore:volto 16 in tests, update docs, fix stylelint overrides [valentinab25 - [`b9a46d8`](https://github.com/eea/volto-eea-website-policy/commit/b9a46d85a64739188a3df9e8cbe645418b5d8b0a)]
59
58
 
@@ -174,7 +173,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
174
173
 
175
174
  - Release 1.5.0 [Alin Voinea - [`a3dea8e`](https://github.com/eea/volto-eea-website-policy/commit/a3dea8ea15cb8d2a876dc10da926ece3a5707ea9)]
176
175
  - test(Jenkinsfile): Use latest stable volto for testing [Alin Voinea - [`a8f7123`](https://github.com/eea/volto-eea-website-policy/commit/a8f712364187f9638886667c249fa102cb49b5c0)]
177
- - Add Sonarqube tag using eea-website-frontend addons list [EEA Jenkins - [`124a8f8`](https://github.com/eea/volto-eea-website-policy/commit/124a8f8ad4ced507aeec27012d725f2e2b977e08)]
178
176
  ### [1.4.0](https://github.com/eea/volto-eea-website-policy/compare/1.3.4...1.4.0) - 21 February 2023
179
177
 
180
178
  #### :rocket: New Features
@@ -254,7 +252,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
254
252
  #### :hammer_and_wrench: Others
255
253
 
256
254
  - Release 1.1.0 [Alin Voinea - [`0291b3b`](https://github.com/eea/volto-eea-website-policy/commit/0291b3bb7b4c6ab09ca98728885cea4051eac8e3)]
257
- - yarn 3 [Alin Voinea - [`593aa58`](https://github.com/eea/volto-eea-website-policy/commit/593aa58eaa4d28aced0603b7f7dd125c857a6f54)]
258
255
  ### [1.0.4](https://github.com/eea/volto-eea-website-policy/compare/1.0.3...1.0.4) - 22 November 2022
259
256
 
260
257
  #### :nail_care: Enhancements
@@ -300,7 +297,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
300
297
 
301
298
  #### :hammer_and_wrench: Others
302
299
 
303
- - Add Sonarqube tag using eea-website-frontend addons list [EEA Jenkins - [`d153f54`](https://github.com/eea/volto-eea-website-policy/commit/d153f54e55e918fa4746e05488c734624eaf14a9)]
304
300
  ### [0.4.0](https://github.com/eea/volto-eea-website-policy/compare/0.3.3...0.4.0) - 19 September 2022
305
301
 
306
302
  #### :hammer_and_wrench: Others
@@ -376,7 +372,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
376
372
  - format index.js [Andrei Grigore - [`db4481a`](https://github.com/eea/volto-eea-website-policy/commit/db4481aeeba59a769272659f33278c902fc69bec)]
377
373
  - Update index.js [Alexandru Ghica - [`dc09886`](https://github.com/eea/volto-eea-website-policy/commit/dc0988640a76a9914381b120f58bb61a9ab1eb39)]
378
374
  - Added externalRoutes [Alexandru Ghica - [`b68135b`](https://github.com/eea/volto-eea-website-policy/commit/b68135b013fafa93a41ea602ea2fad30879abe0f)]
379
- - Add Sonarqube tag using eea-website-frontend addons list [EEA Jenkins - [`575cca6`](https://github.com/eea/volto-eea-website-policy/commit/575cca674602ca2e1c2a41300c47ba594ff49aa0)]
380
375
  ### [0.1.1](https://github.com/eea/volto-eea-website-policy/compare/0.1.0...0.1.1) - 4 March 2022
381
376
 
382
377
  #### :hammer_and_wrench: Others
@@ -389,5 +384,4 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
389
384
 
390
385
  #### :hammer_and_wrench: Others
391
386
 
392
- - yarn bootstrap [Alin Voinea - [`9b4d197`](https://github.com/eea/volto-eea-website-policy/commit/9b4d197cbc7992566cb36524d190078d5ad21a44)]
393
387
  - Initial commit [Alin Voinea - [`3800692`](https://github.com/eea/volto-eea-website-policy/commit/3800692f7a4de6460815bd6061facacb986cbef0)]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eeacms/volto-eea-website-policy",
3
- "version": "1.12.1",
3
+ "version": "1.13.0",
4
4
  "description": "@eeacms/volto-eea-website-policy: Volto add-on",
5
5
  "main": "src/index.js",
6
6
  "author": "European Environment Agency: IDM2 A-Team",
@@ -35,6 +35,10 @@ const messages = defineMessages({
35
35
  id: 'Workflow updated.',
36
36
  defaultMessage: 'Workflow updated.',
37
37
  },
38
+ notAllowedToUpdateWorkflow: {
39
+ id: 'notAllowedToUpdateWorkflow',
40
+ defaultMessage: 'Please fill out all the required fields',
41
+ },
38
42
  messageNoWorkflow: {
39
43
  id: 'No workflow',
40
44
  defaultMessage: 'No workflow',
@@ -45,6 +49,21 @@ const messages = defineMessages({
45
49
  },
46
50
  });
47
51
 
52
+ const filter_remaining_steps = (values, key) => {
53
+ return values.filter((value) => {
54
+ const is_not_ready = !value.is_ready;
55
+ if (!is_not_ready) {
56
+ return false;
57
+ }
58
+ const states = value.states;
59
+ const required_for_all = states?.indexOf('all') !== -1;
60
+ return (
61
+ (is_not_ready && required_for_all) ||
62
+ (is_not_ready && states?.indexOf(key) !== -1)
63
+ );
64
+ });
65
+ };
66
+
48
67
  const SingleValue = injectLazyLibs('reactSelect')(({ children, ...props }) => {
49
68
  const stateDecorator = {
50
69
  marginRight: '10px',
@@ -184,6 +203,7 @@ class Workflow extends Component {
184
203
  workflowLoaded: PropTypes.func,
185
204
  loaded: PropTypes.bool.isRequired,
186
205
  pathname: PropTypes.string.isRequired,
206
+
187
207
  contentHistory: PropTypes.arrayOf(
188
208
  PropTypes.shape({
189
209
  review_state: PropTypes.string,
@@ -245,15 +265,27 @@ class Workflow extends Component {
245
265
  * @returns {undefined}
246
266
  */
247
267
  transition = (selectedOption) => {
248
- this.props.transitionWorkflow(flattenToAppURL(selectedOption.url));
249
- this.setState({ selectedOption });
250
- toast.success(
251
- <Toast
252
- success
253
- title={this.props.intl.formatMessage(messages.messageUpdated)}
254
- content=""
255
- />,
256
- );
268
+ if (filter_remaining_steps(this.props.editingProgressSteps).length === 0) {
269
+ this.props.transitionWorkflow(flattenToAppURL(selectedOption.url));
270
+ this.setState({ selectedOption });
271
+ toast.success(
272
+ <Toast
273
+ success
274
+ title={this.props.intl.formatMessage(messages.messageUpdated)}
275
+ content=""
276
+ />,
277
+ );
278
+ } else {
279
+ toast.error(
280
+ <Toast
281
+ error
282
+ title={this.props.intl.formatMessage(
283
+ messages.notAllowedToUpdateWorkflow,
284
+ )}
285
+ content=""
286
+ />,
287
+ );
288
+ }
257
289
  };
258
290
 
259
291
  selectValue = (option) => {
@@ -367,13 +399,17 @@ export default compose(
367
399
  injectLazyLibs(['reactSelect']),
368
400
  withRouter,
369
401
  connect(
370
- (state) => ({
402
+ (state, props) => ({
371
403
  loaded: state.workflow.transition.loaded,
372
404
  content: state.content.data,
373
405
  workflowLoaded: state.workflow.get?.loaded,
374
406
  contentHistory: state.workflow.history,
375
407
  transitions: state.workflow.transitions,
376
408
  currentStateValue: getCurrentStateMapping(state.workflow.currentState),
409
+ editingProgressSteps:
410
+ state?.editingProgress?.editing?.loaded === true
411
+ ? state?.editingProgress?.result?.steps
412
+ : [],
377
413
  }),
378
414
  { getContent, getWorkflow, transitionWorkflow },
379
415
  ),