mirror of
https://github.com/apache/superset.git
synced 2026-04-19 08:04:53 +00:00
feat(filter-box): hide druid options if druid not enabled (#14921)
* feat(filter-box): hide druid options if druid not enabled * add bootstrap export
This commit is contained in:
@@ -20,6 +20,36 @@ import React from 'react';
|
||||
import { t } from '@superset-ui/core';
|
||||
import { sections } from '@superset-ui/chart-controls';
|
||||
|
||||
const appContainer = document.getElementById('app');
|
||||
const bootstrapData = JSON.parse(appContainer.getAttribute('data-bootstrap'));
|
||||
const druidIsActive = !!bootstrapData?.common?.conf?.DRUID_IS_ACTIVE;
|
||||
const druidSection = druidIsActive
|
||||
? [
|
||||
[
|
||||
{
|
||||
name: 'show_druid_time_granularity',
|
||||
config: {
|
||||
type: 'CheckboxControl',
|
||||
label: t('Show Druid granularity dropdown'),
|
||||
default: false,
|
||||
description: t('Check to include Druid granularity dropdown'),
|
||||
},
|
||||
},
|
||||
],
|
||||
[
|
||||
{
|
||||
name: 'show_druid_time_origin',
|
||||
config: {
|
||||
type: 'CheckboxControl',
|
||||
label: t('Show Druid time origin'),
|
||||
default: false,
|
||||
description: t('Check to include time origin dropdown'),
|
||||
},
|
||||
},
|
||||
],
|
||||
]
|
||||
: [];
|
||||
|
||||
export default {
|
||||
controlPanelSections: [
|
||||
sections.legacyTimeseriesTime,
|
||||
@@ -51,6 +81,8 @@ export default {
|
||||
description: t('Whether to include a time filter'),
|
||||
},
|
||||
},
|
||||
],
|
||||
[
|
||||
{
|
||||
name: 'instant_filtering',
|
||||
config: {
|
||||
@@ -69,41 +101,30 @@ export default {
|
||||
name: 'show_sqla_time_granularity',
|
||||
config: {
|
||||
type: 'CheckboxControl',
|
||||
label: t('Show SQL granularity dropdown'),
|
||||
label: druidIsActive
|
||||
? t('Show SQL time grain dropdown')
|
||||
: t('Show time grain dropdown'),
|
||||
default: false,
|
||||
description: t('Check to include SQL granularity dropdown'),
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'show_sqla_time_column',
|
||||
config: {
|
||||
type: 'CheckboxControl',
|
||||
label: t('Show SQL time column'),
|
||||
default: false,
|
||||
description: t('Check to include time column dropdown'),
|
||||
description: druidIsActive
|
||||
? t('Check to include SQL time grain dropdown')
|
||||
: t('Check to include time grain dropdown'),
|
||||
},
|
||||
},
|
||||
],
|
||||
[
|
||||
{
|
||||
name: 'show_druid_time_granularity',
|
||||
name: 'show_sqla_time_column',
|
||||
config: {
|
||||
type: 'CheckboxControl',
|
||||
label: t('Show Druid granularity dropdown'),
|
||||
label: druidIsActive
|
||||
? t('Show SQL time column')
|
||||
: t('Show time column'),
|
||||
default: false,
|
||||
description: t('Check to include Druid granularity dropdown'),
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'show_druid_time_origin',
|
||||
config: {
|
||||
type: 'CheckboxControl',
|
||||
label: t('Show Druid time origin'),
|
||||
default: false,
|
||||
description: t('Check to include time origin dropdown'),
|
||||
description: t('Check to include time column dropdown'),
|
||||
},
|
||||
},
|
||||
],
|
||||
...druidSection,
|
||||
['adhoc_filters'],
|
||||
],
|
||||
},
|
||||
|
||||
@@ -87,6 +87,7 @@ FRONTEND_CONF_KEYS = (
|
||||
"SUPERSET_DASHBOARD_PERIODICAL_REFRESH_LIMIT",
|
||||
"SUPERSET_DASHBOARD_PERIODICAL_REFRESH_WARNING_MESSAGE",
|
||||
"DISABLE_DATASET_SOURCE_EDIT",
|
||||
"DRUID_IS_ACTIVE",
|
||||
"ENABLE_JAVASCRIPT_CONTROLS",
|
||||
"DEFAULT_SQLLAB_LIMIT",
|
||||
"DEFAULT_VIZ_TYPE",
|
||||
|
||||
Reference in New Issue
Block a user