[APM][UI] Sort environment dropdown alphabetically (#217710)

Closes #217814

### Summary

Sort environment list alphabetically.

|Before|After|
|-|-|
|<img width="1724" alt="Screenshot 2025-04-10 at 12 01 15"
src="https://github.com/user-attachments/assets/53f0b66d-146a-45d9-b4e3-25bde350a263"
/>|<img width="1722" alt="Screenshot 2025-04-10 at 11 58 27"
src="https://github.com/user-attachments/assets/91315d23-801c-4a16-8688-c43d60c389c8"
/>|
This commit is contained in:
Milosz Marcinkowski 2025-04-10 17:38:20 +02:00 committed by GitHub
parent 79058c6529
commit 23cbaa6d55
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 7 additions and 2 deletions

View file

@ -54,6 +54,7 @@ export async function getEnvironments({
terms: {
field: SERVICE_ENVIRONMENT,
missing: ENVIRONMENT_NOT_DEFINED.value,
order: { _key: 'asc' as const },
size,
},
},

View file

@ -51,7 +51,11 @@ export async function getSuggestionsWithTermsAggregation({
},
aggs: {
items: {
terms: { field: fieldName, size },
terms: {
field: fieldName,
size,
order: { _key: 'asc' as const },
},
},
},
});

View file

@ -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",
]
`);
});