[Rt-commit] rt branch 5.0/search-url-shortener updated. rt-5.0.2-295-gc2eb03f724

BPS Git Server git at git.bestpractical.com
Thu Sep 1 20:06:46 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/search-url-shortener has been updated
       via  c2eb03f7244db924be74f8de0b06579643629f08 (commit)
      from  c9de22f2ec4bc4426a207eee0df06ad66b6c9518 (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 c2eb03f7244db924be74f8de0b06579643629f08
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Fri Sep 2 03:41:17 2022 +0800

    Shorten search URLs in js charts

diff --git a/share/html/Search/JSChart b/share/html/Search/JSChart
index bc3f9d3ac2..abb054dbb8 100644
--- a/share/html/Search/JSChart
+++ b/share/html/Search/JSChart
@@ -165,22 +165,17 @@ jQuery('#search-chart').click(function(e) {
     var slice = searchChart.getElementAtEvent(e);
     if ( !slice[0] ) return;
 
-    var query = <% $Query =~ /^\s*\(.*\)$/ ? $Query : "( $Query )" |n,j %>;
-    var extra_query;
+    var query;
 %   if ( $stacked ) { # data_queries is array of array for stacked charts
         if ( data_queries[slice[0]._datasetIndex][slice[0]._index] ) {
-            extra_query = data_queries[slice[0]._datasetIndex][slice[0]._index];
+            query = data_queries[slice[0]._datasetIndex][slice[0]._index];
         }
 %   } else {
         if ( data_queries[slice[0]._index] ) {
-            extra_query = data_queries[slice[0]._index];
+            query = data_queries[slice[0]._index];
         }
 %   }
-    if ( extra_query ) {
-        query += ' AND ( ' + extra_query + ')';
-    }
-    window.open(RT.Config.WebPath + '/Search/Results.html?Query=' + encodeURIComponent(query)
-        + '&' + <% $m->comp('/Elements/QueryString', map { $_ => $DECODED_ARGS->{$_} } grep { $_ ne 'Query' } keys %$DECODED_ARGS) |n,j%>);
+    window.open(RT.Config.WebPath + '/Search/Results.html?' + query);
 });
 
 </script>
@@ -218,7 +213,10 @@ my @data_labels;
 my @data_queries;
 while ( my $entry = $report->Next ) {
     push @{ $data[0] }, [ map $entry->LabelValue( $_ ), @{ $columns{'Groups'} } ];
-    push @data_queries, $entry->Query;
+
+    my $subquery = $Query =~ /^\s*\(.*\)$/ ? $Query : "( $Query )";
+    $subquery .= ' AND ( ' . $entry->Query . ')';
+    push @data_queries, QueryString( ShortenSearchQuery( %$DECODED_ARGS, Query => $subquery ) );
 
     my @values;
     my @label_values;

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

Summary of changes:
 share/html/Search/JSChart | 18 ++++++++----------
 1 file changed, 8 insertions(+), 10 deletions(-)


hooks/post-receive
-- 
rt


More information about the rt-commit mailing list