From e3de4c9d214983d38a7d66e89dae5d4bba170ca3 Mon Sep 17 00:00:00 2001 From: Joanna Jeremicz Date: Wed, 21 Apr 2021 13:59:12 +0200 Subject: Integrate helm validator with SDC-BE - Read helm validator configuration - Add call to helm validator during Helm validation - Add JUnit tests - Fix display message when CNF upload is unsuccessful - Show warning messages from validation after CNF upload Issue-ID: SDC-3185 Signed-off-by: Joanna Jeremicz Change-Id: If197d557e6ddef4a07bef986d7cf133aedcb2cc5 Signed-off-by: Piotr Marcinkiewicz --- .../softwareProduct/SoftwareProductActionHelper.js | 20 +++++++++++++++++++- .../attachments/validation/HeatValidationReducer.js | 13 ++++++++----- 2 files changed, 27 insertions(+), 6 deletions(-) (limited to 'openecomp-ui/src/sdc-app/onboarding') diff --git a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/SoftwareProductActionHelper.js b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/SoftwareProductActionHelper.js index 02e5a24f3b..38600a60b8 100644 --- a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/SoftwareProductActionHelper.js +++ b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/SoftwareProductActionHelper.js @@ -242,6 +242,17 @@ function parseUploadErrorMsg(error) { return message.replace(/\n$/, ''); } +function showWarningValidationInfo(dispatch, errors) { + dispatch({ + type: modalActionTypes.GLOBAL_MODAL_WARNING, + data: { + title: 'Validation messages', + msg: parseUploadErrorMsg(errors), + cancelButtonText: 'OK' + } + }); +} + function fetchSoftwareProductCategories(dispatch) { let handleResponse = response => dispatch({ @@ -447,6 +458,12 @@ const SoftwareProductActionHelper = { break; } closeTimingValidationInfo(dispatch); + if ( + response.errors !== null && + Object.keys(response.errors).length !== 0 + ) { + showWarningValidationInfo(dispatch, response.errors); + } } else { throw new Error(parseUploadErrorMsg(response.errors)); } @@ -460,7 +477,8 @@ const SoftwareProductActionHelper = { msg: error.message || (error.responseJSON && - error.responseJSON.message) + error.responseJSON.message) || + parseUploadErrorMsg(error.responseJSON.errors) } }, closeTimingValidationInfo(dispatch) diff --git a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/attachments/validation/HeatValidationReducer.js b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/attachments/validation/HeatValidationReducer.js index a34dfe7b04..2ab60aca1f 100644 --- a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/attachments/validation/HeatValidationReducer.js +++ b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/attachments/validation/HeatValidationReducer.js @@ -1,5 +1,6 @@ /*! * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2021 Nokia * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -129,8 +130,13 @@ function createErrorList(node, parent, deep = 0, errorList = []) { } const mapValidationDataToTree = (validationData, packageName) => { - let { errors, heat, nested, volume, network, artifacts, other } = + let { errors, heat, helm, nested, volume, network, artifacts, other } = validationData.importStructure || {}; + let heatChildren = + heat && heat.length + ? heat.map(mapHeatData) + : nested ? nested.map(mapHeatData) : []; + let helmChildren = helm && helm.length ? helm.map(mapHeatData) : []; return { children: [ { @@ -139,10 +145,7 @@ const mapValidationDataToTree = (validationData, packageName) => { type: 'heat', header: true, errors: errors, - children: - heat && heat.length - ? heat.map(mapHeatData) - : nested ? nested.map(mapHeatData) : [] + children: heatChildren.concat(helmChildren) }, ...(artifacts ? [ -- cgit 1.2.3-korg