Skip to content

Commit 7533f00

Browse files
author
Robert Jackson
committed
Add better details display...
1 parent f6a8ee1 commit 7533f00

File tree

4 files changed

+52
-7
lines changed

4 files changed

+52
-7
lines changed

app/components/slow-node-times.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
import Ember from 'ember';
22

33
const {
4+
get,
5+
set,
46
computed,
5-
getOwner,
67
inject
78
} = Ember;
89

@@ -91,11 +92,16 @@ export default Ember.Component.extend({
9192

9293
actions: {
9394
'focus-node'(node) {
95+
this.get('graph').selectNode(node);
96+
},
97+
98+
toggleDetailsForNode(node) {
9499
if (node.groupedByPluginName) {
95100
this.set('groupByPluginName', false);
96101
this.set('pluginNameFilter', node.label.name);
97102
} else {
98-
this.get('graph').selectNode(node);
103+
let shown = get(node, 'showDetails');
104+
set(node, 'showDetails', !shown);
99105
}
100106
}
101107
}

app/helpers/includes.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import Ember from 'ember';
2+
3+
export default Ember.Helper.helper(function([haystack, needle]) {
4+
return haystack && haystack.includes && haystack.includes(needle);
5+
});

app/helpers/stats-iterator.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import Ember from 'ember';
2+
3+
export default Ember.Helper.helper(function([node]) {
4+
let stats = {};
5+
6+
for (let [name, value] of node.statsIterator()) {
7+
stats[name] = value;
8+
}
9+
10+
return stats;
11+
});

app/templates/components/slow-node-times.hbs

Lines changed: 28 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,23 +8,46 @@
88
<td style="width: 65%">Description</td>
99
<td>{{if groupByPluginName "Count" "Plugin Name"}}</td>
1010
<td>Time (ms)</td>
11-
<td>&nbsp;</td>
1211
</tr>
1312
</thead>
1413
<tbody>
1514
{{#each nodes as |node|}}
16-
<tr>
15+
<tr {{action 'toggleDetailsForNode' node}}>
1716
<td>{{node.label.name}}</td>
1817
<td>{{node.label.broccoliPluginName}}</td>
1918
<td>{{ns-to-ms node._stats.time.plugin}}</td>
20-
<td>
21-
<button {{action 'focus-node' node}}>Show Graph</button></td>
2219
</tr>
20+
{{#if node.showDetails}}
21+
<tr>
22+
<td colspan="3">
23+
<div class="card">
24+
<header class="card-header">
25+
<p class="card-header-title">
26+
Node Stats
27+
</p>
28+
</header>
29+
<div class="card-content">
30+
{{#each-in (stats-iterator node) as |stat value|}}
31+
<div>
32+
<strong>{{stat}}</strong>:
33+
{{#if (includes stat 'time')}}
34+
{{ns-to-ms value}}ms
35+
{{else}}
36+
{{value}}
37+
{{/if}}
38+
</div>
39+
{{/each-in}}
40+
</div>
41+
</div>
42+
<button class="button" {{action 'focus-node' node}}>Show Graph</button>
43+
</td>
44+
</tr>
45+
{{/if}}
2346
{{/each}}
2447
</tbody>
2548
<tfoot>
2649
<tr>
27-
<td colspan=3 class="has-text-right">Total</td>
50+
<td colspan=2 class="has-text-right">Total</td>
2851
<td>{{ns-to-ms totalTime}}</td>
2952
</tr>
3053
</tfoot>

0 commit comments

Comments
 (0)