[Rt-commit] rt branch 5.0/add-callbacks-to-dashboard-component-call created. rt-5.0.5-163-gb2e5e84c22
BPS Git Server
git at git.bestpractical.com
Mon Mar 4 21:01:38 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 b2e5e84c22eab6ebffbcb3bee99a49cca371c7d3 (commit)
- Log -----------------------------------------------------------------
commit b2e5e84c22eab6ebffbcb3bee99a49cca371c7d3
Author: Ronaldo Richieri <ronaldo at bestpractical.com>
Date: Mon Mar 4 18:01:04 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..966517caa5 100644
--- a/share/html/Dashboards/Elements/ShowPortlet/dashboard
+++ b/share/html/Dashboards/Elements/ShowPortlet/dashboard
@@ -76,7 +76,18 @@ Abort("Possible recursive dashboard detected.") if $Depth > 8;
<%perl>
local $session{CurrentUser} = $session{ContextUser};
+
+$m->callback(CallbackName => 'BeforePanes', Dashboard => $current_dashboard,
+ HasResults => $HasResults, Portlet => $Portlet, ARGSRef => \%ARGS);
+
for my $portlet (@panes) {
+
+ my $skip_portlet = 0;
+ $m->callback(CallbackName => 'BeforeComponent', Dashboard => $current_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 +97,10 @@ for my $portlet (@panes) {
Depth => $Depth + 1,
HasResults => $HasResults
);
+
+ $m->callback(CallbackName => 'AfterComponent', Dashboard => $current_dashboard,
+ HasResults => $HasResults, Portlet => $portlet, ARGSRef => \%ARGS);
+
}
</%perl>
-----------------------------------------------------------------------
hooks/post-receive
--
rt
More information about the rt-commit
mailing list