mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 09:48:58 -04:00
changing fleet server query to include more than first 1000 (#132893)
This commit is contained in:
parent
f1d3127011
commit
c6a6abd325
1 changed files with 14 additions and 11 deletions
|
@ -13,7 +13,7 @@ import { useFleetStatus, useGetAgents } from '../../hooks';
|
|||
|
||||
import { FleetServerRequirementPage } from '../../applications/fleet/sections/agents/agent_requirements_page';
|
||||
|
||||
import { FLEET_SERVER_PACKAGE } from '../../constants';
|
||||
import { AGENTS_PREFIX, FLEET_SERVER_PACKAGE, SO_SEARCH_LIMIT } from '../../constants';
|
||||
|
||||
import { useFleetServerUnhealthy } from '../../applications/fleet/sections/agents/hooks/use_fleet_server_unhealthy';
|
||||
|
||||
|
@ -43,20 +43,23 @@ export const Instructions = (props: InstructionProps) => {
|
|||
const fleetStatus = useFleetStatus();
|
||||
const { isUnhealthy: isFleetServerUnhealthy } = useFleetServerUnhealthy();
|
||||
|
||||
const fleetServerAgentPolicies: string[] = useMemo(
|
||||
() => agentPolicies.filter((pol) => policyHasFleetServer(pol)).map((pol) => pol.id),
|
||||
[agentPolicies]
|
||||
);
|
||||
|
||||
const { data: agents, isLoading: isLoadingAgents } = useGetAgents({
|
||||
page: 1,
|
||||
perPage: 1000,
|
||||
perPage: SO_SEARCH_LIMIT,
|
||||
showInactive: false,
|
||||
kuery:
|
||||
fleetServerAgentPolicies.length === 0
|
||||
? ''
|
||||
: `${AGENTS_PREFIX}.policy_id:${fleetServerAgentPolicies
|
||||
.map((id) => `"${id}"`)
|
||||
.join(' or ')}`,
|
||||
});
|
||||
|
||||
const fleetServers = useMemo(() => {
|
||||
const fleetServerAgentPolicies: string[] = agentPolicies
|
||||
.filter((pol) => policyHasFleetServer(pol))
|
||||
.map((pol) => pol.id);
|
||||
return (agents?.items ?? []).filter((agent) =>
|
||||
fleetServerAgentPolicies.includes(agent.policy_id ?? '')
|
||||
);
|
||||
}, [agents, agentPolicies]);
|
||||
const fleetServers = agents?.items || [];
|
||||
|
||||
const fleetServerHosts = useMemo(() => {
|
||||
return settings?.fleet_server_hosts || [];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue