Thomas Vachuska
Committed by Gerrit Code Review

Fixing various GUI traffic/usage issues.

Reduced key help font.

Change-Id: I273f840aec85c13763688dfee8b3f26c8d1d5233
...@@ -33,7 +33,6 @@ ...@@ -33,7 +33,6 @@
33 33
34 <modules> 34 <modules>
35 <module>bundle</module> 35 <module>bundle</module>
36 - <!--module>web-bundle</module-->
37 </modules> 36 </modules>
38 37
39 </project> 38 </project>
......
1 -/*
2 - * Copyright 2014 Open Networking Laboratory
3 - *
4 - * Licensed under the Apache License, Version 2.0 (the "License");
5 - * you may not use this file except in compliance with the License.
6 - * You may obtain a copy of the License at
7 - *
8 - * http://www.apache.org/licenses/LICENSE-2.0
9 - *
10 - * Unless required by applicable law or agreed to in writing, software
11 - * distributed under the License is distributed on an "AS IS" BASIS,
12 - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 - * See the License for the specific language governing permissions and
14 - * limitations under the License.
15 - */
16 -package sample.bundle;
17 -
18 -import org.apache.felix.scr.annotations.Activate;
19 -import org.apache.felix.scr.annotations.Component;
20 -import org.apache.felix.scr.annotations.Deactivate;
21 -import org.apache.felix.scr.annotations.Service;
22 -import org.slf4j.Logger;
23 -import org.slf4j.LoggerFactory;
24 -
25 -/**
26 - * Skeletal ONOS application component.
27 - */
28 -@Component(immediate = true)
29 -@Service
30 -public class AppComponent implements AppService {
31 -
32 - private static Logger log = LoggerFactory.getLogger(AppComponent.class);
33 -
34 - @Activate
35 - protected void activate() {
36 - log.info("Started");
37 - }
38 -
39 - @Deactivate
40 - protected void deactivate() {
41 - log.info("Stopped");
42 - }
43 -
44 -}
1 -/*
2 - * Copyright 2014 Open Networking Laboratory
3 - *
4 - * Licensed under the Apache License, Version 2.0 (the "License");
5 - * you may not use this file except in compliance with the License.
6 - * You may obtain a copy of the License at
7 - *
8 - * http://www.apache.org/licenses/LICENSE-2.0
9 - *
10 - * Unless required by applicable law or agreed to in writing, software
11 - * distributed under the License is distributed on an "AS IS" BASIS,
12 - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 - * See the License for the specific language governing permissions and
14 - * limitations under the License.
15 - */
16 -package sample.bundle;
17 -
18 -/**
19 - * Skeletal ONOS application API.
20 - */
21 -public interface AppService {
22 -
23 -}
1 -/*
2 - * Copyright 2014 Open Networking Laboratory
3 - *
4 - * Licensed under the Apache License, Version 2.0 (the "License");
5 - * you may not use this file except in compliance with the License.
6 - * You may obtain a copy of the License at
7 - *
8 - * http://www.apache.org/licenses/LICENSE-2.0
9 - *
10 - * Unless required by applicable law or agreed to in writing, software
11 - * distributed under the License is distributed on an "AS IS" BASIS,
12 - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 - * See the License for the specific language governing permissions and
14 - * limitations under the License.
15 - */
16 -package sample.bundle;
17 -
18 -import org.junit.After;
19 -import org.junit.Before;
20 -import org.junit.Test;
21 -
22 -/**
23 - * Set of tests of the ONOS application component.
24 - */
25 -public class AppComponentTest {
26 -
27 - private AppComponent component;
28 -
29 - @Before
30 - public void setUp() {
31 - component = new AppComponent();
32 - component.activate();
33 -
34 - }
35 -
36 - @After
37 - public void tearDown() {
38 - component.deactivate();
39 - }
40 -
41 - @Test
42 - public void basics() {
43 -
44 - }
45 -
46 -}
...@@ -213,6 +213,7 @@ public class TopologyViewWebSocket ...@@ -213,6 +213,7 @@ public class TopologyViewWebSocket
213 processMessage((ObjectNode) mapper.reader().readTree(data)); 213 processMessage((ObjectNode) mapper.reader().readTree(data));
214 } catch (Exception e) { 214 } catch (Exception e) {
215 log.warn("Unable to parse GUI request {} due to {}", data, e); 215 log.warn("Unable to parse GUI request {} due to {}", data, e);
216 + log.warn("Boom!!!", e);
216 } 217 }
217 } 218 }
218 219
...@@ -384,7 +385,6 @@ public class TopologyViewWebSocket ...@@ -384,7 +385,6 @@ public class TopologyViewWebSocket
384 } 385 }
385 386
386 387
387 -
388 private Set<ConnectPoint> getHostLocations(Set<HostId> hostIds) { 388 private Set<ConnectPoint> getHostLocations(Set<HostId> hostIds) {
389 Set<ConnectPoint> points = new HashSet<>(); 389 Set<ConnectPoint> points = new HashSet<>();
390 for (HostId hostId : hostIds) { 390 for (HostId hostId : hostIds) {
...@@ -459,21 +459,19 @@ public class TopologyViewWebSocket ...@@ -459,21 +459,19 @@ public class TopologyViewWebSocket
459 // Cancel any other traffic monitoring mode. 459 // Cancel any other traffic monitoring mode.
460 stopTrafficMonitoring(); 460 stopTrafficMonitoring();
461 461
462 + // Get the set of selected hosts and their intents.
463 + ArrayNode ids = (ArrayNode) payload.path("ids");
464 + selectedHosts = getHosts(ids);
465 + selectedDevices = getDevices(ids);
466 + selectedIntents = intentFilter.findPathIntents(selectedHosts, selectedDevices,
467 + intentService.getIntents());
468 + currentIntentIndex = -1;
469 +
462 String hover = string(payload, "hover"); 470 String hover = string(payload, "hover");
463 if (haveSelectedIntents()) { 471 if (haveSelectedIntents()) {
464 - // Get the set of selected hosts and their intents.
465 - ArrayNode ids = (ArrayNode) payload.path("ids");
466 - selectedHosts = getHosts(ids);
467 - selectedDevices = getDevices(ids);
468 - selectedIntents = intentFilter.findPathIntents(selectedHosts, selectedDevices,
469 - intentService.getIntents());
470 - currentIntentIndex = -1;
471 -
472 // Send a message to highlight all links of all monitored intents. 472 // Send a message to highlight all links of all monitored intents.
473 sendMessage(trafficMessage(sid, new TrafficClass("primary", selectedIntents))); 473 sendMessage(trafficMessage(sid, new TrafficClass("primary", selectedIntents)));
474 - } 474 + } else if (!isNullOrEmpty(hover)) {
475 -
476 - if (!isNullOrEmpty(hover)) {
477 // If there is a hover node, include it in the selection and find intents. 475 // If there is a hover node, include it in the selection and find intents.
478 processExtendedSelection(sid, hover); 476 processExtendedSelection(sid, hover);
479 } 477 }
...@@ -484,19 +482,21 @@ public class TopologyViewWebSocket ...@@ -484,19 +482,21 @@ public class TopologyViewWebSocket
484 } 482 }
485 483
486 private void processExtendedSelection(long sid, String hover) { 484 private void processExtendedSelection(long sid, String hover) {
487 - Set<Host> hoverSelHosts = new HashSet<>(selectedHosts); 485 + if (haveSelectedIntents()) {
488 - Set<Device> hoverSelDevices = new HashSet<>(selectedDevices); 486 + Set<Host> hoverSelHosts = new HashSet<>(selectedHosts);
489 - addHover(hoverSelHosts, hoverSelDevices, hover); 487 + Set<Device> hoverSelDevices = new HashSet<>(selectedDevices);
488 + addHover(hoverSelHosts, hoverSelDevices, hover);
490 489
491 - List<Intent> primary = 490 + List<Intent> primary =
492 - intentFilter.findPathIntents(hoverSelHosts, hoverSelDevices, 491 + intentFilter.findPathIntents(hoverSelHosts, hoverSelDevices,
493 - selectedIntents); 492 + selectedIntents);
494 - Set<Intent> secondary = new HashSet<>(selectedIntents); 493 + Set<Intent> secondary = new HashSet<>(selectedIntents);
495 - secondary.removeAll(primary); 494 + secondary.removeAll(primary);
496 495
497 - // Send a message to highlight all links of all monitored intents. 496 + // Send a message to highlight all links of all monitored intents.
498 - sendMessage(trafficMessage(sid, new TrafficClass("primary", primary), 497 + sendMessage(trafficMessage(sid, new TrafficClass("primary", primary),
499 - new TrafficClass("secondary", secondary))); 498 + new TrafficClass("secondary", secondary)));
499 + }
500 } 500 }
501 501
502 // Requests next of the related intents. 502 // Requests next of the related intents.
...@@ -522,6 +522,9 @@ public class TopologyViewWebSocket ...@@ -522,6 +522,9 @@ public class TopologyViewWebSocket
522 // Requests monitoring of traffic for the selected intent. 522 // Requests monitoring of traffic for the selected intent.
523 private void requestSelectedIntentTraffic(ObjectNode event) { 523 private void requestSelectedIntentTraffic(ObjectNode event) {
524 if (haveSelectedIntents()) { 524 if (haveSelectedIntents()) {
525 + if (currentIntentIndex < 0) {
526 + currentIntentIndex = 0;
527 + }
525 Intent selectedIntent = selectedIntents.get(currentIntentIndex); 528 Intent selectedIntent = selectedIntents.get(currentIntentIndex);
526 log.info("Requested traffic for selected {}", selectedIntent.id()); 529 log.info("Requested traffic for selected {}", selectedIntent.id());
527 530
......
...@@ -36,7 +36,7 @@ ...@@ -36,7 +36,7 @@
36 } 36 }
37 37
38 #quickhelp svg text.title { 38 #quickhelp svg text.title {
39 - font-size: 10pt; 39 + font-size: 8pt;
40 font-style: italic; 40 font-style: italic;
41 text-anchor: middle; 41 text-anchor: middle;
42 fill: #999; 42 fill: #999;
...@@ -52,17 +52,17 @@ ...@@ -52,17 +52,17 @@
52 } 52 }
53 53
54 #quickhelp svg text { 54 #quickhelp svg text {
55 - font-size: 7pt; 55 + font-size: 5pt;
56 alignment-baseline: middle; 56 alignment-baseline: middle;
57 } 57 }
58 58
59 #quickhelp svg text.key { 59 #quickhelp svg text.key {
60 - font-size: 7pt; 60 + font-size: 5pt;
61 fill: #add; 61 fill: #add;
62 } 62 }
63 63
64 #quickhelp svg text.desc { 64 #quickhelp svg text.desc {
65 - font-size: 7pt; 65 + font-size: 5pt;
66 fill: #ddd; 66 fill: #ddd;
67 } 67 }
68 68
......
...@@ -74,7 +74,7 @@ ...@@ -74,7 +74,7 @@
74 // layout configuration 74 // layout configuration
75 var pad = 8, 75 var pad = 8,
76 offy = 45, 76 offy = 45,
77 - dy = 14, 77 + dy = 10,
78 offDesc = 8; 78 offDesc = 8;
79 79
80 // D3 magic 80 // D3 magic
......