Skip to content

Commit

Permalink
[Security Solution] Fix the total installed rules counter (#160059)
Browse files Browse the repository at this point in the history
**Resolves: #159795

## Summary

Fixes the total rules counter to be `installed prebuilt rules` + `custom
rules` instead of the number of filtered rules.
  • Loading branch information
xcrzx authored Jun 20, 2023
1 parent 2a355a7 commit c4dc825
Showing 1 changed file with 6 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@

import React, { useMemo } from 'react';
import { TabNavigation } from '../../../../common/components/navigation/tab_navigation';
import * as i18n from './translations';
import { useRulesTableContext } from './rules_table/rules_table_context';
import { usePrebuiltRulesStatus } from '../../../rule_management/logic/prebuilt_rules/use_prebuilt_rules_status';
import { useRuleManagementFilters } from '../../../rule_management/logic/use_rule_management_filters';
import * as i18n from './translations';

export enum AllRulesTabs {
management = 'management',
Expand All @@ -18,14 +18,12 @@ export enum AllRulesTabs {
}

export const RulesTableToolbar = React.memo(() => {
const {
state: {
pagination: { total: installedTotal },
},
} = useRulesTableContext();

const { data: ruleManagementFilters } = useRuleManagementFilters();
const { data: prebuiltRulesStatus } = usePrebuiltRulesStatus();

const installedTotal =
(ruleManagementFilters?.rules_summary.custom_count ?? 0) +
(ruleManagementFilters?.rules_summary.prebuilt_installed_count ?? 0);
const updateTotal = prebuiltRulesStatus?.num_prebuilt_rules_to_upgrade ?? 0;

const ruleTabs = useMemo(
Expand Down

0 comments on commit c4dc825

Please sign in to comment.