Skip to content

Commit

Permalink
[Fleet] Bug - Add missing instance of enableReusableIntegrationPolici…
Browse files Browse the repository at this point in the history
…es under enterprise plan (elastic#187447)

## Summary

In elastic#186871 I forgot to replace one
instance of `enableReusableIntegrationPolicies` with the new hook
`canUseMultipleAgentPolicies`. This could potentially cause a bug once
the flag is enabled, as that component should only be visible to
enterprise users.

It's a very minor change anyway so I don't think there's any issue in
merging after FF.
  • Loading branch information
criamico authored Jul 3, 2024
1 parent 4359659 commit 307237f
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { FormattedMessage } from '@kbn/i18n-react';
import { useHistory } from 'react-router-dom';

import { SO_SEARCH_LIMIT } from '../../../../../constants';
import { ExperimentalFeaturesService } from '../../../services';
import { useMultipleAgentPolicies } from '../../../hooks';

import {
useStartServices,
Expand Down Expand Up @@ -53,7 +53,7 @@ export const AgentPolicyDeleteProvider: React.FunctionComponent<Props> = ({
const { getPath } = useLink();
const history = useHistory();
const deleteAgentPolicyMutation = useDeleteAgentPolicyMutation();
const { enableReusableIntegrationPolicies } = ExperimentalFeaturesService.get();
const { canUseMultipleAgentPolicies } = useMultipleAgentPolicies();

const deleteAgentPolicyPrompt: DeleteAgentPolicy = (
agentPolicyToDelete,
Expand Down Expand Up @@ -132,11 +132,11 @@ export const AgentPolicyDeleteProvider: React.FunctionComponent<Props> = ({

const packagePoliciesWithMultiplePolicies = useMemo(() => {
// Find if there are package policies that have multiple agent policies
if (packagePolicies && enableReusableIntegrationPolicies) {
if (packagePolicies && canUseMultipleAgentPolicies) {
return packagePolicies.some((policy) => policy?.policy_ids.length > 1);
}
return false;
}, [enableReusableIntegrationPolicies, packagePolicies]);
}, [canUseMultipleAgentPolicies, packagePolicies]);

const renderModal = () => {
if (!isModalOpen) {
Expand Down

0 comments on commit 307237f

Please sign in to comment.