Added large query support to adding a new run.

Added a page size selector to tables.


git-svn-id: svn://10.0.0.236/trunk@218618 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
ghendricks%novell.com 2007-01-18 21:37:24 +00:00
parent 9ec4911355
commit 13914e2dce
8 changed files with 72 additions and 27 deletions

View File

@ -108,6 +108,7 @@ sub init {
my $debug = $cgi->param('debug') if $cgi;
my @list;
if ($query){
my $serverpush = support_server_push($cgi);
print "$query" if $debug;
# For paging we need to know the total number of items
# but Search.pm returns a query with a subset
@ -122,7 +123,23 @@ sub init {
my @ids;
my $list = $dbh->selectcol_arrayref($query);
$dbh = Bugzilla->switch_to_main_db();
my $vars;
my $progress_interval = 1000;
my $i = 0;
my $total = scalar @$list;
foreach my $id (@$list){
$i++;
if ($serverpush && $i % $progress_interval == 0){
print $cgi->multipart_end;
print $cgi->multipart_start;
$vars->{'complete'} = $i;
$vars->{'total'} = $total;
Bugzilla->template->process("testopia/progress.html.tmpl", $vars)
|| ThrowTemplateError(Bugzilla->template->error());
}
my $o;
if ($type eq 'case'){
$o = Bugzilla::Testopia::TestCase->new($id);

View File

@ -47,6 +47,11 @@
[% url = "$table.get_page_url&page="%]
[%# url = "$table.url_loc?direction=$direction&getlist=1&page="%]
[% END %]
[% pagesizelist = [{name => 25, id => 25},
{name => 50, id => 50},
{name => 100, id => 100},
{name => 500, id => 500}]%]
<script type='text/javascript'>
var [% table.type %]Table = {
@ -61,10 +66,13 @@
document.location = url;
}
};
function adjustPageSize(psize) {
document.location = "[% url %]&pagesize=" + psize;
}
</script>
<table align="center">
<tr>
<tr style="background-color: #eeeeee; ">
[% IF table.page != 0 %]
<td><a href="[% url %]0[% pc %]">&lt;&lt;&nbsp;First</a></td>
<td><a href="[% url %][% table.page - 1 %][% pc %]">&lt;&nbsp;Previous</a></td>
@ -72,7 +80,7 @@
<td>&lt;&lt;&nbsp;First</td>
<td>&lt;&nbsp;Previous</td>
[% END %]
<td align="center">
<td align="center" style="font-size: medium">
[% SET framewidth = 10 %]
[% IF (table.page_count - 1) < framewidth %]
[% SET p = 0 %]
@ -103,19 +111,6 @@
[% END %]
[% end_mark %]
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input type="button" onclick="[% table.type %]Table.jumpToPage(document.getElementById('jump_[% table.type %]').value)" value="Jump To Page">
<input id="jump_[% table.type %]" size="4">
&nbsp;Out of [% table.page_count %]
&nbsp;&nbsp;&nbsp;
[% IF ajax %]
<a href="[% url %]null,1[% pc %]">All</a>&nbsp;
[% ELSE %]
[% IF table.list_count < MAX_LIMIT %]
<a href="[% url %]&viewall=1">All</a>&nbsp;
[% ELSE %]
<span style="color:gray">All</span>
[% END %]
[% END %]
</td>
[% IF table.page < table.page_count - 1 %]
<td><a href="[% url %][% table.page + 1 %][% pc %]">Next&nbsp;&gt;</a></td>
@ -124,6 +119,30 @@
<td>Next&nbsp;&gt;</td>
<td>Last&nbsp;&gt;&gt;</td>
[% END %]
</tr>
<td colspan="5">
<input type="button" onclick="[% table.type %]Table.jumpToPage(document.getElementById('jump_[% table.type %]').value)" value="Jump To Page">
<input id="jump_[% table.type %]" size="4">
&nbsp;Out of [% table.page_count %] pages
&nbsp;&nbsp;&nbsp;
View [% PROCESS select sel = {list => pagesizelist,
default => table.page_size,
events => 'onchange="adjustPageSize(this.value)"' }%]
records at a time
&nbsp;&nbsp;&nbsp;
[% IF ajax %]
<a href="[% url %]null,1[% pc %]">View All</a>&nbsp;
[% ELSE %]
[% IF table.list_count < MAX_LIMIT %]
<a href="[% url %]&viewall=1">View All</a>&nbsp;
[% ELSE %]
<span style="color:gray">View All</span>
[% END %]
[% END %]
</td>
</tr>
<tr><th colspan="5" style="font-size: 12pt;">[% table.list_count %] records found</th></tr>
</table>
[% END %]

View File

@ -40,7 +40,12 @@
[% PROCESS testopia/style.none.tmpl %]
[% PROCESS testopia/blocks.html.tmpl %]
[% PROCESS testopia/messages.html.tmpl %]
<script type="text/javascript">
djConfig = {
parseWidgets: false,
searchIds: ["tags"]
};
</script>
<script src="testopia/js/util.js" type="text/javascript"></script>
<script src="testopia/dojo/dojo.js" type="text/javascript"></script>
<script type="text/javascript">
@ -72,17 +77,17 @@
[% PROCESS testopia/case/table.html.tmpl %]
<p>
<p><b>
[% IF table.list_count == 0 %]
No test cases
[% ELSE %]
[% IF table.list_count == 1 %]
One test case
[% ELSE %]
[% table.list_count FILTER none %] test cases
[% table.list_count FILTER none %] total test cases
[% END %]
[% END %]
found.
found.</b>
</p>
[% IF dotweak AND table.list_count %]

View File

@ -235,11 +235,11 @@
<h3>Test Runs</h3>
<div id="plan_runs">
[% IF run_table.list_count >0 %]
<a href="tr_new_run.cgi?plan_id=[% plan.id FILTER none %]&case_status_id=2">Create a New Test Run</a><br />
<a href="tr_new_run.cgi?plan_id=[% plan.id FILTER none %]&case_status_id=2&viewall=0">Create a New Test Run</a><br />
[% END %]
[% PROCESS testopia/run/table.html.tmpl
table = run_table %]
<a href="tr_new_run.cgi?plan_id=[% plan.id FILTER none %]&case_status_id=2">Create a New Test Run</a>
<a href="tr_new_run.cgi?plan_id=[% plan.id FILTER none %]&case_status_id=2&viewall=0">Create a New Test Run</a>
<a href="tr_list_runs.cgi?plan_id=[% plan.id FILTER none %]">List Runs</a>
</div>
[%##### Attachments #####%]

View File

@ -37,6 +37,12 @@
[%############################################################################%]
[% PROCESS global/header.html.tmpl %]
<script type="text/javascript">
djConfig = {
parseWidgets: false,
searchIds: ["tags","environment"]
};
</script>
<script src="testopia/js/util.js" type="text/javascript"></script>
<script src="testopia/dojo/dojo.js" type="text/javascript"></script>
@ -50,8 +56,7 @@
<form id="table" method="post" action="tr_new_run.cgi">
<h3>Select Test Cases</h3>
[% IF table.list_count > 0 %]
[% PROCESS testopia/case/table.html.tmpl
cases = plan.test_cases %]
[% PROCESS testopia/case/table.html.tmpl %]
[% ELSE %]
<b>No CONFIRMED test cases found in this test plan.</b>
[% END %]

View File

@ -176,13 +176,13 @@
[% table.list_count FILTER none %] test cases found.
<br/>
<form action="tr_list_cases.cgi" method="POST">
<form action="tr_list_cases.cgi" method="GET">
<input type="hidden" name="exclude" value="[% run.case_id_list FILTER none %]" />
<input type="hidden" name="current_tab" value="case" />
<input type="hidden" name="addrun" value="[% run.id FILTER none %]" />
<input type="hidden" name="plan_id" value="[% run.plan.id FILTER none %]" />
<input type="hidden" name="case_status_id" value="2" />
<input type="hidden" name="viewall" value="1" />
<input type="hidden" name="viewall" value="0" />
<input type="submit" value="Add Cases" />
</form>

View File

@ -257,7 +257,7 @@ if ($table->view_count > $query_limit){
ThrowUserError('testopia-query-too-large', {'limit' => $query_limit});
}
# Check that all of the test cases returned only belong to one product.
if ($table->list_count > 0){
if ($table->list_count > 0 && $table->list_count < 1000 && !$cgi->param('addrun')){
my %case_prods;
my $prod_id;
foreach my $case (@{$table->list}){

View File

@ -190,7 +190,6 @@ if ($action eq 'Add'){
####################
else {
$cgi->param('current_tab', 'case');
$cgi->param('viewall', 1);
my $search = Bugzilla::Testopia::Search->new($cgi);
my $table = Bugzilla::Testopia::Table->new('case', 'tr_new_run.cgi', $cgi, undef, $search->query);
$vars->{'case'} = Bugzilla::Testopia::TestCase->new({'case_id' => 0});