Bri Prebilic Cole

GUI -- Created sample button and toggle for demo.

Change-Id: I3e2fc93f63688856ce14f347e20b4fb813866970
...@@ -20,25 +20,44 @@ ...@@ -20,25 +20,44 @@
20 20
21 (function () { 21 (function () {
22 'use strict'; 22 'use strict';
23 - var tbs; 23 + var $log, tbs, flash,
24 + sampleDiv;
25 +
26 + function btnFn() {
27 + flash.flash('Hi there friends!');
28 + }
29 + function togFn(display) {
30 + if (display) { sampleDiv.style('display', 'block'); }
31 + else { sampleDiv.style('display', 'none'); }
32 + }
24 33
25 angular.module('ovSample', ['onosUtil']) 34 angular.module('ovSample', ['onosUtil'])
26 - .controller('OvSampleCtrl', ['$log', 'ToolbarService', 35 + .controller('OvSampleCtrl', ['$log', 'ToolbarService', 'FlashService',
27 - function (_$log_, _tbs_) { 36 + function (_$log_, _tbs_, _flash_) {
28 - var self = this, 37 + var self = this;
29 - $log = _$log_, 38 + $log = _$log_;
30 - tbs = _tbs_; 39 + tbs = _tbs_;
40 + flash = _flash_;
31 41
32 self.message = 'Hey there folks!'; 42 self.message = 'Hey there folks!';
33 43
44 + sampleDiv = d3.select('#ov-sample')
45 + .append('div')
46 + .text('Look at me!')
47 + .style({
48 + 'display': 'none',
49 + 'color': 'rgb(204, 89, 81)',
50 + 'font-size': '20pt'
51 + });
52 +
34 var toolbar = tbs.createToolbar('sample'), 53 var toolbar = tbs.createToolbar('sample'),
35 rset = [{ gid: 'switch', cb: function () {}}, 54 rset = [{ gid: 'switch', cb: function () {}},
36 { gid: 'bird', cb: function () {}}]; 55 { gid: 'bird', cb: function () {}}];
37 - toolbar.addButton('some-btn', 'crown', function () {}); 56 + toolbar.addButton('hello-btn', 'crown', btnFn);
38 - toolbar.addToggle('some-tog', 'chain', function () {}); 57 + toolbar.addToggle('sample-tog', 'chain', false, togFn);
39 toolbar.addSeparator(); 58 toolbar.addSeparator();
40 toolbar.addRadioSet('some-rad', rset); 59 toolbar.addRadioSet('some-rad', rset);
41 - toolbar.show(); 60 + toolbar.hide();
42 61
43 $log.log('OvSampleCtrl has been created'); 62 $log.log('OvSampleCtrl has been created');
44 }]); 63 }]);
......