diff --git a/x-pack/platform/plugins/shared/fleet/public/applications/fleet/sections/agent_policy/components/agent_policy_advanced_fields/hooks.test.tsx b/x-pack/platform/plugins/shared/fleet/public/applications/fleet/sections/agent_policy/components/agent_policy_advanced_fields/hooks.test.tsx index 0f3f7356733dd..34ad71f2036d5 100644 --- a/x-pack/platform/plugins/shared/fleet/public/applications/fleet/sections/agent_policy/components/agent_policy_advanced_fields/hooks.test.tsx +++ b/x-pack/platform/plugins/shared/fleet/public/applications/fleet/sections/agent_policy/components/agent_policy_advanced_fields/hooks.test.tsx @@ -681,6 +681,11 @@ describe('useFleetServerHostsOptions', () => { "inputDisplay": "Default (currently Default)", "value": "@@##DEFAULT_SELECT##@@", }, + Object { + "disabled": false, + "inputDisplay": "Default", + "value": "default-host", + }, Object { "disabled": true, "inputDisplay": "Internal", diff --git a/x-pack/platform/plugins/shared/fleet/public/applications/fleet/sections/agent_policy/components/agent_policy_advanced_fields/hooks.tsx b/x-pack/platform/plugins/shared/fleet/public/applications/fleet/sections/agent_policy/components/agent_policy_advanced_fields/hooks.tsx index 68204e8c1ac60..5e851be571565 100644 --- a/x-pack/platform/plugins/shared/fleet/public/applications/fleet/sections/agent_policy/components/agent_policy_advanced_fields/hooks.tsx +++ b/x-pack/platform/plugins/shared/fleet/public/applications/fleet/sections/agent_policy/components/agent_policy_advanced_fields/hooks.tsx @@ -156,7 +156,7 @@ export function useOutputOptions(agentPolicy: Partial) { +export function useDownloadSourcesOptions() { const downloadSourcesRequest = useGetDownloadSources(); const dataDownloadSourceOptions = useMemo(() => { @@ -169,14 +169,12 @@ export function useDownloadSourcesOptions(agentPolicy: Partial !item.is_default) - .map((item) => { - return { - value: item.id, - inputDisplay: item.name, - }; - }), + ...downloadSourcesRequest.data.items.map((item) => { + return { + value: item.id, + inputDisplay: item.name, + }; + }), ]; }, [downloadSourcesRequest]); @@ -222,17 +220,15 @@ export function useFleetServerHostsOptions(agentPolicy: Partial !item.is_default) - .map((item) => { - const isInternalFleetServerHost = !!item.is_internal; + ...fleetServerHostsRequest.data.items.map((item) => { + const isInternalFleetServerHost = !!item.is_internal; - return { - value: item.id, - inputDisplay: item.name, - disabled: isInternalFleetServerHost, - }; - }), + return { + value: item.id, + inputDisplay: item.name, + disabled: isInternalFleetServerHost, + }; + }), ]; }, [fleetServerHostsRequest]); diff --git a/x-pack/platform/plugins/shared/fleet/public/applications/fleet/sections/agent_policy/components/agent_policy_advanced_fields/index.tsx b/x-pack/platform/plugins/shared/fleet/public/applications/fleet/sections/agent_policy/components/agent_policy_advanced_fields/index.tsx index 8d0278e277069..d586c93e40a47 100644 --- a/x-pack/platform/plugins/shared/fleet/public/applications/fleet/sections/agent_policy/components/agent_policy_advanced_fields/index.tsx +++ b/x-pack/platform/plugins/shared/fleet/public/applications/fleet/sections/agent_policy/components/agent_policy_advanced_fields/index.tsx @@ -112,7 +112,7 @@ export const AgentPolicyAdvancedOptionsContent: React.FunctionComponent = maxAgentPoliciesWithInactivityTimeout !== undefined && totalAgentPoliciesWithInactivityTimeout > (maxAgentPoliciesWithInactivityTimeout ?? 0); const { dataDownloadSourceOptions, isLoading: isLoadingDownloadSources } = - useDownloadSourcesOptions(agentPolicy); + useDownloadSourcesOptions(); const { fleetServerHostsOptions, isLoading: isLoadingFleetServerHostsOption } = useFleetServerHostsOptions(agentPolicy);