1
0
mirror of https://gitlab.com/depesz/explain.depesz.com.git synced 2024-11-24 08:42:27 +02:00

subnodes selection for hover/collapse bug fix

+ cte layout/js fix/update
This commit is contained in:
metys 2011-03-26 21:21:16 +00:00
parent 0fb780d09c
commit 5f5a3b5685
2 changed files with 64 additions and 12 deletions

View File

@ -68,16 +68,28 @@
var level = parseInt( row.attr( 'data-level' ) );
var nodeId = row.attr( 'data-node_id' );
row.nextAll( ).each( function( i, r ) {
var r = $( r );
var l = r.attr( 'data-level' )
if ( l == level ) return false;
if ( l == level ) {
if ( r.hasClass( 'sp' ) || r.hasClass( 'ip' ) || r.hasClass( 'cte' ) ) return true;
return false;
}
if ( l == level + 1 ) {
if ( r.attr( 'data-node_parent' ) != nodeId ) return true;
if ( l == level + 1 )
r.addClass( 'sub-n' );
}
} );
},
@ -96,13 +108,40 @@
var affected = 0;
var nodeId = row.attr( 'data-node_id' );
row.nextAll( ).each( function( i, r ) {
var r = $( r );
var l = r.attr( 'data-level' );
if ( l <= level ) return false;
if ( l < level )
return false;
if ( l == level ) {
if ( row.hasClass( 'n' ) ) {
if ( r.hasClass( 'n' ) ) return false;
} else {
return false;
}
}
if ( l == level + 1 ) {
if ( !row.hasClass( 'n' ) ) {
if ( r.attr( 'data-node_parent' ) != nodeId )
return false;
}
}
affected++;

View File

@ -29,6 +29,10 @@
% my $global_node_id = 0;
% my $prev_row_level = 0;
% my $prev_row_class = 'odd';
@ -36,9 +40,10 @@
%
% $block = begin
%
% my ( $node, $level ) = @_;
% my ( $node, $level, $parent ) = @_;
%
% $level ||= 0;
% $parent = '' unless defined $parent;
%
% my $exclusive_point = 1;
% my $inclusive_point = 1;
@ -113,7 +118,9 @@
%
% $row_class .= ' c-' . $row_color;
<tr class="n <%= $row_class %>" data-level="<%= $level =%>" data-e="<%= $exclusive_point =%>" data-i="<%= $inclusive_point =%>" data-x="<%= $rows_x_point =%>">
% my $node_id = $global_node_id++;
<tr class="n <%= $row_class %>" data-node_id="<%= $node_id =%>" data-node_parent="<%= $parent =%>" data-level="<%= $level =%>" data-e="<%= $exclusive_point =%>" data-i="<%= $inclusive_point =%>" data-x="<%= $rows_x_point =%>">
<td class="e c-<%= $exclusive_point =%><%= $cfg->{ ve } ? '' : ' tight' %>">
<span><%= sprintf '%.3f', $node->total_exclusive_time =%></span>
</td>
@ -188,7 +195,9 @@
% for my $cte ( @{ $node->cte_order } ) {
<tr class="cte" data-level="<%= $level =%>">
% my $cte_node_id = $global_node_id++;
<tr class="cte" data-node_id="<%= $cte_node_id =%>" data-node_parent="<%= $node_id =%>" data-level="<%= $level =%>">
<td class="e<%= $cfg->{ ve } ? '' : ' tight' %>"><span>&nbsp;</span></td>
<td class="i<%= $cfg->{ vi } ? '' : ' tight' %>"><span>&nbsp;</span></td>
<td class="x<%= $cfg->{ vx } ? '' : ' tight' %>"><span>&nbsp;</span></td>
@ -201,7 +210,7 @@
</td>
</tr>
%== $block->( $node->cte( $cte ), $level + 1 );
%== $block->( $node->cte( $cte ), $level + 1, $cte_node_id );
% }
@ -211,7 +220,9 @@
% if ( $node->initplans ) {
<tr class="ip" data-level="<%= $level =%>">
% my $ip_node_id = $global_node_id++;
<tr class="ip" data-node_id="<%= $ip_node_id =%>" data-node_parent="<%= $node_id =%>" data-level="<%= $level =%>">
<td class="e<%= $cfg->{ ve } ? '' : ' tight' %>"><span>&nbsp;</span></td>
<td class="i<%= $cfg->{ vi } ? '' : ' tight' %>"><span>&nbsp;</span></td>
<td class="x<%= $cfg->{ vx } ? '' : ' tight' %>"><span>&nbsp;</span></td>
@ -225,19 +236,21 @@
</tr>
% for ( @{ $node->initplans } ) {
%== $block->( $_, $level + 1 );
%== $block->( $_, $level + 1, $ip_node_id );
% }
% }
% if ( $node->sub_nodes ) {
% for ( @{ $node->sub_nodes } ) {
%== $block->( $_, $level + 1 );
%== $block->( $_, $level + 1, $node_id );
% }
% }
% if ( $node->subplans ) {
<tr class="sp" data-level="<%= $level =%>">
% my $sp_node_id = $global_node_id++;
<tr class="sp" data-node_id="<%= $sp_node_id =%>" data-node_parent="<%= $node_id =%>" data-level="<%= $level =%>">
<td class="e<%= $cfg->{ ve } ? '' : ' tight' %>"><span>&nbsp;</span></td>
<td class="i<%= $cfg->{ vi } ? '' : ' tight' %>"><span>&nbsp;</span></td>
<td class="x<%= $cfg->{ vx } ? '' : ' tight' %>"><span>&nbsp;</span></td>
@ -251,7 +264,7 @@
</tr>
% for ( @{ $node->subplans } ) {
%== $block->( $_, $level + 1 );
%== $block->( $_, $level + 1, $sp_node_id );
% }
% }