[Rt-commit] rt branch 5.0/add-queues-column-to-lifecycle-admin created. rt-5.0.3-220-g397b828681

BPS Git Server git at git.bestpractical.com
Fri Dec 30 16:28:05 UTC 2022


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-queues-column-to-lifecycle-admin has been created
        at  397b828681baca0c7751dc3f9142cd09d0910676 (commit)

- Log -----------------------------------------------------------------
commit 397b828681baca0c7751dc3f9142cd09d0910676
Author: Ronaldo Richieri <ronaldo at bestpractical.com>
Date:   Fri Dec 30 12:24:25 2022 -0300

    Show queues where the lifecycle is applied to on Lifecycle administration.

diff --git a/share/html/Admin/Lifecycles/index.html b/share/html/Admin/Lifecycles/index.html
index a5bf77dd07..37bae5a4c5 100644
--- a/share/html/Admin/Lifecycles/index.html
+++ b/share/html/Admin/Lifecycles/index.html
@@ -68,6 +68,7 @@
         <th class="collection-as-table"><&|/l&>Name</&></th>
         <th class="collection-as-table"><&|/l&>Type</&></th>
         <th class="collection-as-table"><&|/l&>Enabled</&></th>
+        <th class="collection-as-table"><&|/l&>Queues Applied</&></th>
       </tr>
 % my $i = 0;
 % for my $key ( sort keys %lifecycles ) {
@@ -83,6 +84,21 @@
             <label class="custom-control-label" for="enable-lifecycle-<% $key %>"></label>
           </div>
         </td>
+        <td class="collection-as-table">
+%    if ( $lifecycles{$key}{'queues'} ) {
+%      my $j = 1;
+%      my @queues = @{$lifecycles{$key}{'queues'}};
+%      for my $queue ( @queues ) {
+          <a href="<% RT->Config->Get('WebURL') %>Admin/Queues/Modify.html?id=<% $queue->id() %>"
+            target="_blank"><% $queue->Name() %></a><% 
+                      (($j < scalar @queues)||$lifecycles{$key}{'show_more_queues_link'}) ? ', ' : '' %>
+%        $j++;
+%      }
+%      if ( $lifecycles{$key}{'show_more_queues_link'} ) {
+            <a href="<% RT->Config->Get('WebURL') %>Admin/Queues" target="_blank"><&|/l&>More...</&></a>
+%      }
+%    }
+        </td>
       </tr>
 %    ++$i;
 % }
@@ -101,7 +117,22 @@
 <%INIT>
 my @results;
 
+use constant MAX_QUEUES_PER_LIFECYCLE => 15;
 my %lifecycles = %{RT::Config->Get('Lifecycles')};
+for my $key ( keys %lifecycles ) {
+    next if grep { $key eq $_ } qw/approvals __maps__/;
+    next if $lifecycles{$key}{'type'} && $lifecycles{$key}{'type'} ne 'ticket';
+    my $lifecycle = RT::Lifecycle->Load($key);
+    my $queues = $lifecycle->Queues();
+    $queues->RowsPerPage(MAX_QUEUES_PER_LIFECYCLE);
+    my @queuesarray = @{$queues->ItemsArrayRef()};
+    if ($queues->CountAll()) {
+      $lifecycles{$key}{'queues'} = \@queuesarray;
+      if ($queues->CountAll() > MAX_QUEUES_PER_LIFECYCLE) {
+          $lifecycles{$key}{'show_more_queues_link'} = 1;
+      }
+    }
+}
 
 if ($Submit) {
     my $changed;

-----------------------------------------------------------------------


hooks/post-receive
-- 
rt


More information about the rt-commit mailing list