From b5b38c1b79edb661165d6b1793f917676be375d1 Mon Sep 17 00:00:00 2001 From: Alex Corey Date: Mon, 1 Jul 2019 09:29:04 -0400 Subject: [PATCH] addresses PR Issues --- .../components/LaunchButton/LaunchButton.jsx | 26 ++------------ .../LaunchButton/LaunchButton.test.jsx | 34 ++++++++++++------- .../JobTemplateDetail/JobTemplateDetail.jsx | 30 +++++++++++----- .../TemplateList/TemplateListItem.jsx | 32 +++++++++++++++-- 4 files changed, 75 insertions(+), 47 deletions(-) diff --git a/awx/ui_next/src/components/LaunchButton/LaunchButton.jsx b/awx/ui_next/src/components/LaunchButton/LaunchButton.jsx index 7d8b878f47..6e7c733319 100644 --- a/awx/ui_next/src/components/LaunchButton/LaunchButton.jsx +++ b/awx/ui_next/src/components/LaunchButton/LaunchButton.jsx @@ -1,9 +1,6 @@ import React, { Fragment } from 'react'; import { withRouter } from 'react-router-dom'; import { number } from 'prop-types'; -import { Button, Tooltip } from '@patternfly/react-core'; -import { RocketIcon } from '@patternfly/react-icons'; -import styled from 'styled-components'; import { withI18n } from '@lingui/react'; import { t } from '@lingui/macro'; @@ -11,15 +8,6 @@ import AlertModal from '@components/AlertModal'; import ErrorDetail from '@components/ErrorDetail'; import { JobTemplatesAPI } from '@api'; -const StyledLaunchButton = styled(Button)` - padding: 5px 8px; - - &:hover { - background-color: #0066cc; - color: white; - } -`; - class LaunchButton extends React.Component { static propTypes = { templateId: number.isRequired, @@ -65,20 +53,10 @@ class LaunchButton extends React.Component { render() { const { launchError, promptError } = this.state; - const { i18n } = this.props; + const { i18n, children } = this.props; return ( - -
- - - -
-
+ {children(this.handleLaunch)} { can_start_without_user_input: true, }, }); + const children = handleLaunch => ( + )} - + {canLaunch && ( + + {handleLaunch => ( + + )} + + )}