Skip to content

Commit

Permalink
chore(explore): make adhoc columns available without UX BETA ff (apac…
Browse files Browse the repository at this point in the history
…he#17921)

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

* Remove redundant imports
  • Loading branch information
kgabryje authored and shcoderAlex committed Feb 7, 2022
1 parent e3952b4 commit 7caac2d
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 34 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ interface ColumnSelectPopoverProps {
setLabel: (title: string) => void;
getCurrentTab: (tab: string) => void;
label: string;
isAdhocColumnsEnabled: boolean;
}

const getInitialColumnValues = (
Expand All @@ -85,7 +84,6 @@ const ColumnSelectPopover = ({
setLabel,
getCurrentTab,
label,
isAdhocColumnsEnabled,
}: ColumnSelectPopoverProps) => {
const [initialLabel] = useState(label);
const [initialAdhocColumn, initialCalculatedColumn, initialSimpleColumn] =
Expand Down Expand Up @@ -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>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -47,8 +42,6 @@ interface ColumnSelectPopoverTriggerProps {
const defaultPopoverLabel = t('My column');
const editableTitleTab = 'sqlExpression';

const isAdhocColumnsEnabled = isFeatureEnabled(FeatureFlag.UX_BETA);

const ColumnSelectPopoverTrigger = ({
columns,
editedColumn,
Expand Down Expand Up @@ -109,7 +102,6 @@ const ColumnSelectPopoverTrigger = ({
label={popoverLabel}
setLabel={setPopoverLabel}
getCurrentTab={getCurrentTab}
isAdhocColumnsEnabled={isAdhocColumnsEnabled}
/>
</ExplorePopoverContent>
),
Expand Down Expand Up @@ -148,7 +140,7 @@ const ColumnSelectPopoverTrigger = ({
defaultVisible={visible}
visible={visible}
onVisibleChange={handleTogglePopover}
title={isAdhocColumnsEnabled && popoverTitle}
title={popoverTitle}
destroyTooltipOnHide
>
{children}
Expand Down

0 comments on commit 7caac2d

Please sign in to comment.