summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorlpsolit%gmail.com <>2007-04-07 18:18:02 +0200
committerlpsolit%gmail.com <>2007-04-07 18:18:02 +0200
commit49ac4e07d266ab55285e6c497cab5d17c56e8fcf (patch)
treeae498e7b437fb2acf727143eb840dc116248ffd7
parentb1710c8f53ed757f1c06e84e4c2790832232c58f (diff)
downloadbugzilla-49ac4e07d266ab55285e6c497cab5d17c56e8fcf.tar.gz
bugzilla-49ac4e07d266ab55285e6c497cab5d17c56e8fcf.tar.xz
Bug 102622: Dependency graphs should be able to be limited by "relationship" - Patch by Frédéric Buclin <LpSolit@gmail.com> r=wicked a=LpSolit
-rwxr-xr-xshowdependencygraph.cgi58
-rw-r--r--template/en/default/bug/dependency-graph.html.tmpl47
2 files changed, 61 insertions, 44 deletions
diff --git a/showdependencygraph.cgi b/showdependencygraph.cgi
index 77259182f..92b6bd450 100755
--- a/showdependencygraph.cgi
+++ b/showdependencygraph.cgi
@@ -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');
diff --git a/template/en/default/bug/dependency-graph.html.tmpl b/template/en/default/bug/dependency-graph.html.tmpl
index 5c1eb8471..5ae858569 100644
--- a/template/en/default/bug/dependency-graph.html.tmpl
+++ b/template/en/default/bug/dependency-graph.html.tmpl
@@ -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>