Skip to content

Commit ea26c58

Browse files
committed
Fix action group ternary and jest test failure
1 parent e7ae38c commit ea26c58

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

x-pack/plugins/infra/public/alerting/inventory/components/expression.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -520,7 +520,7 @@ export const ExpressionRow: React.FC<ExpressionRowProps> = (props) => {
520520
threshold={threshold}
521521
updateComparator={updateComparator}
522522
updateThreshold={updateThreshold}
523-
errors={errors.critical as IErrorObject}
523+
errors={(errors.critical as IErrorObject) ?? {}}
524524
metric={metric}
525525
/>
526526
);
@@ -531,7 +531,7 @@ export const ExpressionRow: React.FC<ExpressionRowProps> = (props) => {
531531
threshold={warningThreshold}
532532
updateComparator={updateWarningComparator}
533533
updateThreshold={updateWarningThreshold}
534-
errors={errors.warning as IErrorObject}
534+
errors={(errors.warning as IErrorObject) ?? {}}
535535
metric={metric}
536536
/>
537537
);

x-pack/plugins/infra/public/alerting/metric_threshold/components/expression_row.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ export const ExpressionRow: React.FC<ExpressionRowProps> = (props) => {
186186
threshold={threshold}
187187
updateComparator={updateComparator}
188188
updateThreshold={updateThreshold}
189-
errors={errors.critical as IErrorObject}
189+
errors={(errors.critical as IErrorObject) ?? {}}
190190
isMetricPct={isMetricPct}
191191
/>
192192
);
@@ -197,7 +197,7 @@ export const ExpressionRow: React.FC<ExpressionRowProps> = (props) => {
197197
threshold={warningThreshold}
198198
updateComparator={updateWarningComparator}
199199
updateThreshold={updateWarningThreshold}
200-
errors={errors.warning as IErrorObject}
200+
errors={(errors.warning as IErrorObject) ?? {}}
201201
isMetricPct={isMetricPct}
202202
/>
203203
);

x-pack/plugins/infra/server/lib/alerting/inventory_metric_threshold/inventory_metric_threshold_executor.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ export const createInventoryMetricThresholdExecutor = (libs: InfraBackendLibs) =
136136
const actionGroupId =
137137
nextState === AlertStates.OK
138138
? RecoveredActionGroup.id
139-
: AlertStates.WARNING
139+
: nextState === AlertStates.WARNING
140140
? WARNING_ACTIONS.id
141141
: FIRED_ACTIONS.id;
142142
alertInstance.scheduleActions(

x-pack/plugins/infra/server/lib/alerting/metric_threshold/metric_threshold_executor.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ export const createMetricThresholdExecutor = (
114114
const actionGroupId =
115115
nextState === AlertStates.OK
116116
? RecoveredActionGroup.id
117-
: AlertStates.WARNING
117+
: nextState === AlertStates.WARNING
118118
? WARNING_ACTIONS.id
119119
: FIRED_ACTIONS.id;
120120
alertInstance.scheduleActions(actionGroupId, {

0 commit comments

Comments
 (0)