Skip to content

Commit cf23e39

Browse files
author
Robert Jackson
committed
Migrate to index template...
1 parent 136a0db commit cf23e39

File tree

3 files changed

+28
-7
lines changed

3 files changed

+28
-7
lines changed

app/controllers/application.js renamed to app/controllers/index.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
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';
26

37
export default Ember.Controller.extend({
48
init() {
@@ -16,6 +20,16 @@ export default Ember.Controller.extend({
1620
};
1721

1822
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+
});
1933
}
2034
}
2135
});

app/templates/application.hbs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1 @@
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-
81
{{outlet}}

app/templates/index.hbs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
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}}

0 commit comments

Comments
 (0)