sort profiles by groups - fixes #4163

This commit is contained in:
Eugene Pankov 2021-07-09 10:02:58 +02:00
parent 6df8707b6d
commit 46e0035327
No known key found for this signature in database
GPG Key ID: 5896FCBBDD1CF4F4

View File

@ -43,8 +43,8 @@ export class ProfilesService {
...this.config.store.profiles ?? [],
...list,
]
list.sort((a, b) => a.group?.localeCompare(b.group ?? '') ?? -1)
list.sort((a, b) => a.name.localeCompare(b.name))
const sortKey = p => `${p.group ?? ''} / ${p.name}`
list.sort((a, b) => sortKey(a).localeCompare(sortKey(b)))
list.sort((a, b) => (a.isBuiltin ? 1 : 0) - (b.isBuiltin ? 1 : 0))
return list
}