import React from 'react'; import JSONTree from 'react-json-tree'; import PropTypes from 'prop-types'; import { Button, Grid, GridItem } from '@patternfly/react-core'; import PageLayout from 'foremanReact/routes/common/PageLayout/PageLayout'; import { translate as __ } from 'foremanReact/common/I18n'; import { foremanUrl } from 'foremanReact/common/helpers'; import { useForemanModal } from 'foremanReact/components/ForemanModal/ForemanModalHooks'; import HostReportDeleteModal from '../Components/HostReportDeleteModal'; import ReportLogsFilter from './Components/ReportLogsFilter'; import HostReportMetrics from './Components/HostReportMetrics'; import { HOSTS_PATH, HOST_REPORTS_PATH, HOST_REPORT_DELETE_MODAL_ID, } from '../constants'; const HostReportsShowPage = ({ id, body, format, host, reportedAt, permissions, isLoading, fetchAndPush, }) => { const { setModalOpen: setDeleteModalOpen, setModalClosed: setDeleteModalClosed, } = useForemanModal({ id: HOST_REPORT_DELETE_MODAL_ID, }); const buttons = []; if (permissions.canDelete) { buttons.push( ); } buttons.push( ); buttons.push( ); const meta = {}; switch (format) { case 'puppet': meta.environment = body.environment; meta.logs = body.logs; break; case 'ansible': meta.checkMode = body.checkMode; meta.logs = body.results; break; default: break; } const theme = { scheme: 'foreman', backgroundColor: 'rgba(0, 0, 0, 255)', base00: 'rgba(0, 0, 0, 0)', }; return ( { setDeleteModalClosed(); fetchAndPush({ page: 1 }); }} /> {format === 'plain' ? ( ) : ( {format === 'puppet' ? ( ) : null} )} ); }; HostReportsShowPage.propTypes = { id: PropTypes.number.isRequired, body: PropTypes.object.isRequired, format: PropTypes.string.isRequired, host: PropTypes.object.isRequired, reportedAt: PropTypes.string.isRequired, permissions: PropTypes.object.isRequired, fetchAndPush: PropTypes.func.isRequired, isLoading: PropTypes.bool, }; HostReportsShowPage.defaultProps = { isLoading: true, }; export default HostReportsShowPage;