import React from 'react'; import PropTypes from 'prop-types'; import { translate as __ } from 'foremanReact/common/I18n'; import { usePaginationOptions } from 'foremanReact/components/Pagination/PaginationHooks'; import RelativeDateTime from 'foremanReact/components/common/dates/RelativeDateTime'; import { TableComposable, Thead, Tbody, Tr, Th, Td, } from '@patternfly/react-table'; import { Flex, FlexItem, Pagination } from '@patternfly/react-core'; import { decodeId } from '../../../../globalIdHelper'; import withLoading from '../../../withLoading'; <<<<<<< HEAD import { readableCron } from './JobsTabHelper'; import { preparePerPageOptions, refreshPage, } from '../../../../helpers/paginationHelper'; ======= import { readableCron, readablePurpose } from './JobsTabHelper'; >>>>>>> 5b01704 (Fixes #34458 - Show Hostgroup jobs on the Host Detail page) const PreviousJobsTable = ({ history, totalCount, jobs, pagination }) => { const columns = [ __('Description'), __('Result'), __('State'), __('Executed at'), __('Schedule'), ]; const handlePerPageSelected = (event, perPage) => { refreshPage(history, { page: 1, perPage }); }; const handlePageSelected = (event, page) => { refreshPage(history, { ...pagination, page }); }; const perPageOptions = preparePerPageOptions(usePaginationOptions()); return (

{__('Previously executed jobs')}

<<<<<<< HEAD ======= {columns.map(col => ( {col} ))} {jobs.map(job => ( window.tfm.nav.pushUrl( `/job_invocations/${decodeId(job.id)}` ) } > {job.description}   {readablePurpose(job.recurringLogic.purpose)} {job.task.result} {job.task.state} {readableCron(job.recurringLogic.cronLine)} ))} >>>>>>> 5b01704 (Fixes #34458 - Show Hostgroup jobs on the Host Detail page) {columns.map(col => ( {col} ))} {jobs.map(job => ( window.tfm.nav.pushUrl( `/job_invocations/${decodeId(job.id)}` ) } > {job.description} {job.task.result} {job.task.state} {readableCron(job.recurringLogic.cronLine)} ))}
); }; PreviousJobsTable.propTypes = { jobs: PropTypes.array.isRequired, history: PropTypes.object.isRequired, totalCount: PropTypes.number.isRequired, pagination: PropTypes.object.isRequired, }; export default withLoading(PreviousJobsTable);