Finished builtin footprints viewer tool.

This commit is contained in:
Jan Böhmer 2023-01-09 23:40:54 +01:00
parent f84d1f8a8f
commit 04b660d777
7 changed files with 39 additions and 10 deletions

View file

@ -130,6 +130,8 @@ perms: # Here comes a list with all Permission names (they have a perm_[name] co
label: "perm.tools.label_scanner"
reel_calculator:
label: "perm.tools.reel_calculator"
builtin_footprints_viewer:
label: "tools.builtin_footprints_viewer.title"
groups:
label: "perm.groups"

View file

@ -90,12 +90,14 @@ class ToolsController extends AbstractController
}
/**
* @Route("/builtin_footprints")
* @Route("/builtin_footprints", name="tools_builtin_footprints_viewer")
* @param AttachmentPathResolver $pathResolver
* @return Response
*/
public function builtInFootprintsViewer(BuiltinAttachmentsFinder $builtinAttachmentsFinder, AttachmentURLGenerator $urlGenerator, ): Response
{
$this->denyAccessUnlessGranted('@tools.builtin_footprints_viewer');
$grouped_footprints = $builtinAttachmentsFinder->getListOfFootprintsGroupedByFolder();
$grouped_footprints = array_map(function($group) use ($urlGenerator) {
return array_map(function($placeholder_filepath) use ($urlGenerator) {

View file

@ -131,6 +131,12 @@ class ToolsTreeBuilder
$this->urlGenerator->generate('tools_reel_calculator')
))->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;
}

View file

@ -139,6 +139,7 @@ class PermissionPresetsHelper
$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', 'reel_calculator', PermissionData::ALLOW);
$this->permissionResolver->setPermission($perm_holder, 'tools', 'builtin_footprints_viewer', PermissionData::ALLOW);
//Set attachments permissions
$this->permissionResolver->setPermission($perm_holder, 'attachments', 'list_attachments', PermissionData::ALLOW);

View file

@ -2,7 +2,7 @@
{% macro path_to_breadcrumb(path) %}
<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("/") %}
{% for part in path_array %}
<li class="breadcrumb-item {% if loop.last %}active{% endif %}" aria-current="page">
@ -13,11 +13,16 @@
</nav>
{% endmacro %}
{% block title %}{% trans %}tools.builtin_footprints_viewer.title{% endtrans %}{% endblock %}
{% block card_title %}
Built in Footprints
<i class="fa-regular fa-images fa-fw"></i> {% trans %}tools.builtin_footprints_viewer.title{% endtrans %}
{% endblock %}
{% block card_content %}
<p class="text-muted">{% trans %}tools.builtin_footprints_viewer.hint{% endtrans %}</p>
{% for folder, file_array in grouped_footprints %}
{{ _self.path_to_breadcrumb(folder) }}

View file

@ -123,6 +123,7 @@ class ApplicationAvailabilityFunctionalTest extends WebTestCase
//Tools
yield ['/tools/reel_calc'];
yield ['/tools/server_infos'];
yield ['/tools/builtin_footprints'];
//Webauthn Register
yield ['/webauthn/register'];

View file

@ -147,7 +147,7 @@
<target>New currency</target>
</segment>
</unit>
<unit id="tlgOYB5" name="project.caption">
<unit id="zNlEdQs" name="project.caption">
<notes>
<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>
@ -158,7 +158,7 @@
<target>Project</target>
</segment>
</unit>
<unit id="fu1Uc_k" name="project.edit">
<unit id="DTt5Co7" name="project.edit">
<notes>
<note category="file-source" priority="1">Part-DB1\templates\AdminPages\DeviceAdmin.html.twig:8</note>
<note category="state" priority="1">new</note>
@ -168,7 +168,7 @@
<target>Edit project</target>
</segment>
</unit>
<unit id="2z6Gm_r" name="project.new">
<unit id="O_iNK2O" name="project.new">
<notes>
<note category="file-source" priority="1">Part-DB1\templates\AdminPages\DeviceAdmin.html.twig:12</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>
</segment>
</unit>
<unit id="g6tt4u1" name="project.labelp">
<unit id="w0jVACo" name="project.labelp">
<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: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>
</segment>
</unit>
<unit id="uR5eAkv" name="project.label">
<unit id="w.zcG5D" name="project.label">
<notes>
<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>
@ -6215,7 +6215,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can
<target>Categories</target>
</segment>
</unit>
<unit id="b2pLmAq" name="tree.tools.edit.projects">
<unit id="0I8lDuo" name="tree.tools.edit.projects">
<notes>
<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>
@ -8112,7 +8112,7 @@ Element 3</target>
<target>Manufacturers</target>
</segment>
</unit>
<unit id="5_k9ofl" name="perm.projects">
<unit id="1AtDlX." name="perm.projects">
<notes>
<note priority="1">obsolete</note>
<note category="state" priority="1">obsolete</note>
@ -10249,5 +10249,17 @@ Element 3</target>
<target>Move target</target>
</segment>
</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>
</xliff>