@eeacms/volto-eea-website-policy 1.12.0 → 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,11 +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.12.0](https://github.com/eea/volto-eea-website-policy/compare/1.12.0-beta.4...1.12.0) - 17 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
+
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)]
8
12
 
9
13
  #### :hammer_and_wrench: Others
10
14
 
11
- - Release 1.12.0 [Alin Voinea - [`820ae80`](https://github.com/eea/volto-eea-website-policy/commit/820ae8045e44d1856f35a61bc17bcf929baedb33)]
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
+
20
+ ### [1.12.0](https://github.com/eea/volto-eea-website-policy/compare/1.12.0-beta.4...1.12.0) - 17 January 2024
21
+
12
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
13
23
 
14
24
  ### [1.12.0-beta.2](https://github.com/eea/volto-eea-website-policy/compare/1.12.0-beta.1...1.12.0-beta.2) - 12 January 2024
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eeacms/volto-eea-website-policy",
3
- "version": "1.12.0",
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
  ),
package/src/index.js CHANGED
@@ -39,7 +39,7 @@ const overrideBlocks = {
39
39
 
40
40
  const applyConfig = (config) => {
41
41
  // #158717#note-25 any path that isn't static, en or controlpanel is treated as external
42
- const notInEN = /^(?!(#|\/en|\/fallback_login|\/static|\/controlpanel|\/cypress|\/login|\/logout|\/contact-form|\/passwordreset)).*$/;
42
+ const notInEN = /^(?!(#|\/en|\/login-authomatic|\/fallback_login|\/static|\/controlpanel|\/cypress|\/login|\/logout|\/contact-form|\/passwordreset)).*$/;
43
43
  config.settings.externalRoutes = [
44
44
  ...(config.settings.externalRoutes || []),
45
45
  {