blob: 80a3fa91bb710dfc09806b6d240a7f3e5a2d1637 [file] [log] [blame]
Simon Hunt72e44bf2015-07-21 21:34:20 -07001// sample topology overlay - client side
2(function () {
3 'use strict';
4
5 // injected refs
6 var $log;
7
8 // our overlay definition
9 var overlay = {
Simon Huntfb940112015-07-29 18:36:35 -070010 // NOTE: this must match the ID defined in AppUiTopoOverlay
11 overlayId: 'meowster-overlay',
12 glyphId: '*star4',
13 tooltip: 'Sample Meowster Topo Overlay',
Simon Hunt72e44bf2015-07-21 21:34:20 -070014
Simon Huntfb940112015-07-29 18:36:35 -070015 // These glyphs get installed using the overlayId as a prefix.
16 // e.g. 'star4' is installed as 'meowster-overlay-star4'
17 // They can be referenced (from this overlay) as '*star4'
18 // That is, the '*' prefix stands in for 'meowster-overlay-'
19 glyphs: {
20 star4: {
21 vb: '0 0 8 8',
22 d: 'M1,4l2,-1l1,-2l1,2l2,1l-2,1l-1,2l-1,-2z'
23 },
24 banner: {
25 vb: '0 0 6 6',
26 d: 'M1,1v4l2,-2l2,2v-4z'
27 }
Simon Hunt72e44bf2015-07-21 21:34:20 -070028 },
Simon Hunt72e44bf2015-07-21 21:34:20 -070029
30 activate: activateOverlay,
Simon Huntfb940112015-07-29 18:36:35 -070031 deactivate: deactivateOverlay,
32
33 // button descriptors - these can be added to overview or detail panels
34 buttons: {
35 foo: {
36 gid: 'chain',
37 tt: 'a FOO action',
38 cb: fooCb
39 },
40 bar: {
41 gid: '*banner',
42 tt: 'a BAR action',
43 cb: barCb
44 }
45 }
Simon Hunt72e44bf2015-07-21 21:34:20 -070046 };
47
Simon Huntfb940112015-07-29 18:36:35 -070048 function fooCb(data) {
49 $log.debug('FOO callback with data:', data);
50 }
51
52 function barCb(data) {
53 $log.debug('BAR callback with data:', data);
54 }
55
Simon Hunt72e44bf2015-07-21 21:34:20 -070056 // === implementation of overlay API (essentially callbacks)
57 function activateOverlay() {
58 $log.debug("sample topology overlay ACTIVATED");
59 }
60
61 function deactivateOverlay() {
62 $log.debug("sample topology overlay DEACTIVATED");
63 }
64
65
66 // invoke code to register with the overlay service
67 angular.module('ovSample')
68 .run(['$log', 'TopoOverlayService',
69
70 function (_$log_, tov) {
71 $log = _$log_;
72 tov.register(overlay);
73 }]);
74
75}());