Add class to StatusIcon wrapper and fix merge conflicts

This commit is contained in:
Marliana Lara
2019-09-26 09:20:33 -04:00
parent 76325eefd3
commit e97fc54deb
4 changed files with 20 additions and 37 deletions

View File

@@ -75,11 +75,12 @@ const SkippedBottom = styled.div`
const StatusIcon = ({ status, ...props }) => { const StatusIcon = ({ status, ...props }) => {
return ( return (
<div {...props}> <div className="at-c-statusIcon" {...props}>
{status === 'running' && <RunningJob />} {status === 'running' && <RunningJob />}
{(status === 'new' || status === 'pending' || status === 'waiting') && ( {(status === 'new' ||
<WaitingJob /> status === 'pending' ||
)} status === 'waiting' ||
status === 'never updated') && <WaitingJob />}
{(status === 'failed' || status === 'error' || status === 'canceled') && ( {(status === 'failed' || status === 'error' || status === 'canceled') && (
<FinishedJob> <FinishedJob>
<FailedTop /> <FailedTop />

View File

@@ -41,7 +41,7 @@ const VariablesInput = styled(_VariablesInput)`
const StatusDetailValue = styled.div` const StatusDetailValue = styled.div`
align-items: center; align-items: center;
display: inline-flex; display: inline-flex;
> div { .at-c-statusIcon {
margin-right: 10px; margin-right: 10px;
} }
`; `;
@@ -155,13 +155,11 @@ function JobDetail({ job, i18n, history }) {
<Detail <Detail
label={i18n._(t`Launched By`)} label={i18n._(t`Launched By`)}
value={ value={
<> launchedByLink ? (
{launchedByLink ? ( <Link to={`${launchedByLink}`}>{launchedByValue}</Link>
<Link to={`${launchedByLink}`}>{launchedByValue}</Link> ) : (
) : ( launchedByValue
launchedByValue )
)}
</>
} }
/> />
{inventory && ( {inventory && (

View File

@@ -73,19 +73,8 @@ describe('<JobDetail />', () => {
}); });
test('should properly delete job', async () => { test('should properly delete job', async () => {
job = { const wrapper = mountWithContexts(<JobDetail job={mockJobData} />);
name: 'Rage', wrapper.find('button[aria-label="Delete"]').simulate('click');
id: 1,
type: 'job',
summary_fields: {
job_template: { name: 'Spud' },
},
};
const wrapper = mountWithContexts(<JobDetail job={job} />);
wrapper
.find('button')
.at(0)
.simulate('click');
await sleep(1); await sleep(1);
wrapper.update(); wrapper.update();
const modal = wrapper.find('Modal'); const modal = wrapper.find('Modal');
@@ -93,17 +82,12 @@ describe('<JobDetail />', () => {
modal.find('button[aria-label="Delete"]').simulate('click'); modal.find('button[aria-label="Delete"]').simulate('click');
expect(JobsAPI.destroy).toHaveBeenCalledTimes(1); expect(JobsAPI.destroy).toHaveBeenCalledTimes(1);
}); });
// The test below is skipped until react can be upgraded to at least 16.9.0. An upgrade to /*
// react - router will likely be necessary also. The test below is skipped until react can be upgraded to at least 16.9.0. An upgrade to
react - router will likely be necessary also.
See: https://github.com/ansible/awx/issues/4817
*/
test.skip('should display error modal when a job does not delete properly', async () => { test.skip('should display error modal when a job does not delete properly', async () => {
job = {
name: 'Angry',
id: 'a',
type: 'project_update',
summary_fields: {
job_template: { name: 'Peanut' },
},
};
ProjectUpdatesAPI.destroy.mockRejectedValue( ProjectUpdatesAPI.destroy.mockRejectedValue(
new Error({ new Error({
response: { response: {
@@ -116,7 +100,7 @@ describe('<JobDetail />', () => {
}, },
}) })
); );
const wrapper = mountWithContexts(<JobDetail job={job} />); const wrapper = mountWithContexts(<JobDetail job={mockJobData} />);
wrapper wrapper
.find('button') .find('button')

View File

@@ -32,7 +32,7 @@ const Modal = styled(PFModal)`
const HostNameDetailValue = styled.div` const HostNameDetailValue = styled.div`
align-items: center; align-items: center;
display: inline-flex; display: inline-flex;
> div { .at-c-statusIcon {
margin-right: 10px; margin-right: 10px;
} }
`; `;