diff --git a/src/QueryEditor.tsx b/src/QueryEditor.tsx index e222d22..364cbc7 100644 --- a/src/QueryEditor.tsx +++ b/src/QueryEditor.tsx @@ -28,7 +28,15 @@ export class QueryEditor extends PureComponent { children?: React.ReactNode; }> ) { - if ( + this.props.query.queryType = 'query'; + if (this.props.app && this.props.app === CoreApp.UnifiedAlerting) { + this.props.query.queryType = 'alert'; + } + + const { onChange, query } = this.props; + onChange({ ...query, queryType: props.query.queryType }); + + if (( props.query.keyspace && props.query.keyspace !== '' && props.query.table && @@ -41,7 +49,8 @@ export class QueryEditor extends PureComponent { props.query.columnId !== '' && props.query.valueId && props.query.valueId !== '' - ) { + ) || (props.query.target && props.query.target !== '')) + { this.props.onRunQuery(); } } @@ -149,11 +158,6 @@ export class QueryEditor extends PureComponent { render() { const options = this.props; - this.props.query.queryType = 'query'; - if (this.props.app !== undefined && this.props.app === CoreApp.UnifiedAlerting) { - this.props.query.queryType = 'alert'; - } - return (
{options.query.rawQuery && ( @@ -168,7 +172,9 @@ export class QueryEditor extends PureComponent {