/
MainLayout.js
77 lines (62 loc) · 1.67 KB
/
MainLayout.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
define([
"exports",
"dojo/query",
"dijit/layout/BorderContainer",
"dijit/layout/TabContainer",
"dijit/layout/StackContainer",
"dijit/layout/ContentPane",
"./views/HeaderPane",
"./views/TrafficPane",
"./views/ReportPane",
"./views/TrafficView", //Deprecated, refactor to dojo
"./traffic",
"dojo/domReady!"
], function(exports,query, BorderContainer, TabContainer, StackContainer, ContentPane, HeaderPane, TrafficPane, ReportPane, TrafficView, traffic) {
//appLayout covers everything
var appLayout = new BorderContainer({
design: "headline",
liveSplitters: false,
gutters: false
}, "appLayout");
var header = new HeaderPane({
region: "top",
id: "header",
style: "width: 100%;"
});
//main covers the whole content area, but not the header
var main = new StackContainer({
id: "main",
region: "center"
});
//populate appLayout
appLayout.addChild(header);
appLayout.addChild(main);
//Traffic Pane, our default view with search sidebar and traffic table.
var trafficPane = new TrafficPane({
liveSplitters: false,
gutters: false
});
//Report Pane
var reportPane = new ReportPane({
liveSplitters: false,
gutters: false
});
//populate main
main.addChild(trafficPane);
main.addChild(reportPane);
appLayout.startup();
var trafficView = new TrafficView({
collection: traffic,
el: $("#trafficTable .data tbody")[0]
});
trafficView.$el.on("click", "tr", function() {
trafficPane.selectFlow($(this).data("flow-id"));
});
exports.showPane = function(index){
main.selectChild(main.getChildren()[index]);
};
exports.header = header;
exports.trafficView = trafficView;
exports.trafficPane = trafficPane;
return exports;
});