File tree Expand file tree Collapse file tree 3 files changed +28
-7
lines changed Expand file tree Collapse file tree 3 files changed +28
-7
lines changed 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
+
5
+ const SAMPLE_DATA = config . rootURL + 'broccoli-viz-files/initial-build-canary-20161220.json' ;
2
6
3
7
export default Ember . Controller . extend ( {
4
8
init ( ) {
@@ -16,6 +20,16 @@ export default Ember.Controller.extend({
16
20
} ;
17
21
18
22
reader . readAsText ( event . target . files [ 0 ] ) ;
23
+ } ,
24
+
25
+ useSample ( ) {
26
+ fetch ( SAMPLE_DATA )
27
+ . then ( ( response ) => {
28
+ return response . json ( ) ;
29
+ } )
30
+ . then ( ( response ) => {
31
+ this . set ( 'graphData' , response ) ;
32
+ } ) ;
19
33
}
20
34
}
21
35
} ) ;
Original file line number Diff line number Diff line change 1
- <input type =" file" onchange ={{ action ' parseFile' }} >
2
-
3
- {{ basic-tree graphData =graphData }}
4
-
5
- {{! useful for testing... }}
6
- {{! basic-tree graphPath="/broccoli-viz-files/initial-build-canary-20161220.json"}}
7
-
8
1
{{ outlet }}
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
+ <button {{ action ' useSample' }} >Display sample</button >
8
+ </div >
9
+ </form >
10
+
11
+ {{! basic-tree graphData=graphData}}
12
+
13
+ {{! useful for testing... }}
14
+ {{ basic-tree graphData =graphData }}
You can’t perform that action at this time.
0 commit comments