tree collapsing

This commit is contained in:
Sander Hautvast 2018-07-17 12:51:51 +02:00
parent c91b2ad80b
commit a3e3594bb8
5 changed files with 61 additions and 49 deletions

View file

@ -1,7 +1,7 @@
body { body {
background:white; background:white;
font: normal 12px/150% Arial, Helvetica, sans-serif; font: normal 12px/150% Arial, Helvetica, sans-serif;
padding:5px; padding:2px;
} }
.view{ .view{
@ -12,43 +12,73 @@ body {
border-radius: 3px; border-radius: 3px;
} }
/** .tree, .tree ul {
* Framework starts from here ...
* ------------------------------
*/
.tree,
.tree ul {
margin:0 0 0 1em; /* indentation */ margin:0 0 0 1em; /* indentation */
padding:0; padding:0;
list-style:none; list-style:none;
color:#369; color:#369;
position:relative; position:relative;
left:0px;
} }
.tree ul {margin-left:.5em} /* (indentation/2) */ .treeView{
position: relative;
left:-20px;
}
.tree:before,
.tree ul:before {
.tree li input ~ ul{
display: none;
height: 0;
}
/*
.tree input {
background: url(toggle-small-expand.png) no-repeat;
height: 1em;
content: "\00a0\00a0\00a0";
overflow: hidden;
width: 16px;
height: 16px;
}
.tree input:checked{
background: url(toggle-small.png) no-repeat;
}*/
.tree li input:checked ~ ul{
display: inline;
}
/* .tree li input:checked { display: block; margin: 0 0 0.125em; 2px} */
/* .tree li input:checked li:last-child { margin: 0 0 0.063em; 1px } */
.tree ul {margin-left:1em} /* (indentation/2) */
.tree li:before {
content:""; content:"";
display:block; display:block;
width:0; width:10px; /* same with indentation */
height:0;
border-top:1px solid;
margin-top:-3px; /* border top width */
position:absolute; position:absolute;
top:0; top:1em; /* (line-height/2) */
bottom:0; left:px;
left:0;
border-left:1px solid;
} }
.tree li { .tree li {
margin:0; border-left:1px solid;
padding:0 1.5em; /* indentation + .5em */ margin-left: -3px;
line-height:2em; /* default list item's `line-height` */ padding: 0 0em; /* indentation + .5em */
position:relative; line-height: 1.5em; /* default list item's `line-height` */
color: #000; position: relative;
color: #00496B;
left:20px;
} }
.datagrid table { .datagrid table {
border-collapse: collapse; border-collapse: collapse;
text-align: left; text-align: left;
@ -69,15 +99,11 @@ body {
padding: 3px 10px; padding: 3px 10px;
} }
.datagrid table thead th {
}
.datagrid table thead th:first-child { .datagrid table thead th:first-child {
border: none; border: none;
} }
.datagrid table tbody td { .datagrid table tbody tr {
color: #00496B; color: #00496B;
border-left: 1px solid #E1EEF4; border-left: 1px solid #E1EEF4;
font-size: 12px; font-size: 12px;
@ -86,7 +112,6 @@ body {
.datagrid table tbody .alt td { .datagrid table tbody .alt td {
background: #E1EEF4; background: #E1EEF4;
color: #00496B;
} }
.datagrid table tbody td:first-child { .datagrid table tbody td:first-child {
@ -122,22 +147,7 @@ body {
display: inline; display: inline;
} }
.datagrid table tfoot li a { .datagrid tbody tr:hover {
text-decoration: none;
display: inline-block;
padding: 2px 8px;
margin: 1px;
color: #FFFFFF;
border: 1px solid #006699;
-webkit-border-radius: 3px;
-moz-border-radius: 3px;
border-radius: 3px;
background: -webkit-gradient(linear, left top, left bottom, color-stop(0.05, #006699), color-stop(1, #00557F));
background: -moz-linear-gradient(center top, #006699 5%, #00557F 100%);
background-color: #006699;
}
.datagrid table tfoot ul.active, .datagrid table tfoot ul a:hover {
text-decoration: none; text-decoration: none;
border-color: #006699; border-color: #006699;
color: #FFFFFF; color: #FFFFFF;

View file

@ -26,7 +26,7 @@ class List extends Component {
<thead><tr><th>name</th><th>invocations</th><th>totalDuration</th><th>average</th></tr></thead> <thead><tr><th>name</th><th>invocations</th><th>totalDuration</th><th>average</th></tr></thead>
<tbody> <tbody>
{this.state.data.map(datum => {this.state.data.map(datum =>
<tr key={datum.name}><td>{datum.name}</td><td>{datum.invocations}</td><td>{datum.totalDuration}</td><td>{datum.average}</td></tr> <tr key={datum.name}><td>{datum.name}</td><td>{datum.invocations}</td><td>{Math.floor(datum.totalDuration/1000)/1000}</td><td>{Math.floor(datum.average/1000)/1000}</td></tr>
)} )}
</tbody> </tbody>
</table> </table>

View file

@ -18,7 +18,7 @@ class Tree extends Component {
return (<ul className="tree"> return (<ul className="tree">
{children.map( {children.map(
r => r =>
<li> <li><input type="checkbox" className="tree"></input>
{Math.floor(r.report.average / 1000) / 1000} ms &nbsp; {Math.floor(r.report.average / 1000) / 1000} ms &nbsp;
- {r.report.invocations} inv. &nbsp; - {r.report.invocations} inv. &nbsp;
{r.report.name} {r.report.name}
@ -32,11 +32,13 @@ class Tree extends Component {
return ( return (
<div> <div>
<div className="view"><h1>Callstack view</h1> <div className="view"><h1>Callstack view</h1>
<div className="treeView">
{/* <button type="button" onClick={this.loadData()}> refresh </button> */} {/* <button type="button" onClick={this.loadData()}> refresh </button> */}
{this.renderChildren(this.state.data)} {this.renderChildren(this.state.data)}
</div> </div>
</div>
<p/> <p/>
<List/> <List />
</div> </div>
) )
} }

BIN
ui/src/toggle-small-expand.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 418 B

BIN
ui/src/toggle-small.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 394 B