fix: chart export fails when buildQuery not present (#10062)

This commit is contained in:
Ville Brofeldt 2020-06-16 19:25:10 +03:00 committed by GitHub
parent 7504b1cf20
commit d3a9ce5afc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 12 additions and 6 deletions

View File

@ -198,7 +198,12 @@ export const shouldUseLegacyApi = formData => {
return useLegacyApi || false;
};
export const buildV1ChartDataPayload = ({ formData, force }) => {
export const buildV1ChartDataPayload = ({
formData,
force,
resultFormat,
resultType,
}) => {
const buildQuery =
getChartBuildQueryRegistry().get(formData.viz_type) ??
(buildQueryformData =>
@ -210,6 +215,8 @@ export const buildV1ChartDataPayload = ({ formData, force }) => {
return buildQuery({
...formData,
force,
result_format: resultFormat,
result_type: resultType,
});
};
@ -260,13 +267,12 @@ export const exportChart = ({
payload = formData;
} else {
url = '/api/v1/chart/data';
const buildQuery = getChartBuildQueryRegistry().get(formData.viz_type);
payload = buildQuery({
...formData,
payload = buildV1ChartDataPayload({
formData,
force,
resultFormat,
resultType,
});
payload.result_type = resultType;
payload.result_format = resultFormat;
}
postForm(url, payload);
};