blob: 2df38eb29e1ec71f8d8066ca565b5b698bfc699e [file] [log] [blame]
Paul Greysonc090d142013-04-09 16:59:03 -07001function appInit(cb) {
Paul Greyson7a300822013-04-09 12:57:49 -07002
3 // populates selected flows with empty rows
4 updateSelectedFlows();
5
6 d3.select('#showFlowChooser').on('click', function () {
7 showFlowChooser();
8 });
Paul Greysonc090d142013-04-09 16:59:03 -07009
Paul Greysone6266b92013-04-09 23:15:27 -070010 d3.select('#action-all').on('click', function () {
Jonathan Harte865f9b2013-04-13 12:08:42 -070011 var prompt = "Add backup controllers?"
Paul Greyson28cf92b2013-04-10 13:15:06 -070012 doConfirm(prompt, function (result) {
13 if (result) {
14 switchAll();
15 }
16 });
Paul Greysone6266b92013-04-09 23:15:27 -070017 });
18
19 d3.select('#action-local').on('click', function () {
20 var prompt = "Switch controllers to local?"
Paul Greyson28cf92b2013-04-10 13:15:06 -070021 doConfirm(prompt, function (result) {
22 if (result) {
23 switchLocal();
24 }
25 });
Paul Greysone6266b92013-04-09 23:15:27 -070026 });
27
28 d3.select('#action-scale').on('click', function () {
Paul Greysonb14d40d2013-04-11 12:37:30 -070029 var prompt = "Scale network?"
30 doConfirm(prompt, function (result) {
31 if (result) {
32 scaleNetwork();
33 }
34 });
Paul Greysone6266b92013-04-09 23:15:27 -070035 });
36
Paul Greyson69f8baa2013-04-10 12:16:53 -070037 d3.select('#action-reset').on('click', function () {
Paul Greysonb14d40d2013-04-11 12:37:30 -070038 var prompt = "Reset network?"
39 doConfirm(prompt, function (result) {
40 if (result) {
41 resetNetwork();
42 }
43 });
Paul Greyson69f8baa2013-04-10 12:16:53 -070044 });
45
Paul Greyson0ad75202013-04-11 12:29:32 -070046 d3.select('#action-kill').on('click', function () {
Tim Lindberg6445a182013-04-15 10:17:18 -070047 var prompt = "Kill ONOS instance?";
Paul Greyson0ad75202013-04-11 12:29:32 -070048 var options = model.activeControllers;
49 doConfirm(prompt, function (result) {
50 controllerDown(result);
51 }, options);
52 });
53
Paul Greysonc090d142013-04-09 16:59:03 -070054 createTopologyView(cb);
Paul Greyson7a300822013-04-09 12:57:49 -070055}