mirror of
https://github.com/apache/superset.git
synced 2026-05-11 10:55:43 +00:00
feat: expand new chart data endpoint coverage (#9903)
* feat: implement new chart API for additional components * Fix python tests * Fix tests * Fix lint * fix camel case error in requestParams * lint * fix samples row limit * Add samples row limit to config * remove unnecessary code * lint * Address review comments
This commit is contained in:
@@ -41,7 +41,7 @@ import { SupersetClient } from '@superset-ui/connection';
|
||||
|
||||
import getClientErrorObject from '../../utils/getClientErrorObject';
|
||||
import CopyToClipboard from './../../components/CopyToClipboard';
|
||||
import { getExploreUrl } from '../exploreUtils';
|
||||
import { getChartDataRequest } from '../../chart/chartAction';
|
||||
|
||||
import Loading from '../../components/Loading';
|
||||
import ModalTrigger from './../../components/ModalTrigger';
|
||||
@@ -87,33 +87,29 @@ export class DisplayQueryButton extends React.PureComponent {
|
||||
this.openPropertiesModal = this.openPropertiesModal.bind(this);
|
||||
this.closePropertiesModal = this.closePropertiesModal.bind(this);
|
||||
}
|
||||
beforeOpen(endpointType) {
|
||||
beforeOpen(resultType) {
|
||||
this.setState({ isLoading: true });
|
||||
const url = getExploreUrl({
|
||||
formData: this.props.latestQueryFormData,
|
||||
endpointType,
|
||||
});
|
||||
SupersetClient.post({
|
||||
url,
|
||||
postPayload: { form_data: this.props.latestQueryFormData },
|
||||
})
|
||||
.then(({ json }) => {
|
||||
|
||||
getChartDataRequest(this.props.latestQueryFormData, 'json', resultType)
|
||||
.then(response => {
|
||||
// Currently displaying of only first query is supported
|
||||
const result = response.result[0];
|
||||
this.setState({
|
||||
language: json.language,
|
||||
query: json.query,
|
||||
data: json.data,
|
||||
language: result.language,
|
||||
query: result.query,
|
||||
data: result.data,
|
||||
isLoading: false,
|
||||
error: null,
|
||||
});
|
||||
})
|
||||
.catch(response =>
|
||||
.catch(response => {
|
||||
getClientErrorObject(response).then(({ error, statusText }) => {
|
||||
this.setState({
|
||||
error: error || statusText || t('Sorry, An error occurred'),
|
||||
isLoading: false,
|
||||
});
|
||||
}),
|
||||
);
|
||||
});
|
||||
});
|
||||
}
|
||||
changeFilterText(event) {
|
||||
this.setState({ filterText: event.target.value });
|
||||
|
||||
@@ -48,7 +48,7 @@ export default function ExploreActionButtons({
|
||||
'disabled disabledButton': !canDownload,
|
||||
});
|
||||
const doExportCSV = exportChart.bind(this, latestQueryFormData, 'csv');
|
||||
const doExportChart = exportChart.bind(this, latestQueryFormData, 'json');
|
||||
const doExportChart = exportChart.bind(this, latestQueryFormData, 'results');
|
||||
|
||||
return (
|
||||
<div className="btn-group results" role="group">
|
||||
|
||||
Reference in New Issue
Block a user