chore(explore): make adhoc columns available without UX BETA ff (#17921)

* chore(explore): make adhoc columns available without UX BETA ff

* Remove redundant imports
This commit is contained in:
Kamil Gabryjelski
2022-02-04 14:01:16 +01:00
committed by GitHub
parent 55cd7fb412
commit 6cad7b1d05
2 changed files with 23 additions and 34 deletions

View File

@@ -59,7 +59,6 @@ interface ColumnSelectPopoverProps {
setLabel: (title: string) => void;
getCurrentTab: (tab: string) => void;
label: string;
isAdhocColumnsEnabled: boolean;
}
const getInitialColumnValues = (
@@ -85,7 +84,6 @@ const ColumnSelectPopover = ({
setLabel,
getCurrentTab,
label,
isAdhocColumnsEnabled,
}: ColumnSelectPopoverProps) => {
const [initialLabel] = useState(label);
const [initialAdhocColumn, initialCalculatedColumn, initialSimpleColumn] =
@@ -279,28 +277,27 @@ const ColumnSelectPopover = ({
/>
</FormItem>
</Tabs.TabPane>
{isAdhocColumnsEnabled && (
<Tabs.TabPane key="sqlExpression" tab={t('Custom SQL')}>
<SQLEditor
value={
adhocColumn?.sqlExpression ||
selectedSimpleColumn?.column_name ||
selectedCalculatedColumn?.expression
}
onFocus={onSqlEditorFocus}
showLoadingForImport
onChange={onSqlExpressionChange}
width="100%"
height={`${POPOVER_INITIAL_HEIGHT - 80}px`}
showGutter={false}
editorProps={{ $blockScrolling: true }}
enableLiveAutocompletion
className="filter-sql-editor"
wrapEnabled
ref={sqlEditorRef}
/>
</Tabs.TabPane>
)}
<Tabs.TabPane key="sqlExpression" tab={t('Custom SQL')}>
<SQLEditor
value={
adhocColumn?.sqlExpression ||
selectedSimpleColumn?.column_name ||
selectedCalculatedColumn?.expression
}
onFocus={onSqlEditorFocus}
showLoadingForImport
onChange={onSqlExpressionChange}
width="100%"
height={`${POPOVER_INITIAL_HEIGHT - 80}px`}
showGutter={false}
editorProps={{ $blockScrolling: true }}
enableLiveAutocompletion
className="filter-sql-editor"
wrapEnabled
ref={sqlEditorRef}
/>
</Tabs.TabPane>
</Tabs>
<div>
<Button buttonSize="small" onClick={onResetStateAndClose} cta>

View File

@@ -17,12 +17,7 @@
* under the License.
*/
import React, { useCallback, useEffect, useMemo, useState } from 'react';
import {
AdhocColumn,
FeatureFlag,
isFeatureEnabled,
t,
} from '@superset-ui/core';
import { AdhocColumn, t } from '@superset-ui/core';
import {
ColumnMeta,
isAdhocColumn,
@@ -47,8 +42,6 @@ interface ColumnSelectPopoverTriggerProps {
const defaultPopoverLabel = t('My column');
const editableTitleTab = 'sqlExpression';
const isAdhocColumnsEnabled = isFeatureEnabled(FeatureFlag.UX_BETA);
const ColumnSelectPopoverTrigger = ({
columns,
editedColumn,
@@ -109,7 +102,6 @@ const ColumnSelectPopoverTrigger = ({
label={popoverLabel}
setLabel={setPopoverLabel}
getCurrentTab={getCurrentTab}
isAdhocColumnsEnabled={isAdhocColumnsEnabled}
/>
</ExplorePopoverContent>
),
@@ -148,7 +140,7 @@ const ColumnSelectPopoverTrigger = ({
defaultVisible={visible}
visible={visible}
onVisibleChange={handleTogglePopover}
title={isAdhocColumnsEnabled && popoverTitle}
title={popoverTitle}
destroyTooltipOnHide
>
{children}