feat: Configurable default row limit for native filters (#24043)

Co-authored-by: Calum Leslie <calum.leslie@skyscanner.net>
This commit is contained in:
cleslie 2023-06-12 22:47:58 +01:00 committed by GitHub
parent cd78ccb2c2
commit 6f25275d76
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 1 deletions

View File

@ -33,6 +33,14 @@ import extractUrlParams from 'src/dashboard/util/extractUrlParams';
import { isFeatureEnabled } from 'src/featureFlags';
import { CHART_TYPE, TAB_TYPE } from '../../util/componentTypes';
import { DASHBOARD_GRID_ID, DASHBOARD_ROOT_ID } from '../../util/constants';
import getBootstrapData from '../../../utils/getBootstrapData';
const getDefaultRowLimit = (): number => {
const bootstrapData = getBootstrapData();
const nativeFilterDefaultRowLimit =
bootstrapData?.common?.conf?.NATIVE_FILTER_DEFAULT_ROW_LIMIT;
return nativeFilterDefaultRowLimit || 1000;
};
export const getFormData = ({
datasetId,
@ -75,7 +83,7 @@ export const getFormData = ({
extra_form_data: dependencies,
granularity_sqla,
metrics: ['count'],
row_limit: 1000,
row_limit: getDefaultRowLimit(),
showSearch: true,
defaultValue: defaultDataMask?.filterState?.value,
time_range,

View File

@ -146,6 +146,8 @@ DEFAULT_VIZ_TYPE = "table"
ROW_LIMIT = 50000
# default row limit when requesting samples from datasource in explore view
SAMPLES_ROW_LIMIT = 1000
# default row limit for native filters
NATIVE_FILTER_DEFAULT_ROW_LIMIT = 1000
# max rows retrieved by filter select auto complete
FILTER_SELECT_ROW_LIMIT = 10000
# default time filter in explore

View File

@ -120,6 +120,7 @@ FRONTEND_CONF_KEYS = (
"ALERT_REPORTS_DEFAULT_CRON_VALUE",
"ALERT_REPORTS_DEFAULT_RETENTION",
"ALERT_REPORTS_DEFAULT_WORKING_TIMEOUT",
"NATIVE_FILTER_DEFAULT_ROW_LIMIT",
)
logger = logging.getLogger(__name__)