1 // sample topology overlay - client side
3 // This is the glue that binds our business logic (in sampleTopovDemo.js)
4 // to the overlay framework.
12 // internal state should be kept in the service module (not here)
14 // our overlay definition
16 // NOTE: this must match the ID defined in AppUiTopoOverlay
17 overlayId: 'meowster-overlay',
19 tooltip: 'Sample Meowster Topo Overlay',
21 // These glyphs get installed using the overlayId as a prefix.
22 // e.g. 'star4' is installed as 'meowster-overlay-star4'
23 // They can be referenced (from this overlay) as '*star4'
24 // That is, the '*' prefix stands in for 'meowster-overlay-'
28 d: 'M1,4l2,-1l1,-2l1,2l2,1l-2,1l-1,2l-1,-2z'
32 d: 'M1,1v4l2,-2l2,2v-4z'
36 activate: function () {
37 $log.debug("Sample topology overlay ACTIVATED");
39 deactivate: function () {
41 $log.debug("Sample topology overlay DEACTIVATED");
44 // detail panel button definitions
50 $log.debug('FOO action invoked with data:', data);
57 $log.debug('BAR action invoked with data:', data);
62 // Key bindings for traffic overlay buttons
63 // NOTE: fully qual. button ID is derived from overlay-id and key-name
66 cb: function () { stds.stopDisplay(); },
67 tt: 'Cancel Display Mode',
71 cb: function () { stds.startDisplay('mouse'); },
72 tt: 'Start Mouse Mode',
76 cb: function () { stds.startDisplay('link'); },
77 tt: 'Start Link Mode',
92 // hook for handling escape key
93 // Must return true to consume ESC, false otherwise.
95 // Must return true to consume ESC, false otherwise.
96 return stds.stopDisplay();
99 // hooks for when the selection changes...
101 selectionCallback('empty');
103 single: function (data) {
104 selectionCallback('single', data);
106 multi: function (selectOrder) {
107 selectionCallback('multi', selectOrder);
108 tov.addDetailButton('foo');
109 tov.addDetailButton('bar');
111 mouseover: function (m) {
112 // m has id, class, and type properties
113 $log.debug('mouseover:', m);
114 stds.updateDisplay(m);
116 mouseout: function () {
117 $log.debug('mouseout');
118 stds.updateDisplay();
124 function buttonCallback(x) {
125 $log.debug('Toolbar-button callback', x);
128 function selectionCallback(x, d) {
129 $log.debug('Selection callback', x, d);
132 // invoke code to register with the overlay service
133 angular.module('ovSampleTopov')
134 .run(['$log', 'TopoOverlayService', 'SampleTopovDemoService',
136 function (_$log_, _tov_, _stds_) {
140 tov.register(overlay);