diff --git a/docs/static/resources/openapi.json b/docs/static/resources/openapi.json index bb9608749ff08..4eb0cc7c48660 100644 --- a/docs/static/resources/openapi.json +++ b/docs/static/resources/openapi.json @@ -3205,6 +3205,12 @@ "owners": { "$ref": "#/components/schemas/DashboardRestApi.get_list.User2" }, + "advanced_data_type": { + "maxLength": 255, + "minLength": 1, + "nullable": true, + "type": "string" + }, "position_json": { "nullable": true, "type": "string" @@ -4245,6 +4251,12 @@ "nullable": true, "type": "string" }, + "advanced_data_type": { + "maxLength": 255, + "minLength": 1, + "nullable": true, + "type": "string" + }, "uuid": { "format": "uuid", "nullable": true, diff --git a/superset-frontend/packages/superset-ui-core/src/utils/featureFlags.ts b/superset-frontend/packages/superset-ui-core/src/utils/featureFlags.ts index 03d44078344f7..422f88f8f10c0 100644 --- a/superset-frontend/packages/superset-ui-core/src/utils/featureFlags.ts +++ b/superset-frontend/packages/superset-ui-core/src/utils/featureFlags.ts @@ -23,6 +23,7 @@ export enum FeatureFlag { ALERT_REPORTS = 'ALERT_REPORTS', CLIENT_CACHE = 'CLIENT_CACHE', DYNAMIC_PLUGINS = 'DYNAMIC_PLUGINS', + ENABLE_ADVANCED_DATA_TYPES = 'ENABLE_ADVANCED_DATA_TYPES', SCHEDULED_QUERIES = 'SCHEDULED_QUERIES', SQL_VALIDATORS_BY_ENGINE = 'SQL_VALIDATORS_BY_ENGINE', ESTIMATE_QUERY_COST = 'ESTIMATE_QUERY_COST', diff --git a/superset-frontend/src/components/Datasource/DatasourceEditor.jsx b/superset-frontend/src/components/Datasource/DatasourceEditor.jsx index 8ba4652980a1f..afa47ea80b984 100644 --- a/superset-frontend/src/components/Datasource/DatasourceEditor.jsx +++ b/superset-frontend/src/components/Datasource/DatasourceEditor.jsx @@ -173,22 +173,46 @@ function ColumnCollectionTable({ return ( )} + {isFeatureEnabled(FeatureFlag.ENABLE_ADVANCED_DATA_TYPES) ? ( + + } + /> + ) : ( + <> + )} } - columnLabels={{ - column_name: t('Column'), - type: t('Data type'), - groupby: t('Is dimension'), - is_dttm: t('Is temporal'), - main_dttm_col: t('Default datetime'), - filterable: t('Is filterable'), - }} + columnLabels={ + isFeatureEnabled(FeatureFlag.ENABLE_ADVANCED_DATA_TYPES) + ? { + column_name: t('Column'), + advanced_data_type: t('Advanced data type'), + type: t('Data type'), + groupby: t('Is dimension'), + is_dttm: t('Is temporal'), + main_dttm_col: t('Default datetime'), + filterable: t('Is filterable'), + } + : { + column_name: t('Column'), + type: t('Data type'), + groupby: t('Is dimension'), + is_dttm: t('Is temporal'), + main_dttm_col: t('Default datetime'), + filterable: t('Is filterable'), + } + } onChange={onColumnsChange} - itemRenderers={{ - column_name: (v, onItemChange, _, record) => - editableColumnName ? ( - - {record.is_certified && ( - - )} - - - ) : ( - - {record.is_certified && ( - - )} - {v} - - ), - main_dttm_col: (value, _onItemChange, _label, record) => { - const checked = datasource.main_dttm_col === record.column_name; - const disabled = !columns.find( - column => column.column_name === record.column_name, - ).is_dttm; - return ( - - onDatasourceChange({ - ...datasource, - main_dttm_col: record.column_name, - }) - } - /> - ); - }, - type: d => (d ? : null), - is_dttm: checkboxGenerator, - filterable: checkboxGenerator, - groupby: checkboxGenerator, - }} + itemRenderers={ + isFeatureEnabled(FeatureFlag.ENABLE_ADVANCED_DATA_TYPES) + ? { + column_name: (v, onItemChange, _, record) => + editableColumnName ? ( + + {record.is_certified && ( + + )} + + + ) : ( + + {record.is_certified && ( + + )} + {v} + + ), + main_dttm_col: (value, _onItemChange, _label, record) => { + const checked = datasource.main_dttm_col === record.column_name; + const disabled = !columns.find( + column => column.column_name === record.column_name, + ).is_dttm; + return ( + + onDatasourceChange({ + ...datasource, + main_dttm_col: record.column_name, + }) + } + /> + ); + }, + type: d => (d ? : null), + advanced_data_type: d => ( + + ), + is_dttm: checkboxGenerator, + filterable: checkboxGenerator, + groupby: checkboxGenerator, + } + : { + column_name: (v, onItemChange, _, record) => + editableColumnName ? ( + + {record.is_certified && ( + + )} + + + ) : ( + + {record.is_certified && ( + + )} + {v} + + ), + main_dttm_col: (value, _onItemChange, _label, record) => { + const checked = datasource.main_dttm_col === record.column_name; + const disabled = !columns.find( + column => column.column_name === record.column_name, + ).is_dttm; + return ( + + onDatasourceChange({ + ...datasource, + main_dttm_col: record.column_name, + }) + } + /> + ); + }, + type: d => (d ? : null), + is_dttm: checkboxGenerator, + filterable: checkboxGenerator, + groupby: checkboxGenerator, + } + } /> ); } diff --git a/superset-frontend/src/explore/components/controls/FilterControl/AdhocFilterEditPopover/index.jsx b/superset-frontend/src/explore/components/controls/FilterControl/AdhocFilterEditPopover/index.jsx index 1fa42eb6db5ca..8ae706fc54de5 100644 --- a/superset-frontend/src/explore/components/controls/FilterControl/AdhocFilterEditPopover/index.jsx +++ b/superset-frontend/src/explore/components/controls/FilterControl/AdhocFilterEditPopover/index.jsx @@ -98,6 +98,7 @@ export default class AdhocFilterEditPopover extends React.Component { this.onMouseMove = this.onMouseMove.bind(this); this.onMouseUp = this.onMouseUp.bind(this); this.onAdhocFilterChange = this.onAdhocFilterChange.bind(this); + this.setSimpleTabIsValid = this.setSimpleTabIsValid.bind(this); this.adjustHeight = this.adjustHeight.bind(this); this.onTabChange = this.onTabChange.bind(this); @@ -106,6 +107,7 @@ export default class AdhocFilterEditPopover extends React.Component { width: POPOVER_INITIAL_WIDTH, height: POPOVER_INITIAL_HEIGHT, activeKey: this.props?.adhocFilter?.expressionType || 'SIMPLE', + isSimpleTabValid: true, }; this.popoverContentRef = React.createRef(); @@ -124,6 +126,10 @@ export default class AdhocFilterEditPopover extends React.Component { this.setState({ adhocFilter }); } + setSimpleTabIsValid(isValid) { + this.setState({ isSimpleTabValid: isValid }); + } + onSave() { this.props.onChange(this.state.adhocFilter); this.props.onClose(); @@ -214,6 +220,7 @@ export default class AdhocFilterEditPopover extends React.Component { onHeightChange={this.adjustHeight} partitionColumn={partitionColumn} popoverRef={this.popoverContentRef.current} + validHandler={this.setSimpleTabIsValid} /> @@ -252,7 +259,7 @@ export default class AdhocFilterEditPopover extends React.Component {