mirror of
https://github.com/alkimake/paperclip.git
synced 2026-06-15 10:30:37 +09:00
Sort agents alphabetically by name in all views
Sort the flat list view, org tree view, and sidebar agents list alphabetically by name using localeCompare. Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
parent
e61f00d4c1
commit
bdecb1bad2
2 changed files with 16 additions and 8 deletions
|
|
@ -28,6 +28,10 @@ function sortByHierarchy(agents: Agent[]): Agent[] {
|
|||
list.push(a);
|
||||
childrenOf.set(parent, list);
|
||||
}
|
||||
// Sort children at each level alphabetically by name
|
||||
for (const [, list] of childrenOf) {
|
||||
list.sort((a, b) => a.name.localeCompare(b.name));
|
||||
}
|
||||
const sorted: Agent[] = [];
|
||||
const queue = childrenOf.get(null) ?? [];
|
||||
while (queue.length > 0) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue