Skip to content

Commit

Permalink
Default-sort variable keyvalues at serialization (#18051)
Browse files Browse the repository at this point in the history
  • Loading branch information
philrenaud authored Jul 24, 2023
1 parent 55723e5 commit 937d927
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
3 changes: 3 additions & 0 deletions .changelog/18051.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:improvement
ui: sort variable key/values alphabetically by key when editing
```
14 changes: 8 additions & 6 deletions ui/app/serializers/variable.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,14 @@ export default class VariableSerializer extends ApplicationSerializer {
if (!hash.Items) {
hash.Items = { '': '' };
}
hash.KeyValues = Object.entries(hash.Items).map(([key, value]) => {
return {
key,
value,
};
});
hash.KeyValues = Object.entries(hash.Items)
.map(([key, value]) => {
return {
key,
value,
};
})
.sort((a, b) => a.key.localeCompare(b.key));
delete hash.Items;
return super.normalizeFindRecordResponse(
store,
Expand Down

0 comments on commit 937d927

Please sign in to comment.