mirror of https://github.com/apache/superset.git
[explore] allow URL shortner even if no slice exist (#4457)
recent regression perhaps from the PR that moved to using POST .
This commit is contained in:
parent
a373db24f0
commit
0eecec10cd
|
@ -9,27 +9,28 @@ import { exportChart } from '../exploreUtils';
|
|||
|
||||
const propTypes = {
|
||||
canDownload: PropTypes.oneOfType([PropTypes.string, PropTypes.bool]).isRequired,
|
||||
slice: PropTypes.object,
|
||||
chartStatus: PropTypes.string,
|
||||
latestQueryFormData: PropTypes.object,
|
||||
queryResponse: PropTypes.object,
|
||||
};
|
||||
|
||||
export default function ExploreActionButtons({
|
||||
canDownload, slice, chartStatus, latestQueryFormData, queryResponse }) {
|
||||
canDownload, chartStatus, latestQueryFormData, queryResponse }) {
|
||||
const exportToCSVClasses = cx('btn btn-default btn-sm', {
|
||||
'disabled disabledButton': !canDownload,
|
||||
});
|
||||
const doExportCSV = exportChart.bind(this, latestQueryFormData, 'csv');
|
||||
const doExportChart = exportChart.bind(this, latestQueryFormData, 'json');
|
||||
|
||||
if (slice) {
|
||||
return (
|
||||
<div className="btn-group results" role="group">
|
||||
<URLShortLinkButton latestQueryFormData={latestQueryFormData} />
|
||||
return (
|
||||
<div className="btn-group results" role="group">
|
||||
{latestQueryFormData &&
|
||||
<URLShortLinkButton latestQueryFormData={latestQueryFormData} />}
|
||||
|
||||
<EmbedCodeButton latestQueryFormData={latestQueryFormData} />
|
||||
{latestQueryFormData &&
|
||||
<EmbedCodeButton latestQueryFormData={latestQueryFormData} />}
|
||||
|
||||
{latestQueryFormData &&
|
||||
<a
|
||||
onClick={doExportChart}
|
||||
className="btn btn-default btn-sm"
|
||||
|
@ -38,8 +39,8 @@ export default function ExploreActionButtons({
|
|||
rel="noopener noreferrer"
|
||||
>
|
||||
<i className="fa fa-file-code-o" /> .json
|
||||
</a>
|
||||
|
||||
</a>}
|
||||
{latestQueryFormData &&
|
||||
<a
|
||||
onClick={doExportCSV}
|
||||
className={exportToCSVClasses}
|
||||
|
@ -48,18 +49,13 @@ export default function ExploreActionButtons({
|
|||
rel="noopener noreferrer"
|
||||
>
|
||||
<i className="fa fa-file-text-o" /> .csv
|
||||
</a>
|
||||
|
||||
<DisplayQueryButton
|
||||
queryResponse={queryResponse}
|
||||
latestQueryFormData={latestQueryFormData}
|
||||
chartStatus={chartStatus}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
return (
|
||||
<DisplayQueryButton latestQueryFormData={latestQueryFormData} />
|
||||
</a>}
|
||||
<DisplayQueryButton
|
||||
queryResponse={queryResponse}
|
||||
latestQueryFormData={latestQueryFormData}
|
||||
chartStatus={chartStatus}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -8,12 +8,7 @@ import ExploreActionButtons from
|
|||
describe('ExploreActionButtons', () => {
|
||||
const defaultProps = {
|
||||
canDownload: 'True',
|
||||
slice: {
|
||||
data: {
|
||||
csv_endpoint: '',
|
||||
json_endpoint: '',
|
||||
},
|
||||
},
|
||||
latestQueryFormData: {},
|
||||
queryEndpoint: 'localhost',
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue