Remove test cases from a run now prompts for confirmation. Allows user to remove multiple cases from a run at once.
git-svn-id: svn://10.0.0.236/trunk@213811 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -950,9 +950,8 @@ sub candelete {
|
||||
my $self = shift;
|
||||
|
||||
return ($self->canedit
|
||||
&& Param('allow-test-deletion')
|
||||
&& scalar @{$self->get_case_run_list} == 1
|
||||
&& $self->status eq 'IDLE');
|
||||
&& Param('allow-test-deletion'));
|
||||
|
||||
}
|
||||
|
||||
=head2 obliterate
|
||||
|
||||
@@ -0,0 +1,74 @@
|
||||
[%# 1.0@bugzilla.org %]
|
||||
[%# The contents of this file are subject to the Mozilla Public
|
||||
# License Version 1.1 (the "License"); you may not use this file
|
||||
# except in compliance with the License. You may obtain a copy of
|
||||
# the License at http://www.mozilla.org/MPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS
|
||||
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
# implied. See the License for the specific language governing
|
||||
# rights and limitations under the License.
|
||||
#
|
||||
# The Original Code is the Bugzilla Test Runner System.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Maciej Maczynski.
|
||||
# Portions created by Maciej Maczynski are Copyright (C) 2001
|
||||
# Maciej Maczynski. All Rights Reserved.
|
||||
#
|
||||
# Contributor(s): Ed Fuentetaja <efuentetaja@acm.org>
|
||||
# Greg Hendricks <ghendricks@novell.com>
|
||||
#%]
|
||||
|
||||
[%# INTERFACE:
|
||||
# ...
|
||||
#%]
|
||||
|
||||
[%############################################################################%]
|
||||
[%# Template Initialization #%]
|
||||
[%############################################################################%]
|
||||
|
||||
[% PROCESS global/variables.none.tmpl %]
|
||||
|
||||
[%############################################################################%]
|
||||
[%# Page Header #%]
|
||||
[%############################################################################%]
|
||||
|
||||
[% PROCESS global/header.html.tmpl %]
|
||||
|
||||
[% IF NOT deleted %]
|
||||
[% IF caseruns %]
|
||||
You are about to permanently remove [% caseruncount %] case(s) from this test run.
|
||||
[% ELSE %]
|
||||
You are about to permanently remove this test case from this run with all its history.
|
||||
[% END %]
|
||||
<br>
|
||||
[% IF bugcount %]
|
||||
This case has <a href="buglist.cgi?bug_id=[% caserun.bug_list FILTER none %]">[% bugcount FILTER none %] [% terms.bugs %]</a> linked to it.<br/>
|
||||
[% END %]
|
||||
<span style="font-size:12pt; font-weight:bold; color:#cc0000;">Warning: This action cannot be undone!</span>
|
||||
<br>
|
||||
<br>
|
||||
<form action="[% form_action FILTER none %]" method="POST">
|
||||
<input type="hidden" name="run_id" value="[% run_id FILTER none %]" />
|
||||
<input type="hidden" name="action" value="do_delete" />
|
||||
[% IF caseruns %]
|
||||
[% FOREACH c = caseruns %]
|
||||
<input type="hidden" name="caserun_id" value="[% c.id FILTER none %]" />
|
||||
[% END %]
|
||||
[% ELSE %]
|
||||
<input type="hidden" name="caserun_id" value="[% caserun.id FILTER none %]" />
|
||||
[% END %]
|
||||
<input type="submit" value="Remove" />
|
||||
</form>
|
||||
|
||||
<a href="tr_show_run.cgi?run_id=[% caserun.run.id FILTER none %]">Cancel</a>
|
||||
|
||||
[% ELSE %]
|
||||
|
||||
Test case(s) removed.
|
||||
[% IF run_id %]
|
||||
<a href="tr_show_run.cgi?run_id=[% run_id FILTER none %]">Go back to test run [% run_id FILTER none %]</a>
|
||||
[% END %]
|
||||
[% END %]
|
||||
|
||||
[% PROCESS global/footer.html.tmpl %]
|
||||
@@ -49,6 +49,9 @@
|
||||
<br/>
|
||||
[% IF table.list_count %]
|
||||
[% PROCESS "testopia/caserun/case-history.html.tmpl" %]
|
||||
[% IF Param('allow-test-deletion') %]
|
||||
<p align="right"><input type="submit" name="action" value="Delete Selected" /></p>
|
||||
[% END %]
|
||||
[% END %]
|
||||
<p>
|
||||
[% IF table.list_count == 0 %]
|
||||
|
||||
@@ -33,7 +33,7 @@ use Bugzilla::Testopia::TestCaseRun;
|
||||
use Bugzilla::Testopia::Table;
|
||||
|
||||
use vars qw($vars $template);
|
||||
require "globals.pl";
|
||||
require 'globals.pl';
|
||||
|
||||
my $dbh = Bugzilla->dbh;
|
||||
my $cgi = Bugzilla->cgi;
|
||||
@@ -46,6 +46,7 @@ $cgi->send_cookie(-name => "TEST_LAST_ORDER",
|
||||
-expires => "Fri, 01-Jan-2038 00:00:00 GMT");
|
||||
Bugzilla->login();
|
||||
print $cgi->header;
|
||||
|
||||
my $action = $cgi->param('action') || '';
|
||||
|
||||
if ($action eq 'Commit'){
|
||||
@@ -131,6 +132,43 @@ if ($action eq 'Commit'){
|
||||
}
|
||||
exit;
|
||||
}
|
||||
elsif ($action eq 'Delete Selected'){
|
||||
Bugzilla->login(LOGIN_REQUIRED);
|
||||
my $reg = qr/r_([\d]+)/;
|
||||
my @caseruns;
|
||||
foreach my $p ($cgi->param()){
|
||||
my $caserun = Bugzilla::Testopia::TestCaseRun->new($1) if $p =~ $reg;
|
||||
ThrowUserError("testopia-read-only", {'object' => 'case run'}) if ($caserun && !$caserun->candelete);
|
||||
push @caseruns, $caserun if $caserun;
|
||||
}
|
||||
ThrowUserError('testopia-none-selected', {'object' => 'case-run'}) if (scalar @caseruns < 1);
|
||||
$vars->{'caseruns'} = \@caseruns;
|
||||
$vars->{'caseruncount'} = scalar @caseruns;
|
||||
$vars->{'title'} = "Remove Test Cases from Run";
|
||||
$vars->{'form_action'} = 'tr_list_caseruns.cgi';
|
||||
$vars->{'run_id'} = $cgi->param('run_id');
|
||||
$template->process("testopia/caserun/delete.html.tmpl", $vars) ||
|
||||
ThrowTemplateError($template->error());
|
||||
exit;
|
||||
}
|
||||
elsif ($action eq 'do_delete'){
|
||||
Bugzilla->login(LOGIN_REQUIRED);
|
||||
my @caseruns;
|
||||
foreach my $id ($cgi->param('caserun_id')){
|
||||
my $caserun = Bugzilla::Testopia::TestCaseRun->new($id);
|
||||
push @caseruns, $caserun;
|
||||
ThrowUserError("testopia-read-only", {'object' => 'case run'}) if !$caserun->candelete;
|
||||
}
|
||||
foreach my $c (@caseruns){
|
||||
$c->obliterate;
|
||||
}
|
||||
$vars->{'deleted'} = 1;
|
||||
$vars->{'run_id'} = $cgi->param('run_id');
|
||||
$template->process("testopia/caserun/delete.html.tmpl", $vars) ||
|
||||
ThrowTemplateError($template->error());
|
||||
exit;
|
||||
}
|
||||
|
||||
# Take the search from the URL params and convert it to SQL
|
||||
$cgi->param('current_tab', 'case_run');
|
||||
my $search = Bugzilla::Testopia::Search->new($cgi);
|
||||
|
||||
@@ -139,6 +139,17 @@ if ($action eq 'Commit'){
|
||||
display($caserun);
|
||||
}
|
||||
elsif ($action eq 'delete'){
|
||||
Bugzilla->login(LOGIN_REQUIRED);
|
||||
my $caserun = Bugzilla::Testopia::TestCaseRun->new($caserun_id);
|
||||
ThrowUserError("testopia-read-only", {'object' => 'case run'}) if !$caserun->candelete;
|
||||
$vars->{'title'} = 'Remove Test Case '. $caserun->case->id .' from Run: ' . $caserun->run->summary;
|
||||
$vars->{'bugcount'} = scalar @{$caserun->bugs};
|
||||
$vars->{'form_action'} = 'tr_show_caserun.cgi';
|
||||
$vars->{'caserun'} = $caserun;
|
||||
$template->process("testopia/caserun/delete.html.tmpl", $vars) ||
|
||||
ThrowTemplateError($template->error());
|
||||
}
|
||||
elsif ($action eq 'do_delete'){
|
||||
Bugzilla->login(LOGIN_REQUIRED);
|
||||
my $caserun = Bugzilla::Testopia::TestCaseRun->new($caserun_id);
|
||||
ThrowUserError("testopia-read-only", {'object' => 'case run'}) if !$caserun->candelete;
|
||||
|
||||
Reference in New Issue
Block a user