john-bodley commented on a change in pull request #17202:
URL: https://github.com/apache/superset/pull/17202#discussion_r734816035
##########
File path:
superset-frontend/src/explore/components/controls/MetricControl/AdhocMetricEditPopover/index.jsx
##########
@@ -370,58 +378,57 @@ export default class AdhocMetricEditPopover extends
React.PureComponent {
/>
</FormItem>
</Tabs.TabPane>
- <Tabs.TabPane key={EXPRESSION_TYPES.SIMPLE} tab={t('Simple')}>
- <FormItem label={t('column')}>
- <Select
- options={columns.map(column => ({
- value: column.column_name,
- label: column.verbose_name || column.column_name,
- key: column.id,
- customLabel: this.renderColumnOption(column),
- }))}
- {...columnSelectProps}
- />
- </FormItem>
- <FormItem label={t('aggregate')}>
- <Select
- options={AGGREGATES_OPTIONS.map(option => ({
- value: option,
- label: option,
- key: option,
- }))}
- {...aggregateSelectProps}
- />
- </FormItem>
- </Tabs.TabPane>
- <Tabs.TabPane
- key={EXPRESSION_TYPES.SQL}
- tab={t('Custom SQL')}
- data-test="adhoc-metric-edit-tab#custom"
- >
- {this.props.datasourceType !== 'druid' ? (
- <SQLEditor
- data-test="sql-editor"
- showLoadingForImport
- ref={this.handleAceEditorRef}
- keywords={keywords}
- height={`${this.state.height - 80}px`}
- onChange={this.onSqlExpressionChange}
- width="100%"
- showGutter={false}
- value={
- adhocMetric.sqlExpression || adhocMetric.translateToSql()
- }
- editorProps={{ $blockScrolling: true }}
- enableLiveAutocompletion
- className="filter-sql-editor"
- wrapEnabled
- />
- ) : (
- <div className="custom-sql-disabled-message">
- Custom SQL Metrics are not available on druid datasources
- </div>
+ {extra.disallow_adhoc_metrics !== true && (
+ <Tabs.TabPane key={EXPRESSION_TYPES.SIMPLE} tab={t('Simple')}>
Review comment:
Either way works, though I feel we need consistency with the ad-hoc
filters.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]