import React from 'react'; import PropTypes from 'prop-types'; import { Alert } from 'patternfly-react'; import { translate as __ } from 'foremanReact/common/I18n'; const Errors = ({ ...props }) => { const { failedSteps, executionPlan } = props; if (!executionPlan) return ( {__('Execution plan data not available ')} ); if (!failedSteps.length) return {__('No errors')}; return (
{failedSteps.map((step, i) => ( {__('Action')}:
{step.action_class}
{__('Input')}:
{step.input}
{__('Output')}:
{step.output}
{step.error && ( {__('Exception')}:
                  {step.error.exception_class}: {step.error.message}
                
{__('Backtrace')}:
{step.error.backtrace.join('\n')}
)}
))}
); }; Errors.propTypes = { failedSteps: PropTypes.array, executionPlan: PropTypes.shape({}), }; Errors.defaultProps = { failedSteps: [], executionPlan: {}, }; export default Errors;