[Rt-commit] rt branch 5.0/add-callbacks-to-dashboard-component-call created. rt-5.0.5-163-g3151ba1998
BPS Git Server
git at git.bestpractical.com
Mon Mar 4 21:33:22 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 3151ba19989ceba57326021fc44df6b303bcad1b (commit)
- Log -----------------------------------------------------------------
commit 3151ba19989ceba57326021fc44df6b303bcad1b
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..1cab239b12 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_processing = 0;
+ $m->callback(CallbackName => 'BeforeComponent', Dashboard => $current_dashboard,
+ HasResults => $HasResults, Portlet => $portlet, ARGSRef => \%ARGS,
+ SkipProcessing => \$skip_processing);
+ last if $skip_processing;
+
$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