diff --git a/awx/ui_next/src/api/models/Jobs.js b/awx/ui_next/src/api/models/Jobs.js index 295ee815e8..1c3375691c 100644 --- a/awx/ui_next/src/api/models/Jobs.js +++ b/awx/ui_next/src/api/models/Jobs.js @@ -5,6 +5,11 @@ class Jobs extends Base { super(http); this.baseUrl = '/api/v2/jobs/'; } + + readDetail (id, type) { + // TODO: adjust url based on type + return this.http.get(`${this.baseUrl}${id}/`); + } } export default Jobs; diff --git a/awx/ui_next/src/components/DetailList/Detail.jsx b/awx/ui_next/src/components/DetailList/Detail.jsx index ea65fdc288..761fd6aa94 100644 --- a/awx/ui_next/src/components/DetailList/Detail.jsx +++ b/awx/ui_next/src/components/DetailList/Detail.jsx @@ -26,7 +26,7 @@ const DetailValue = styled(({ fullWidth, ...props }) => ( `; const Detail = ({ label, value, fullWidth }) => { - if (!value) return null; + if (!value && typeof value !== 'number') { return null; } return ( diff --git a/awx/ui_next/src/screens/Job/Job.jsx b/awx/ui_next/src/screens/Job/Job.jsx index 67b33f6fc5..b936edb0fa 100644 --- a/awx/ui_next/src/screens/Job/Job.jsx +++ b/awx/ui_next/src/screens/Job/Job.jsx @@ -49,7 +49,7 @@ class Job extends Component { this.setState({ contentError: null, hasContentLoading: true }); try { - const { data } = await JobsAPI.readDetail(id); + const { data } = await JobsAPI.readDetail(id, match.params.type); setBreadcrumb(data); this.setState({ job: data }); } catch (err) { @@ -106,17 +106,31 @@ class Job extends Component { {cardHeader} - + {job && ( } + path="/jobs/:type/:id/details" + render={() => ( + + )} /> )} {job && ( } + path="/jobs/:type/:id/output" + render={() => ( + + )} /> )} diff --git a/awx/ui_next/src/screens/Job/JobDetail/JobDetail.jsx b/awx/ui_next/src/screens/Job/JobDetail/JobDetail.jsx index a4b1ea8651..93f5a825e6 100644 --- a/awx/ui_next/src/screens/Job/JobDetail/JobDetail.jsx +++ b/awx/ui_next/src/screens/Job/JobDetail/JobDetail.jsx @@ -1,35 +1,145 @@ -import React, { Component } from 'react'; +import React, { Component, useState, useEffect } from 'react'; import { Link, withRouter } from 'react-router-dom'; import { withI18n } from '@lingui/react'; import { t } from '@lingui/macro'; import { CardBody, Button } from '@patternfly/react-core'; import styled from 'styled-components'; +import { DetailList, Detail } from '@components/DetailList'; +import { ChipGroup, Chip } from '@components/Chip'; +import ContentError from '@components/ContentError'; +import ContentLoading from '@components/ContentLoading'; +import { toTitleCase } from '@util/strings'; const ActionButtonWrapper = styled.div` display: flex; justify-content: flex-end; `; -class JobDetail extends Component { - render() { - const { job, i18n } = this.props; - return ( - - {job.name} +const VERBOSITY = { + 0: '0 (Normal)', + 1: '1 (Verbose)', + 2: '2 (More Verbose)', + 3: '3 (Debug)', + 4: '4 (Connection Debug)', +}; - - - - - ); - } +function JobDetail ({ job, i18n }) { + const [instanceGroups, setInstanceGroups] = useState(null); + console.log(job); + const { + job_template: jobTemplate, + project, + inventory, + instance_group: instanceGroup, + } = job.summary_fields; + + return ( + + + {/* TODO: add status icon? */} + + + + + {jobTemplate.name} + + )} + /> + + + {inventory.name} + + )} + /> + {/* TODO: show project status icon */} + + {project.name} + + )} + /> + + + + + + + + {instanceGroup.name} + + )} + /> + + {(instanceGroups && instanceGroups.length > 0) && ( + + {instanceGroups.map(ig => ( + {ig.name} + ))} + + )} + /> + )} + + + + + + ); } export default withI18n()(withRouter(JobDetail)); diff --git a/awx/ui_next/src/screens/Job/JobList/JobListItem.jsx b/awx/ui_next/src/screens/Job/JobList/JobListItem.jsx index 4d2fe70f53..805d4e1506 100644 --- a/awx/ui_next/src/screens/Job/JobList/JobListItem.jsx +++ b/awx/ui_next/src/screens/Job/JobList/JobListItem.jsx @@ -32,7 +32,7 @@ class JobListItem extends Component { - + {job.name} diff --git a/awx/ui_next/src/screens/Job/Jobs.jsx b/awx/ui_next/src/screens/Job/Jobs.jsx index fc4311b2bb..a71bfeef71 100644 --- a/awx/ui_next/src/screens/Job/Jobs.jsx +++ b/awx/ui_next/src/screens/Job/Jobs.jsx @@ -58,7 +58,7 @@ class Jobs extends Component { )} /> (