File tree Expand file tree Collapse file tree 6 files changed +89
-49
lines changed Expand file tree Collapse file tree 6 files changed +89
-49
lines changed Original file line number Diff line number Diff line change
1
+ import Ember from 'ember' ;
2
+ import fetch from "ember-network/fetch" ;
3
+
4
+ const {
5
+ inject
6
+ } = Ember ;
7
+
8
+ export default Ember . Controller . extend ( {
9
+ graph : inject . service ( ) ,
10
+
11
+ actions : {
12
+ parseFile ( event ) {
13
+ let reader = new FileReader ( ) ;
14
+ reader . onload = ( e ) => {
15
+ var contents = e . target . result ;
16
+ this . get ( 'graph' ) . setGraph ( JSON . parse ( contents ) ) ;
17
+ this . set ( 'showUploadModal' , false ) ;
18
+ } ;
19
+
20
+ reader . readAsText ( event . target . files [ 0 ] ) ;
21
+ } ,
22
+
23
+ useSample ( url ) {
24
+ fetch ( url )
25
+ . then ( ( response ) => {
26
+ return response . json ( ) ;
27
+ } )
28
+ . then ( ( contents ) => {
29
+ this . get ( 'graph' ) . setGraph ( contents ) ;
30
+ this . set ( 'showUploadModal' , false ) ;
31
+ } ) ;
32
+ }
33
+ }
34
+ } )
Original file line number Diff line number Diff line change 1
1
import Ember from 'ember' ;
2
- import fetch from "ember-network/fetch" ;
3
- import config from '../config/environment' ;
4
2
5
3
const {
6
4
inject
7
5
} = Ember ;
8
6
9
7
export default Ember . Controller . extend ( {
10
- graph : inject . service ( ) ,
11
-
12
- actions : {
13
- parseFile ( event ) {
14
- let reader = new FileReader ( ) ;
15
- reader . onload = ( e ) => {
16
- var contents = e . target . result ;
17
- this . get ( 'graph' ) . setGraph ( JSON . parse ( contents ) ) ;
18
- } ;
19
-
20
- reader . readAsText ( event . target . files [ 0 ] ) ;
21
- } ,
22
-
23
- useSample ( url ) {
24
- fetch ( url )
25
- . then ( ( response ) => {
26
- return response . json ( ) ;
27
- } )
28
- . then ( ( contents ) => {
29
- this . get ( 'graph' ) . setGraph ( contents ) ;
30
- } ) ;
31
- }
32
- }
8
+ graph : inject . service ( )
33
9
} ) ;
Original file line number Diff line number Diff line change 3
3
<div class =" nav-left" >
4
4
{{ link-to ' Home' ' index' class =" nav-item is-tab" activeClass =" is-active" }}
5
5
{{ link-to ' Slow Nodes' ' slow-nodes' class =" nav-item is-tab" activeClass =" is-active" }}
6
+ <a class =" nav-item" {{ action (action (mut showUploadModal ) true )}} >
7
+ Upload Data
8
+ </a >
6
9
</div >
7
10
<div class =" nav-center" >
8
11
<p class =" nav-item title" >
19
22
</nav >
20
23
</section >
21
24
25
+ <div class =" modal {{ if showUploadModal ' is-active' }} " >
26
+ <div class =" modal-background" ></div >
27
+ <div class =" modal-content" >
28
+ <div class =" box" >
29
+ <form >
30
+ <div class =" control is-grouped" >
31
+ <label class =" label" >Upload the output of <code >BROCCOLI_VIZ=1 ember build</code >:</label >
32
+ <p class =" control" >
33
+ <input name =" file-upload" type =" file" onchange ={{ action ' parseFile' }} >
34
+ </p >
35
+ </div >
36
+ <div class =" control is-grouped" >
37
+ <label class =" label" >Sample File:</label >
38
+ <p class =" control" >
39
+ <span class =" select is-small" >
40
+ <select onchange ={{ action ' useSample' value =" target.value" }} >
41
+ <option selected disabled>Choose sample file</option >
42
+ <option value =" ./broccoli-viz-files/initial-build-canary-ember-cli-20170206.json" >Empty Project - 2017-02-06</option >
43
+ <option value =" ./broccoli-viz-files/ghost-initial-build-canary-ember-cli-20170206.json" >Ghost Admin Client - 2017-02-06</option >
44
+ </select >
45
+ </span >
46
+ </p >
47
+ </div >
48
+ </form >
49
+ </div >
50
+ </div >
51
+ <button class =" modal-close" {{ action (action (mut showUploadModal ) false )}} ></button >
52
+ </div >
53
+
22
54
{{ outlet }}
Original file line number Diff line number Diff line change 1
- {{ input value =pluginNameFilter placeholder =" Filter by plugin name..." }}
2
- <label >Group by Plugin Name{{ input type =" checkbox" checked =groupByPluginName }} </label >
3
- <button {{ action (action (mut pluginNameFilter ) ' ' )}} >Clear</button >
1
+ <div class =" level" >
2
+ <div class =" level-left" >
3
+ <div class =" level-item" >
4
+ <p class =" control" >
5
+ {{ input value =pluginNameFilter placeholder =" Filter by plugin name..." }}
6
+ </p >
7
+ </div >
8
+ <div class =" level-item" >
9
+ <p class =" control" >
10
+ <label class =" checkbox" >
11
+ {{ input type =" checkbox" checked =groupByPluginName }}
12
+ Group by Plugin Name
13
+ </label >
14
+ </p >
15
+ </div >
16
+ </div >
17
+ <div class =" level-right" >
18
+ <p class =" control" >
19
+ <button class =" button" {{ action (action (mut pluginNameFilter ) ' ' )}} >Clear</button >
20
+ </p >
21
+ </div >
22
+ </div >
4
23
5
24
<table class =" table is-striped" >
6
25
<thead >
Original file line number Diff line number Diff line change 1
- <form >
2
- <div >
3
- <label for =" file-upload" >Upload the output of <code >BROCCOLI_VIZ=1 ember build</code >:</label >
4
- <input name =" file-upload" type =" file" onchange ={{ action ' parseFile' }} >
5
- </div >
6
- <div >
7
- <select onchange ={{ action ' useSample' value =" target.value" }} >
8
- <option selected disabled>Choose sample file</option >
9
- <option value =" ./broccoli-viz-files/initial-build-canary-ember-cli-20170206.json" >Empty Project - 2017-02-06</option >
10
- <option value =" ./broccoli-viz-files/ghost-initial-build-canary-ember-cli-20170206.json" >Ghost Admin Client - 2017-02-06</option >
11
- </select >
12
- </div >
13
- </form >
14
-
15
1
{{! basic-tree graphData=graphData}}
16
2
17
3
{{! useful for testing... }}
Original file line number Diff line number Diff line change 1
- <form >
2
- <div >
3
- <label for =" file-upload" >Upload the `instrumentation.*.json` output of <code >BROCCOLI_VIZ=1 ember build</code >:</label >
4
- <input name =" file-upload" type =" file" onchange ={{ action ' parseFile' }} >
5
- </div >
6
- </form >
7
-
8
1
{{ slow-node-times data =graph.graph }}
You can’t perform that action at this time.
0 commit comments