diff --git a/x-pack/plugins/ingest_manager/public/applications/ingest_manager/sections/agent_config/details_page/components/yaml/index.tsx b/x-pack/plugins/ingest_manager/public/applications/ingest_manager/sections/agent_config/details_page/components/yaml/index.tsx index c1cdde730837fe..56b109a9bc062f 100644 --- a/x-pack/plugins/ingest_manager/public/applications/ingest_manager/sections/agent_config/details_page/components/yaml/index.tsx +++ b/x-pack/plugins/ingest_manager/public/applications/ingest_manager/sections/agent_config/details_page/components/yaml/index.tsx @@ -25,7 +25,15 @@ import { import { ShellEnrollmentInstructions } from '../../../../../components/enrollment_instructions'; import { Loading } from '../../../../../components'; -const CONFIG_KEYS_ORDER = ['id', 'revision', 'outputs', 'datasources']; +const CONFIG_KEYS_ORDER = [ + 'id', + 'revision', + 'outputs', + 'datasources', + 'enabled', + 'package', + 'input', +]; export const ConfigYamlView = memo<{ config: AgentConfig }>(({ config }) => { const core = useCore(); @@ -47,7 +55,17 @@ export const ConfigYamlView = memo<{ config: AgentConfig }>(({ config }) => { {dump(fullConfigRequest.data.item, { sortKeys: (keyA: string, keyB: string) => { - return CONFIG_KEYS_ORDER.indexOf(keyA) - CONFIG_KEYS_ORDER.indexOf(keyB); + const indexA = CONFIG_KEYS_ORDER.indexOf(keyA); + const indexB = CONFIG_KEYS_ORDER.indexOf(keyB); + if (indexA >= 0 && indexB < 0) { + return -1; + } + + if (indexA < 0 && indexB >= 0) { + return 1; + } + + return indexA - indexB; }, })}