|
|
@@ -2,7 +2,8 @@ import React, { PureComponent } from 'react';
|
|
|
|
|
|
import { QueryTransaction, HistoryItem, QueryHint } from 'app/types/explore';
|
|
|
|
|
|
-import DefaultQueryField from './QueryField';
|
|
|
+// import DefaultQueryField from './QueryField';
|
|
|
+import QueryEditor from './QueryEditor';
|
|
|
import QueryTransactionStatus from './QueryTransactionStatus';
|
|
|
import { DataSource, DataQuery } from 'app/types';
|
|
|
|
|
|
@@ -36,6 +37,11 @@ type QueryRowProps = QueryRowCommonProps &
|
|
|
};
|
|
|
|
|
|
class QueryRow extends PureComponent<QueryRowProps> {
|
|
|
+ onExecuteQuery = () => {
|
|
|
+ const { onExecuteQuery } = this.props;
|
|
|
+ onExecuteQuery();
|
|
|
+ };
|
|
|
+
|
|
|
onChangeQuery = (value: DataQuery, override?: boolean) => {
|
|
|
const { index, onChangeQuery } = this.props;
|
|
|
if (onChangeQuery) {
|
|
|
@@ -80,23 +86,40 @@ class QueryRow extends PureComponent<QueryRowProps> {
|
|
|
const transactionWithError = transactions.find(t => t.error !== undefined);
|
|
|
const hint = getFirstHintFromTransactions(transactions);
|
|
|
const queryError = transactionWithError ? transactionWithError.error : null;
|
|
|
- const QueryField = datasource.pluginExports.ExploreQueryField || DefaultQueryField;
|
|
|
+ // const QueryField = datasource.pluginExports.ExploreQueryField || DefaultQueryField;
|
|
|
+ const QueryField = datasource.pluginExports.ExploreQueryField;
|
|
|
+ // const QueryEditor = datasource.pluginExports.QueryCtrl;
|
|
|
return (
|
|
|
<div className="query-row">
|
|
|
<div className="query-row-status">
|
|
|
<QueryTransactionStatus transactions={transactions} />
|
|
|
</div>
|
|
|
<div className="query-row-field">
|
|
|
- <QueryField
|
|
|
- datasource={datasource}
|
|
|
- error={queryError}
|
|
|
- hint={hint}
|
|
|
- initialQuery={initialQuery}
|
|
|
- history={history}
|
|
|
- onClickHintFix={this.onClickHintFix}
|
|
|
- onPressEnter={this.onPressEnter}
|
|
|
- onQueryChange={this.onChangeQuery}
|
|
|
- />
|
|
|
+ {QueryField ? (
|
|
|
+ <QueryField
|
|
|
+ datasource={datasource}
|
|
|
+ error={queryError}
|
|
|
+ hint={hint}
|
|
|
+ initialQuery={initialQuery}
|
|
|
+ history={history}
|
|
|
+ onClickHintFix={this.onClickHintFix}
|
|
|
+ onPressEnter={this.onPressEnter}
|
|
|
+ onQueryChange={this.onChangeQuery}
|
|
|
+ />
|
|
|
+ ) : (
|
|
|
+ <QueryEditor
|
|
|
+ datasource={datasource}
|
|
|
+ error={queryError}
|
|
|
+ onQueryChange={this.onChangeQuery}
|
|
|
+ onExecuteQuery={this.onExecuteQuery}
|
|
|
+ // hint={hint}
|
|
|
+ // initialQuery={initialQuery}
|
|
|
+ // history={history}
|
|
|
+ // onClickHintFix={this.onClickHintFix}
|
|
|
+ // onPressEnter={this.onPressEnter}
|
|
|
+ // onQueryChange={this.onChangeQuery}
|
|
|
+ />
|
|
|
+ )}
|
|
|
</div>
|
|
|
<div className="query-row-tools">
|
|
|
<button className="btn navbar-button navbar-button--tight" onClick={this.onClickClearButton}>
|