Skip to content

Commit 9b47c5c

Browse files
stonebuzzRom1-B
andauthored
Rework menu GLPI 10 (#29)
* Feat(UI): rework main menu * Feat(UI): rework main menu * Apply suggestion from @Rom1-B --------- Co-authored-by: Romain B. <8530352+Rom1-B@users.noreply.github.com>
1 parent 656f98e commit 9b47c5c

5 files changed

Lines changed: 45 additions & 37 deletions

File tree

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
## [UNRELEASED]
44

5+
### Added
6+
7+
- Rework main menu
8+
59
### Fixes
610

711
- SQL error when merging the Jamf device linked to a GLPI asset

front/menu.php

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -46,22 +46,25 @@
4646
$links = [];
4747
if (Session::haveRight('plugin_jamf_mobiledevice', CREATE)) {
4848
$links[] = [
49-
'name' => _x('menu', 'Import devices', 'jamf'),
50-
'url' => PluginJamfImport::getSearchURL(),
49+
'name' => _x('menu', 'Import devices', 'jamf'),
50+
'url' => PluginJamfImport::getSearchURL(),
51+
'description' => __('Discover the devices in your Jamf Pro instance to ensure data integrity and prevent the creation of unwanted assets.', 'jamf'),
52+
'action' => __s('Import', 'jamf'),
53+
'pics' => $plugin_dir . '/pics/import.png',
5154
];
5255
$links[] = [
53-
'name' => _x('menu', 'Merge existing devices', 'jamf'),
54-
'url' => "{$plugin_dir}/front/merge.php",
55-
];
56-
}
57-
if (Session::haveRight('config', UPDATE)) {
58-
$links[] = [
59-
'name' => _x('menu', 'Configuration', 'jamf'),
60-
'url' => Config::getFormURL() . '?forcetab=PluginJamfConfig',
56+
'name' => _x('menu', 'Merge existing devices', 'jamf'),
57+
'url' => $plugin_dir . '/front/merge.php',
58+
'description' => __('Compare imported devices with those already present in GLPI using unique identifiers and facilitate the consolidation.', 'jamf'),
59+
'action' => __s('Merge', 'jamf'),
60+
'pics' => $plugin_dir . '/pics/merge.png',
6161
];
6262
}
6363

6464
TemplateRenderer::getInstance()->display('@jamf/menu.html.twig', [
65-
'links' => $links,
65+
'links' => $links,
66+
'can_configure' => Session::haveRight('config', UPDATE),
67+
'config_url' => Config::getFormURL() . '?forcetab=PluginJamfConfig$1',
6668
]);
69+
6770
Html::footer();

pics/import.png

5.8 KB
Loading

pics/merge.png

4.63 KB
Loading

templates/menu.html.twig

Lines changed: 27 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -29,31 +29,32 @@
2929
*/
3030
#}
3131

32-
{% if links|length > 0 %}
33-
<div class="text-center">
34-
<table class="mx-auto table" style="width: 400px">
35-
<thead>
36-
<tr>
37-
<th>{{ _x('plugin_info', 'Jamf plugin', 'jamf') }}</th>
38-
</tr>
39-
</thead>
40-
<tbody>
41-
{% for link in links %}
42-
<tr>
43-
<td>
44-
<a href="{{ link.url }}">{{ link.name }}</a>
45-
</td>
46-
</tr>
47-
{% endfor %}
48-
</tbody>
49-
</table>
50-
</div>
51-
{% else %}
52-
<div class="text-center">
53-
<div class="alert alert-warning" role="alert">
54-
<i class="alert-icon ti ti-alert-triangle fa-2x"></i>
55-
<p class="alert-title">{{ _x('error', 'You do not have access to any Jamf plugin items', 'jamf') }}</p>
56-
<p>{{ _x('error', 'Please check your profile permissions', 'jamf') }}</p>
32+
<div class="container d-flex flex-column justify-content-center mt-4">
33+
{% if can_configure %}
34+
<div class="d-flex justify-content-end mb-4">
35+
<a href="{{ config_url }}" class="btn btn-outline-secondary d-flex align-items-center shadow-sm">
36+
<i class="ti ti-settings me-2"></i> {{ __('Configuration', 'jamf') }}
37+
</a>
5738
</div>
39+
{% endif %}
40+
<div class="row justify-content-center">
41+
{% for link in links %}
42+
<div class="col-md-5 col-lg-4 mb-3">
43+
<div class="card h-100 shadow-sm border-0">
44+
<div class="d-flex justify-content-center align-items-center p-3">
45+
<img src="{{ link.pics }}" class="card-img-top" style="width: 150px; height: 150px; color: var(--tblr-muted) !important;" alt="{{ link.name }}">
46+
</div>
47+
<div class="card-body text-center p-5">
48+
<h5 class="card-title fw-bold">{{ link.name }}</h5>
49+
<p class="card-text">{{ link.description }}</p>
50+
<a href="{{ link.url }}" class="btn btn-primary w-100 mt-3">
51+
{{ link.action }}
52+
</a>
53+
</div>
54+
</div>
55+
</div>
56+
{% endfor %}
5857
</div>
59-
{% endif %}
58+
</div>
59+
60+

0 commit comments

Comments
 (0)