backport of commit 67e5b084a1ea525cc5a2b93c2f0ed890d1af0ce3 (#18052)

This pull request was automerged via backport-assistant
This commit is contained in:
hc-github-team-nomad-core 2023-07-24 15:00:43 -05:00 committed by GitHub
parent 04a95ef5c7
commit 51b8993180
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 6 deletions

3
.changelog/18051.txt Normal file
View File

@ -0,0 +1,3 @@
```release-note:improvement
ui: sort variable key/values alphabetically by key when editing
```

View File

@ -21,12 +21,14 @@ export default class VariableSerializer extends ApplicationSerializer {
if (!hash.Items) { if (!hash.Items) {
hash.Items = { '': '' }; hash.Items = { '': '' };
} }
hash.KeyValues = Object.entries(hash.Items).map(([key, value]) => { hash.KeyValues = Object.entries(hash.Items)
return { .map(([key, value]) => {
key, return {
value, key,
}; value,
}); };
})
.sort((a, b) => a.key.localeCompare(b.key));
delete hash.Items; delete hash.Items;
return super.normalizeFindRecordResponse( return super.normalizeFindRecordResponse(
store, store,