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

# Backport

This will backport the following commits from `main` to `9.0`:
- [[APM][UI] Sort environment dropdown alphabetically
(#217710)](https://github.com/elastic/kibana/pull/217710)

<!--- Backport version: 8.9.8 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Milosz
Marcinkowski","email":"38698566+miloszmarcinkowski@users.noreply.github.com"},"sourceCommit":{"committedDate":"2025-04-10T15:38:20Z","message":"[APM][UI]
Sort environment dropdown alphabetically (#217710)\n\nCloses
#217814\n\n### Summary\n\nSort environment list
alphabetically.\n\n|Before|After|\n|-|-|\n|<img width=\"1724\"
alt=\"Screenshot 2025-04-10 at 12 01
15\"\nsrc=\"https://github.com/user-attachments/assets/53f0b66d-146a-45d9-b4e3-25bde350a263\"\n/>|<img
width=\"1722\" alt=\"Screenshot 2025-04-10 at 11 58
27\"\nsrc=\"https://github.com/user-attachments/assets/91315d23-801c-4a16-8688-c43d60c389c8\"\n/>|","sha":"23cbaa6d55de4e331ce180f6857db94ca11c209a","branchLabelMapping":{"^v9.1.0$":"main","^v8.19.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:fix","backport:prev-minor","backport:prev-major","Team:obs-ux-infra_services","v8.18.0","v9.1.0","v8.19.0","v8.17.5","v8.16.7"],"number":217710,"url":"https://github.com/elastic/kibana/pull/217710","mergeCommit":{"message":"[APM][UI]
Sort environment dropdown alphabetically (#217710)\n\nCloses
#217814\n\n### Summary\n\nSort environment list
alphabetically.\n\n|Before|After|\n|-|-|\n|<img width=\"1724\"
alt=\"Screenshot 2025-04-10 at 12 01
15\"\nsrc=\"https://github.com/user-attachments/assets/53f0b66d-146a-45d9-b4e3-25bde350a263\"\n/>|<img
width=\"1722\" alt=\"Screenshot 2025-04-10 at 11 58
27\"\nsrc=\"https://github.com/user-attachments/assets/91315d23-801c-4a16-8688-c43d60c389c8\"\n/>|","sha":"23cbaa6d55de4e331ce180f6857db94ca11c209a"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"8.18","label":"v8.18.0","labelRegex":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"url":"https://github.com/elastic/kibana/pull/217880","number":217880,"state":"MERGED","mergeCommit":{"sha":"6d7097d6be890bac0896fe67d04b84e65cbe2c7c","message":"[8.18]
[APM][UI] Sort environment dropdown alphabetically (#217710)
(#217880)\n\n# Backport\n\nThis will backport the following commits from
`main` to `8.18`:\n- [[APM][UI] Sort environment dropdown
alphabetically\n(#217710)](https://github.com/elastic/kibana/pull/217710)\n\n<!---
Backport version: 9.6.6 -->\n\n### Questions ?\nPlease refer to the
[Backport
tool\ndocumentation](https://github.com/sorenlouv/backport)\n\n<!--BACKPORT
[{\"author\":{\"name\":\"Milosz\nMarcinkowski\",\"email\":\"38698566+miloszmarcinkowski@users.noreply.github.com\"},\"sourceCommit\":{\"committedDate\":\"2025-04-10T15:38:20Z\",\"message\":\"[APM][UI]\nSort
environment dropdown alphabetically
(#217710)\\n\\nCloses\n#217814\\n\\n### Summary\\n\\nSort environment
list\nalphabetically.\\n\\n|Before|After|\\n|-|-|\\n|<img
width=\\\"1724\\\"\nalt=\\\"Screenshot 2025-04-10 at 12
01\n15\\\"\\nsrc=\\\"https://github.com/user-attachments/assets/53f0b66d-146a-45d9-b4e3-25bde350a263\\\"\\n/>|<img\nwidth=\\\"1722\\\"
alt=\\\"Screenshot 2025-04-10 at 11
58\n27\\\"\\nsrc=\\\"https://github.com/user-attachments/assets/91315d23-801c-4a16-8688-c43d60c389c8\\\"\\n/>|\",\"sha\":\"23cbaa6d55de4e331ce180f6857db94ca11c209a\",\"branchLabelMapping\":{\"^v9.1.0$\":\"main\",\"^v8.19.0$\":\"8.x\",\"^v(\\\\d+).(\\\\d+).\\\\d+$\":\"$1.$2\"}},\"sourcePullRequest\":{\"labels\":[\"release_note:skip\",\"backport:prev-major\",\"Team:obs-ux-infra_services\",\"v9.1.0\"],\"title\":\"[APM][UI]\nSort
environment
dropdown\nalphabetically\",\"number\":217710,\"url\":\"https://github.com/elastic/kibana/pull/217710\",\"mergeCommit\":{\"message\":\"[APM][UI]\nSort
environment dropdown alphabetically
(#217710)\\n\\nCloses\n#217814\\n\\n### Summary\\n\\nSort environment
list\nalphabetically.\\n\\n|Before|After|\\n|-|-|\\n|<img
width=\\\"1724\\\"\nalt=\\\"Screenshot 2025-04-10 at 12
01\n15\\\"\\nsrc=\\\"https://github.com/user-attachments/assets/53f0b66d-146a-45d9-b4e3-25bde350a263\\\"\\n/>|<img\nwidth=\\\"1722\\\"
alt=\\\"Screenshot 2025-04-10 at 11
58\n27\\\"\\nsrc=\\\"https://github.com/user-attachments/assets/91315d23-801c-4a16-8688-c43d60c389c8\\\"\\n/>|\",\"sha\":\"23cbaa6d55de4e331ce180f6857db94ca11c209a\"}},\"sourceBranch\":\"main\",\"suggestedTargetBranches\":[],\"targetPullRequestStates\":[{\"branch\":\"main\",\"label\":\"v9.1.0\",\"branchLabelMappingKey\":\"^v9.1.0$\",\"isSourceBranch\":true,\"state\":\"MERGED\",\"url\":\"https://github.com/elastic/kibana/pull/217710\",\"number\":217710,\"mergeCommit\":{\"message\":\"[APM][UI]\nSort
environment dropdown alphabetically
(#217710)\\n\\nCloses\n#217814\\n\\n### Summary\\n\\nSort environment
list\nalphabetically.\\n\\n|Before|After|\\n|-|-|\\n|<img
width=\\\"1724\\\"\nalt=\\\"Screenshot 2025-04-10 at 12
01\n15\\\"\\nsrc=\\\"https://github.com/user-attachments/assets/53f0b66d-146a-45d9-b4e3-25bde350a263\\\"\\n/>|<img\nwidth=\\\"1722\\\"
alt=\\\"Screenshot 2025-04-10 at 11
58\n27\\\"\\nsrc=\\\"https://github.com/user-attachments/assets/91315d23-801c-4a16-8688-c43d60c389c8\\\"\\n/>|\",\"sha\":\"23cbaa6d55de4e331ce180f6857db94ca11c209a\"}}]}]\nBACKPORT-->\n\n---------\n\nCo-authored-by:
kibanamachine
<42973632+kibanamachine@users.noreply.github.com>"}},{"branch":"main","label":"v9.1.0","labelRegex":"^v9.1.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/217710","number":217710,"mergeCommit":{"message":"[APM][UI]
Sort environment dropdown alphabetically (#217710)\n\nCloses
#217814\n\n### Summary\n\nSort environment list
alphabetically.\n\n|Before|After|\n|-|-|\n|<img width=\"1724\"
alt=\"Screenshot 2025-04-10 at 12 01
15\"\nsrc=\"https://github.com/user-attachments/assets/53f0b66d-146a-45d9-b4e3-25bde350a263\"\n/>|<img
width=\"1722\" alt=\"Screenshot 2025-04-10 at 11 58
27\"\nsrc=\"https://github.com/user-attachments/assets/91315d23-801c-4a16-8688-c43d60c389c8\"\n/>|","sha":"23cbaa6d55de4e331ce180f6857db94ca11c209a"}},{"branch":"8.x","label":"v8.19.0","labelRegex":"^v8.19.0$","isSourceBranch":false,"url":"https://github.com/elastic/kibana/pull/217878","number":217878,"state":"MERGED","mergeCommit":{"sha":"22cb96803f4b8533d7e3c82981afb75b8112da11","message":"[8.x]
[APM][UI] Sort environment dropdown alphabetically (#217710)
(#217878)\n\n# Backport\n\nThis will backport the following commits from
`main` to `8.x`:\n- [[APM][UI] Sort environment dropdown
alphabetically\n(#217710)](https://github.com/elastic/kibana/pull/217710)\n\n<!---
Backport version: 9.6.6 -->\n\n### Questions ?\nPlease refer to the
[Backport
tool\ndocumentation](https://github.com/sorenlouv/backport)\n\n<!--BACKPORT
[{\"author\":{\"name\":\"Milosz\nMarcinkowski\",\"email\":\"38698566+miloszmarcinkowski@users.noreply.github.com\"},\"sourceCommit\":{\"committedDate\":\"2025-04-10T15:38:20Z\",\"message\":\"[APM][UI]\nSort
environment dropdown alphabetically
(#217710)\\n\\nCloses\n#217814\\n\\n### Summary\\n\\nSort environment
list\nalphabetically.\\n\\n|Before|After|\\n|-|-|\\n|<img
width=\\\"1724\\\"\nalt=\\\"Screenshot 2025-04-10 at 12
01\n15\\\"\\nsrc=\\\"https://github.com/user-attachments/assets/53f0b66d-146a-45d9-b4e3-25bde350a263\\\"\\n/>|<img\nwidth=\\\"1722\\\"
alt=\\\"Screenshot 2025-04-10 at 11
58\n27\\\"\\nsrc=\\\"https://github.com/user-attachments/assets/91315d23-801c-4a16-8688-c43d60c389c8\\\"\\n/>|\",\"sha\":\"23cbaa6d55de4e331ce180f6857db94ca11c209a\",\"branchLabelMapping\":{\"^v9.1.0$\":\"main\",\"^v8.19.0$\":\"8.x\",\"^v(\\\\d+).(\\\\d+).\\\\d+$\":\"$1.$2\"}},\"sourcePullRequest\":{\"labels\":[\"release_note:skip\",\"backport:prev-major\",\"Team:obs-ux-infra_services\",\"v9.1.0\"],\"title\":\"[APM][UI]\nSort
environment
dropdown\nalphabetically\",\"number\":217710,\"url\":\"https://github.com/elastic/kibana/pull/217710\",\"mergeCommit\":{\"message\":\"[APM][UI]\nSort
environment dropdown alphabetically
(#217710)\\n\\nCloses\n#217814\\n\\n### Summary\\n\\nSort environment
list\nalphabetically.\\n\\n|Before|After|\\n|-|-|\\n|<img
width=\\\"1724\\\"\nalt=\\\"Screenshot 2025-04-10 at 12
01\n15\\\"\\nsrc=\\\"https://github.com/user-attachments/assets/53f0b66d-146a-45d9-b4e3-25bde350a263\\\"\\n/>|<img\nwidth=\\\"1722\\\"
alt=\\\"Screenshot 2025-04-10 at 11
58\n27\\\"\\nsrc=\\\"https://github.com/user-attachments/assets/91315d23-801c-4a16-8688-c43d60c389c8\\\"\\n/>|\",\"sha\":\"23cbaa6d55de4e331ce180f6857db94ca11c209a\"}},\"sourceBranch\":\"main\",\"suggestedTargetBranches\":[],\"targetPullRequestStates\":[{\"branch\":\"main\",\"label\":\"v9.1.0\",\"branchLabelMappingKey\":\"^v9.1.0$\",\"isSourceBranch\":true,\"state\":\"MERGED\",\"url\":\"https://github.com/elastic/kibana/pull/217710\",\"number\":217710,\"mergeCommit\":{\"message\":\"[APM][UI]\nSort
environment dropdown alphabetically
(#217710)\\n\\nCloses\n#217814\\n\\n### Summary\\n\\nSort environment
list\nalphabetically.\\n\\n|Before|After|\\n|-|-|\\n|<img
width=\\\"1724\\\"\nalt=\\\"Screenshot 2025-04-10 at 12
01\n15\\\"\\nsrc=\\\"https://github.com/user-attachments/assets/53f0b66d-146a-45d9-b4e3-25bde350a263\\\"\\n/>|<img\nwidth=\\\"1722\\\"
alt=\\\"Screenshot 2025-04-10 at 11
58\n27\\\"\\nsrc=\\\"https://github.com/user-attachments/assets/91315d23-801c-4a16-8688-c43d60c389c8\\\"\\n/>|\",\"sha\":\"23cbaa6d55de4e331ce180f6857db94ca11c209a\"}}]}]\nBACKPORT-->\n\n---------\n\nCo-authored-by:
kibanamachine
<42973632+kibanamachine@users.noreply.github.com>"}},{"branch":"8.17","label":"v8.17.5","labelRegex":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"url":"https://github.com/elastic/kibana/pull/217881","number":217881,"state":"MERGED","mergeCommit":{"sha":"0fe80714cb1d0b7f73543f303c7224aa66741605","message":"[8.17]
[APM][UI] Sort environment dropdown alphabetically (#217710)
(#217881)\n\n# Backport\n\nThis will backport the following commits from
`main` to `8.17`:\n- [[APM][UI] Sort environment dropdown
alphabetically\n(#217710)](https://github.com/elastic/kibana/pull/217710)\n\n<!---
Backport version: 9.6.6 -->\n\n### Questions ?\nPlease refer to the
[Backport
tool\ndocumentation](https://github.com/sorenlouv/backport)\n\n<!--BACKPORT
[{\"author\":{\"name\":\"Milosz\nMarcinkowski\",\"email\":\"38698566+miloszmarcinkowski@users.noreply.github.com\"},\"sourceCommit\":{\"committedDate\":\"2025-04-10T15:38:20Z\",\"message\":\"[APM][UI]\nSort
environment dropdown alphabetically
(#217710)\\n\\nCloses\n#217814\\n\\n### Summary\\n\\nSort environment
list\nalphabetically.\\n\\n|Before|After|\\n|-|-|\\n|<img
width=\\\"1724\\\"\nalt=\\\"Screenshot 2025-04-10 at 12
01\n15\\\"\\nsrc=\\\"https://github.com/user-attachments/assets/53f0b66d-146a-45d9-b4e3-25bde350a263\\\"\\n/>|<img\nwidth=\\\"1722\\\"
alt=\\\"Screenshot 2025-04-10 at 11
58\n27\\\"\\nsrc=\\\"https://github.com/user-attachments/assets/91315d23-801c-4a16-8688-c43d60c389c8\\\"\\n/>|\",\"sha\":\"23cbaa6d55de4e331ce180f6857db94ca11c209a\",\"branchLabelMapping\":{\"^v9.1.0$\":\"main\",\"^v8.19.0$\":\"8.x\",\"^v(\\\\d+).(\\\\d+).\\\\d+$\":\"$1.$2\"}},\"sourcePullRequest\":{\"labels\":[\"release_note:skip\",\"backport:prev-major\",\"Team:obs-ux-infra_services\",\"v9.1.0\"],\"title\":\"[APM][UI]\nSort
environment
dropdown\nalphabetically\",\"number\":217710,\"url\":\"https://github.com/elastic/kibana/pull/217710\",\"mergeCommit\":{\"message\":\"[APM][UI]\nSort
environment dropdown alphabetically
(#217710)\\n\\nCloses\n#217814\\n\\n### Summary\\n\\nSort environment
list\nalphabetically.\\n\\n|Before|After|\\n|-|-|\\n|<img
width=\\\"1724\\\"\nalt=\\\"Screenshot 2025-04-10 at 12
01\n15\\\"\\nsrc=\\\"https://github.com/user-attachments/assets/53f0b66d-146a-45d9-b4e3-25bde350a263\\\"\\n/>|<img\nwidth=\\\"1722\\\"
alt=\\\"Screenshot 2025-04-10 at 11
58\n27\\\"\\nsrc=\\\"https://github.com/user-attachments/assets/91315d23-801c-4a16-8688-c43d60c389c8\\\"\\n/>|\",\"sha\":\"23cbaa6d55de4e331ce180f6857db94ca11c209a\"}},\"sourceBranch\":\"main\",\"suggestedTargetBranches\":[],\"targetPullRequestStates\":[{\"branch\":\"main\",\"label\":\"v9.1.0\",\"branchLabelMappingKey\":\"^v9.1.0$\",\"isSourceBranch\":true,\"state\":\"MERGED\",\"url\":\"https://github.com/elastic/kibana/pull/217710\",\"number\":217710,\"mergeCommit\":{\"message\":\"[APM][UI]\nSort
environment dropdown alphabetically
(#217710)\\n\\nCloses\n#217814\\n\\n### Summary\\n\\nSort environment
list\nalphabetically.\\n\\n|Before|After|\\n|-|-|\\n|<img
width=\\\"1724\\\"\nalt=\\\"Screenshot 2025-04-10 at 12
01\n15\\\"\\nsrc=\\\"https://github.com/user-attachments/assets/53f0b66d-146a-45d9-b4e3-25bde350a263\\\"\\n/>|<img\nwidth=\\\"1722\\\"
alt=\\\"Screenshot 2025-04-10 at 11
58\n27\\\"\\nsrc=\\\"https://github.com/user-attachments/assets/91315d23-801c-4a16-8688-c43d60c389c8\\\"\\n/>|\",\"sha\":\"23cbaa6d55de4e331ce180f6857db94ca11c209a\"}}]}]\nBACKPORT-->\n\n---------\n\nCo-authored-by:
kibanamachine
<42973632+kibanamachine@users.noreply.github.com>"}},{"branch":"8.16","label":"v8.16.7","labelRegex":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"url":"https://github.com/elastic/kibana/pull/217883","number":217883,"state":"MERGED","mergeCommit":{"sha":"8ea1340a099d0db7aec11f9f0849cd11ea25a589","message":"[8.16]
[APM][UI] Sort environment dropdown alphabetically (#217710)
(#217883)\n\n# Backport\n\nThis will backport the following commits from
`main` to `8.16`:\n- [[APM][UI] Sort environment dropdown
alphabetically\n(#217710)](https://github.com/elastic/kibana/pull/217710)\n\n<!---
Backport version: 9.6.6 -->\n\n### Questions ?\nPlease refer to the
[Backport
tool\ndocumentation](https://github.com/sorenlouv/backport)\n\n<!--BACKPORT
[{\"author\":{\"name\":\"Milosz\nMarcinkowski\",\"email\":\"38698566+miloszmarcinkowski@users.noreply.github.com\"},\"sourceCommit\":{\"committedDate\":\"2025-04-10T15:38:20Z\",\"message\":\"[APM][UI]\nSort
environment dropdown alphabetically
(#217710)\\n\\nCloses\n#217814\\n\\n### Summary\\n\\nSort environment
list\nalphabetically.\\n\\n|Before|After|\\n|-|-|\\n|<img
width=\\\"1724\\\"\nalt=\\\"Screenshot 2025-04-10 at 12
01\n15\\\"\\nsrc=\\\"https://github.com/user-attachments/assets/53f0b66d-146a-45d9-b4e3-25bde350a263\\\"\\n/>|<img\nwidth=\\\"1722\\\"
alt=\\\"Screenshot 2025-04-10 at 11
58\n27\\\"\\nsrc=\\\"https://github.com/user-attachments/assets/91315d23-801c-4a16-8688-c43d60c389c8\\\"\\n/>|\",\"sha\":\"23cbaa6d55de4e331ce180f6857db94ca11c209a\",\"branchLabelMapping\":{\"^v9.1.0$\":\"main\",\"^v8.19.0$\":\"8.x\",\"^v(\\\\d+).(\\\\d+).\\\\d+$\":\"$1.$2\"}},\"sourcePullRequest\":{\"labels\":[\"release_note:skip\",\"backport:prev-major\",\"Team:obs-ux-infra_services\",\"v9.1.0\"],\"title\":\"[APM][UI]\nSort
environment
dropdown\nalphabetically\",\"number\":217710,\"url\":\"https://github.com/elastic/kibana/pull/217710\",\"mergeCommit\":{\"message\":\"[APM][UI]\nSort
environment dropdown alphabetically
(#217710)\\n\\nCloses\n#217814\\n\\n### Summary\\n\\nSort environment
list\nalphabetically.\\n\\n|Before|After|\\n|-|-|\\n|<img
width=\\\"1724\\\"\nalt=\\\"Screenshot 2025-04-10 at 12
01\n15\\\"\\nsrc=\\\"https://github.com/user-attachments/assets/53f0b66d-146a-45d9-b4e3-25bde350a263\\\"\\n/>|<img\nwidth=\\\"1722\\\"
alt=\\\"Screenshot 2025-04-10 at 11
58\n27\\\"\\nsrc=\\\"https://github.com/user-attachments/assets/91315d23-801c-4a16-8688-c43d60c389c8\\\"\\n/>|\",\"sha\":\"23cbaa6d55de4e331ce180f6857db94ca11c209a\"}},\"sourceBranch\":\"main\",\"suggestedTargetBranches\":[],\"targetPullRequestStates\":[{\"branch\":\"main\",\"label\":\"v9.1.0\",\"branchLabelMappingKey\":\"^v9.1.0$\",\"isSourceBranch\":true,\"state\":\"MERGED\",\"url\":\"https://github.com/elastic/kibana/pull/217710\",\"number\":217710,\"mergeCommit\":{\"message\":\"[APM][UI]\nSort
environment dropdown alphabetically
(#217710)\\n\\nCloses\n#217814\\n\\n### Summary\\n\\nSort environment
list\nalphabetically.\\n\\n|Before|After|\\n|-|-|\\n|<img
width=\\\"1724\\\"\nalt=\\\"Screenshot 2025-04-10 at 12
01\n15\\\"\\nsrc=\\\"https://github.com/user-attachments/assets/53f0b66d-146a-45d9-b4e3-25bde350a263\\\"\\n/>|<img\nwidth=\\\"1722\\\"
alt=\\\"Screenshot 2025-04-10 at 11
58\n27\\\"\\nsrc=\\\"https://github.com/user-attachments/assets/91315d23-801c-4a16-8688-c43d60c389c8\\\"\\n/>|\",\"sha\":\"23cbaa6d55de4e331ce180f6857db94ca11c209a\"}}]}]\nBACKPORT-->"}}]}]
BACKPORT-->

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
Milosz Marcinkowski 2025-04-14 15:54:40 +02:00 committed by GitHub
parent c097111a82
commit 1b5224cd3f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 7 additions and 2 deletions

View file

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

View file

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