@ -4,7 +4,7 @@ import React, { FC, useCallback, useState } from 'react';
import { useFormContext } from 'react-hook-form' ;
import { DataFrame , dateTimeFormat , GrafanaTheme2 , isTimeSeriesFrames , LoadingState , PanelData } from '@grafana/data' ;
import { AutoSizeInput , Button , clearButtonStyles , IconButton , Stack , useStyles2 } from '@grafana/ui' ;
import { Alert , A utoSizeInput , Button , clearButtonStyles , IconButton , Stack , useStyles2 } from '@grafana/ui' ;
import { ClassicConditions } from 'app/features/expressions/components/ClassicConditions' ;
import { Math } from 'app/features/expressions/components/Math' ;
import { Reduce } from 'app/features/expressions/components/Reduce' ;
@ -136,12 +136,20 @@ export const Expression: FC<ExpressionProps> = ({
onUpdateRefId = { ( newRefId ) = > onUpdateRefId ( query . refId , newRefId ) }
onUpdateExpressionType = { ( type ) = > onUpdateExpressionType ( query . refId , type ) }
onSetCondition = { onSetCondition }
warning = { warning }
error = { error }
query = { query }
alertCondition = { alertCondition }
/ >
< div className = { styles . expression . body } >
{ error && (
< Alert title = "Expression failed" severity = "error" >
{ error . message }
< / Alert >
) }
{ warning && (
< Alert title = "Expression warning" severity = "warning" >
{ warning . message }
< / Alert >
) }
< div className = { styles . expression . description } > { selectedExpressionDescription } < / div >
{ renderExpressionType ( query ) }
< / div >
@ -275,8 +283,6 @@ interface HeaderProps {
onUpdateRefId : ( refId : string ) = > void ;
onRemoveExpression : ( ) = > void ;
onUpdateExpressionType : ( type : ExpressionQueryType ) = > void ;
warning? : Error ;
error? : Error ;
onSetCondition : ( refId : string ) = > void ;
query : ExpressionQuery ;
alertCondition : boolean ;
@ -287,11 +293,9 @@ const Header: FC<HeaderProps> = ({
queryType ,
onUpdateRefId ,
onRemoveExpression ,
warning ,
onSetCondition ,
alertCondition ,
query ,
error ,
} ) = > {
const styles = useStyles2 ( getStyles ) ;
const clearButton = useStyles2 ( clearButtonStyles ) ;
@ -335,12 +339,7 @@ const Header: FC<HeaderProps> = ({
< div > { getExpressionLabel ( queryType ) } < / div >
< / Stack >
< Spacer / >
< ExpressionStatusIndicator
error = { error }
warning = { warning }
onSetCondition = { ( ) = > onSetCondition ( query . refId ) }
isCondition = { alertCondition }
/ >
< ExpressionStatusIndicator onSetCondition = { ( ) = > onSetCondition ( query . refId ) } isCondition = { alertCondition } / >
< IconButton
name = "trash-alt"
variant = "secondary"