[Rt-commit] rt branch 5.0/add-callbacks-to-dashboard-component-call created. rt-5.0.5-161-g69d8c74438
BPS Git Server
git at git.bestpractical.com
Tue Feb 27 16:03:31 UTC 2024
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "rt".
The branch, 5.0/add-callbacks-to-dashboard-component-call has been created
at 69d8c744386e6aef45cd90e0c00f7fa514777643 (commit)
- Log -----------------------------------------------------------------
commit 69d8c744386e6aef45cd90e0c00f7fa514777643
Author: Ronaldo Richieri <ronaldo at bestpractical.com>
Date: Tue Feb 27 13:02:51 2024 -0300
Add callbacks to dashboard portlet rendering
In some cases, we might want to change portlet attributes
before rendering it, skip it, or even update HasResults
attribute after the portlet has been rendered.
diff --git a/share/html/Dashboards/Elements/ShowPortlet/dashboard b/share/html/Dashboards/Elements/ShowPortlet/dashboard
index 14b343bb28..a15be262bb 100644
--- a/share/html/Dashboards/Elements/ShowPortlet/dashboard
+++ b/share/html/Dashboards/Elements/ShowPortlet/dashboard
@@ -77,6 +77,13 @@ Abort("Possible recursive dashboard detected.") if $Depth > 8;
<%perl>
local $session{CurrentUser} = $session{ContextUser};
for my $portlet (@panes) {
+
+ my $skip_portlet = 0;
+ $m->callback(CallbackName => 'BeforeComponent', Dashboard => $Dashboard,
+ HasResults => $HasResults, Portlet => $portlet, ARGSRef => \%ARGS,
+ SkipPortlet => \$skip_portlet);
+ next if $skip_portlet;
+
$m->comp($portlet->{portlet_type},
Portlet => $portlet,
Rows => $Rows,
@@ -86,6 +93,10 @@ for my $portlet (@panes) {
Depth => $Depth + 1,
HasResults => $HasResults
);
+
+ $m->callback(CallbackName => 'AfterComponent', Dashboard => $Dashboard,
+ HasResults => $HasResults, Portlet => $portlet, ARGSRef => \%ARGS);
+
}
</%perl>
-----------------------------------------------------------------------
hooks/post-receive
--
rt
More information about the rt-commit
mailing list