From 5a6bb7581f6427640174e3ad97a691b557cfaeea Mon Sep 17 00:00:00 2001
From: Milosz Marcinkowski
<38698566+miloszmarcinkowski@users.noreply.github.com>
Date: Thu, 10 Apr 2025 17:38:20 +0200
Subject: [PATCH 1/2] [APM][UI] Sort environment dropdown alphabetically
(#217710)
Closes #217814
### Summary
Sort environment list alphabetically.
|Before|After|
|-|-|
|
|
|
(cherry picked from commit 23cbaa6d55de4e331ce180f6857db94ca11c209a)
# Conflicts:
# x-pack/plugins/observability_solution/apm/server/routes/environments/get_environments.ts
# x-pack/plugins/observability_solution/apm/server/routes/suggestions/get_suggestions_with_terms_aggregation.ts
---
.../apm/server/routes/environments/get_environments.ts | 1 +
.../suggestions/get_suggestions_with_terms_aggregation.ts | 6 +++++-
.../observability/apm/environment/get_environment.spec.ts | 2 +-
3 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/x-pack/plugins/observability_solution/apm/server/routes/environments/get_environments.ts b/x-pack/plugins/observability_solution/apm/server/routes/environments/get_environments.ts
index 90ae73a214f4a..e7c5d46e7de10 100644
--- a/x-pack/plugins/observability_solution/apm/server/routes/environments/get_environments.ts
+++ b/x-pack/plugins/observability_solution/apm/server/routes/environments/get_environments.ts
@@ -55,6 +55,7 @@ export async function getEnvironments({
terms: {
field: SERVICE_ENVIRONMENT,
missing: ENVIRONMENT_NOT_DEFINED.value,
+ order: { _key: 'asc' as const },
size,
},
},
diff --git a/x-pack/plugins/observability_solution/apm/server/routes/suggestions/get_suggestions_with_terms_aggregation.ts b/x-pack/plugins/observability_solution/apm/server/routes/suggestions/get_suggestions_with_terms_aggregation.ts
index 9a2cea0ebf29d..1f3eed94b9b21 100644
--- a/x-pack/plugins/observability_solution/apm/server/routes/suggestions/get_suggestions_with_terms_aggregation.ts
+++ b/x-pack/plugins/observability_solution/apm/server/routes/suggestions/get_suggestions_with_terms_aggregation.ts
@@ -52,7 +52,11 @@ export async function getSuggestionsWithTermsAggregation({
},
aggs: {
items: {
- terms: { field: fieldName, size },
+ terms: {
+ field: fieldName,
+ size,
+ order: { _key: 'asc' as const },
+ },
},
},
},
diff --git a/x-pack/test/api_integration/deployment_agnostic/apis/observability/apm/environment/get_environment.spec.ts b/x-pack/test/api_integration/deployment_agnostic/apis/observability/apm/environment/get_environment.spec.ts
index ba6f0df98e3a1..bc3d95e42cadc 100644
--- a/x-pack/test/api_integration/deployment_agnostic/apis/observability/apm/environment/get_environment.spec.ts
+++ b/x-pack/test/api_integration/deployment_agnostic/apis/observability/apm/environment/get_environment.spec.ts
@@ -104,10 +104,10 @@ export default function environmentsAPITests({ getService }: DeploymentAgnosticF
expect(body.environments.length).to.be.equal(4);
expectSnapshot(body.environments).toMatchInline(`
Array [
+ "custom-go-environment",
"development",
"production",
"staging",
- "custom-go-environment",
]
`);
});
From 55914b32aa1c094d530b6dde6203c84fe7de9bb0 Mon Sep 17 00:00:00 2001
From: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Date: Thu, 10 Apr 2025 16:29:33 +0000
Subject: [PATCH 2/2] [CI] Auto-commit changed files from 'node scripts/eslint
--no-cache --fix'
---
.../suggestions/get_suggestions_with_terms_aggregation.ts | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/x-pack/plugins/observability_solution/apm/server/routes/suggestions/get_suggestions_with_terms_aggregation.ts b/x-pack/plugins/observability_solution/apm/server/routes/suggestions/get_suggestions_with_terms_aggregation.ts
index 1f3eed94b9b21..3e646b5e6375b 100644
--- a/x-pack/plugins/observability_solution/apm/server/routes/suggestions/get_suggestions_with_terms_aggregation.ts
+++ b/x-pack/plugins/observability_solution/apm/server/routes/suggestions/get_suggestions_with_terms_aggregation.ts
@@ -52,11 +52,11 @@ export async function getSuggestionsWithTermsAggregation({
},
aggs: {
items: {
- terms: {
- field: fieldName,
+ terms: {
+ field: fieldName,
size,
order: { _key: 'asc' as const },
- },
+ },
},
},
},