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

BPS Git Server git at git.bestpractical.com
Wed Feb 28 21:12:47 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  dfb7ed3bd240ac6087689919e663c58de3447fe5 (commit)

- Log -----------------------------------------------------------------
commit dfb7ed3bd240ac6087689919e663c58de3447fe5
Author: Ronaldo Richieri <ronaldo at bestpractical.com>
Date:   Wed Feb 28 18:12:17 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..07075f684d 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 => $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 +93,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