mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-06-21 01:25:55 +02:00
Finished builtin footprints viewer tool.
This commit is contained in:
parent
f84d1f8a8f
commit
04b660d777
7 changed files with 39 additions and 10 deletions
|
@ -130,6 +130,8 @@ perms: # Here comes a list with all Permission names (they have a perm_[name] co
|
||||||
label: "perm.tools.label_scanner"
|
label: "perm.tools.label_scanner"
|
||||||
reel_calculator:
|
reel_calculator:
|
||||||
label: "perm.tools.reel_calculator"
|
label: "perm.tools.reel_calculator"
|
||||||
|
builtin_footprints_viewer:
|
||||||
|
label: "tools.builtin_footprints_viewer.title"
|
||||||
|
|
||||||
groups:
|
groups:
|
||||||
label: "perm.groups"
|
label: "perm.groups"
|
||||||
|
|
|
@ -90,12 +90,14 @@ class ToolsController extends AbstractController
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Route("/builtin_footprints")
|
* @Route("/builtin_footprints", name="tools_builtin_footprints_viewer")
|
||||||
* @param AttachmentPathResolver $pathResolver
|
* @param AttachmentPathResolver $pathResolver
|
||||||
* @return Response
|
* @return Response
|
||||||
*/
|
*/
|
||||||
public function builtInFootprintsViewer(BuiltinAttachmentsFinder $builtinAttachmentsFinder, AttachmentURLGenerator $urlGenerator, ): Response
|
public function builtInFootprintsViewer(BuiltinAttachmentsFinder $builtinAttachmentsFinder, AttachmentURLGenerator $urlGenerator, ): Response
|
||||||
{
|
{
|
||||||
|
$this->denyAccessUnlessGranted('@tools.builtin_footprints_viewer');
|
||||||
|
|
||||||
$grouped_footprints = $builtinAttachmentsFinder->getListOfFootprintsGroupedByFolder();
|
$grouped_footprints = $builtinAttachmentsFinder->getListOfFootprintsGroupedByFolder();
|
||||||
$grouped_footprints = array_map(function($group) use ($urlGenerator) {
|
$grouped_footprints = array_map(function($group) use ($urlGenerator) {
|
||||||
return array_map(function($placeholder_filepath) use ($urlGenerator) {
|
return array_map(function($placeholder_filepath) use ($urlGenerator) {
|
||||||
|
|
|
@ -131,6 +131,12 @@ class ToolsTreeBuilder
|
||||||
$this->urlGenerator->generate('tools_reel_calculator')
|
$this->urlGenerator->generate('tools_reel_calculator')
|
||||||
))->setIcon('fa-treeview fa-fw fa-solid fa-ruler');
|
))->setIcon('fa-treeview fa-fw fa-solid fa-ruler');
|
||||||
}
|
}
|
||||||
|
if ($this->security->isGranted('@tools.builtin_footprints_viewer')) {
|
||||||
|
$nodes[] = (new TreeViewNode(
|
||||||
|
$this->translator->trans('tools.builtin_footprints_viewer.title'),
|
||||||
|
$this->urlGenerator->generate('tools_builtin_footprints_viewer')
|
||||||
|
))->setIcon('fa-treeview fa-fw fa-solid fa-images');
|
||||||
|
}
|
||||||
|
|
||||||
return $nodes;
|
return $nodes;
|
||||||
}
|
}
|
||||||
|
|
|
@ -139,6 +139,7 @@ class PermissionPresetsHelper
|
||||||
$this->permissionResolver->setPermission($perm_holder, 'tools', 'statistics', PermissionData::ALLOW);
|
$this->permissionResolver->setPermission($perm_holder, 'tools', 'statistics', PermissionData::ALLOW);
|
||||||
$this->permissionResolver->setPermission($perm_holder, 'tools', 'label_scanner', PermissionData::ALLOW);
|
$this->permissionResolver->setPermission($perm_holder, 'tools', 'label_scanner', PermissionData::ALLOW);
|
||||||
$this->permissionResolver->setPermission($perm_holder, 'tools', 'reel_calculator', PermissionData::ALLOW);
|
$this->permissionResolver->setPermission($perm_holder, 'tools', 'reel_calculator', PermissionData::ALLOW);
|
||||||
|
$this->permissionResolver->setPermission($perm_holder, 'tools', 'builtin_footprints_viewer', PermissionData::ALLOW);
|
||||||
|
|
||||||
//Set attachments permissions
|
//Set attachments permissions
|
||||||
$this->permissionResolver->setPermission($perm_holder, 'attachments', 'list_attachments', PermissionData::ALLOW);
|
$this->permissionResolver->setPermission($perm_holder, 'attachments', 'list_attachments', PermissionData::ALLOW);
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
{% macro path_to_breadcrumb(path) %}
|
{% macro path_to_breadcrumb(path) %}
|
||||||
<nav aria-label="breadcrumb" >
|
<nav aria-label="breadcrumb" >
|
||||||
<ol class="breadcrumb p-2 bg-light rounded mt-2" id="path-{{ path|replace({'/': '-'}) }}">
|
<ol class="breadcrumb p-2 bg-info rounded mt-3" id="path-{{ path|replace({'/': '-'}) }}">
|
||||||
{% set path_array = path|split("/") %}
|
{% set path_array = path|split("/") %}
|
||||||
{% for part in path_array %}
|
{% for part in path_array %}
|
||||||
<li class="breadcrumb-item {% if loop.last %}active{% endif %}" aria-current="page">
|
<li class="breadcrumb-item {% if loop.last %}active{% endif %}" aria-current="page">
|
||||||
|
@ -13,11 +13,16 @@
|
||||||
</nav>
|
</nav>
|
||||||
{% endmacro %}
|
{% endmacro %}
|
||||||
|
|
||||||
|
{% block title %}{% trans %}tools.builtin_footprints_viewer.title{% endtrans %}{% endblock %}
|
||||||
|
|
||||||
{% block card_title %}
|
{% block card_title %}
|
||||||
Built in Footprints
|
<i class="fa-regular fa-images fa-fw"></i> {% trans %}tools.builtin_footprints_viewer.title{% endtrans %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block card_content %}
|
{% block card_content %}
|
||||||
|
|
||||||
|
<p class="text-muted">{% trans %}tools.builtin_footprints_viewer.hint{% endtrans %}</p>
|
||||||
|
|
||||||
{% for folder, file_array in grouped_footprints %}
|
{% for folder, file_array in grouped_footprints %}
|
||||||
{{ _self.path_to_breadcrumb(folder) }}
|
{{ _self.path_to_breadcrumb(folder) }}
|
||||||
|
|
||||||
|
|
|
@ -123,6 +123,7 @@ class ApplicationAvailabilityFunctionalTest extends WebTestCase
|
||||||
//Tools
|
//Tools
|
||||||
yield ['/tools/reel_calc'];
|
yield ['/tools/reel_calc'];
|
||||||
yield ['/tools/server_infos'];
|
yield ['/tools/server_infos'];
|
||||||
|
yield ['/tools/builtin_footprints'];
|
||||||
|
|
||||||
//Webauthn Register
|
//Webauthn Register
|
||||||
yield ['/webauthn/register'];
|
yield ['/webauthn/register'];
|
||||||
|
|
|
@ -147,7 +147,7 @@
|
||||||
<target>New currency</target>
|
<target>New currency</target>
|
||||||
</segment>
|
</segment>
|
||||||
</unit>
|
</unit>
|
||||||
<unit id="tlgOYB5" name="project.caption">
|
<unit id="zNlEdQs" name="project.caption">
|
||||||
<notes>
|
<notes>
|
||||||
<note category="file-source" priority="1">Part-DB1\templates\AdminPages\DeviceAdmin.html.twig:4</note>
|
<note category="file-source" priority="1">Part-DB1\templates\AdminPages\DeviceAdmin.html.twig:4</note>
|
||||||
<note priority="1">Part-DB1\templates\AdminPages\DeviceAdmin.html.twig:4</note>
|
<note priority="1">Part-DB1\templates\AdminPages\DeviceAdmin.html.twig:4</note>
|
||||||
|
@ -158,7 +158,7 @@
|
||||||
<target>Project</target>
|
<target>Project</target>
|
||||||
</segment>
|
</segment>
|
||||||
</unit>
|
</unit>
|
||||||
<unit id="fu1Uc_k" name="project.edit">
|
<unit id="DTt5Co7" name="project.edit">
|
||||||
<notes>
|
<notes>
|
||||||
<note category="file-source" priority="1">Part-DB1\templates\AdminPages\DeviceAdmin.html.twig:8</note>
|
<note category="file-source" priority="1">Part-DB1\templates\AdminPages\DeviceAdmin.html.twig:8</note>
|
||||||
<note category="state" priority="1">new</note>
|
<note category="state" priority="1">new</note>
|
||||||
|
@ -168,7 +168,7 @@
|
||||||
<target>Edit project</target>
|
<target>Edit project</target>
|
||||||
</segment>
|
</segment>
|
||||||
</unit>
|
</unit>
|
||||||
<unit id="2z6Gm_r" name="project.new">
|
<unit id="O_iNK2O" name="project.new">
|
||||||
<notes>
|
<notes>
|
||||||
<note category="file-source" priority="1">Part-DB1\templates\AdminPages\DeviceAdmin.html.twig:12</note>
|
<note category="file-source" priority="1">Part-DB1\templates\AdminPages\DeviceAdmin.html.twig:12</note>
|
||||||
<note category="state" priority="1">new</note>
|
<note category="state" priority="1">new</note>
|
||||||
|
@ -4095,7 +4095,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can
|
||||||
<target>Go!</target>
|
<target>Go!</target>
|
||||||
</segment>
|
</segment>
|
||||||
</unit>
|
</unit>
|
||||||
<unit id="g6tt4u1" name="project.labelp">
|
<unit id="w0jVACo" name="project.labelp">
|
||||||
<notes>
|
<notes>
|
||||||
<note category="file-source" priority="1">Part-DB1\templates\_sidebar.html.twig:37</note>
|
<note category="file-source" priority="1">Part-DB1\templates\_sidebar.html.twig:37</note>
|
||||||
<note category="file-source" priority="1">Part-DB1\templates\_sidebar.html.twig:12</note>
|
<note category="file-source" priority="1">Part-DB1\templates\_sidebar.html.twig:12</note>
|
||||||
|
@ -6025,7 +6025,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can
|
||||||
<target>Attachment type</target>
|
<target>Attachment type</target>
|
||||||
</segment>
|
</segment>
|
||||||
</unit>
|
</unit>
|
||||||
<unit id="uR5eAkv" name="project.label">
|
<unit id="w.zcG5D" name="project.label">
|
||||||
<notes>
|
<notes>
|
||||||
<note category="file-source" priority="1">Part-DB1\src\Services\ElementTypeNameGenerator.php:82</note>
|
<note category="file-source" priority="1">Part-DB1\src\Services\ElementTypeNameGenerator.php:82</note>
|
||||||
<note priority="1">Part-DB1\src\Services\ElementTypeNameGenerator.php:82</note>
|
<note priority="1">Part-DB1\src\Services\ElementTypeNameGenerator.php:82</note>
|
||||||
|
@ -6215,7 +6215,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can
|
||||||
<target>Categories</target>
|
<target>Categories</target>
|
||||||
</segment>
|
</segment>
|
||||||
</unit>
|
</unit>
|
||||||
<unit id="b2pLmAq" name="tree.tools.edit.projects">
|
<unit id="0I8lDuo" name="tree.tools.edit.projects">
|
||||||
<notes>
|
<notes>
|
||||||
<note category="file-source" priority="1">Part-DB1\src\Services\Trees\ToolsTreeBuilder.php:161</note>
|
<note category="file-source" priority="1">Part-DB1\src\Services\Trees\ToolsTreeBuilder.php:161</note>
|
||||||
<note priority="1">Part-DB1\src\Services\Trees\ToolsTreeBuilder.php:138</note>
|
<note priority="1">Part-DB1\src\Services\Trees\ToolsTreeBuilder.php:138</note>
|
||||||
|
@ -8112,7 +8112,7 @@ Element 3</target>
|
||||||
<target>Manufacturers</target>
|
<target>Manufacturers</target>
|
||||||
</segment>
|
</segment>
|
||||||
</unit>
|
</unit>
|
||||||
<unit id="5_k9ofl" name="perm.projects">
|
<unit id="1AtDlX." name="perm.projects">
|
||||||
<notes>
|
<notes>
|
||||||
<note priority="1">obsolete</note>
|
<note priority="1">obsolete</note>
|
||||||
<note category="state" priority="1">obsolete</note>
|
<note category="state" priority="1">obsolete</note>
|
||||||
|
@ -10249,5 +10249,17 @@ Element 3</target>
|
||||||
<target>Move target</target>
|
<target>Move target</target>
|
||||||
</segment>
|
</segment>
|
||||||
</unit>
|
</unit>
|
||||||
|
<unit id="e2xzHIo" name="tools.builtin_footprints_viewer.title">
|
||||||
|
<segment>
|
||||||
|
<source>tools.builtin_footprints_viewer.title</source>
|
||||||
|
<target>Builtin footprint image gallery</target>
|
||||||
|
</segment>
|
||||||
|
</unit>
|
||||||
|
<unit id="jtxbmbi" name="tools.builtin_footprints_viewer.hint">
|
||||||
|
<segment>
|
||||||
|
<source>tools.builtin_footprints_viewer.hint</source>
|
||||||
|
<target>This gallery lists all available builtin footprint images. If you want to use them in an attachment, type in the name (or a keyword) in the path field of the attachment and select the image from the dropdown select.</target>
|
||||||
|
</segment>
|
||||||
|
</unit>
|
||||||
</file>
|
</file>
|
||||||
</xliff>
|
</xliff>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue