[Bps-public-commit] rt-extension-changemanagement branch master updated. c05dba37f4392171321f79451ba3e9aa7122a145

BPS Git Server git at git.bestpractical.com
Thu Apr 28 20:15:13 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-extension-changemanagement".

The branch, master has been updated
       via  c05dba37f4392171321f79451ba3e9aa7122a145 (commit)
      from  fcf580b97e4701d03de93ad6080532795c31f9b2 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit c05dba37f4392171321f79451ba3e9aa7122a145
Author: Jason Crome <jcrome at bestpractical.com>
Date:   Thu Apr 28 16:12:13 2022 -0400

    Fix existing chg mgmt searches and dashboards
    
    For anyone who installed the previous version of
    RT::Extension::ChangeManagement, the saved searches were created
    incorrectly. This puts their Attribute record in order, and makes sure
    that the change management dashboard reflects these changes.

diff --git a/etc/upgrade/0.02/content b/etc/upgrade/0.02/content
new file mode 100644
index 0000000..39f5d46
--- /dev/null
+++ b/etc/upgrade/0.02/content
@@ -0,0 +1,63 @@
+use strict;
+use warnings;
+
+our @Final = (
+    sub {
+        RT->Logger->debug("Converting attributes");
+
+        my $attribute = RT::Attribute->new( RT->SystemUser );
+        $attribute->LoadByNameAndObject( Name => 'Changes Scheduled, Next 7 Days', Object => RT->SystemUser );
+        my ($status, $msg) = $attribute->__Set( Field => 'Name', Value => 'SavedSearch' );
+        RT->Logger->warning( "Couldn't change attribute $msg" ) unless $status;
+        ($status, $msg) = $attribute->__Set( Field => 'Description', Value => 'Changes Scheduled, Next 7 Days' );
+        RT->Logger->warning( "Couldn't change attribute $msg" ) unless $status;
+
+        $attribute = RT::Attribute->new( RT->SystemUser );
+        $attribute->LoadByNameAndObject( Name => 'Changes Deployed, Last 30 Days', Object => RT->SystemUser );
+        ($status, $msg) = $attribute->__Set( Field => 'Name', Value => 'SavedSearch' );
+        RT->Logger->warning( "Couldn't change attribute $msg" ) unless $status;
+        ($status, $msg) = $attribute->__Set( Field => 'Description', Value => 'Changes Deployed, Last 30 Days' );
+        RT->Logger->warning( "Couldn't change attribute $msg" ) unless $status;
+    },
+    sub {
+        RT->Logger->debug("Converting dashboards");
+
+        my $dashboard = RT::Dashboard->new( RT->SystemUser );
+        $dashboard->LoadByNameAndObject( Name => 'ChangeManagement', Object => RT->SystemUser );
+
+        my @searches;
+        for my $search_desc ( 'Changes Scheduled, Next 7 Days', 'Changes Deployed, Last 30 Days' ) {
+            my $search = RT::Attribute->new( RT->SystemUser );
+            my ( $ret, $msg ) = $search->LoadByCols(
+                Name        => 'SavedSearch',
+                Description => $search_desc,
+            );
+            if ($search && $ret) {
+                push @searches,
+                    {
+                    pane         => 'body',
+                    portlet_type => 'search',
+                    id           => $search->Id,
+                    description  => "Saved Search: $search_desc",
+                    privacy      => join( '-', ref( RT->System ), RT->System->Id ),
+                    };
+                } else {
+                    RT->Logger->error( "Could not load saved search '$search_desc': $msg" );
+                }
+        }
+
+        my $panes = {
+            body => [
+                @searches,
+            ],
+        };
+
+        # fill content
+        my ( $ret, $msg ) = $dashboard->Update( Panes => $panes );
+        if ( !$ret ) {
+            RT->Logger->error("Couldn't update content for dashboard Change Management: $msg");
+        }
+    },
+);
+
+
-----------------------------------------------------------------------

Summary of changes:
 etc/upgrade/0.02/content | 63 ++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 63 insertions(+)
 create mode 100644 etc/upgrade/0.02/content


hooks/post-receive
-- 
rt-extension-changemanagement


More information about the Bps-public-commit mailing list