From a57f2ca2bf9e7a6cfe962646371330cc2a4a20a7 Mon Sep 17 00:00:00 2001 From: mabashian Date: Wed, 7 Aug 2019 14:46:41 -0400 Subject: [PATCH] Run prettier --- .../components/Sparkline/JobStatusIcon.jsx | 65 +++++++------------ .../Sparkline/JobStatusIcon.test.jsx | 14 ++-- .../src/components/Sparkline/Sparkline.jsx | 32 +++++---- .../components/Sparkline/Sparkline.test.jsx | 11 ++-- awx/ui_next/src/components/Sparkline/index.js | 2 +- .../TemplateList/TemplateListItem.jsx | 4 +- 6 files changed, 59 insertions(+), 69 deletions(-) diff --git a/awx/ui_next/src/components/Sparkline/JobStatusIcon.jsx b/awx/ui_next/src/components/Sparkline/JobStatusIcon.jsx index 609a4939ed..ce6713e90d 100644 --- a/awx/ui_next/src/components/Sparkline/JobStatusIcon.jsx +++ b/awx/ui_next/src/components/Sparkline/JobStatusIcon.jsx @@ -21,10 +21,7 @@ const Wrapper = styled.div` const RunningJob = styled(Wrapper)` background-color: #5cb85c; padding-right: 0px; - text-shadow: - -1px -1px 0 #ffffff, - 1px -1px 0 #ffffff, - -1px 1px 0 #ffffff, + text-shadow: -1px -1px 0 #ffffff, 1px -1px 0 #ffffff, -1px 1px 0 #ffffff, 1px 1px 0 #ffffff; animation: ${Pulse} 1.5s linear infinite alternate; `; @@ -58,43 +55,35 @@ const FailedTop = styled.div` `; const FailedBottom = styled.div` - background-color: #D9534F; + background-color: #d9534f; `; const JobStatusIcon = ({ job, link, tooltip, ...props }) => { let Icon = ( - { job.status === 'running' && } - { (job.status === 'new' - || job.status === 'pending' - || job.status === 'waiting') - && - } - { (job.status === 'failed' - || job.status === 'error' - || job.status === 'canceled') - && ( - - - - - ) - } - { job.status === 'successful' && ( - - - - - )} - + {job.status === 'running' && } + {(job.status === 'new' || + job.status === 'pending' || + job.status === 'waiting') && } + {(job.status === 'failed' || + job.status === 'error' || + job.status === 'canceled') && ( + + + + + )} + {job.status === 'successful' && ( + + + + + )} + ); if (link) { - Icon = ( - - {Icon} - - ); + Icon = {Icon}; } if (tooltip) { @@ -107,17 +96,13 @@ const JobStatusIcon = ({ job, link, tooltip, ...props }) => { ); } - return ( -
- {Icon} -
- ); -} + return
{Icon}
; +}; JobStatusIcon.propTypes = { job: object.isRequired, link: string, - tooltip: node + tooltip: node, }; JobStatusIcon.defaultProps = { diff --git a/awx/ui_next/src/components/Sparkline/JobStatusIcon.test.jsx b/awx/ui_next/src/components/Sparkline/JobStatusIcon.test.jsx index 914c574cc7..ab915db6d5 100644 --- a/awx/ui_next/src/components/Sparkline/JobStatusIcon.test.jsx +++ b/awx/ui_next/src/components/Sparkline/JobStatusIcon.test.jsx @@ -7,7 +7,7 @@ import JobStatusIcon from './JobStatusIcon'; describe('JobStatusIcon', () => { const job = { id: 1, - status: 'successful' + status: 'successful', }; test('renders the expected content', () => { @@ -23,7 +23,9 @@ describe('JobStatusIcon', () => { expect(wrapper.find('Link')).toHaveLength(0); }); test('renders with link if link passed', () => { - const wrapper = mountWithContexts(); + const wrapper = mountWithContexts( + + ); expect(wrapper).toHaveLength(1); expect(wrapper.find('Tooltip')).toHaveLength(0); expect(wrapper.find('Link')).toHaveLength(1); @@ -31,7 +33,7 @@ describe('JobStatusIcon', () => { test('renders running job', () => { const runningJob = { id: 2, - status: 'running' + status: 'running', }; const wrapper = mount(); expect(wrapper.find('JobStatusIcon__RunningJob')).toHaveLength(1); @@ -39,7 +41,7 @@ describe('JobStatusIcon', () => { test('renders waiting job', () => { const waitingJob = { id: 3, - status: 'waiting' + status: 'waiting', }; const wrapper = mount(); expect(wrapper.find('JobStatusIcon__WaitingJob')).toHaveLength(1); @@ -47,7 +49,7 @@ describe('JobStatusIcon', () => { test('renders failed job', () => { const failedJob = { id: 4, - status: 'failed' + status: 'failed', }; const wrapper = mount(); expect(wrapper.find('JobStatusIcon__FailedTop')).toHaveLength(1); @@ -58,4 +60,4 @@ describe('JobStatusIcon', () => { expect(wrapper.find('JobStatusIcon__SuccessfulTop')).toHaveLength(1); expect(wrapper.find('JobStatusIcon__SuccessfulBottom')).toHaveLength(1); }); -}); \ No newline at end of file +}); diff --git a/awx/ui_next/src/components/Sparkline/Sparkline.jsx b/awx/ui_next/src/components/Sparkline/Sparkline.jsx index 4c9a97448f..9872caeb5e 100644 --- a/awx/ui_next/src/components/Sparkline/Sparkline.jsx +++ b/awx/ui_next/src/components/Sparkline/Sparkline.jsx @@ -11,24 +11,28 @@ const JobStatusIcon = styled(props => <_JobStatusIcon {...props} />)` `; const Sparkline = ({ i18n, jobs }) => { - const generateTooltip = (job) => ( + const generateTooltip = job => ( -
{i18n._(t`JOB ID:`)} {job.id}
-
{i18n._(t`STATUS:`)} {job.status.toUpperCase()}
-
{i18n._(t`FINISHED:`)} {job.finished}
+
+ {i18n._(t`JOB ID:`)} {job.id} +
+
+ {i18n._(t`STATUS:`)} {job.status.toUpperCase()} +
+
+ {i18n._(t`FINISHED:`)} {job.finished} +
); - return ( - (jobs.map(job => ( - - ))) - ) + return jobs.map(job => ( + + )); }; Sparkline.propTypes = { diff --git a/awx/ui_next/src/components/Sparkline/Sparkline.test.jsx b/awx/ui_next/src/components/Sparkline/Sparkline.test.jsx index 6417acd7d2..427709577b 100644 --- a/awx/ui_next/src/components/Sparkline/Sparkline.test.jsx +++ b/awx/ui_next/src/components/Sparkline/Sparkline.test.jsx @@ -13,12 +13,13 @@ describe('Sparkline', () => { const jobs = [ { id: 1, - status: 'successful' - }, { + status: 'successful', + }, + { id: 2, - status: 'failed' - } - ] + status: 'failed', + }, + ]; const wrapper = mountWithContexts(); expect(wrapper.find('JobStatusIcon')).toHaveLength(2); }); diff --git a/awx/ui_next/src/components/Sparkline/index.js b/awx/ui_next/src/components/Sparkline/index.js index 6c37734e51..f33b83ae6c 100644 --- a/awx/ui_next/src/components/Sparkline/index.js +++ b/awx/ui_next/src/components/Sparkline/index.js @@ -1,2 +1,2 @@ export { default as Sparkline } from './Sparkline'; -export { default as JobStatusIcon } from './JobStatusIcon'; \ No newline at end of file +export { default as JobStatusIcon } from './JobStatusIcon'; diff --git a/awx/ui_next/src/screens/Template/TemplateList/TemplateListItem.jsx b/awx/ui_next/src/screens/Template/TemplateList/TemplateListItem.jsx index 947a04a72e..964cc397d2 100644 --- a/awx/ui_next/src/screens/Template/TemplateList/TemplateListItem.jsx +++ b/awx/ui_next/src/screens/Template/TemplateList/TemplateListItem.jsx @@ -58,9 +58,7 @@ class TemplateListItem extends Component { {toTitleCase(template.type)} , - + , {canLaunch && template.type === 'job_template' && (