Skip to content

Commit

Permalink
[Fleet] hide auto upgrade UI elements if feature flag is disabled (el…
Browse files Browse the repository at this point in the history
…astic#207714)

## Summary

Follow up after elastic#206955

Hide auto upgrade feature when feature flag is disabled.

To test:
- verify that UI elements are not visible by default (tour, Manage
auto-upgrade agents action, Agent policy details header)
- enable FF in `kibana.dev.yml` and verify that UI elements are visible
  - `xpack.fleet.enableExperimental: ['enableAutomaticAgentUpgrades']`

Feature flag off (default):

<img width="1278" alt="image"
src="https://github.com/user-attachments/assets/c2cb7734-ec04-47fc-b719-69fe73218df1"
/>
<img width="1271" alt="image"
src="https://github.com/user-attachments/assets/f9f048ff-468a-4485-9d79-67d95925dade"
/>

Feature flag on:

<img width="1278" alt="image"
src="https://github.com/user-attachments/assets/2c754487-cd5d-42fc-b346-e817150c4486"
/>
<img width="1278" alt="image"
src="https://github.com/user-attachments/assets/3eacd4bd-1fa8-44ee-a8aa-df387701e4be"
/>
  • Loading branch information
juliaElastic authored Jan 22, 2025
1 parent 9800147 commit dd37080
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ import { WithHeaderLayout } from '../../../../layouts';

import { AutoUpgradeAgentsTour } from '../../sections/agent_policy/components/auto_upgrade_agents_tour';

import { ExperimentalFeaturesService } from '../../services';

import { DefaultPageTitle } from './default_page_title';

interface Props {
Expand All @@ -34,6 +36,7 @@ export const DefaultLayout: React.FunctionComponent<Props> = ({
const authz = useAuthz();
const { docLinks } = useStartServices();
const granularPrivilegesCallout = useDismissableTour('GRANULAR_PRIVILEGES');
const { enableAutomaticAgentUpgrades } = ExperimentalFeaturesService.get();

const tabs = [
{
Expand Down Expand Up @@ -144,7 +147,9 @@ export const DefaultLayout: React.FunctionComponent<Props> = ({
<WithHeaderLayout leftColumn={<DefaultPageTitle />} rightColumn={rightColumn} tabs={tabs}>
{children}
</WithHeaderLayout>
<AutoUpgradeAgentsTour anchor="#fleet-agent-policies-tab" />
{enableAutomaticAgentUpgrades ? (
<AutoUpgradeAgentsTour anchor="#fleet-agent-policies-tab" />
) : null}
</>
);
};
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import {
} from '../../../components';
import { FLEET_SERVER_PACKAGE } from '../../../constants';

import { policyHasFleetServer } from '../../../services';
import { ExperimentalFeaturesService, policyHasFleetServer } from '../../../services';

import { AgentUpgradeAgentModal } from '../../agents/components';

Expand Down Expand Up @@ -54,6 +54,7 @@ export const AgentPolicyActionMenu = memo<{
const [isManageAutoUpgradeAgentsModalOpen, setIsManageAutoUpgradeAgentsModalOpen] =
useState<boolean>(false);
const refreshAgentPolicy = useAgentPolicyRefresh();
const { enableAutomaticAgentUpgrades } = ExperimentalFeaturesService.get();

const isFleetServerPolicy = useMemo(
() =>
Expand Down Expand Up @@ -209,7 +210,7 @@ export const AgentPolicyActionMenu = memo<{
)}
</EuiContextMenuItem>,
viewPolicyItem,
manageAutoUpgradeAgentsItem,
...(enableAutomaticAgentUpgrades ? [manageAutoUpgradeAgentsItem] : []),
copyPolicyItem,
deletePolicyItem,
];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import { FLEET_SERVER_PACKAGE } from '../../../../../../../../common/constants';
import { getRootIntegrations } from '../../../../../../../../common/services';
import { ManageAutoUpgradeAgentsModal } from '../../../../agents/components/manage_auto_upgrade_agents_modal';
import { AutoUpgradeAgentsTour } from '../../../components/auto_upgrade_agents_tour';
import { ExperimentalFeaturesService } from '../../../../../services';

export interface HeaderRightContentProps {
isLoading: boolean;
Expand Down Expand Up @@ -62,6 +63,7 @@ export const HeaderRightContent: React.FunctionComponent<HeaderRightContentProps
const [isManageAutoUpgradeAgentsModalOpen, setIsManageAutoUpgradeAgentsModalOpen] =
useState<boolean>(false);
const refreshAgentPolicy = useAgentPolicyRefresh();
const { enableAutomaticAgentUpgrades } = ExperimentalFeaturesService.get();

const isFleetServerPolicy = useMemo(
() =>
Expand Down Expand Up @@ -214,7 +216,7 @@ export const HeaderRightContent: React.FunctionComponent<HeaderRightContentProps
'',
},
{ isDivider: true },
...(authz.fleet.allAgentPolicies
...(enableAutomaticAgentUpgrades && authz.fleet.allAgentPolicies
? [
{
label: i18n.translate('xpack.fleet.policyDetails.summary.autoUpgrade', {
Expand Down Expand Up @@ -299,7 +301,9 @@ export const HeaderRightContent: React.FunctionComponent<HeaderRightContentProps
/>
</EuiPortal>
)}
<AutoUpgradeAgentsTour anchor="#auto-upgrade-manage-button" />
{enableAutomaticAgentUpgrades ? (
<AutoUpgradeAgentsTour anchor="#auto-upgrade-manage-button" />
) : null}
</>
);
};

0 comments on commit dd37080

Please sign in to comment.