mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2026-01-14 06:09:33 +00:00
PoC for predefined filters in the tools sidebar menu
Custom filters would need some extra work if they are to be implemented. Fixes #938.
This commit is contained in:
parent
c44535990b
commit
89c230322a
2 changed files with 59 additions and 0 deletions
|
|
@ -90,10 +90,38 @@ class ToolsTreeBuilder
|
|||
});
|
||||
}
|
||||
|
||||
protected function getFilterNode(): array
|
||||
{
|
||||
$nodes = [];
|
||||
|
||||
if ($this->security->isGranted('@parts.read')) {
|
||||
$nodes[] = (new TreeViewNode(
|
||||
$this->translator->trans('filter.less_than_desired'),
|
||||
$this->urlGenerator->generate('parts_filter_less_than_desired')
|
||||
))->setIcon("fa-treeview fa-fw fa-solid fa-circle-exclamation");
|
||||
}
|
||||
|
||||
if ($this->security->isGranted('@parts.read')) {
|
||||
$nodes[] = (new TreeViewNode(
|
||||
$this->translator->trans('filter.custom'),
|
||||
$this->urlGenerator->generate('parts_filter_custom')
|
||||
))->setIcon("fa-treeview fa-fw fa-solid fa-code");
|
||||
}
|
||||
return $nodes;
|
||||
}
|
||||
|
||||
protected function getToolsNode(): array
|
||||
{
|
||||
$nodes = [];
|
||||
|
||||
if ($this->security->isGranted('@parts.read')) {
|
||||
$nodes[] = (new TreeViewNode(
|
||||
$this->translator->trans('filter.title'),
|
||||
null,
|
||||
$this->getFilterNode()
|
||||
))->setIcon("fa-fw fa-treeview fa-solid fa-filter");
|
||||
}
|
||||
|
||||
if ($this->security->isGranted('@labels.create_labels')) {
|
||||
$nodes[] = (new TreeViewNode(
|
||||
$this->translator->trans('tree.tools.tools.label_dialog'),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue