mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 09:48:58 -04:00
[Fleet] Add featureFlag to support standalone fleet server (#151865)
This commit is contained in:
parent
81a4b39847
commit
629b87635c
7 changed files with 29 additions and 9 deletions
|
@ -21,6 +21,7 @@ export const allowedExperimentalValues = Object.freeze({
|
|||
showIntegrationsSubcategories: false,
|
||||
agentFqdnMode: true,
|
||||
showExperimentalShipperOptions: false,
|
||||
fleetServerStandalone: false,
|
||||
});
|
||||
|
||||
type ExperimentalConfigKeys = Array<keyof ExperimentalFeatures>;
|
||||
|
|
|
@ -27,6 +27,7 @@ import {
|
|||
useStartServices,
|
||||
useFlyoutContext,
|
||||
sendGetAgentTags,
|
||||
useFleetServerStandalone,
|
||||
} from '../../../hooks';
|
||||
import { AgentEnrollmentFlyout } from '../../../components';
|
||||
import {
|
||||
|
@ -433,6 +434,9 @@ export const AgentListPage: React.FunctionComponent<{}> = () => {
|
|||
|
||||
// Fleet server unhealthy status
|
||||
const { isUnhealthy: isFleetServerUnhealthy } = useFleetServerUnhealthy();
|
||||
const { isFleetServerStandalone } = useFleetServerStandalone();
|
||||
const showUnhealthyCallout = isFleetServerUnhealthy && !isFleetServerStandalone;
|
||||
|
||||
const onClickAddFleetServer = useCallback(() => {
|
||||
flyoutContext.openFleetServerFlyout();
|
||||
}, [flyoutContext]);
|
||||
|
@ -558,7 +562,7 @@ export const AgentListPage: React.FunctionComponent<{}> = () => {
|
|||
}}
|
||||
/>
|
||||
)}
|
||||
{isFleetServerUnhealthy && (
|
||||
{showUnhealthyCallout && (
|
||||
<>
|
||||
{cloud?.deploymentUrl ? (
|
||||
<FleetServerCloudUnhealthyCallout deploymentUrl={cloud.deploymentUrl} />
|
||||
|
|
|
@ -13,6 +13,7 @@ jest.mock('../../hooks', () => {
|
|||
return {
|
||||
...jest.requireActual('../../hooks'),
|
||||
useFleetStatus: jest.fn(),
|
||||
useFleetServerStandalone: jest.fn(),
|
||||
useAgentEnrollmentFlyoutData: jest.fn(),
|
||||
};
|
||||
});
|
||||
|
|
|
@ -27,6 +27,7 @@ import {
|
|||
useAgentEnrollmentFlyoutData,
|
||||
KibanaVersionContext,
|
||||
useFleetStatus,
|
||||
useFleetServerStandalone,
|
||||
} from '../../hooks';
|
||||
|
||||
import { useAdvancedForm } from '../../applications/fleet/components/fleet_server_instructions/hooks';
|
||||
|
@ -92,6 +93,7 @@ describe('<AgentEnrollmentFlyout />', () => {
|
|||
],
|
||||
},
|
||||
});
|
||||
jest.mocked(useFleetServerStandalone).mockReturnValue({ isFleetServerStandalone: false });
|
||||
|
||||
(useFleetStatus as jest.Mock).mockReturnValue({ isReady: true });
|
||||
(useFleetServerUnhealthy as jest.Mock).mockReturnValue({
|
||||
|
|
|
@ -9,22 +9,15 @@ import React, { useMemo, useEffect } from 'react';
|
|||
import { EuiText, EuiSpacer } from '@elastic/eui';
|
||||
import { FormattedMessage } from '@kbn/i18n-react';
|
||||
|
||||
import { useFleetStatus, useGetAgents } from '../../hooks';
|
||||
|
||||
import { useFleetStatus, useGetAgents, useFleetServerStandalone } from '../../hooks';
|
||||
import { FleetServerRequirementPage } from '../../applications/fleet/sections/agents/agent_requirements_page';
|
||||
|
||||
import { AGENTS_PREFIX, FLEET_SERVER_PACKAGE, SO_SEARCH_LIMIT } from '../../constants';
|
||||
|
||||
import { useFleetServerUnhealthy } from '../../applications/fleet/sections/agents/hooks/use_fleet_server_unhealthy';
|
||||
|
||||
import { Loading } from '..';
|
||||
|
||||
import { policyHasFleetServer } from '../../services';
|
||||
|
||||
import { AdvancedTab } from '../../applications/fleet/components/fleet_server_instructions/advanced_tab';
|
||||
|
||||
import type { InstructionProps } from './types';
|
||||
|
||||
import { ManagedSteps, StandaloneSteps } from './steps';
|
||||
import { DefaultMissingRequirements } from './default_missing_requirements';
|
||||
|
||||
|
@ -45,6 +38,8 @@ export const Instructions = (props: InstructionProps) => {
|
|||
const { isUnhealthy: isFleetServerUnhealthy, isLoading: isLoadingFleetServerHealth } =
|
||||
useFleetServerUnhealthy();
|
||||
|
||||
const { isFleetServerStandalone } = useFleetServerStandalone();
|
||||
|
||||
useEffect(() => {
|
||||
refreshAgentPolicies();
|
||||
}, [refreshAgentPolicies]);
|
||||
|
@ -74,12 +69,14 @@ export const Instructions = (props: InstructionProps) => {
|
|||
|
||||
const showAgentEnrollment =
|
||||
isFleetServerPolicySelected ||
|
||||
isFleetServerStandalone ||
|
||||
(fleetStatus.isReady &&
|
||||
!isFleetServerUnhealthy &&
|
||||
fleetServers.length > 0 &&
|
||||
(fleetServerHosts?.length ?? 0) > 0);
|
||||
|
||||
const showFleetServerEnrollment =
|
||||
!isFleetServerStandalone &&
|
||||
!isFleetServerPolicySelected &&
|
||||
(fleetServers.length === 0 ||
|
||||
isFleetServerUnhealthy ||
|
||||
|
|
|
@ -30,3 +30,4 @@ export * from './use_agent_enrollment_flyout_data';
|
|||
export * from './use_flyout_context';
|
||||
export * from './use_is_guided_onboarding_active';
|
||||
export * from './use_fleet_server_hosts_for_policy';
|
||||
export * from './use_fleet_server_standalone';
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License
|
||||
* 2.0; you may not use this file except in compliance with the Elastic License
|
||||
* 2.0.
|
||||
*/
|
||||
|
||||
import { ExperimentalFeaturesService } from '../applications/fleet/services';
|
||||
|
||||
export function useFleetServerStandalone() {
|
||||
const isFleetServerStandalone = ExperimentalFeaturesService.get().fleetServerStandalone;
|
||||
|
||||
return { isFleetServerStandalone };
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue