HEL-430: replace directory search picker with collapsible tree
Co-authored-by: Cursor <cursoragent@cursor.com> Co-authored-by: multica-agent <github@multica.ai>
This commit is contained in:
co-authored by
Cursor
multica-agent
parent
8ceafe70b1
commit
fbafb8015d
+2
-7
@@ -167,13 +167,8 @@ function directoryPickerItems(array $dirs): array
|
||||
}
|
||||
unset($children);
|
||||
$pathMap = dirPathMap($dirs);
|
||||
$nameCounts = [];
|
||||
foreach ($dirs as $d) {
|
||||
$n = (string) $d['name'];
|
||||
$nameCounts[$n] = ($nameCounts[$n] ?? 0) + 1;
|
||||
}
|
||||
$out = [];
|
||||
$walk = static function (int $parent) use (&$walk, $byParent, $pathMap, $nameCounts, &$out): void {
|
||||
$walk = static function (int $parent) use (&$walk, $byParent, $pathMap, &$out): void {
|
||||
foreach ($byParent[$parent] ?? [] as $d) {
|
||||
$id = (int) $d['id'];
|
||||
$name = (string) $d['name'];
|
||||
@@ -182,7 +177,7 @@ function directoryPickerItems(array $dirs): array
|
||||
'name' => $name,
|
||||
'path' => (string) ($pathMap[$id] ?? $name),
|
||||
'level' => (int) ($d['level'] ?? 1),
|
||||
'dup' => ($nameCounts[$name] ?? 0) > 1,
|
||||
'parent_id' => $parent,
|
||||
];
|
||||
$walk($id);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user