Skip to content

Commit

Permalink
Fixes #30138 - report template download button
Browse files Browse the repository at this point in the history
  • Loading branch information
ezr-ondrej authored and xprazak2 committed Jun 18, 2020
1 parent 88eb8d4 commit 570298b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
Expand Up @@ -2,7 +2,8 @@ import React from 'react';
import PropTypes from 'prop-types';
import { Alert, Button } from 'patternfly-react';

import { sprintf, translate as __ } from '../../../react_app/common/I18n';
import { noop } from '../../common/helpers';
import { sprintf, translate as __ } from '../../common/I18n';
import AlertBody from '../common/Alert/AlertBody';

const pollingMsg = `
Expand Down Expand Up @@ -43,15 +44,15 @@ class TemplateGenerator extends React.Component {
}

render() {
const { polling, dataUrl, generatingError } = this.props;
const { polling, dataUrl, pollReportData, generatingError } = this.props;

if (!dataUrl && !polling) return null;

return (
<React.Fragment>
{this.renderAlert()}
{!polling && !generatingError && (
<Button bsStyle="primary" href={dataUrl} target="_blank">
<Button bsStyle="primary" onClick={() => pollReportData(dataUrl)}>
{__('Download')}
</Button>
)}
Expand All @@ -65,6 +66,7 @@ TemplateGenerator.propTypes = {
templateName: PropTypes.string.isRequired,
}).isRequired,
polling: PropTypes.bool,
pollReportData: PropTypes.func,
dataUrl: PropTypes.string,
generatingError: PropTypes.string,
generatingErrorMessages: PropTypes.arrayOf(
Expand All @@ -74,6 +76,7 @@ TemplateGenerator.propTypes = {

TemplateGenerator.defaultProps = {
polling: false,
pollReportData: noop,
dataUrl: null,
generatingError: null,
generatingErrorMessages: null,
Expand Down
Expand Up @@ -22,8 +22,7 @@ exports[`TemplateGenerator rendering render button if not polling and no errors
bsClass="btn"
bsStyle="primary"
disabled={false}
href="/data/IDENTIFIER.json"
target="_blank"
onClick={[Function]}
>
Download
</Button>
Expand Down

0 comments on commit 570298b

Please sign in to comment.