// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance // with the License. A copy of the License is located at // // http://aws.amazon.com/apache2.0/ // // or in the "LICENSE.txt" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES // OR CONDITIONS OF ANY KIND, express or implied. See the License for the specific language governing permissions and // limitations under the License. // UI Elements import {Trans} from 'react-i18next' import {Icon} from '@cloudscape-design/components' export default function ValidationErrors({errors}: any) { const colorMap = (level: string) => { return { ERROR: 'red', WARNING: 'orange', SUCCESS: 'green', }[level] } const colored = (text: any, success: any) => (
{text}
) var success = errors.message && errors.message.includes('succeeded') var configErrors = errors.configurationValidationErrors || errors.validationMessages var updateErrors = errors.updateValidationErrors return (
{colored(errors.message, success)} {configErrors && (
{errors.configurationValidationErrors ? ( ) : ( )} : {configErrors.map((error: any, i: any) => (
{`${error.type}: ${error.message}`}
))}
)} {updateErrors && (
: {updateErrors.map((error: any, i: any) => (
{`${error.message}`}
))}
)}
) }