[Metrics UI] Fix all threshold alert conditions disappearing due to alert prefill (#73708)
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
This commit is contained in:
parent
d3f498af9a
commit
5fa162c699
|
@ -185,7 +185,7 @@ export const Expressions: React.FC<Props> = (props) => {
|
||||||
|
|
||||||
const preFillAlertCriteria = useCallback(() => {
|
const preFillAlertCriteria = useCallback(() => {
|
||||||
const md = alertsContext.metadata;
|
const md = alertsContext.metadata;
|
||||||
if (md && md.currentOptions?.metrics) {
|
if (md?.currentOptions?.metrics?.length) {
|
||||||
setAlertParams(
|
setAlertParams(
|
||||||
'criteria',
|
'criteria',
|
||||||
md.currentOptions.metrics.map((metric) => ({
|
md.currentOptions.metrics.map((metric) => ({
|
||||||
|
@ -249,7 +249,7 @@ export const Expressions: React.FC<Props> = (props) => {
|
||||||
if (!alertParams.sourceId) {
|
if (!alertParams.sourceId) {
|
||||||
setAlertParams('sourceId', source?.id || 'default');
|
setAlertParams('sourceId', source?.id || 'default');
|
||||||
}
|
}
|
||||||
}, [alertsContext.metadata, defaultExpression, source]); // eslint-disable-line react-hooks/exhaustive-deps
|
}, [alertsContext.metadata, source]); // eslint-disable-line react-hooks/exhaustive-deps
|
||||||
|
|
||||||
const handleFieldSearchChange = useCallback(
|
const handleFieldSearchChange = useCallback(
|
||||||
(e: ChangeEvent<HTMLInputElement>) => onFilterChange(e.target.value),
|
(e: ChangeEvent<HTMLInputElement>) => onFilterChange(e.target.value),
|
||||||
|
|
Loading…
Reference in a new issue