Fix import/export messing with Policy tests

This commit is contained in:
Tom Ratcliffe
2024-03-26 15:58:42 +00:00
committed by Tom Ratcliffe
parent bd06607a51
commit 5fbca0962e
2 changed files with 5 additions and 3 deletions

View File

@@ -33,7 +33,7 @@ const VIEWS = {
};
// make sure we ask for 1 more so we show the "show x more" button
export const LIMIT_ALERTS = INSTANCES_DISPLAY_LIMIT + 1;
const LIMIT_ALERTS = INSTANCES_DISPLAY_LIMIT + 1;
const RuleList = withErrorBoundary(
() => {

View File

@@ -17,8 +17,8 @@ import {
Stack,
} from '@grafana/ui';
import { useAppNotification } from 'app/core/copy/appNotification';
import { LIMIT_ALERTS } from 'app/features/alerting/unified/RuleList';
import { alertRuleApi } from 'app/features/alerting/unified/api/alertRuleApi';
import { INSTANCES_DISPLAY_LIMIT } from 'app/features/alerting/unified/components/rules/RuleDetails';
import { useRulesFilter } from 'app/features/alerting/unified/hooks/useFilteredRules';
import { useDispatch } from 'app/types';
import { CombinedRule, RuleIdentifier, RulesSource } from 'app/types/unified-alerting';
@@ -107,7 +107,9 @@ export const RuleActionsButtons = ({ rule, rulesSource }: Props) => {
await updateRule({ nameSpaceUID: rule.namespace.uid!, payload }).unwrap();
const limitAlerts = hasActiveFilters ? undefined : LIMIT_ALERTS;
// Uses INSTANCES_DISPLAY_LIMIT + 1 here as exporting LIMIT_ALERTS from RuleList has the side effect
// of breaking some unrelated tests in Policy.test.tsx due to mocking approach
const limitAlerts = hasActiveFilters ? undefined : INSTANCES_DISPLAY_LIMIT + 1;
// Trigger a re-fetch of the rules table
// TODO: Migrate rules table functionality to RTK Query, so we instead rely
// on tag invalidation (or optimistic cache updates) for this