Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Explore][Adhoc Metrics/ Filters] disabled message for custom sql tab in druid #5162

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 18 additions & 15 deletions superset/assets/src/explore/components/AdhocFilterEditPopover.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -123,21 +123,24 @@ export default class AdhocFilterEditPopover extends React.Component {
onHeightChange={this.adjustHeight}
/>
</Tab>
{
(!this.props.datasource || this.props.datasource.type !== 'druid') &&
<Tab
className="adhoc-filter-edit-tab"
eventKey={EXPRESSION_TYPES.SQL}
title="Custom SQL"
>
<AdhocFilterEditPopoverSqlTabContent
adhocFilter={this.state.adhocFilter}
onChange={this.onAdhocFilterChange}
options={this.props.options}
height={this.state.height}
/>
</Tab>
}
<Tab
className="adhoc-filter-edit-tab"
eventKey={EXPRESSION_TYPES.SQL}
title="Custom SQL"
>
{
(!this.props.datasource || this.props.datasource.type !== 'druid') ?
<AdhocFilterEditPopoverSqlTabContent
adhocFilter={this.state.adhocFilter}
onChange={this.onAdhocFilterChange}
options={this.props.options}
height={this.state.height}
/> :
<div className="custom-sql-disabled-message">
Custom SQL Filters are not available on druid datasources
</div>
}
</Tab>
</Tabs>
<div>
<Button
Expand Down
45 changes: 24 additions & 21 deletions superset/assets/src/explore/components/AdhocMetricEditPopover.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -225,27 +225,30 @@ export default class AdhocMetricEditPopover extends React.Component {
<OnPasteSelect {...this.selectProps} {...aggregateSelectProps} />
</FormGroup>
</Tab>
{
this.props.datasourceType !== 'druid' &&
<Tab className="adhoc-metric-edit-tab" eventKey={EXPRESSION_TYPES.SQL} title="Custom SQL">
<FormGroup>
<AceEditor
ref={this.handleAceEditorRef}
mode="sql"
theme="github"
height={(this.state.height - 43) + 'px'}
onChange={this.onSqlExpressionChange}
width="100%"
showGutter={false}
value={adhocMetric.sqlExpression || adhocMetric.translateToSql()}
editorProps={{ $blockScrolling: true }}
enableLiveAutocompletion
className="adhoc-filter-sql-editor"
wrapEnabled
/>
</FormGroup>
</Tab>
}
<Tab className="adhoc-metric-edit-tab" eventKey={EXPRESSION_TYPES.SQL} title="Custom SQL">
{
this.props.datasourceType !== 'druid' ?
<FormGroup>
<AceEditor
ref={this.handleAceEditorRef}
mode="sql"
theme="github"
height={(this.state.height - 43) + 'px'}
onChange={this.onSqlExpressionChange}
width="100%"
showGutter={false}
value={adhocMetric.sqlExpression || adhocMetric.translateToSql()}
editorProps={{ $blockScrolling: true }}
enableLiveAutocompletion
className="adhoc-filter-sql-editor"
wrapEnabled
/>
</FormGroup> :
<div className="custom-sql-disabled-message">
Custom SQL Metrics are not available on druid datasources
</div>
}
</Tab>
</Tabs>
<div>
<Button
Expand Down
7 changes: 7 additions & 0 deletions superset/assets/src/explore/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -210,3 +210,10 @@
margin-left: 3px;
position: static;
}

.custom-sql-disabled-message {
color: gray;
font-size: 11px;
text-align: center;
margin-top: 60px;
}