mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
[Fleet] Fix add fleet server flow from agent policy page (#149507)
This commit is contained in:
parent
1d5e25ae27
commit
da83d96ff6
1 changed files with 9 additions and 5 deletions
|
@ -42,7 +42,8 @@ export const Instructions = (props: InstructionProps) => {
|
|||
refreshAgentPolicies,
|
||||
} = props;
|
||||
const fleetStatus = useFleetStatus();
|
||||
const { isUnhealthy: isFleetServerUnhealthy } = useFleetServerUnhealthy();
|
||||
const { isUnhealthy: isFleetServerUnhealthy, isLoading: isLoadingFleetServerHealth } =
|
||||
useFleetServerUnhealthy();
|
||||
|
||||
useEffect(() => {
|
||||
refreshAgentPolicies();
|
||||
|
@ -66,14 +67,17 @@ export const Instructions = (props: InstructionProps) => {
|
|||
|
||||
const fleetServers = agents?.items || [];
|
||||
|
||||
if (isLoadingAgents || isLoadingAgentPolicies) return <Loading size="l" />;
|
||||
if (isLoadingAgents || isLoadingAgentPolicies || isLoadingFleetServerHealth)
|
||||
return <Loading size="l" />;
|
||||
|
||||
const hasNoFleetServerHost = fleetStatus.isReady && (fleetServerHosts?.length ?? 0) === 0;
|
||||
|
||||
const showAgentEnrollment =
|
||||
fleetStatus.isReady &&
|
||||
(isFleetServerPolicySelected ||
|
||||
(!isFleetServerUnhealthy && fleetServers.length > 0 && (fleetServerHosts?.length ?? 0) > 0));
|
||||
isFleetServerPolicySelected ||
|
||||
(fleetStatus.isReady &&
|
||||
!isFleetServerUnhealthy &&
|
||||
fleetServers.length > 0 &&
|
||||
(fleetServerHosts?.length ?? 0) > 0);
|
||||
|
||||
const showFleetServerEnrollment =
|
||||
!isFleetServerPolicySelected &&
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue