[Rt-commit] rt branch 5.0/add-callbacks-to-dashboard-component-call created. rt-5.0.5-161-gc08d36b059

BPS Git Server git at git.bestpractical.com
Thu Feb 22 19:59:55 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  c08d36b059042ab9ed3e2e0f4ff618a47b0db0a2 (commit)

- Log -----------------------------------------------------------------
commit c08d36b059042ab9ed3e2e0f4ff618a47b0db0a2
Author: Ronaldo Richieri <ronaldo at bestpractical.com>
Date:   Thu Feb 22 16:57:02 2024 -0300

    Add callbacks to dashboard portlet rendering
    
    In some cases, we might want to change portlet attributes
    before rendering it, or even update HasResults attribute
    after the portlet has been rendered.
    
    This patch adds callbacks before and after rendering
    portlets.

diff --git a/share/html/Dashboards/Elements/ShowPortlet/dashboard b/share/html/Dashboards/Elements/ShowPortlet/dashboard
index 14b343bb28..164c229631 100644
--- a/share/html/Dashboards/Elements/ShowPortlet/dashboard
+++ b/share/html/Dashboards/Elements/ShowPortlet/dashboard
@@ -77,6 +77,10 @@ Abort("Possible recursive dashboard detected.") if $Depth > 8;
 <%perl>
 local $session{CurrentUser} = $session{ContextUser};
 for my $portlet (@panes) {
+
+    $m->callback(CallbackName => 'BeforeComponent', Dashboard => $Dashboard,
+        HasResults => $HasResults, Portlet => $portlet, ARGSRef => \%ARGS);
+
     $m->comp($portlet->{portlet_type},
         Portlet    => $portlet,
         Rows       => $Rows,
@@ -86,6 +90,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