[Rt-commit] rt branch, 4.4/querybuilder-active-and-inactive-status, created. rt-4.4.2-67-g2c36ffc4c

Maureen Mirville maureen at bestpractical.com
Thu Jan 11 13:29:14 EST 2018


The branch, 4.4/querybuilder-active-and-inactive-status has been created
        at  2c36ffc4c0b987f597470fb4fc3dd9240d197a54 (commit)

- Log -----------------------------------------------------------------
commit c97667948c8074b5823cf6d17d34b7a5f0260c13
Author: Maureen E. Mirville <maureen at bestpractical.com>
Date:   Wed Jan 10 13:28:09 2018 -0500

    Add active and inactive status to query builder
    
    RT already has the functionality to search for active vs inactive
    tickets by manually entering a query in Search/Edit.html. To make
    it easier, users can now select 'active' or 'inactive' from the
    status dropdown menu of the query builder.
    
    Fixes: I#30647

diff --git a/share/html/Elements/SelectStatus b/share/html/Elements/SelectStatus
index b10e5adba..82f60544c 100644
--- a/share/html/Elements/SelectStatus
+++ b/share/html/Elements/SelectStatus
@@ -49,6 +49,10 @@
 % if ( $DefaultValue ) {
 <option value=""<% !$Default && qq[ selected="selected"] |n %>><% $DefaultLabel %></option>
 % }
+% if ( $ShowActiveInactive ) {
+<option value="__Active__"><% loc('active') %></option>
+<option value="__Inactive__"><% loc('inactive') %></option>
+% }
 % for my $lifecycle (sort keys %statuses_by_lifecycle) {
 %     if ($group_by_lifecycle) {
 <optgroup label="<% $lifecycle %>">
@@ -140,4 +144,5 @@ $DefaultLabel => "-"
 
 $Multiple => 0
 $Size => 6
+$ShowActiveInactive => 0
 </%ARGS>
diff --git a/share/html/Search/Elements/PickBasics b/share/html/Search/Elements/PickBasics
index 3f2ed237a..14367c93b 100644
--- a/share/html/Search/Elements/PickBasics
+++ b/share/html/Search/Elements/PickBasics
@@ -103,7 +103,7 @@ my @lines = (
         Value => {
             Type => 'component',
             Path => '/Ticket/Elements/SelectStatus',
-            Arguments => { SkipDeleted => 1, Queues => \%queues },
+            Arguments => { SkipDeleted => 1, Queues => \%queues, ShowActiveInactive => 1 },
         },
     },
     {

commit c72f5371495246d63855a3d9644887dbb1ebf84a
Author: Maureen E. Mirville <maureen at bestpractical.com>
Date:   Wed Jan 10 15:54:13 2018 -0500

    Update query builder tests for active and inactive statuses
    
    Query builder tests were added and existing ones were updated to
    verify when searching for tickets with an active or inactive
    status, the correct query is generated.

diff --git a/t/web/query_builder.t b/t/web/query_builder.t
index dbe909939..578e48631 100644
--- a/t/web/query_builder.t
+++ b/t/web/query_builder.t
@@ -3,7 +3,7 @@ use warnings;
 use HTTP::Request::Common;
 use HTTP::Cookies;
 use LWP;
-use RT::Test tests => 70;
+use RT::Test tests => undef;
 
 my $cookie_jar = HTTP::Cookies->new;
 my ($baseurl, $agent) = RT::Test->started_ok;
@@ -324,3 +324,20 @@ diag "make sure skipped order by field doesn't break search";
         url_regex => qr{/Ticket/Display\.html},
     ), "link to the ticket" );
 }
+
+diag "make sure active and inactive statuses generate the correct query";
+{
+    $agent->get_ok( $url . '/Search/Build.html' );
+    ok( $agent->form_name( 'BuildQuery' ), "found the form" );
+    $agent->select( 'clauses', ['0'] );
+    $agent->field( ValueOfStatus => 'active' );
+    $agent->click( 'DeleteClause' );
+    is getQueryFromForm( $agent ), "Status = '__Active__'", "active status generated the correct query";
+
+    $agent->select( 'clauses', ['0'] );
+    $agent->field( ValueOfStatus => 'inactive' );
+    $agent->click( 'DeleteClause' );
+    is getQueryFromForm( $agent ), "Status = '__Inactive__'", "inactive status generated the correct query";
+}
+
+done_testing;
diff --git a/t/web/query_builder_queue_limits.t b/t/web/query_builder_queue_limits.t
index c1f0a72e3..256092f4c 100644
--- a/t/web/query_builder_queue_limits.t
+++ b/t/web/query_builder_queue_limits.t
@@ -1,7 +1,7 @@
 use strict;
 use warnings;
 
-use RT::Test tests => 34;
+use RT::Test tests => undef;
 
 my $lifecycles = RT->Config->Get('Lifecycles');
 $lifecycles->{foo} = {
@@ -78,7 +78,7 @@ ok( !$form->find_input("ValueOfCF.{foo_cf}"), 'no foo_cf by default' );
 my $status_input = $form->find_input('ValueOfStatus');
 my @statuses     = sort $status_input->possible_values;
 is_deeply(
-    \@statuses, [ '', qw/initial new open open rejected resolved resolved stalled/], 'found all statuses'
+    \@statuses, [ '', qw/__Active__ __Inactive__ initial new open open rejected resolved resolved stalled/], 'found all statuses'
 ) or diag "Statuses are: ", explain \@statuses;
 
 my $owner_input = $form->find_input('ValueOfActor');
@@ -101,7 +101,7 @@ $status_input = $form->find_input('ValueOfStatus');
 @statuses     = sort $status_input->possible_values;
 is_deeply(
     \@statuses,
-    [ '', qw/initial open resolved/ ],
+    [ '', qw/__Active__ __Inactive__ initial open resolved/ ],
     'found statuses from foo only'
 );
 
@@ -126,7 +126,7 @@ $status_input = $form->find_input('ValueOfStatus');
 @statuses     = sort $status_input->possible_values;
 is_deeply(
     \@statuses,
-    [ '', qw/initial new open open rejected resolved resolved stalled/ ],
+    [ '', qw/__Active__ __Inactive__ initial new open open rejected resolved resolved stalled/ ],
     'found all statuses again'
 ) or diag "Statuses are: ", explain \@statuses;
 $owner_input = $form->find_input('ValueOfActor');
@@ -150,7 +150,7 @@ ok( !$form->find_input("ValueOfCF.{general_cf}"), 'no general_cf' );
 $status_input = $form->find_input('ValueOfStatus');
 @statuses     = sort $status_input->possible_values;
 is_deeply(
-    \@statuses, [ '', qw/initial new open open rejected resolved resolved stalled/],
+    \@statuses, [ '', qw/__Active__ __Inactive__ initial new open open rejected resolved resolved stalled/],
     'found all statuses'
 ) or diag "Statuses are: ", explain \@statuses;
 $owner_input = $form->find_input('ValueOfActor');
@@ -173,7 +173,7 @@ $status_input = $form->find_input('ValueOfStatus');
 @statuses     = sort $status_input->possible_values;
 is_deeply(
     \@statuses,
-    [ '', qw/initial new open open rejected resolved resolved stalled/ ],
+    [ '', qw/__Active__ __Inactive__ initial new open open rejected resolved resolved stalled/ ],
     'found all statuses'
 ) or diag "Statuses are: ", explain \@statuses;
 $owner_input = $form->find_input('ValueOfActor');
@@ -181,3 +181,5 @@ $owner_input = $form->find_input('ValueOfActor');
 is_deeply(
     \@owners, [ '', qw/Nobody root user_a user_b/], 'found all users'
 );
+
+done_testing;

commit 2c36ffc4c0b987f597470fb4fc3dd9240d197a54
Author: Maureen E. Mirville <maureen at bestpractical.com>
Date:   Thu Jan 11 13:19:36 2018 -0500

    Update query builder docs to include active/inactive status
    
    Query builder documentation was updated to address the 'active'
    and 'inactive' status options that were added to the status dropdown.

diff --git a/docs/query_builder.pod b/docs/query_builder.pod
index c84b40e60..8f92a9f37 100644
--- a/docs/query_builder.pod
+++ b/docs/query_builder.pod
@@ -27,6 +27,11 @@ src="images/search-criteria.png">
 
 =for :man [Search Criteria F<docs/images/search-criteria.png>]
 
+RT also has two meta-statuses, 'active' and 'inactive'. By selecting either of
+these from the status dropdown of the query builder, you will no longer need
+to explicitly list all of the active or inactive statuses or manually enter
+the queries: "Status = '__Active__'" or "Status = '__Inactive__'".
+
 Now that I've selected some criteria, I can click either Add These Terms or
 Add These Terms and Search. I'll click the former:
 

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


More information about the rt-commit mailing list