Skip to content

Commit

Permalink
Address review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
villebro committed Jun 2, 2020
1 parent 7db93f2 commit 4e48e6f
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 17 deletions.
33 changes: 16 additions & 17 deletions superset-frontend/src/chart/chartAction.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,12 +107,6 @@ const shouldUseLegacyApi = formData => {
return useLegacyApi || false;
};

const getClientMethod = method => {
return method === 'GET' && isFeatureEnabled(FeatureFlag.CLIENT_CACHE)
? SupersetClient.get
: SupersetClient.post;
};

const legacyChartDataRequest = async (
formData,
resultFormat,
Expand Down Expand Up @@ -142,7 +136,10 @@ const legacyChartDataRequest = async (
postPayload: { form_data: formData },
};

const clientMethod = getClientMethod(method);
const clientMethod =
'GET' && isFeatureEnabled(FeatureFlag.CLIENT_CACHE)
? SupersetClient.get
: SupersetClient.post;
return clientMethod(querySettings).then(({ json }) => {
// Make the legacy endpoint return a payload that corresponds to the
// V1 chart data endpoint response signature.
Expand All @@ -157,7 +154,6 @@ const v1ChartDataRequest = async (
resultFormat,
resultType,
force,
method,
requestParams,
) => {
const buildQuery = await getChartBuildQueryRegistry().get(formData.viz_type);
Expand All @@ -174,8 +170,7 @@ const v1ChartDataRequest = async (
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(payload),
};
const clientMethod = getClientMethod(method);
return clientMethod(querySettings).then(({ json }) => {
return SupersetClient.post(querySettings).then(({ json }) => {
return json;
});
};
Expand All @@ -200,16 +195,21 @@ export async function getChartDataRequest(
};
}

const chartDataRequest = shouldUseLegacyApi(formData)
? legacyChartDataRequest
: v1ChartDataRequest;

return chartDataRequest(
if (shouldUseLegacyApi(formData)) {
return legacyChartDataRequest(
formData,
resultFormat,
resultType,
force,
method,
querySettings,
);
}
return v1ChartDataRequest(
formData,
resultFormat,
resultType,
force,
method,
querySettings,
);
}
Expand Down Expand Up @@ -352,7 +352,6 @@ export function exploreJSON(
.then(response => {
// new API returns an object with an array of restults
// problem: response holds a list of results, when before we were just getting one result.
// `queryResponse` state is used all over the place.
// How to make the entire app compatible with multiple results?
// For now just use the first result.
const result = response.result[0];
Expand Down
1 change: 1 addition & 0 deletions superset/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ def _try_json_readsha(filepath, length): # pylint: disable=unused-argument

ROW_LIMIT = 50000
VIZ_ROW_LIMIT = 10000
# max rows retreieved when requesting samples from datasource in explore view
SAMPLES_ROW_LIMIT = 1000
# max rows retrieved by filter select auto complete
FILTER_SELECT_ROW_LIMIT = 10000
Expand Down

0 comments on commit 4e48e6f

Please sign in to comment.