diff --git a/public/app/core/components/QueryOperationRow/QueryOperationAction.tsx b/public/app/core/components/QueryOperationRow/QueryOperationAction.tsx index 350cce40669..59108217d67 100644 --- a/public/app/core/components/QueryOperationRow/QueryOperationAction.tsx +++ b/public/app/core/components/QueryOperationRow/QueryOperationAction.tsx @@ -28,6 +28,7 @@ export const QueryOperationAction: React.FC = ({ icon disabled={!!disabled} onClick={onClick} surface="header" + type="button" aria-label={selectors.components.QueryEditorRow.actionButton(title)} /> ); diff --git a/public/app/features/alerting/components/AlertingQueryRows.tsx b/public/app/features/alerting/components/AlertingQueryRows.tsx index c092ea35072..3372673892c 100644 --- a/public/app/features/alerting/components/AlertingQueryRows.tsx +++ b/public/app/features/alerting/components/AlertingQueryRows.tsx @@ -28,7 +28,11 @@ export class AlertingQueryRows extends PureComponent { } onRemoveQuery = (query: DataQuery) => { - this.props.onQueriesChange(this.props.queries.filter((item) => item.model !== query)); + this.props.onQueriesChange( + this.props.queries.filter((item) => { + return item.model.refId !== query.refId; + }) + ); }; onChangeTimeRange = (timeRange: RelativeTimeRange, index: number) => { diff --git a/public/app/features/alerting/components/AlertingQueryWrapper.tsx b/public/app/features/alerting/components/AlertingQueryWrapper.tsx index eefef84b066..9add49978b6 100644 --- a/public/app/features/alerting/components/AlertingQueryWrapper.tsx +++ b/public/app/features/alerting/components/AlertingQueryWrapper.tsx @@ -13,6 +13,7 @@ import { QueryEditorRow } from '../../query/components/QueryEditorRow'; import { VizWrapper } from '../unified/components/rule-editor/VizWrapper'; import { isExpressionQuery } from '../../expressions/guards'; import { GrafanaQuery } from 'app/types/unified-alerting-dto'; +import { cloneDeep } from 'lodash'; interface Props { data: PanelData; @@ -66,7 +67,7 @@ export const AlertingQueryWrapper: FC = ({ index={index} key={query.refId} data={data} - query={query.model} + query={cloneDeep(query.model)} onChange={(query) => onChangeQuery(query, index)} onRemoveQuery={onRemoveQuery} onAddQuery={onDuplicateQuery}