[rt-users] Web UI - limit tickets/page ability?

Jan Okrouhly okrouhly at civ.zcu.cz
Thu Mar 1 10:47:44 EST 2001


On Mon, 5 Feb 2001, Darren Nickerson wrote:

> 
> Folks,
> 
> Since moving from ReqNG to RT some time ago now, our support queue has been
> effectively paralysed by the fact that RT's WWW UI shows the complete list of
> ALL open trouble tickets. Our queue is a large one, and the thousand+ entries
> cause Nutscrape and Internet Destroyer to REALLY chug when trying to render the
> table.
> 
> I note, with joy, that 1.3.x (soon to be 2.x) has the ability to limit results/
> page. I note, with chagrin, the number of issues in that alpha-quality code.
> 
> Do I presently have any viable option here? I just slurped the CVS - is it 
> functional enough to manage a fairly simple queue, or is it still scary 
> monster time? If it's not an option, does anyone have a hack I can wedge into 
> the current stable release?
> 

I've finaly found it...it was sent by Rich West on 25 May 1999 to
rt-users... working pretty well with 0.99.8pre4, but there were no
problems getting into the current 1.0.7 stable version.
I just make some modifications to correct work of his links (Next xx,
Previos xx) to preserve actual setting of sort criteria...
Both are in attachments.

> Thanks in advance.
> 
> -Darren
> 
> 
> 
> _______________________________________________
> rt-users mailing list
> rt-users at lists.fsck.com
> http://lists.fsck.com/mailman/listinfo/rt-users
> 


Jan Okrouhly
---------------------------------------\-\-\+\-\-\---okrouhly at civ.zcu.cz---
Laboratory for Computer Science             |    phone: (420 19) 7491588
University of West Bohemia                  | location: Univerzitni 22
Americka 42, 306 14 Pilsen, Czech Republic  |     room: UI404
------------------------------------------73!-de-OK1INC at OK0PPL.#BOH.CZE.EU-
-------------- next part --------------
diff -cr rt-1.0.7pJO2/lib/rt/ui/web/forms.pm rt-1.0.7pJO3/lib/rt/ui/web/forms.pm
*** rt-1.0.7pJO2/lib/rt/ui/web/forms.pm	Tue Feb 27 22:14:21 2001
--- rt-1.0.7pJO3/lib/rt/ui/web/forms.pm	Thu Mar  1 13:30:17 2001
***************
*** 8,14 ****
  sub FormQueueOptions{
      local($^W) = 0; # Lots of form fields that may or may not exist give bogus errors
      my @qs;

      print "<form action=\"$ScriptURL\" method=\"get\"";
      if ($frames){ 
--- 8,60 ----
  sub FormQueueOptions{
      local($^W) = 0; # Lots of form fields that may or may not exist give bogus errors
      my @qs;
!     my $pa;#flag, that printing ampersand is needed
! 
!     if ($rt::ui::web::FORM{'q_limit'}) {
! 
!       $query = $ENV{'QUERY_STRING'};
!       $query =~ s/&?q_limit=[0-9]+(&?)/\1/;
!       $query =~ s/&?q_range=[0-9]+(&?)/\1/;
!       $query =~ s/&&/&/;
!       $query =~ s/^&//;
!        print "<CENTER>";
!        $range=$rt::ui::web::FORM{'q_limit'} + $rt::ui::web::FORM{'q_range'};
!        print "<A HREF=\"$ScriptURL?";
!        if ($query) {
!           print "$query";
!           $pa=1;
!        }
!        if ($frames) {
!           print "&" if ($pa);
!           print "display=Queue";
!           $pa=1;
!        }
!        print "&" if ($pa);
!        print "q_limit=$rt::ui::web::FORM{'q_limit'}&q_range=$range\">Next $rt::ui::web::FORM{'q_limit'}</A>";
!        print "     ";
!        $pa=0;
!  
!        $range=$rt::ui::web::FORM{'q_range'} - $rt::ui::web::FORM{'q_limit'};
!        if ($range >= 0) {
!           print "<A HREF=\"$ScriptURL?";
!           $pa=0;
!           if ($query) {
!             print "$query";
!             $pa=1;
!           }
!           if ($frames) {
!             print "&" if ($pa);
!             print "display=Queue";
!             $pa=1;
!           }
!           print "&" if ($pa);
!           print "q_limit=$rt::ui::web::FORM{'q_limit'}&q_range=$range\">Previous $rt::ui::web::FORM{'q_limit'}</A>";
!        }
!        else {
!           print " None Previous";
!        }
!     }
  
      print "<form action=\"$ScriptURL\" method=\"get\"";
      if ($frames){ 
***************
*** 159,173 ****
  </font>
  
  
! </td></tr></table></center>
! <B>
! <center><input type=\"submit\" value =\"Update Queue Filters\"></center>
! </B>
! 
  <input type=\"hidden\" name=\"display\" value=\"Queue\">
  </form>
  ";
  }  
  
  sub FormShowNum{
--- 205,259 ----
  </font>
  
  
! </td></tr>
! <tr><td>
!        <font size=\"-1\">
!        <b>Area</b>:
!        <SELECT NAME=\"q_area\">
!        <option value=\"\">Any
!        <option value=\"\">None ";
!            foreach $area ( sort keys % {$rt::queues{$rt::req[$serial_num]{queue_id}}{areas}} )
!      {
!         print "<option ";
!         print "SELECTED" if ($rt::ui::web::FORM{'q_area'} eq $area);
!         print ">$area\n";
!      }
!      print "</select></font>";
!      print "</td><td>
!  <font size=\"-1\"><b>Length</b>:
!  <SELECT NAME=\"q_limit\">";
!          print "<OPTION VALUE=0 ";
!          if ($rt::ui::web::FORM{'q_limit'} == 0 ) { print "SELECTED " ;}
!          print "> All";
!  
!          print "<OPTION VALUE=25 ";
!          if ($rt::ui::web::FORM{'q_limit'} == 25 ) { print "SELECTED " ;}
!          print "> 25";
!  
!          print "<OPTION VALUE=50 ";
!          if ($rt::ui::web::FORM{'q_limit'} == 50 ) { print "SELECTED " ;}
!          print "> 50";
!  
!          print "<OPTION VALUE=100 ";
!          if ($rt::ui::web::FORM{'q_limit'} == 100 ) { print "SELECTED " ;}
!          print "> 100";
!  
!          print "<OPTION VALUE=500 ";
!          if ($rt::ui::web::FORM{'q_limit'} == 500 ) { print "SELECTED " ;}
!          print "> 500";
!  
!          print "<OPTION VALUE=1000 ";
!          if ($rt::ui::web::FORM{'q_limit'} == 1000 ) { print "SELECTED " ;}
!          print "> 1000";
!  
!      print "</select></font>
!  </td>
! <td><table CELLPADDING=0 CELLSPACING=0 BORDER=0><tr VALIGN=TOP>
! <td BGCOLOR=\"#FBFBFB\"><B><input type=\"submit\" value =\"Update Queue Filters\"></B></td></tr></table></td></tr></table></center>
!   
  <input type=\"hidden\" name=\"display\" value=\"Queue\">
  </form>
  ";
  }  
  
  sub FormShowNum{
diff -cr rt-1.0.7pJO2/lib/rt/ui/web/manipulate.pm rt-1.0.7pJO3/lib/rt/ui/web/manipulate.pm
*** rt-1.0.7pJO2/lib/rt/ui/web/manipulate.pm	Tue Feb 27 22:06:54 2001
--- rt-1.0.7pJO3/lib/rt/ui/web/manipulate.pm	Thu Mar  1 16:19:42 2001
***************
*** 435,441 ****
        $status_ops = " status <> \'dead\'";
      } 
    }   
!   
    if ($rt::ui::web::FORM{'q_user'} eq 'other') {
      if ($user_ops){
        $user_ops .= " OR ";
--- 440,453 ----
        $status_ops = " status <> \'dead\'";
      } 
    }   
! 
!   if ($rt::ui::web::FORM{'q_area'} && $rt::ui::web::FORM{'q_area'} ne "Any") {
!     $area_ops .= " area like \'%" . $rt::ui::web::FORM{'q_area'} . "%\' ";
!   }
!   if ($rt::ui::web::FORM{'q_area'} eq "None") {
!     $area_ops = !$area_ops;
!   }
!  
    if ($rt::ui::web::FORM{'q_user'} eq 'other') {
      if ($user_ops){
        $user_ops .= " OR ";
***************
*** 567,572 ****
--- 579,590 ----
      if ($query_string) {$query_string .= " AND ";}
      $query_string .= "( $user_ops )";
    }
+ 
+   if ($area_ops) {
+     if ($query_string) {$query_string .= " AND ";}
+     $query_string .= "( $area_ops )";
+   }
+  
    if ($owner_ops) {
      if ($query_string) {$query_string .= " AND ";}
      $query_string .= "( $owner_ops )";
***************
*** 585,590 ****
--- 603,618 ----
    if ($reverse) {
      $query_string .= " DESC";
    }
+   if ($rt::ui::web::FORM{'q_limit'}) {
+     if ($rt::ui::web::FORM{'q_range'}) {
+        $start = $rt::ui::web::FORM{'q_range'};
+     }
+     else {
+        $start = 0;
+     }
+     $query_string .= " LIMIT $start,$rt::ui::web::FORM{'q_limit'}";
+   }
+ 
    
    
    $count=&rt::get_queue($query_string,$current_user);
-------------- next part --------------
From owner-rt-users-outgoing at fsck.com Tue May 25 20:59:55 1999
Received: from skylight.fsck.com (IDENT:postfix at r240-20-dsl.sea.lightrealm.net [216.122.20.240])
	by ori.zcu.cz (8.9.1a/8.9.1) with ESMTP id UAA32329
	for <okrouhly at civ.zcu.cz>; Tue, 25 May 1999 20:59:30 +0200 (MET DST)
Delivered-To: rt-users-outgoing at fsck.com
Received: by skylight.fsck.com (Postfix, from userid 91)
	id D7DF716BFC; Tue, 25 May 1999 11:57:01 -0700 (PDT)
Delivered-To: rt-users at fsck.com
Received: from CS.Princeton.EDU (CS.Princeton.EDU [128.112.136.10])
	by skylight.fsck.com (Postfix) with ESMTP
	id 3536616BFA; Tue, 25 May 1999 11:56:46 -0700 (PDT)
Received: from princeton.edu (sniper.CS.Princeton.EDU [128.112.152.32])
	by CS.Princeton.EDU (8.8.8/8.8.8) with ESMTP id OAA03618;
	Tue, 25 May 1999 14:55:26 -0400 (EDT)
Message-ID: <374AF222.E4584984 at princeton.edu>
Date: Tue, 25 May 1999 14:55:30 -0400
From: Rich West <rwest at princeton.edu>
Organization: Princeton University Computer Science Department
X-Mailer: Mozilla 4.51 [en] (X11; I; SunOS 5.7 sun4u)
X-Accept-Language: en
MIME-Version: 1.0
To: rt-devel <rt-devel at skylight.fsck.com>,
        "rt-users at horked.fsck.com" <rt-users at skylight.fsck.com>,
        Jesse <jesse at fsck.com>
Subject: rt 99.8pre4 (enhancement)
Content-Type: multipart/mixed;
 boundary="------------13E5E7D313AAD0F536B43B9B"
Sender: owner-rt-users at lists.fsck.com
Precedence: bulk
X-Keywords:                 
X-UID: 699
Status: RO
X-Status: 

This is a multi-part message in MIME format.
--------------13E5E7D313AAD0F536B43B9B
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Well, I've just been plugging away at things... I tackled a problem that
we experience here with our resolved queue.  Basically, we have 11,000
resolved tickets (+/- 1,000), and if you happen to view the resolved
queue, well, you're hosed for the next 20 minutes as it builds the page.

For a while, I thought it would make more sense to break up the queue
view into pieces (eg. display x number of tickets in the queue view at
any one time), but I didn't have the time to put into it.  Well, I
finally got it done.

The first attachment shows the necessary changes to
lib/rt/ui/web/forms.pm to allow for :
1. The ability to search by area, and
2. The ability to limit the output of the Update of the Queue filters to
a user specified limit.

The second attachment shows the necessary changes to
lib/rt/ui/web/manipulate.pm to handle the building of the mysql query
for area searches and output limiting.

-Rich

--
Richard West                  Disclaimer:  These opinions are mine.  They may
Systems Administrator                      be yours; they may be the company's.
Princeton University                       Then again, maybe not.
Computer Science Department
Princeton, NJ                 mailto:rwest at princeton.edu



--------------13E5E7D313AAD0F536B43B9B
Content-Type: text/plain; charset=us-ascii;
 name="mod"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="mod"

*** forms.pm	Tue Apr  6 06:30:06 1999
--- ../../../../../rt-0.99.8pre4-mod/lib/rt/ui/web/forms.pm	Tue May 25 14:45:16 1999
***************
*** 9,14 ****
--- 9,33 ----
      local($^W) = 0; # Lots of form fields that may or may not exist give bogus errors
      my @qs;
      
+    if ($rt::ui::web::FORM{'q_limit'}) {
+       print "<CENTER>";
+       $range=$rt::ui::web::FORM{'q_limit'} + $rt::ui::web::FORM{'q_range'};
+       print "<A HREF=\"$ScriptURL?";
+       print "display=Queue" if ($frames);
+       print "&q_limit=$rt::ui::web::FORM{'q_limit'}&q_range=$range\">Next $rt::ui::web::FORM{'q_limit'}</A>";
+       print "     ";
+ 
+       $range=$rt::ui::web::FORM{'q_range'} - $rt::ui::web::FORM{'q_limit'};
+       if ($range >= 0) {
+          print "<A HREF=\"$ScriptURL?";
+          print "display=Queue" if ($frames);
+          print "&q_limit=$rt::ui::web::FORM{'q_limit'}&q_range=$range\">Previous $rt::ui::web::FORM{'q_limit'}</A>";
+       }
+       else {
+          print " None Previous";
+       }
+    }
+ 
  
      print "<form action=\"$ScriptURL\" method=\"get\"";
      if ($frames){ 
***************
*** 155,164 ****
  </font>
  
  
! </td></tr></table></center>
  <B>
  <center><input type=\"submit\" value =\"Update Queue Filters\"></center>
  </B>
  
  <input type=\"hidden\" name=\"display\" value=\"Queue\">
  </form>
--- 174,226 ----
  	</font>
  
  
! 	</td></tr>
! 	<tr><td>
! 	<font size=\"-1\">
! 	<b>Area</b>:
! 	<SELECT NAME=\"q_area\">
! 	<option value=\"\">Any
! 	<option value=\"\">None ";
! 	    foreach $area ( sort keys % {$rt::queues{$rt::req[$serial_num]{queue_id}}{areas}} )
!     {
!        print "<option ";
!        print "SELECTED" if ($rt::ui::web::FORM{'q_area'} eq $area);
!        print ">$area\n";
!     }
!     print "</select></font>";
!     print "</td><td>
! <font size=\"-1\"><b>Length</b>:
! <SELECT NAME=\"q_limit\">";
!         print "<OPTION VALUE=0 ";
!         if ($rt::ui::web::FORM{'q_limit'} == 0 ) { print "SELECTED " ;}
!         print "> All";
! 
!         print "<OPTION VALUE=25 ";
!         if ($rt::ui::web::FORM{'q_limit'} == 25 ) { print "SELECTED " ;}
!         print "> 25";
! 
!         print "<OPTION VALUE=50 ";
!         if ($rt::ui::web::FORM{'q_limit'} == 50 ) { print "SELECTED " ;}
!         print "> 50";
! 
!         print "<OPTION VALUE=100 ";
!         if ($rt::ui::web::FORM{'q_limit'} == 100 ) { print "SELECTED " ;}
!         print "> 100";
! 
!         print "<OPTION VALUE=500 ";
!         if ($rt::ui::web::FORM{'q_limit'} == 500 ) { print "SELECTED " ;}
!         print "> 500";
! 
!         print "<OPTION VALUE=1000 ";
!         if ($rt::ui::web::FORM{'q_limit'} == 1000 ) { print "SELECTED " ;}
!         print "> 1000";
! 
!     print "</select></font>
! </td><td>
  <B>
  <center><input type=\"submit\" value =\"Update Queue Filters\"></center>
  </B>
+ </td></tr></table></center>
  
  <input type=\"hidden\" name=\"display\" value=\"Queue\">
  </form>

--------------13E5E7D313AAD0F536B43B9B
Content-Type: text/plain; charset=us-ascii;
 name="mods"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="mods"

*** /var/local/pkg/src/rt-0.99.8pre4/lib/rt/ui/web/manipulate.pm	Wed May  5 02:39:48 1999
--- manipulate.pm	Tue May 25 14:30:17 1999
***************
*** 409,414 ****
--- 415,426 ----
      } 
    }   
    
+   if ($rt::ui::web::FORM{'q_area'} && $rt::ui::web::FORM{'q_area'} ne "Any") {
+     $area_ops .= " area like \'%" . $rt::ui::web::FORM{'q_area'} . "%\' ";
+   }
+   if ($rt::ui::web::FORM{'q_area'} eq "None") {
+     $area_ops = !$area_ops;
+   }
    if ($rt::ui::web::FORM{'q_user'} eq 'other') {
      if ($user_ops){
        $user_ops .= " OR ";
***************
*** 544,549 ****
--- 556,565 ----
      if ($query_string) {$query_string .= " AND ";}
      $query_string .= "( $owner_ops )";
    }
+   if ($area_ops) {
+     if ($query_string) {$query_string .= " AND ";}
+     $query_string .= "( $area_ops )";
+   }
    if (!$query_string) {
      $query_string = "(owner = \'$current_user\' or owner = \'\' ) and status = \'open\' ";
    }
***************
*** 558,570 ****
    if ($reverse) {
      $query_string .= " DESC";
    }
    
    
    $count=&rt::get_queue($query_string,$current_user);
  
    #we subtract 1 from the refresh rate so that the default value is -1..which 
    #means never refresh...as 0 should...but 0 means refresh now.
!   $rt::ui::web::FORM{'refresh'} =   $rt::ui::web::FORM{'refresh'}-1;
    if ($rt::ui::web::FORM{'refresh'} >=1) {
    print "<META HTTP-EQUIV=\"REFRESH\" CONTENT=\"". $rt::ui::web::FORM{'refresh'}."\">";
    }
--- 574,595 ----
    if ($reverse) {
      $query_string .= " DESC";
    }
+   if ($rt::ui::web::FORM{'q_limit'}) {
+     if ($rt::ui::web::FORM{'q_range'}) {
+        $start = $rt::ui::web::FORM{'q_range'};
+     }
+     else {
+        $start = 0;
+     }
+     $query_string .= " LIMIT $start,$rt::ui::web::FORM{'q_limit'}";
+   }
    
    
    $count=&rt::get_queue($query_string,$current_user);
  
    #we subtract 1 from the refresh rate so that the default value is -1..which 
    #means never refresh...as 0 should...but 0 means refresh now.
!   $rt::ui::web::FORM{'refresh'} =   $rt::ui::web::FORM{'refresh'}-1 if !defined $rt::ui::web::FORM{'refresh'};
    if ($rt::ui::web::FORM{'refresh'} >=1) {
    print "<META HTTP-EQUIV=\"REFRESH\" CONTENT=\"". $rt::ui::web::FORM{'refresh'}."\">";
    }

--------------13E5E7D313AAD0F536B43B9B--


More information about the rt-users mailing list