Skip to content

Commit

Permalink
memoize alert suppression label
Browse files Browse the repository at this point in the history
  • Loading branch information
maximpn committed Nov 9, 2024
1 parent f8b460f commit a745071
Showing 1 changed file with 12 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -498,6 +498,17 @@ const StepDefineRuleComponent: FC<StepDefineRuleProps> = ({
}
}, [esqlSuppressionFields, mlSuppressionFields, ruleType, termsAggregationFields]);

const alertSuppressionFieldsAppendText = useMemo(
() => (
<EuiText color="subdued" size="xs">
{isSuppressionRuleInGA(ruleType)
? i18n.ALERT_SUPPRESSION_FIELDS_GA_LABEL_APPEND
: i18n.ALERT_SUPPRESSION_FIELDS_TECH_PREVIEW_LABEL_APPEND}
</EuiText>
),
[ruleType]
);

const dataViewIndexPatternToggleButtonOptions: EuiButtonGroupOptionProps[] = useMemo(
() => [
{
Expand Down Expand Up @@ -938,13 +949,7 @@ const StepDefineRuleComponent: FC<StepDefineRuleProps> = ({
) : (
<AlertSuppressionEdit
suppressibleFields={suppressionGroupByFields}
labelAppend={
<EuiText color="subdued" size="xs">
{isSuppressionRuleInGA(ruleType)
? i18n.ALERT_SUPPRESSION_FIELDS_GA_LABEL_APPEND
: i18n.ALERT_SUPPRESSION_FIELDS_TECH_PREVIEW_LABEL_APPEND}
</EuiText>
}
labelAppend={alertSuppressionFieldsAppendText}
warningText={
isMlSuppressionIncomplete
? i18n.MACHINE_LEARNING_SUPPRESSION_INCOMPLETE_LABEL
Expand Down

0 comments on commit a745071

Please sign in to comment.