@@ -174,10 +174,7 @@ private function getTreeViewUncached(
174174 }
175175
176176 if (($ mode === 'list_parts_root ' || $ mode === 'devices ' ) && $ this ->rootNodeEnabled ) {
177- //We show the root node as a link to the list of all parts
178- $ show_all_parts_url = $ this ->router ->generate ('parts_show_all ' );
179-
180- $ root_node = new TreeViewNode ($ this ->entityClassToRootNodeString ($ class ), $ show_all_parts_url , $ generic );
177+ $ root_node = new TreeViewNode ($ this ->entityClassToRootNodeString ($ class ), $ this ->entityClassToRootNodeHref ($ class ), $ generic );
181178 $ root_node ->setExpanded ($ this ->rootNodeExpandedByDefault );
182179 $ root_node ->setIcon ($ this ->entityClassToRootNodeIcon ($ class ));
183180
@@ -187,6 +184,19 @@ private function getTreeViewUncached(
187184 return array_merge ($ head , $ generic );
188185 }
189186
187+ protected function entityClassToRootNodeHref (string $ class ): ?string
188+ {
189+ return match ($ class ) {
190+ Category::class => $ this ->router ->generate ('category_new ' ),
191+ StorageLocation::class => $ this ->router ->generate ('store_location_new ' ),
192+ Footprint::class => $ this ->router ->generate ('footprint_new ' ),
193+ Manufacturer::class => $ this ->router ->generate ('manufacturer_new ' ),
194+ Supplier::class => $ this ->router ->generate ('supplier_new ' ),
195+ Project::class => $ this ->router ->generate ('project_new ' ),
196+ default => null ,
197+ };
198+ }
199+
190200 protected function entityClassToRootNodeString (string $ class ): string
191201 {
192202 return match ($ class ) {
0 commit comments