GUI - Added 'No devices are connected' text.
- commented out test key bindings Change-Id: I918d683df601d4575574d13b0a5379b34a3f681b
Showing
2 changed files
with
59 additions
and
6 deletions
... | @@ -43,6 +43,20 @@ | ... | @@ -43,6 +43,20 @@ |
43 | } | 43 | } |
44 | 44 | ||
45 | 45 | ||
46 | +#topo svg .noDevsLayer { | ||
47 | + visibility: hidden; | ||
48 | +} | ||
49 | + | ||
50 | +#topo svg .noDevsLayer text { | ||
51 | + font-size: 60pt; | ||
52 | + font-style: italic; | ||
53 | + fill: #dde; | ||
54 | +} | ||
55 | + | ||
56 | +#topo svg .noDevsBird { | ||
57 | + fill: #ecd; | ||
58 | +} | ||
59 | + | ||
46 | /* NODES */ | 60 | /* NODES */ |
47 | 61 | ||
48 | #topo svg .node { | 62 | #topo svg .node { | ... | ... |
... | @@ -122,10 +122,10 @@ | ... | @@ -122,10 +122,10 @@ |
122 | 122 | ||
123 | // key bindings | 123 | // key bindings |
124 | var keyDispatch = { | 124 | var keyDispatch = { |
125 | - // TODO: remove these "development only" bindings | 125 | + // ==== "development mode" ==== |
126 | - 0: testMe, | 126 | + //0: testMe, |
127 | - equals: injectStartupEvents, | 127 | + //equals: injectStartupEvents, |
128 | - dash: injectTestEvent, | 128 | + //dash: injectTestEvent, |
129 | 129 | ||
130 | O: [toggleSummary, 'Toggle ONOS summary pane'], | 130 | O: [toggleSummary, 'Toggle ONOS summary pane'], |
131 | I: [toggleInstances, 'Toggle ONOS instances pane'], | 131 | I: [toggleInstances, 'Toggle ONOS instances pane'], |
... | @@ -225,6 +225,7 @@ | ... | @@ -225,6 +225,7 @@ |
225 | // D3 selections | 225 | // D3 selections |
226 | var svg, | 226 | var svg, |
227 | panZoomContainer, | 227 | panZoomContainer, |
228 | + noDevices, | ||
228 | bgImg, | 229 | bgImg, |
229 | topoG, | 230 | topoG, |
230 | nodeG, | 231 | nodeG, |
... | @@ -398,6 +399,10 @@ | ... | @@ -398,6 +399,10 @@ |
398 | } | 399 | } |
399 | } | 400 | } |
400 | 401 | ||
402 | + function showNoDevs(b) { | ||
403 | + noDevices.style('visibility', visVal(b)); | ||
404 | + } | ||
405 | + | ||
401 | // ============================== | 406 | // ============================== |
402 | // Oblique view ... | 407 | // Oblique view ... |
403 | 408 | ||
... | @@ -826,6 +831,8 @@ | ... | @@ -826,6 +831,8 @@ |
826 | id = device.id, | 831 | id = device.id, |
827 | d; | 832 | d; |
828 | 833 | ||
834 | + showNoDevs(false); | ||
835 | + | ||
829 | if (network.lookup[id]) { | 836 | if (network.lookup[id]) { |
830 | updateDevice(data); | 837 | updateDevice(data); |
831 | return; | 838 | return; |
... | @@ -1507,7 +1514,7 @@ | ... | @@ -1507,7 +1514,7 @@ |
1507 | } | 1514 | } |
1508 | 1515 | ||
1509 | function appendBadge(svg, ox, oy, dim, iid, cls) { | 1516 | function appendBadge(svg, ox, oy, dim, iid, cls) { |
1510 | - appendUse(svg, ox, oy, dim, iid,cls ).classed('badgeIcon', true); | 1517 | + appendUse(svg, ox, oy, dim, iid, cls).classed('badgeIcon', true); |
1511 | } | 1518 | } |
1512 | 1519 | ||
1513 | function attachUiBadge(svg) { | 1520 | function attachUiBadge(svg) { |
... | @@ -2326,6 +2333,11 @@ | ... | @@ -2326,6 +2333,11 @@ |
2326 | // remove from nodes array | 2333 | // remove from nodes array |
2327 | var idx = find(id, network.nodes); | 2334 | var idx = find(id, network.nodes); |
2328 | network.nodes.splice(idx, 1); | 2335 | network.nodes.splice(idx, 1); |
2336 | + | ||
2337 | + if (!network.nodes.length) { | ||
2338 | + showNoDevs(true); | ||
2339 | + } | ||
2340 | + | ||
2329 | // remove from SVG | 2341 | // remove from SVG |
2330 | updateNodes(); | 2342 | updateNodes(); |
2331 | fResume(); | 2343 | fResume(); |
... | @@ -2770,6 +2782,24 @@ | ... | @@ -2770,6 +2782,24 @@ |
2770 | svg.call(zoom); | 2782 | svg.call(zoom); |
2771 | } | 2783 | } |
2772 | 2784 | ||
2785 | + | ||
2786 | + function setupNoDevices() { | ||
2787 | + var g = noDevices.append('g'); | ||
2788 | + appendBadge(g, 0, 0, 100, '#bird', 'noDevsBird'); | ||
2789 | + var text = g.append('text') | ||
2790 | + .text('No devices are connected') | ||
2791 | + .attr({ x: 120, y: 80}); | ||
2792 | + } | ||
2793 | + | ||
2794 | + function repositionNoDevices() { | ||
2795 | + var g = noDevices.select('g'); | ||
2796 | + var box = g.node().getBBox(); | ||
2797 | + box.x -= box.width/2; | ||
2798 | + box.y -= box.height/2; | ||
2799 | + g.attr('transform', translate(box.x, box.y)); | ||
2800 | + } | ||
2801 | + | ||
2802 | + | ||
2773 | // ============================== | 2803 | // ============================== |
2774 | // Test harness code | 2804 | // Test harness code |
2775 | 2805 | ||
... | @@ -2838,10 +2868,11 @@ | ... | @@ -2838,10 +2868,11 @@ |
2838 | function init(view, ctx, flags) { | 2868 | function init(view, ctx, flags) { |
2839 | var w = view.width(), | 2869 | var w = view.width(), |
2840 | h = view.height(), | 2870 | h = view.height(), |
2871 | + logSize = config.logicalSize, | ||
2841 | fcfg = config.force; | 2872 | fcfg = config.force; |
2842 | 2873 | ||
2843 | // NOTE: view.$div is a D3 selection of the view's div | 2874 | // NOTE: view.$div is a D3 selection of the view's div |
2844 | - var viewBox = '0 0 ' + config.logicalSize + ' ' + config.logicalSize; | 2875 | + var viewBox = '0 0 ' + logSize + ' ' + logSize; |
2845 | svg = view.$div.append('svg').attr('viewBox', viewBox); | 2876 | svg = view.$div.append('svg').attr('viewBox', viewBox); |
2846 | setSize(svg, view); | 2877 | setSize(svg, view); |
2847 | 2878 | ||
... | @@ -2851,6 +2882,11 @@ | ... | @@ -2851,6 +2882,11 @@ |
2851 | panZoomContainer = svg.append('g').attr('id', 'panZoomContainer'); | 2882 | panZoomContainer = svg.append('g').attr('id', 'panZoomContainer'); |
2852 | setupPanZoom(); | 2883 | setupPanZoom(); |
2853 | 2884 | ||
2885 | + noDevices = svg.append('g') | ||
2886 | + .attr('class', 'noDevsLayer') | ||
2887 | + .attr('transform', translate(logSize/2, logSize/2)); | ||
2888 | + setupNoDevices(); | ||
2889 | + | ||
2854 | // group for the topology | 2890 | // group for the topology |
2855 | topoG = panZoomContainer.append('g') | 2891 | topoG = panZoomContainer.append('g') |
2856 | .attr('id', 'topo-G'); | 2892 | .attr('id', 'topo-G'); |
... | @@ -3008,6 +3044,9 @@ | ... | @@ -3008,6 +3044,9 @@ |
3008 | loadGeoMap(); | 3044 | loadGeoMap(); |
3009 | } | 3045 | } |
3010 | 3046 | ||
3047 | + repositionNoDevices(); | ||
3048 | + showNoDevs(true); | ||
3049 | + | ||
3011 | // finally, connect to the server... | 3050 | // finally, connect to the server... |
3012 | if (config.useLiveData) { | 3051 | if (config.useLiveData) { |
3013 | webSock.connect(); | 3052 | webSock.connect(); | ... | ... |
-
Please register or login to post a comment