diff --git a/CHANGELOG.md b/CHANGELOG.md
index 495f05f..18e5a97 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -11,6 +11,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
- Manage dashboard access rights per Group and per User (in addition to per Profile)
+### Changed
+
+- Make the plugin compatible with the Content Security Policy
+
## [1.5.0] - 2026-10-06
### Added
diff --git a/inc/dashboard.class.php b/inc/dashboard.class.php
index 84c5711..3bee3d5 100644
--- a/inc/dashboard.class.php
+++ b/inc/dashboard.class.php
@@ -144,8 +144,8 @@ function ($dashboard) use ($viewable, $profileId) {
'current_dashboard',
array_combine(array_column($dashboards, 'id'), array_column($dashboards, 'name')),
[
- 'on_change' => ($is_helpdesk) ? 'location.href = location.origin+location.pathname+"?uuid="+$(this).val()' : 'reloadTab("uuid=" + $(this).val());',
- 'value' => $currentUuid,
+ 'add_data_attributes' => ['metabase-dashboard-switch' => ($is_helpdesk) ? 'helpdesk' : 'central'],
+ 'value' => $currentUuid,
],
);
diff --git a/public/metabase.js b/public/metabase.js
index c75fabf..9d57229 100644
--- a/public/metabase.js
+++ b/public/metabase.js
@@ -55,4 +55,13 @@ $(function() {
}
});
});
+
+ // jQuery event: select2 triggers change on the native select
+ $(document).on("change", "select[data-metabase-dashboard-switch]", function() {
+ if ($(this).data('metabaseDashboardSwitch') === 'helpdesk') {
+ location.href = location.origin + location.pathname + "?uuid=" + $(this).val();
+ } else {
+ reloadTab("uuid=" + $(this).val());
+ }
+ });
});
diff --git a/setup.php b/setup.php
index 4668bd1..8367911 100644
--- a/setup.php
+++ b/setup.php
@@ -113,12 +113,13 @@ function plugin_init_metabase()
function plugin_version_metabase()
{
return [
- 'name' => 'Metabase',
- 'version' => PLUGIN_METABASE_VERSION,
- 'author' => 'Teclib\'',
- 'license' => 'GPLv2+',
- 'homepage' => 'https://github.com/pluginsGLPI/metabase',
- 'requirements' => [
+ 'name' => 'Metabase',
+ 'version' => PLUGIN_METABASE_VERSION,
+ 'author' => 'Teclib\'',
+ 'license' => 'GPLv2+',
+ 'homepage' => 'https://github.com/pluginsGLPI/metabase',
+ 'csp_compliant' => true,
+ 'requirements' => [
'glpi' => [
'min' => PLUGIN_METABASE_MIN_GLPI,
'max' => PLUGIN_METABASE_MAX_GLPI,