Thomas Vachuska
Committed by Gerrit Code Review

GUI -- Fixed host view row height CSS by adding an icon for host type.

Change-Id: Id090b494f3cd3aa754bc3b3db952d69f613a1fc2
...@@ -18,6 +18,7 @@ package org.onosproject.ui.impl; ...@@ -18,6 +18,7 @@ package org.onosproject.ui.impl;
18 import com.fasterxml.jackson.databind.node.ArrayNode; 18 import com.fasterxml.jackson.databind.node.ArrayNode;
19 import com.fasterxml.jackson.databind.node.ObjectNode; 19 import com.fasterxml.jackson.databind.node.ObjectNode;
20 import com.google.common.collect.ImmutableSet; 20 import com.google.common.collect.ImmutableSet;
21 +import org.onosproject.net.AnnotationKeys;
21 import org.onosproject.net.Host; 22 import org.onosproject.net.Host;
22 import org.onosproject.net.HostLocation; 23 import org.onosproject.net.HostLocation;
23 import org.onosproject.net.host.HostService; 24 import org.onosproject.net.host.HostService;
...@@ -26,6 +27,8 @@ import java.util.ArrayList; ...@@ -26,6 +27,8 @@ import java.util.ArrayList;
26 import java.util.Arrays; 27 import java.util.Arrays;
27 import java.util.List; 28 import java.util.List;
28 29
30 +import static com.google.common.base.Strings.isNullOrEmpty;
31 +
29 /** 32 /**
30 * Message handler for host view related messages. 33 * Message handler for host view related messages.
31 */ 34 */
...@@ -69,19 +72,23 @@ public class HostViewMessageHandler extends AbstractTabularViewMessageHandler { ...@@ -69,19 +72,23 @@ public class HostViewMessageHandler extends AbstractTabularViewMessageHandler {
69 */ 72 */
70 private static class HostTableRow extends AbstractTableRow { 73 private static class HostTableRow extends AbstractTableRow {
71 74
75 + private static final String TYPE_IID = "_iconid_type";
72 private static final String ID = "id"; 76 private static final String ID = "id";
73 private static final String MAC = "mac"; 77 private static final String MAC = "mac";
74 private static final String VLAN = "vlan"; 78 private static final String VLAN = "vlan";
75 private static final String IPS = "ips"; 79 private static final String IPS = "ips";
76 private static final String LOCATION = "location"; 80 private static final String LOCATION = "location";
77 81
82 + private static final String HOST_ICON_PREFIX = "hostIcon_";
83 +
78 private static final String[] COL_IDS = { 84 private static final String[] COL_IDS = {
79 - ID, MAC, VLAN, IPS, LOCATION 85 + TYPE_IID, ID, MAC, VLAN, IPS, LOCATION
80 }; 86 };
81 87
82 public HostTableRow(Host h) { 88 public HostTableRow(Host h) {
83 HostLocation location = h.location(); 89 HostLocation location = h.location();
84 90
91 + add(TYPE_IID, getTypeIconId(h));
85 add(ID, h.id().toString()); 92 add(ID, h.id().toString());
86 add(MAC, h.mac().toString()); 93 add(MAC, h.mac().toString());
87 add(VLAN, h.vlan().toString()); 94 add(VLAN, h.vlan().toString());
...@@ -90,6 +97,12 @@ public class HostViewMessageHandler extends AbstractTabularViewMessageHandler { ...@@ -90,6 +97,12 @@ public class HostViewMessageHandler extends AbstractTabularViewMessageHandler {
90 location.port().toString())); 97 location.port().toString()));
91 } 98 }
92 99
100 + private String getTypeIconId(Host host) {
101 + String hostType = host.annotations().value(AnnotationKeys.TYPE);
102 + return HOST_ICON_PREFIX +
103 + (isNullOrEmpty(hostType) ? "endstation" : hostType);
104 + }
105 +
93 @Override 106 @Override
94 protected String[] columnIds() { 107 protected String[] columnIds() {
95 return COL_IDS; 108 return COL_IDS;
......
...@@ -65,16 +65,16 @@ svg.embeddedIcon .icon.appInactive .glyph { ...@@ -65,16 +65,16 @@ svg.embeddedIcon .icon.appInactive .glyph {
65 } 65 }
66 66
67 67
68 -.light svg.embeddedIcon .icon.devIcon_SWITCH { 68 +.light table svg.embeddedIcon {
69 fill: #ccc; 69 fill: #ccc;
70 } 70 }
71 -.dark svg.embeddedIcon .icon.devIcon_SWITCH { 71 +.dark table svg.embeddedIcon {
72 fill: #222; 72 fill: #222;
73 } 73 }
74 -.light svg.embeddedIcon .icon.devIcon_SWITCH .glyph { 74 +.light table svg.embeddedIcon .glyph {
75 fill: #333; 75 fill: #333;
76 } 76 }
77 -.dark svg.embeddedIcon .icon.devIcon_SWITCH .glyph { 77 +.dark table svg.embeddedIcon .glyph {
78 fill: #ccc; 78 fill: #ccc;
79 } 79 }
80 80
......
...@@ -39,6 +39,11 @@ ...@@ -39,6 +39,11 @@
39 deviceOnline: 'checkMark', 39 deviceOnline: 'checkMark',
40 deviceOffline: 'xMark', 40 deviceOffline: 'xMark',
41 devIcon_SWITCH: 'switch', 41 devIcon_SWITCH: 'switch',
42 + devIcon_ROADM: 'roadm',
43 +
44 + hostIcon_endstation: 'endstation',
45 + hostIcon_router: 'router',
46 + hostIcon_bgpSpeaker: 'bgpSpeaker',
42 47
43 tableColSortAsc: 'triangleUp', 48 tableColSortAsc: 'triangleUp',
44 tableColSortDesc: 'triangleDown' 49 tableColSortDesc: 'triangleDown'
......
...@@ -19,5 +19,4 @@ ...@@ -19,5 +19,4 @@
19 */ 19 */
20 20
21 #ov-host td { 21 #ov-host td {
22 - height: 20px;
23 } 22 }
...\ No newline at end of file ...\ No newline at end of file
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
7 sort-callback="sortCallback(requestParams)"> 7 sort-callback="sortCallback(requestParams)">
8 <thead> 8 <thead>
9 <tr> 9 <tr>
10 + <th colId="type" class="table-icon" sortable></th>
10 <th colId="id" sortable>Host ID </th> 11 <th colId="id" sortable>Host ID </th>
11 <th colId="mac" sortable>MAC Address </th> 12 <th colId="mac" sortable>MAC Address </th>
12 <th colId="vlan" sortable>VLAN ID </th> 13 <th colId="vlan" sortable>VLAN ID </th>
...@@ -18,6 +19,9 @@ ...@@ -18,6 +19,9 @@
18 <tbody> 19 <tbody>
19 <tr ng-repeat="host in ctrl.hostData" 20 <tr ng-repeat="host in ctrl.hostData"
20 ng-repeat-done> 21 ng-repeat-done>
22 + <td class="table-icon">
23 + <div icon icon-id="{{host._iconid_type}}"></div>
24 + </td>
21 <td>{{host.id}}</td> 25 <td>{{host.id}}</td>
22 <td>{{host.mac}}</td> 26 <td>{{host.mac}}</td>
23 <td>{{host.vlan}}</td> 27 <td>{{host.vlan}}</td>
......