mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-06-21 09:35:49 +02:00
Show root node for devices.
This commit is contained in:
parent
c6970505c7
commit
28e7e401d4
2 changed files with 6 additions and 2 deletions
|
@ -139,7 +139,7 @@ class TreeController extends AbstractController
|
|||
*/
|
||||
public function deviceTree(?Device $device = null): JsonResponse
|
||||
{
|
||||
$tree = $this->treeGenerator->getTreeView(Device::class, $device, '');
|
||||
$tree = $this->treeGenerator->getTreeView(Device::class, $device, 'devices');
|
||||
|
||||
return new JsonResponse($tree);
|
||||
}
|
||||
|
|
|
@ -112,6 +112,10 @@ class TreeViewGenerator
|
|||
$href_type = 'list_parts';
|
||||
}
|
||||
|
||||
if ($mode === 'devices') {
|
||||
$href_type = '';
|
||||
}
|
||||
|
||||
$generic = $this->getGenericTree($class, $parent);
|
||||
$treeIterator = new TreeViewNodeIterator($generic);
|
||||
$recursiveIterator = new \RecursiveIteratorIterator($treeIterator, \RecursiveIteratorIterator::SELF_FIRST);
|
||||
|
@ -136,7 +140,7 @@ class TreeViewGenerator
|
|||
}
|
||||
}
|
||||
|
||||
if ($mode === 'list_parts_root') {
|
||||
if ($mode === 'list_parts_root' ||$mode === 'devices') {
|
||||
$root_node = new TreeViewNode($this->translator->trans('tree.root_node.text'), null, $generic);
|
||||
$root_node->setExpanded(true);
|
||||
$generic = [$root_node];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue