import React, { useState } from 'react'; import PropTypes from 'prop-types'; import { Alert, AlertActionCloseButton } from '@patternfly/react-core'; import { translate as __ } from 'foremanReact/common/I18n'; import { msgLevelClasses } from './helpers'; const AnsibleLogs = ({ logs, checkMode }) => { const [alertVisibility, setAlertVisibility] = useState(true); return ( <> {checkMode && alertVisibility ? ( setAlertVisibility(false)} /> } > {__('Notice that ansible roles run in check mode.')} ) : null} {logs.map((log, idx) => ( {Array.isArray(log.friendlyMessage) ? ( ) : ( )} ))} {logs.length === 0 ? ( ) : null}
{__('Level')} {__('Task')} {__('Message')}
{log.level} {log.task.name}
    {log.friendlyMessage.map((msg, i) => (
  • {msg}
  • ))}
{log.friendlyMessage}
{__('Nothing to show')}
); }; AnsibleLogs.propTypes = { logs: PropTypes.array.isRequired, checkMode: PropTypes.bool, }; AnsibleLogs.defaultProps = { checkMode: false, }; export default AnsibleLogs;