Skip to content

Commit

Permalink
change enum to object with type
Browse files Browse the repository at this point in the history
  • Loading branch information
WafaaNasr committed Jan 25, 2024
1 parent 661912d commit dcca963
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
* 2.0.
*/

import { Type } from '@kbn/securitysolution-io-ts-alerting-types';

export enum RULE_PREVIEW_INVOCATION_COUNT {
HOUR = 12,
DAY = 24,
Expand Down Expand Up @@ -37,9 +39,9 @@ export const DEFAULT_SUPPRESSION_MISSING_FIELDS_STRATEGY = 'suppress' as const;

export const MINIMUM_LICENSE_FOR_SUPPRESSION = 'platinum' as const;

export enum SuppressibleAlertRules {
THRESHOLD = 'threshold',
SAVED_QUERY = 'saved_query',
QUERY = 'query',
THREAT_MATCH = 'threat_match',
}
export const SuppressibleAlertRules: { [key: string]: Type } = {
THRESHOLD: 'threshold',
SAVED_QUERY: 'saved_query',
QUERY: 'query',
THREAT_MATCH: 'threat_match',
};
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ const StepDefineRuleComponent: FC<StepDefineRuleProps> = ({
thresholdFields,
enableThresholdSuppression,
}) => {
const { isSuppressionEnabled } = useAlertSuppression(ruleType);
const { isSuppressionEnabled: isAlertSuppressionEnabled } = useAlertSuppression(ruleType);
const mlCapabilities = useMlCapabilities();
const [openTimelineSearch, setOpenTimelineSearch] = useState(false);
const [indexModified, setIndexModified] = useState(false);
Expand Down Expand Up @@ -981,7 +981,7 @@ const StepDefineRuleComponent: FC<StepDefineRuleProps> = ({
</RuleTypeEuiFormRow>

<EuiSpacer size="m" />
<RuleTypeEuiFormRow $isVisible={isSuppressionEnabled && isThresholdRule} fullWidth>
<RuleTypeEuiFormRow $isVisible={isAlertSuppressionEnabled && isThresholdRule} fullWidth>
<EuiToolTip content={alertSuppressionUpsellingMessage} position="right">
<CommonUseField
path="enableThresholdSuppression"
Expand All @@ -998,7 +998,7 @@ const StepDefineRuleComponent: FC<StepDefineRuleProps> = ({
</RuleTypeEuiFormRow>

<RuleTypeEuiFormRow
$isVisible={isSuppressionEnabled && !isThresholdRule}
$isVisible={isAlertSuppressionEnabled && !isThresholdRule}
data-test-subj="alertSuppressionInput"
>
<UseField
Expand All @@ -1013,7 +1013,7 @@ const StepDefineRuleComponent: FC<StepDefineRuleProps> = ({
</RuleTypeEuiFormRow>

<IntendedRuleTypeEuiFormRow
$isVisible={isSuppressionEnabled}
$isVisible={isAlertSuppressionEnabled}
data-test-subj="alertSuppressionDuration"
>
<UseMultiFields
Expand All @@ -1035,7 +1035,7 @@ const StepDefineRuleComponent: FC<StepDefineRuleProps> = ({

<IntendedRuleTypeEuiFormRow
// threshold rule does not have this suppression configuration
$isVisible={isSuppressionEnabled && !isThresholdRule}
$isVisible={isAlertSuppressionEnabled && !isThresholdRule}
data-test-subj="alertSuppressionMissingFields"
label={
<span>
Expand Down

0 comments on commit dcca963

Please sign in to comment.