Skip to content

Commit

Permalink
[Explore][Adhoc Metrics/ Filters] disabled message for custom sql tab…
Browse files Browse the repository at this point in the history
… in druid (apache#5162)

* added disabled message for custom sql tab on druid datasources

* Update AdhocFilterEditPopover.jsx

Fixing indentation.

* Update AdhocMetricEditPopover.jsx

Fixing indent.

* Update AdhocFilterEditPopover.jsx

Fixing indentation.

* Update AdhocMetricEditPopover.jsx

Fixing indentation.
  • Loading branch information
Gabe Lyons authored and john-bodley committed Jun 7, 2018
1 parent 1b4406d commit b53b240
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 36 deletions.
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;
}

0 comments on commit b53b240

Please sign in to comment.