Simon Hunt

GUI -- Implemented Show/Hide Offline devices & Show/Hide Hosts (also used Flash Service).

- added 'toggle(cb)' to panel API.
- deferred keybindings to allow direct reference to sub-API functions.
- re-implemented tick() function.
- added 'list scenarios' command to mockserver.

Change-Id: I1cc0009266e1015747b1d8106bd1f088adb2feb5
...@@ -71,6 +71,7 @@ ...@@ -71,6 +71,7 @@
71 api = { 71 api = {
72 show: showPanel, 72 show: showPanel,
73 hide: hidePanel, 73 hide: hidePanel,
74 + toggle: togglePanel,
74 empty: emptyPanel, 75 empty: emptyPanel,
75 append: appendPanel, 76 append: appendPanel,
76 width: panelWidth, 77 width: panelWidth,
...@@ -111,6 +112,14 @@ ...@@ -111,6 +112,14 @@
111 .style('opacity', 0); 112 .style('opacity', 0);
112 } 113 }
113 114
115 + function togglePanel(cb) {
116 + if (p.on) {
117 + hidePanel(cb);
118 + } else {
119 + showPanel(cb);
120 + }
121 + }
122 +
114 function emptyPanel() { 123 function emptyPanel() {
115 return p.el.html(''); 124 return p.el.html('');
116 } 125 }
......
...@@ -141,7 +141,7 @@ ...@@ -141,7 +141,7 @@
141 lightMute = ['#A8B8CC', '#CCB3A8', '#FFC2BD', '#96D6BF', '#D19FCE', '#8FCCCA', '#CAEAA4'], 141 lightMute = ['#A8B8CC', '#CCB3A8', '#FFC2BD', '#96D6BF', '#D19FCE', '#8FCCCA', '#CAEAA4'],
142 142
143 darkNorm = ['#304860', '#664631', '#A8391B', '#00754B', '#77206D', '#005959', '#428700'], 143 darkNorm = ['#304860', '#664631', '#A8391B', '#00754B', '#77206D', '#005959', '#428700'],
144 - darkMute = ['#16203A', '#281810', '#4F1206', '#00331C', '#3D063A', '#002D2D', '#1B4400']; 144 + darkMute = ['#304860', '#664631', '#A8391B', '#00754B', '#77206D', '#005959', '#428700'];
145 145
146 var colors= { 146 var colors= {
147 light: { 147 light: {
......
...@@ -36,73 +36,59 @@ ...@@ -36,73 +36,59 @@
36 // Internal state 36 // Internal state
37 var zoomer; 37 var zoomer;
38 38
39 - // Note: "exported" state should be properties on 'self' variable
40 -
41 // --- Short Cut Keys ------------------------------------------------ 39 // --- Short Cut Keys ------------------------------------------------
42 40
43 - var keyBindings = { 41 + function setUpKeys() {
44 - //O: [toggleSummary, 'Toggle ONOS summary pane'], 42 + // key bindings need to be made after the services have been injected
45 - I: [toggleInstances, 'Toggle ONOS instances pane'], 43 + // thus, deferred to here...
46 - //D: [toggleDetails, 'Disable / enable details pane'], 44 + ks.keyBindings({
47 - 45 + //O: [toggleSummary, 'Toggle ONOS summary pane'],
48 - //H: [toggleHosts, 'Toggle host visibility'], 46 + I: [toggleInstances, 'Toggle ONOS instances pane'],
49 - //M: [toggleOffline, 'Toggle offline visibility'], 47 + //D: [toggleDetails, 'Disable / enable details pane'],
50 - //B: [toggleBg, 'Toggle background image'], 48 +
51 - //P: togglePorts, 49 + H: [tfs.toggleHosts, 'Toggle host visibility'],
52 - 50 + M: [tfs.toggleOffline, 'Toggle offline visibility'],
53 - //X: [toggleNodeLock, 'Lock / unlock node positions'], 51 + //B: [toggleBg, 'Toggle background image'],
54 - //Z: [toggleOblique, 'Toggle oblique view (Experimental)'], 52 + //P: togglePorts,
55 - L: [cycleLabels, 'Cycle device labels'], 53 +
56 - //U: [unpin, 'Unpin node (hover mouse over)'], 54 + //X: [toggleNodeLock, 'Lock / unlock node positions'],
57 - R: [resetZoom, 'Reset pan / zoom'], 55 + //Z: [toggleOblique, 'Toggle oblique view (Experimental)'],
58 - 56 + L: [tfs.cycleDeviceLabels, 'Cycle device labels'],
59 - //V: [showRelatedIntentsAction, 'Show all related intents'], 57 + //U: [unpin, 'Unpin node (hover mouse over)'],
60 - //rightArrow: [showNextIntentAction, 'Show next related intent'], 58 + R: [resetZoom, 'Reset pan / zoom'],
61 - //leftArrow: [showPrevIntentAction, 'Show previous related intent'], 59 +
62 - //W: [showSelectedIntentTrafficAction, 'Monitor traffic of selected intent'], 60 + //V: [showRelatedIntentsAction, 'Show all related intents'],
63 - //A: [showAllTrafficAction, 'Monitor all traffic'], 61 + //rightArrow: [showNextIntentAction, 'Show next related intent'],
64 - //F: [showDeviceLinkFlowsAction, 'Show device link flows'], 62 + //leftArrow: [showPrevIntentAction, 'Show previous related intent'],
65 - 63 + //W: [showSelectedIntentTrafficAction, 'Monitor traffic of selected intent'],
66 - //E: [equalizeMasters, 'Equalize mastership roles'], 64 + //A: [showAllTrafficAction, 'Monitor all traffic'],
67 - 65 + //F: [showDeviceLinkFlowsAction, 'Show device link flows'],
68 - //esc: handleEscape, 66 +
69 - 67 + //E: [equalizeMasters, 'Equalize mastership roles'],
70 - _helpFormat: [ 68 +
71 - ['O', 'I', 'D', '-', 'H', 'M', 'B', 'P' ], 69 + //esc: handleEscape,
72 - ['X', 'Z', 'L', 'U', 'R' ], 70 +
73 - ['V', 'rightArrow', 'leftArrow', 'W', 'A', 'F', '-', 'E' ] 71 + _helpFormat: [
74 - ] 72 + ['O', 'I', 'D', '-', 'H', 'M', 'B', 'P' ],
75 - 73 + ['X', 'Z', 'L', 'U', 'R' ],
76 - }; 74 + ['V', 'rightArrow', 'leftArrow', 'W', 'A', 'F', '-', 'E' ]
77 - 75 + ]
78 - // mouse gestures 76 + });
79 - var gestures = [
80 - ['click', 'Select the item and show details'],
81 - ['shift-click', 'Toggle selection state'],
82 - ['drag', 'Reposition (and pin) device / host'],
83 - ['cmd-scroll', 'Zoom in / out'],
84 - ['cmd-drag', 'Pan']
85 - ];
86 77
87 - function toggleInstances() { 78 + // TODO: // mouse gestures
88 - if (tis.isVisible()) { 79 + var gestures = [
89 - tis.hide(); 80 + ['click', 'Select the item and show details'],
90 - } else { 81 + ['shift-click', 'Toggle selection state'],
91 - tis.show(); 82 + ['drag', 'Reposition (and pin) device / host'],
92 - } 83 + ['cmd-scroll', 'Zoom in / out'],
93 - tfs.updateDeviceColors(); 84 + ['cmd-drag', 'Pan']
85 + ];
94 } 86 }
95 87
96 - function cycleLabels() {
97 - $log.debug('Cycle Labels.....');
98 - }
99 88
100 - function resetZoom() { 89 + function toggleInstances() {
101 - zoomer.reset(); 90 + tis.toggle();
102 - } 91 + tfs.updateDeviceColors();
103 -
104 - function setUpKeys() {
105 - ks.keyBindings(keyBindings);
106 } 92 }
107 93
108 94
...@@ -122,8 +108,7 @@ ...@@ -122,8 +108,7 @@
122 } 108 }
123 109
124 function zoomCallback() { 110 function zoomCallback() {
125 - var tr = zoomer.translate(), 111 + var sc = zoomer.scale();
126 - sc = zoomer.scale();
127 112
128 // keep the map lines constant width while zooming 113 // keep the map lines constant width while zooming
129 mapG.style('stroke-width', (2.0 / sc) + 'px'); 114 mapG.style('stroke-width', (2.0 / sc) + 'px');
...@@ -139,6 +124,10 @@ ...@@ -139,6 +124,10 @@
139 }); 124 });
140 } 125 }
141 126
127 + function resetZoom() {
128 + zoomer.reset();
129 + }
130 +
142 131
143 // callback invoked when the SVG view has been resized.. 132 // callback invoked when the SVG view has been resized..
144 function svgResized(dim) { 133 function svgResized(dim) {
......
...@@ -23,9 +23,7 @@ ...@@ -23,9 +23,7 @@
23 'use strict'; 23 'use strict';
24 24
25 // injected refs 25 // injected refs
26 - var $log, fs, sus, is, ts, tis, uplink; 26 + var $log, fs, sus, is, ts, flash, tis, icfg, uplink;
27 -
28 - var icfg;
29 27
30 // configuration 28 // configuration
31 var labelConfig = { 29 var labelConfig = {
...@@ -53,9 +51,9 @@ ...@@ -53,9 +51,9 @@
53 outColor: '#f00', 51 outColor: '#f00',
54 }, 52 },
55 dark: { 53 dark: {
56 - baseColor: '#666', 54 + baseColor: '#aaa',
57 inColor: '#66f', 55 inColor: '#66f',
58 - outColor: '#f00', 56 + outColor: '#f66'
59 }, 57 },
60 inWidth: 12, 58 inWidth: 12,
61 outWidth: 10 59 outWidth: 10
...@@ -74,7 +72,9 @@ ...@@ -74,7 +72,9 @@
74 lu = network.lookup, // shorthand 72 lu = network.lookup, // shorthand
75 deviceLabelIndex = 0, // for device label cycling 73 deviceLabelIndex = 0, // for device label cycling
76 hostLabelIndex = 0, // for host label cycling 74 hostLabelIndex = 0, // for host label cycling
77 - showHosts = 1, // whether hosts are displayed 75 + showHosts = true, // whether hosts are displayed
76 + showOffline = true, // whether offline devices are displayed
77 + oblique = false, // whether we are in the oblique view
78 width, height; 78 width, height;
79 79
80 // SVG elements; 80 // SVG elements;
...@@ -150,9 +150,8 @@ ...@@ -150,9 +150,8 @@
150 } 150 }
151 updateNodes(); 151 updateNodes();
152 if (wasOnline !== d.online) { 152 if (wasOnline !== d.online) {
153 - // TODO: re-instate link update, and offline visibility 153 + findAttachedLinks(d.id).forEach(restyleLinkElement);
154 - //findAttachedLinks(d.id).forEach(restyleLinkElement); 154 + updateOfflineVisibility(d);
155 - //updateOfflineVisibility(d);
156 } 155 }
157 } else { 156 } else {
158 // TODO: decide whether we want to capture logic errors 157 // TODO: decide whether we want to capture logic errors
...@@ -338,9 +337,8 @@ ...@@ -338,9 +337,8 @@
338 linkScale = d3.scale.linear() 337 linkScale = d3.scale.linear()
339 .domain([1, 12]) 338 .domain([1, 12])
340 .range([widthRatio, 12 * widthRatio]) 339 .range([widthRatio, 12 * widthRatio])
341 - .clamp(true); 340 + .clamp(true),
342 - 341 + allLinkTypes = 'direct indirect optical tunnel',
343 - var allLinkTypes = 'direct indirect optical tunnel',
344 defaultLinkType = 'direct'; 342 defaultLinkType = 'direct';
345 343
346 function restyleLinkElement(ldata) { 344 function restyleLinkElement(ldata) {
...@@ -364,6 +362,12 @@ ...@@ -364,6 +362,12 @@
364 .attr('stroke', linkConfig[th].baseColor); 362 .attr('stroke', linkConfig[th].baseColor);
365 } 363 }
366 364
365 + function findLinkById(id) {
366 + // check to see if this is a reverse lookup, else default to given id
367 + var key = network.revLinkToKey[id] || id;
368 + return key && lu[key];
369 + }
370 +
367 function findLink(linkData, op) { 371 function findLink(linkData, op) {
368 var key = makeLinkKey(linkData), 372 var key = makeLinkKey(linkData),
369 keyrev = makeLinkKey(linkData, 1), 373 keyrev = makeLinkKey(linkData, 1),
...@@ -436,6 +440,15 @@ ...@@ -436,6 +440,15 @@
436 return result; 440 return result;
437 } 441 }
438 442
443 + function findOfflineNodes() {
444 + var a = [];
445 + network.nodes.forEach(function (d) {
446 + if (d.class === 'device' && !d.online) {
447 + a.push(d);
448 + }
449 + });
450 + return a;
451 + }
439 452
440 function findAttachedHosts(devId) { 453 function findAttachedHosts(devId) {
441 var hosts = []; 454 var hosts = [];
...@@ -513,6 +526,36 @@ ...@@ -513,6 +526,36 @@
513 fResume(); 526 fResume();
514 } 527 }
515 528
529 + function updateHostVisibility() {
530 + sus.makeVisible(nodeG.selectAll('.host'), showHosts);
531 + sus.makeVisible(linkG.selectAll('.hostLink'), showHosts);
532 + }
533 +
534 + function updateOfflineVisibility(dev) {
535 + function updDev(d, show) {
536 + sus.makeVisible(d.el, show);
537 +
538 + findAttachedLinks(d.id).forEach(function (link) {
539 + b = show && ((link.type() !== 'hostLink') || showHosts);
540 + sus.makeVisible(link.el, b);
541 + });
542 + findAttachedHosts(d.id).forEach(function (host) {
543 + b = show && showHosts;
544 + sus.makeVisible(host.el, b);
545 + });
546 + }
547 +
548 + if (dev) {
549 + // updating a specific device that just toggled off/on-line
550 + updDev(dev, dev.online || showOffline);
551 + } else {
552 + // updating all offline devices
553 + findOfflineNodes().forEach(function (d) {
554 + updDev(d, showOffline);
555 + });
556 + }
557 + }
558 +
516 559
517 function sendUpdateMeta(d, store) { 560 function sendUpdateMeta(d, store) {
518 var metaUi = {}, 561 var metaUi = {},
...@@ -536,16 +579,6 @@ ...@@ -536,16 +579,6 @@
536 } 579 }
537 580
538 581
539 - function fStart() {
540 - $log.debug('TODO fStart()...');
541 - // TODO...
542 - }
543 -
544 - function fResume() {
545 - $log.debug('TODO fResume()...');
546 - // TODO...
547 - }
548 -
549 // ========================== 582 // ==========================
550 // === Devices and hosts - helper functions 583 // === Devices and hosts - helper functions
551 584
...@@ -817,6 +850,28 @@ ...@@ -817,6 +850,28 @@
817 } 850 }
818 } 851 }
819 852
853 + function vis(b) {
854 + return b ? 'visible' : 'hidden';
855 + }
856 +
857 + function toggleHosts() {
858 + showHosts = !showHosts;
859 + updateHostVisibility();
860 + flash.flash('Hosts ' + vis(showHosts));
861 + }
862 +
863 + function toggleOffline() {
864 + showOffline = !showOffline;
865 + updateOfflineVisibility();
866 + flash.flash('Offline devices ' + vis(showOffline));
867 + }
868 +
869 + function cycleDeviceLabels() {
870 + // TODO cycle device labels
871 + }
872 +
873 + // ==========================================
874 +
820 var dCol = { 875 var dCol = {
821 black: '#000', 876 black: '#000',
822 paleblue: '#acf', 877 paleblue: '#acf',
...@@ -1070,12 +1125,12 @@ ...@@ -1070,12 +1125,12 @@
1070 // operate on exiting links: 1125 // operate on exiting links:
1071 link.exit() 1126 link.exit()
1072 .attr('stroke-dasharray', '3 3') 1127 .attr('stroke-dasharray', '3 3')
1128 + .attr('stroke', linkConfig[th].outColor)
1073 .style('opacity', 0.5) 1129 .style('opacity', 0.5)
1074 .transition() 1130 .transition()
1075 .duration(1500) 1131 .duration(1500)
1076 .attr({ 1132 .attr({
1077 'stroke-dasharray': '3 12', 1133 'stroke-dasharray': '3 12',
1078 - stroke: linkConfig[th].outColor,
1079 'stroke-width': linkConfig.outWidth 1134 'stroke-width': linkConfig.outWidth
1080 }) 1135 })
1081 .style('opacity', 0.0) 1136 .style('opacity', 0.0)
...@@ -1084,7 +1139,7 @@ ...@@ -1084,7 +1139,7 @@
1084 // NOTE: invoke a single tick to force the labels to position 1139 // NOTE: invoke a single tick to force the labels to position
1085 // onto their links. 1140 // onto their links.
1086 tick(); 1141 tick();
1087 - // FIXME: this is a bug when in oblique view 1142 + // TODO: this causes undesirable behavior when in oblique view
1088 // It causes the nodes to jump into "overhead" view positions, even 1143 // It causes the nodes to jump into "overhead" view positions, even
1089 // though the oblique planes are still showing... 1144 // though the oblique planes are still showing...
1090 } 1145 }
...@@ -1191,14 +1246,55 @@ ...@@ -1191,14 +1246,55 @@
1191 1246
1192 // ========================== 1247 // ==========================
1193 // force layout tick function 1248 // force layout tick function
1194 - function tick() {
1195 1249
1250 + function fResume() {
1251 + if (!oblique) {
1252 + force.resume();
1253 + }
1254 + }
1255 +
1256 + function fStart() {
1257 + if (!oblique) {
1258 + force.start();
1259 + }
1260 + }
1261 +
1262 + var tickStuff = {
1263 + nodeAttr: {
1264 + transform: function (d) { return sus.translate(d.x, d.y); }
1265 + },
1266 + linkAttr: {
1267 + x1: function (d) { return d.source.x; },
1268 + y1: function (d) { return d.source.y; },
1269 + x2: function (d) { return d.target.x; },
1270 + y2: function (d) { return d.target.y; }
1271 + },
1272 + linkLabelAttr: {
1273 + transform: function (d) {
1274 + var lnk = findLinkById(d.key);
1275 + if (lnk) {
1276 + return transformLabel({
1277 + x1: lnk.source.x,
1278 + y1: lnk.source.y,
1279 + x2: lnk.target.x,
1280 + y2: lnk.target.y
1281 + });
1282 + }
1283 + }
1284 + }
1285 + };
1286 +
1287 + function tick() {
1288 + node.attr(tickStuff.nodeAttr);
1289 + link.attr(tickStuff.linkAttr);
1290 + linkLabel.attr(tickStuff.linkLabelAttr);
1196 } 1291 }
1197 1292
1198 1293
1199 // ========================== 1294 // ==========================
1200 // === MOUSE GESTURE HANDLERS 1295 // === MOUSE GESTURE HANDLERS
1201 1296
1297 + // FIXME:
1202 function selectCb() { } 1298 function selectCb() { }
1203 function atDragEnd() {} 1299 function atDragEnd() {}
1204 function dragEnabled() {} 1300 function dragEnabled() {}
...@@ -1211,14 +1307,15 @@ ...@@ -1211,14 +1307,15 @@
1211 angular.module('ovTopo') 1307 angular.module('ovTopo')
1212 .factory('TopoForceService', 1308 .factory('TopoForceService',
1213 ['$log', 'FnService', 'SvgUtilService', 'IconService', 'ThemeService', 1309 ['$log', 'FnService', 'SvgUtilService', 'IconService', 'ThemeService',
1214 - 'TopoInstService', 1310 + 'FlashService', 'TopoInstService',
1215 1311
1216 - function (_$log_, _fs_, _sus_, _is_, _ts_, _tis_) { 1312 + function (_$log_, _fs_, _sus_, _is_, _ts_, _flash_, _tis_) {
1217 $log = _$log_; 1313 $log = _$log_;
1218 fs = _fs_; 1314 fs = _fs_;
1219 sus = _sus_; 1315 sus = _sus_;
1220 is = _is_; 1316 is = _is_;
1221 ts = _ts_; 1317 ts = _ts_;
1318 + flash = _flash_;
1222 tis = _tis_; 1319 tis = _tis_;
1223 1320
1224 icfg = is.iconConfig(); 1321 icfg = is.iconConfig();
...@@ -1270,6 +1367,9 @@ ...@@ -1270,6 +1367,9 @@
1270 resize: resize, 1367 resize: resize,
1271 1368
1272 updateDeviceColors: updateDeviceColors, 1369 updateDeviceColors: updateDeviceColors,
1370 + toggleHosts: toggleHosts,
1371 + toggleOffline: toggleOffline,
1372 + cycleDeviceLabels: cycleDeviceLabels,
1273 1373
1274 addDevice: addDevice, 1374 addDevice: addDevice,
1275 updateDevice: updateDevice, 1375 updateDevice: updateDevice,
......
...@@ -55,7 +55,6 @@ ...@@ -55,7 +55,6 @@
55 55
56 56
57 // ========================== 57 // ==========================
58 - // *** ADD INSTANCE ***
59 58
60 function addInstance(data) { 59 function addInstance(data) {
61 var id = data.id; 60 var id = data.id;
...@@ -330,7 +329,8 @@ ...@@ -330,7 +329,8 @@
330 329
331 isVisible: function () { return oiBox.isVisible(); }, 330 isVisible: function () { return oiBox.isVisible(); },
332 show: function () { oiBox.show(); }, 331 show: function () { oiBox.show(); },
333 - hide: function () { oiBox.hide(); } 332 + hide: function () { oiBox.hide(); },
333 + toggle: function () { oiBox.toggle(); }
334 }; 334 };
335 }]); 335 }]);
336 }()); 336 }());
......
...@@ -87,7 +87,8 @@ describe('factory: fw/layer/panel.js', function () { ...@@ -87,7 +87,8 @@ describe('factory: fw/layer/panel.js', function () {
87 it('should provide an api of panel functions', function () { 87 it('should provide an api of panel functions', function () {
88 var p = ps.createPanel('foo'); 88 var p = ps.createPanel('foo');
89 expect(fs.areFunctions(p, [ 89 expect(fs.areFunctions(p, [
90 - 'show', 'hide', 'empty', 'append', 'width', 'height', 'isVisible', 'el' 90 + 'show', 'hide', 'toggle', 'empty', 'append',
91 + 'width', 'height', 'isVisible', 'el'
91 ])).toBeTruthy(); 92 ])).toBeTruthy();
92 }); 93 });
93 94
......
...@@ -76,7 +76,7 @@ describe('factory: fw/svg/svgUtil.js', function() { ...@@ -76,7 +76,7 @@ describe('factory: fw/svg/svgUtil.js', function() {
76 }); 76 });
77 77
78 it('should provide an alternate (dark) shade of blue for muted', function () { 78 it('should provide an alternate (dark) shade of blue for muted', function () {
79 - expect(sus.cat7().getColor('foo', true, 'dark')).toEqual('#16203A'); 79 + expect(sus.cat7().getColor('foo', true, 'dark')).toEqual('#304860');
80 }); 80 });
81 81
82 it('should iterate across the colors', function () { 82 it('should iterate across the colors', function () {
......
...@@ -35,6 +35,7 @@ describe('factory: view/topo/topoForce.js', function() { ...@@ -35,6 +35,7 @@ describe('factory: view/topo/topoForce.js', function() {
35 it('should define api functions', function () { 35 it('should define api functions', function () {
36 expect(fs.areFunctions(tfs, [ 36 expect(fs.areFunctions(tfs, [
37 'initForce', 'resize', 'updateDeviceColors', 37 'initForce', 'resize', 'updateDeviceColors',
38 + 'toggleHosts', 'toggleOffline','cycleDeviceLabels',
38 'addDevice', 'updateDevice', 'removeDevice', 39 'addDevice', 'updateDevice', 'removeDevice',
39 'addHost', 'updateHost', 'removeHost', 40 'addHost', 'updateHost', 'removeHost',
40 'addLink', 'updateLink', 'removeLink' 41 'addLink', 'updateLink', 'removeLink'
......
...@@ -36,7 +36,7 @@ describe('factory: view/topo/topoInst.js', function() { ...@@ -36,7 +36,7 @@ describe('factory: view/topo/topoInst.js', function() {
36 expect(fs.areFunctions(tis, [ 36 expect(fs.areFunctions(tis, [
37 'initInst', 'destroyInst', 37 'initInst', 'destroyInst',
38 'addInstance', 'updateInstance', 'removeInstance', 38 'addInstance', 'updateInstance', 'removeInstance',
39 - 'isVisible', 'show', 'hide' 39 + 'isVisible', 'show', 'hide', 'toggle'
40 ])).toBeTruthy(); 40 ])).toBeTruthy();
41 }); 41 });
42 42
......
...@@ -13,8 +13,8 @@ ...@@ -13,8 +13,8 @@
13 "0E:2A:69:30:13:86" 13 "0E:2A:69:30:13:86"
14 ], 14 ],
15 "metaUi": { 15 "metaUi": {
16 - "x": 800, 16 + "Xx": 800,
17 - "y": 180 17 + "Xy": 180
18 }, 18 },
19 "props": {} 19 "props": {}
20 } 20 }
......
...@@ -13,8 +13,8 @@ ...@@ -13,8 +13,8 @@
13 "A6:96:E5:03:52:5F" 13 "A6:96:E5:03:52:5F"
14 ], 14 ],
15 "metaUi": { 15 "metaUi": {
16 - "x": 520, 16 + "Xx": 520,
17 - "y": 250 17 + "Xy": 250
18 }, 18 },
19 "props": {} 19 "props": {}
20 } 20 }
......
...@@ -25,10 +25,7 @@ var lastcmd, // last command executed ...@@ -25,10 +25,7 @@ var lastcmd, // last command executed
25 var scFiles = fs.readdirSync(scenarioRoot); 25 var scFiles = fs.readdirSync(scenarioRoot);
26 console.log('Mock Server v1.0'); 26 console.log('Mock Server v1.0');
27 console.log('================'); 27 console.log('================');
28 -console.log('Scenarios ...'); 28 +listScenarios();
29 -console.log(scFiles.join(', '));
30 -console.log();
31 -
32 29
33 var rl = readline.createInterface(process.stdin, process.stdout); 30 var rl = readline.createInterface(process.stdin, process.stdout);
34 rl.setPrompt('ws> '); 31 rl.setPrompt('ws> ');
...@@ -118,6 +115,7 @@ function doCli() { ...@@ -118,6 +115,7 @@ function doCli() {
118 } 115 }
119 116
120 switch(cmd) { 117 switch(cmd) {
118 + case 'l': listScenarios(); break;
121 case 'c': connStatus(); break; 119 case 'c': connStatus(); break;
122 case 'm': customMessage(str); break; 120 case 'm': customMessage(str); break;
123 case 's': setScenario(str); break; 121 case 's': setScenario(str); break;
...@@ -137,10 +135,11 @@ function doCli() { ...@@ -137,10 +135,11 @@ function doCli() {
137 } 135 }
138 136
139 var helptext = '\n' + 137 var helptext = '\n' +
138 + 'l - list scenarios\n' +
140 'c - show connection status\n' + 139 'c - show connection status\n' +
141 'm {text} - send custom message to client\n' + 140 'm {text} - send custom message to client\n' +
142 's {id} - load scenario {id}\n' + 141 's {id} - load scenario {id}\n' +
143 - 's - show scenario staus\n' + 142 + 's - show scenario status\n' +
144 //'a - auto-send events\n' + 143 //'a - auto-send events\n' +
145 'n - send next event\n' + 144 'n - send next event\n' +
146 'r - restart the scenario\n' + 145 'r - restart the scenario\n' +
...@@ -151,6 +150,12 @@ function showHelp() { ...@@ -151,6 +150,12 @@ function showHelp() {
151 console.log(helptext); 150 console.log(helptext);
152 } 151 }
153 152
153 +function listScenarios() {
154 + console.log('Scenarios ...');
155 + console.log(scFiles.join(', '));
156 + console.log();
157 +}
158 +
154 function connStatus() { 159 function connStatus() {
155 if (connection) { 160 if (connection) {
156 console.log('Connection from ' + origin + ' established.'); 161 console.log('Connection from ' + origin + ' established.');
......