blob: 75bccb15e4585d349018d1f7f0c2f2da8aaa42df [file] [log] [blame]
rama-huaweic78f3092016-05-19 18:09:29 +05301// sfcweb topology overlay - client side
2//
3// This is the glue that binds our business logic (in sfcwebTopovDemo.js)
4// to the overlay framework.
5
6(function () {
7 'use strict';
8
9 // injected refs
10 var $log, tov, pps;
11 var longPrefix = 'M15.9,19.1h-8v-13h8V19.1z M90.5,6.1H75.6v13h14.9V6.1' +
12 'z M71.9,6.1H56.9v13h14.9V6.1z M53.2,6.1H38.3v13h14.9V6.1z M34.5,' +
13 '6.1H19.6v13h14.9V6.1z M102.2,6.1h-8v13h8V6.1z' ;
14
15 // our overlay definition
16 var overlay = {
17 // NOTE: this must match the ID defined in SfcWebUiTopovOverlay
18 overlayId: 'SFC-Service-overlay',
19 glyphId: '*star4',
20 tooltip: 'SFC web service Topo Overlay',
21
22 // These glyphs get installed using the overlayId as a prefix.
23 // e.g. 'star4' is installed as 'meowster-overlay-star4'
24 // They can be referenced (from this overlay) as '*star4'
25 // That is, the '*' prefix stands in for 'meowster-overlay-'
26 glyphs: {
27 star4: {
28 vb: '0 0 8 8',
29 d: 'M1,4l2,-1l1,-2l1,2l2,1l-2,1l-1,2l-1,-2z'
30 },
31 jp: {
32 vb: '0 0 110 110',
33 d: 'M84.3,89.3L58.9,64.2l-1.4,1.4L83,90.7L84.3,89.3z M27,7.6H7.4v19.2H27V7.6z' +
34 'M59.3,47.1H39.8v19.2h19.5V47.1z M102.1,79.5H82.6v19.2h19.5V79.5z M41.7,47.6L19,25.1l-1.2,1.2l22.7,22.5L41.7,47.6z'
35 }
36 },
37 activate: function () {
38 $log.debug("SFC service topology overlay ACTIVATED");
39 },
40 deactivate: function () {
41 pps.clear();
42 $log.debug("SFC service topology overlay DEACTIVATED");
43 },
44
45 // Key bindings for traffic overlay buttons
46 // NOTE: fully qual. button ID is derived from overlay-id and key-name
47 // FIXME: find better keys for shortest paths & disjoint paths modes
48 keyBindings: {
49 4: {
50 cb: function () {
51 pps.start();
52 },
53 tt: 'Query SFP active list information',
54 gid: 'summary'
55 },
56 5: {
57 cb: function () {
58 pps.configSfp();
59 },
60 tt: 'Highlight SFP active list information',
61 gid: '*jp'
62 },
63
64 _keyOrder: [
65 '4' , '5'
66 ]
67 }
68
69 };
70
71 // invoke code to register with the overlay service
72 angular.module('ovSfcwebTopov')
73 .run(['$log', 'TopoOverlayService', 'SfcwebTopovDemoService',
74
75 function (_$log_, _tov_, _pps_) {
76 $log = _$log_;
77 tov = _tov_;
78 pps = _pps_;
79 tov.register(overlay);
80 $log.debug('ovSfcwebTopov run');
81 }]);
82
83}());