Commit 49ac4e07 authored by lpsolit%gmail.com's avatar lpsolit%gmail.com

Bug 102622: Dependency graphs should be able to be limited by "relationship" -…

Bug 102622: Dependency graphs should be able to be limited by "relationship" - Patch by Fré©ric Buclin <LpSolit@gmail.com> r=wicked a=LpSolit
parent b1710c8f
......@@ -106,9 +106,10 @@ if (lsearch(\@valid_rankdirs, $rankdir) < 0) {
$rankdir = 'LR';
}
my $display = $cgi->param('display') || 'tree';
my $webdotdir = bz_locations()->{'webdotdir'};
if (!defined $cgi->param('id') && !defined $cgi->param('doall')) {
if (!defined $cgi->param('id') && $display ne 'doall') {
ThrowCodeError("missing_bug_id");
}
......@@ -125,7 +126,7 @@ node [URL="${urlbase}show_bug.cgi?id=\\N", style=filled, color=lightgrey]
my %baselist;
if ($cgi->param('doall')) {
if ($display eq 'doall') {
my $dependencies = $dbh->selectall_arrayref(
"SELECT blocked, dependson FROM dependencies");
......@@ -135,29 +136,48 @@ if ($cgi->param('doall')) {
}
} else {
foreach my $i (split('[\s,]+', $cgi->param('id'))) {
$i = trim($i);
ValidateBugID($i);
$baselist{$i} = 1;
}
my @stack = keys(%baselist);
my $sth = $dbh->prepare(
q{SELECT blocked, dependson
FROM dependencies
WHERE blocked = ? or dependson = ?});
foreach my $id (@stack) {
my $dependencies = $dbh->selectall_arrayref($sth, undef, ($id, $id));
foreach my $dependency (@$dependencies) {
my ($blocked, $dependson) = @$dependency;
if ($blocked != $id && !exists $seen{$blocked}) {
push @stack, $blocked;
}
if ($dependson != $id && !exists $seen{$dependson}) {
push @stack, $dependson;
if ($display eq 'web') {
my $sth = $dbh->prepare(q{SELECT blocked, dependson
FROM dependencies
WHERE blocked = ? OR dependson = ?});
foreach my $id (@stack) {
my $dependencies = $dbh->selectall_arrayref($sth, undef, ($id, $id));
foreach my $dependency (@$dependencies) {
my ($blocked, $dependson) = @$dependency;
if ($blocked != $id && !exists $seen{$blocked}) {
push @stack, $blocked;
}
if ($dependson != $id && !exists $seen{$dependson}) {
push @stack, $dependson;
}
AddLink($blocked, $dependson, $fh);
}
}
}
# This is the default: a tree instead of a spider web.
else {
my @blocker_stack = @stack;
foreach my $id (@blocker_stack) {
my $blocker_ids = Bugzilla::Bug::EmitDependList('blocked', 'dependson', $id);
foreach my $blocker_id (@$blocker_ids) {
push(@blocker_stack, $blocker_id) unless $seen{$blocker_id};
AddLink($id, $blocker_id, $fh);
}
}
my @dependent_stack = @stack;
foreach my $id (@dependent_stack) {
my $dep_bug_ids = Bugzilla::Bug::EmitDependList('dependson', 'blocked', $id);
foreach my $dep_bug_id (@$dep_bug_ids) {
push(@dependent_stack, $dep_bug_id) unless $seen{$dep_bug_id};
AddLink($dep_bug_id, $id, $fh);
}
AddLink($blocked, $dependson, $fh);
}
}
......@@ -294,7 +314,7 @@ foreach my $f (@files)
my @bugs = grep(detaint_natural($_), split(/[\s,]+/, $cgi->param('id')));
$vars->{'bug_id'} = join(', ', @bugs);
$vars->{'multiple_bugs'} = ($cgi->param('id') =~ /[ ,]/);
$vars->{'doall'} = $cgi->param('doall');
$vars->{'display'} = $display;
$vars->{'rankdir'} = $rankdir;
$vars->{'showsummary'} = $cgi->param('showsummary');
......
......@@ -64,42 +64,39 @@
<hr>
<form action="showdependencygraph.cgi">
<form action="showdependencygraph.cgi" method="GET">
<table>
<tr>
<th align="left"><label for="id">[% terms.Bug %] numbers</label>:</th>
<td><input id="id" name="id" value="[% bug_id %]"></td>
<td>
[% terms.Bug %] numbers:
<input name="id" value="[% bug_id %]">
<input type="checkbox" id="showsummary" name="showsummary" [% " checked" IF showsummary %]>
<label for="showsummary">Show the summaries of all displayed [% terms.bugs %]</label>
</td>
</tr>
<tr>
<td>
<input type="checkbox" name="doall"
[% " checked" IF doall %]>
Show <b>every</b> [% terms.bug %] in the system with dependencies
</td>
</tr>
<tr>
<td colspan="3">
<input type="checkbox" name="showsummary"
[% " checked" IF showsummary %]>
Show the summaries of all displayed [% terms.bugs %]
<th align="left"><label for="display">Display:</label></th>
<td colspan="2">
<select id="display" name="display">
<option value="tree"[% 'selected="selected"' IF (!display || display == "tree") %]>
Restrict to [% terms.bugs %] having a direct relationship with entered [% terms.bugs %]</option>
<option value="web" [% 'selected="selected"' IF display == "web" %]>
Show all [% terms.bugs %] having any relationship with entered [% terms.bugs %]</option>
<option value="doall" [% 'selected="selected"' IF display == "doall" %]>
Show every [% terms.bug %] in the system with dependencies</option>
</select>
</td>
</tr>
<tr>
<td colspan="3">
<select name="rankdir">
<option value="TB"
[% " selected" IF rankdir == "TB" %]>
Orient top-to-bottom
</option>
<option value="LR"
[% " selected" IF rankdir == "LR" %]>
Orient left-to-right
</option>
<th align="left"><label for="rankdir">Orientation:</label></th>
<td colspan="2">
<select id="rankdir" name="rankdir">
<option value="TB"[% " selected" IF rankdir == "TB" %]>Top to bottom</option>
<option value="BT"[% " selected" IF rankdir == "BT" %]>Bottom to top</option>
<option value="LR"[% " selected" IF rankdir == "LR" %]>Left to right</option>
<option value="RL"[% " selected" IF rankdir == "RL" %]>Right to left</option>
</select>
</td>
</tr>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment