Simplify the tree implementation a bit more

This commit is contained in:
Eelco Dolstra 2013-02-20 00:54:03 +01:00
parent 1a992d170d
commit 41d7d63339
3 changed files with 21 additions and 27 deletions

View file

@ -7,12 +7,12 @@
[% job = build.job %] [% job = build.job %]
[% BLOCK renderNode %] [% BLOCK renderNode %]
<li> <li class="treenode">
[% IF done.${node.path} %] [% IF done.${node.path} %]
<p><tt>[% node.name %]</tt> (<em>repeated</em>)</p> <span class="treeline"><tt>[% node.name %]</tt> (<em>repeated</em>)</span>
[% ELSE %] [% ELSE %]
[% done.${node.path} = 1 %] [% done.${node.path} = 1 %]
<p> <span class="treeline">
[% IF node.buildStep %] [% IF node.buildStep %]
<a href="[% c.uri_for('/build' node.buildStep.get_column('build')) %]"><tt>[% node.name %]</tt></a> [% <a href="[% c.uri_for('/build' node.buildStep.get_column('build')) %]"><tt>[% node.name %]</tt></a> [%
IF log_exists(node.buildStep.drvpath); IF log_exists(node.buildStep.drvpath);
@ -21,7 +21,7 @@
[% ELSE %] [% ELSE %]
<tt>[% node.name %]</tt> <tt>[% node.name %]</tt>
[% END %] [% END %]
</p> </span>
[% IF node.refs.size > 0 %] [% IF node.refs.size > 0 %]
<ul> <ul>
[% FOREACH ref IN node.refs; INCLUDE renderNode node=ref; END %] [% FOREACH ref IN node.refs; INCLUDE renderNode node=ref; END %]
@ -34,7 +34,7 @@
<a name="runtime"></a> <a name="runtime"></a>
<h2>Runtime dependency graph</h2> <h2>Runtime dependency graph</h2>
[% IF available %] [% IF available %]
<ul> <ul class="tree">
[% done={}; FOREACH node IN runtimeGraph; INCLUDE renderNode; END %] [% done={}; FOREACH node IN runtimeGraph; INCLUDE renderNode; END %]
</ul> </ul>
[% ELSE %] [% ELSE %]
@ -44,7 +44,7 @@
<a name="buildtime"></a> <a name="buildtime"></a>
<h2>Build-time dependency graph</h2> <h2>Build-time dependency graph</h2>
[% IF drvAvailable %] [% IF drvAvailable %]
<ul> <ul class="tree">
[% INCLUDE renderNode node=buildTimeGraph %] [% INCLUDE renderNode node=buildTimeGraph %]
</ul> </ul>
[% ELSE %] [% ELSE %]

View file

@ -4,27 +4,27 @@ ul.tree, ul.subtree {
list-style-type: none; list-style-type: none;
} }
/* Indent each tree level. */ /* Indent each tree level and draw vertical tree lines next to all
li.tree-line { children except the last. */
ul.subtree > li {
position: relative; position: relative;
padding-left: 2.0em; padding-left: 2.0em;
}
li.tree-line:last-child {
padding-left: 2.1em; /* for the 0.1em border-left in the last child */
}
/* Draw vertical tree lines next to all children except the last. */
li.tree-line {
border-left: 0.1em solid #6185a0; border-left: 0.1em solid #6185a0;
} }
li.tree-line:last-child { ul.subtree > li:last-child {
padding-left: 2.1em; /* for the 0.1em border-left in the last child */
border-left: 0; border-left: 0;
} }
/* Draw the vertical tree line to the last child. */
ul.subtree > li:last-child > *:first-child:before {
border-left: 0.1em solid #6185a0;
}
/* Draw horizontal tree lines to all children. */ /* Draw horizontal tree lines to all children. */
span.tree-conn { ul.subtree > li > *:first-child:before {
content: "";
position: absolute; position: absolute;
height: 0.65em; height: 0.65em;
left: 0em; left: 0em;
@ -32,13 +32,8 @@ span.tree-conn {
border-bottom: 0.1em solid #6185a0; border-bottom: 0.1em solid #6185a0;
} }
/* Draw the vertical tree line to the last child. */ /* Ensure that the + and - have the same size. */
li.tree-line:last-child > span.tree-conn { a.tree-toggle {
border-left: 0.1em solid #6185a0;
}
.tree-toggle {
text-decoration: none; text-decoration: none;
font-family: monospace; font-family: monospace;
font-size: larger;
} }

View file

@ -45,8 +45,7 @@
<ul class='subtree' style="{$style}"> <ul class='subtree' style="{$style}">
<xsl:for-each select='line|nest'> <xsl:for-each select='line|nest'>
<li class='tree-line'> <li>
<span class='tree-conn' />
<xsl:apply-templates select='.'/> <xsl:apply-templates select='.'/>
</li> </li>
</xsl:for-each> </xsl:for-each>