Committed by
Gerrit Code Review
[ONOS-3642] Add GUI Meter View
This implements the web GUI meter view. Current implementation uses the group table icon for meter, and the revised meter icon will be updated in following commit. See ONOS-3645 for detail. Change-Id: Iaa2e673ef83024135d757a2aaec1c31a87263217
Showing
17 changed files
with
413 additions
and
41 deletions
1 | +/* | ||
2 | + * Copyright 2016 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 | + | ||
17 | +package org.onosproject.ui.impl; | ||
18 | + | ||
19 | +import com.fasterxml.jackson.databind.node.ObjectNode; | ||
20 | +import com.google.common.base.Strings; | ||
21 | +import com.google.common.collect.ImmutableSet; | ||
22 | +import org.onosproject.net.DeviceId; | ||
23 | +import org.onosproject.net.meter.Band; | ||
24 | +import org.onosproject.net.meter.Meter; | ||
25 | +import org.onosproject.net.meter.MeterService; | ||
26 | +import org.onosproject.ui.RequestHandler; | ||
27 | +import org.onosproject.ui.UiMessageHandler; | ||
28 | +import org.onosproject.ui.table.CellFormatter; | ||
29 | +import org.onosproject.ui.table.TableModel; | ||
30 | +import org.onosproject.ui.table.TableRequestHandler; | ||
31 | + | ||
32 | +import java.util.Collection; | ||
33 | + | ||
34 | +/** | ||
35 | + * Message handler for meter view related messages. | ||
36 | + */ | ||
37 | +public class MeterViewMessageHandler extends UiMessageHandler { | ||
38 | + | ||
39 | + private static final String METER_DATA_REQ = "meterDataRequest"; | ||
40 | + private static final String METER_DATA_RESP = "meterDataResponse"; | ||
41 | + private static final String METERS = "meters"; | ||
42 | + | ||
43 | + private static final String ID = "id"; | ||
44 | + private static final String APP_ID = "app_id"; | ||
45 | + private static final String STATE = "state"; | ||
46 | + private static final String PACKETS = "packets"; | ||
47 | + private static final String BYTES = "bytes"; | ||
48 | + private static final String BANDS = "bands"; | ||
49 | + | ||
50 | + private static final String[] COL_IDS = { | ||
51 | + ID, APP_ID, STATE, PACKETS, BYTES, BANDS | ||
52 | + }; | ||
53 | + | ||
54 | + @Override | ||
55 | + protected Collection<RequestHandler> createRequestHandlers() { | ||
56 | + return ImmutableSet.of(new MeterDataRequest()); | ||
57 | + } | ||
58 | + | ||
59 | + // handler for meter table requests | ||
60 | + private final class MeterDataRequest extends TableRequestHandler { | ||
61 | + | ||
62 | + private MeterDataRequest() { | ||
63 | + super(METER_DATA_REQ, METER_DATA_RESP, METERS); | ||
64 | + } | ||
65 | + | ||
66 | + @Override | ||
67 | + protected String[] getColumnIds() { | ||
68 | + return COL_IDS; | ||
69 | + } | ||
70 | + | ||
71 | + @Override | ||
72 | + protected TableModel createTableModel() { | ||
73 | + TableModel tm = super.createTableModel(); | ||
74 | + tm.setFormatter(BANDS, new BandFormatter()); | ||
75 | + return tm; | ||
76 | + } | ||
77 | + | ||
78 | + @Override | ||
79 | + protected void populateTable(TableModel tm, ObjectNode payload) { | ||
80 | + String uri = string(payload, "devId"); | ||
81 | + if (!Strings.isNullOrEmpty(uri)) { | ||
82 | + DeviceId deviceId = DeviceId.deviceId(uri); | ||
83 | + MeterService ms = get(MeterService.class); | ||
84 | + for (Meter meter : ms.getMeters(deviceId)) { | ||
85 | + populateRow(tm.addRow(), meter); | ||
86 | + } | ||
87 | + } | ||
88 | + } | ||
89 | + | ||
90 | + private void populateRow(TableModel.Row row, Meter m) { | ||
91 | + row.cell(ID, m.id().id()) | ||
92 | + .cell(APP_ID, m.appId().name()) | ||
93 | + .cell(STATE, m.state()) | ||
94 | + .cell(PACKETS, m.packetsSeen()) | ||
95 | + .cell(BYTES, m.bytesSeen()) | ||
96 | + .cell(BANDS, m.bands()); | ||
97 | + } | ||
98 | + | ||
99 | + private final class BandFormatter implements CellFormatter { | ||
100 | + private static final String BREAK = "<br>"; | ||
101 | + | ||
102 | + @Override | ||
103 | + public String format(Object value) { | ||
104 | + StringBuilder sb = new StringBuilder(); | ||
105 | + Collection<Band> bands = (Collection<Band>) value; | ||
106 | + | ||
107 | + if (bands.isEmpty()) { | ||
108 | + return "(No bands for this meter)"; | ||
109 | + } | ||
110 | + | ||
111 | + // TODO: re-arrange band properties based on band type | ||
112 | + for (Band b : bands) { | ||
113 | + sb.append("Bytes: ") | ||
114 | + .append(b.bytes()) | ||
115 | + .append(" Packets: ") | ||
116 | + .append(b.packets()) | ||
117 | + .append(" Type: ") | ||
118 | + .append(b.type()) | ||
119 | + .append(BREAK); | ||
120 | + } | ||
121 | + | ||
122 | + return sb.toString(); | ||
123 | + } | ||
124 | + } | ||
125 | + } | ||
126 | +} |
1 | /* | 1 | /* |
2 | - * Copyright 2015 Open Networking Laboratory | 2 | + * Copyright 2015,2016 Open Networking Laboratory |
3 | * | 3 | * |
4 | * Licensed under the Apache License, Version 2.0 (the "License"); | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
5 | * you may not use this file except in compliance with the License. | 5 | * you may not use this file except in compliance with the License. |
... | @@ -83,6 +83,7 @@ public class UiExtensionManager implements UiExtensionService, SpriteService { | ... | @@ -83,6 +83,7 @@ public class UiExtensionManager implements UiExtensionService, SpriteService { |
83 | new UiViewHidden("flow"), | 83 | new UiViewHidden("flow"), |
84 | new UiViewHidden("port"), | 84 | new UiViewHidden("port"), |
85 | new UiViewHidden("group"), | 85 | new UiViewHidden("group"), |
86 | + new UiViewHidden("meter"), | ||
86 | new UiView(NETWORK, "link", "Links", "nav_links"), | 87 | new UiView(NETWORK, "link", "Links", "nav_links"), |
87 | new UiView(NETWORK, "host", "Hosts", "nav_hosts"), | 88 | new UiView(NETWORK, "host", "Hosts", "nav_hosts"), |
88 | new UiView(NETWORK, "intent", "Intents", "nav_intents"), | 89 | new UiView(NETWORK, "intent", "Intents", "nav_intents"), |
... | @@ -99,6 +100,7 @@ public class UiExtensionManager implements UiExtensionService, SpriteService { | ... | @@ -99,6 +100,7 @@ public class UiExtensionManager implements UiExtensionService, SpriteService { |
99 | new FlowViewMessageHandler(), | 100 | new FlowViewMessageHandler(), |
100 | new PortViewMessageHandler(), | 101 | new PortViewMessageHandler(), |
101 | new GroupViewMessageHandler(), | 102 | new GroupViewMessageHandler(), |
103 | + new MeterViewMessageHandler(), | ||
102 | new IntentViewMessageHandler(), | 104 | new IntentViewMessageHandler(), |
103 | new ApplicationViewMessageHandler(), | 105 | new ApplicationViewMessageHandler(), |
104 | new SettingsViewMessageHandler(), | 106 | new SettingsViewMessageHandler(), | ... | ... |
1 | /* | 1 | /* |
2 | - * Copyright 2015 Open Networking Laboratory | 2 | + * Copyright 2015,2016 Open Networking Laboratory |
3 | * | 3 | * |
4 | * Licensed under the Apache License, Version 2.0 (the "License"); | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
5 | * you may not use this file except in compliance with the License. | 5 | * you may not use this file except in compliance with the License. |
... | @@ -230,6 +230,28 @@ | ... | @@ -230,6 +230,28 @@ |
230 | '-6.3,0.9-8.9,2.5c3.7,3.8,6.1,8.9,6.2,14.6c6.1,3.1,10.6,8.9,11.7,' + | 230 | '-6.3,0.9-8.9,2.5c3.7,3.8,6.1,8.9,6.2,14.6c6.1,3.1,10.6,8.9,11.7,' + |
231 | '15.8C81.5,65.6,85,60,85,53.5C85,43.8,77.1,35.8,67.3,35.8z', | 231 | '15.8C81.5,65.6,85,60,85,53.5C85,43.8,77.1,35.8,67.3,35.8z', |
232 | 232 | ||
233 | + meterTable: 'M16,19.1H8v-13h8V19.1z M90.6,6.1H75.7v13h14.9V6.1z ' + | ||
234 | + 'M71.9,6.1H57v13h14.9V6.1z M53.3,6.1H38.4v13h14.9V6.1z M34.6,6.1' + | ||
235 | + 'H19.7v13h14.9V6.1z M102.3,6.1h-8v13h8V6.1z M45.7,52.7c0.2-5.6,' + | ||
236 | + '2.6-10.7,6.2-14.4c-2.6-1.5-5.7-2.5-8.9-2.5c-9.8,0-17.7,7.9-17.7,' + | ||
237 | + '17.7c0,6.3,3.3,11.9,8.3,15C34.8,61.5,39.4,55.6,45.7,52.7z M51.9,' + | ||
238 | + '68.8c-3.1-3.1-5.2-7.2-6-11.7c-4.7,2.8-7.9,7.6-8.6,13.2c1.8,0.6,' + | ||
239 | + '3.6,0.9,5.6,0.9C46.2,71.2,49.3,70.3,51.9,68.8z M55.2,71.5c-3.5,' + | ||
240 | + '2.4-7.7,3.7-12.2,3.7c-1.9,0-3.8-0.3-5.6-0.7C38.5,83.2,45.9,90,' + | ||
241 | + '54.9,90c9,0,16.4-6.7,17.5-15.4c-1.6,0.4-3.4,0.6-5.1,0.6C62.8,' + | ||
242 | + '75.2,58.6,73.8,55.2,71.5z M54.9,50.6c1.9,0,3.8,0.3,5.6,0.7c-0.5' + | ||
243 | + '-4.1-2.5-7.9-5.4-10.6c-2.9,2.7-4.8,6.4-5.3,10.5C51.5,50.8,53.2,' + | ||
244 | + '50.6,54.9,50.6z M49.7,55.4c0.5,4.3,2.4,8.1,5.4,10.9c2.9-2.8,4.9' + | ||
245 | + '-6.6,5.4-10.8c-1.8-0.6-3.6-0.9-5.6-0.9C53.1,54.6,51.4,54.9,49.7,' + | ||
246 | + '55.4z M102.3,23.6v78.5H8V23.6H102.3z M89,53.5c0-12-9.7-21.7-' + | ||
247 | + '21.7-21.7c-4.5,0-8.7,1.4-12.2,3.7c-3.5-2.4-7.7-3.7-12.2-3.7c-12,' + | ||
248 | + '0-21.7,9.7-21.7,21.7c0,8.5,4.9,15.9,12,19.4C33.6,84.6,43.2,94,' + | ||
249 | + '54.9,94c11.7,0,21.2-9.3,21.7-20.9C84,69.7,89,62.2,89,53.5z M' + | ||
250 | + '64.3,57.3c-0.8,4.4-2.9,8.4-5.9,11.5c2.6,1.5,5.7,2.5,8.9,2.5c1.8,' + | ||
251 | + '0,3.6-0.3,5.2-0.8C72,64.9,68.8,60.1,64.3,57.3z M67.3,35.8c-3.3,0' + | ||
252 | + '-6.3,0.9-8.9,2.5c3.7,3.8,6.1,8.9,6.2,14.6c6.1,3.1,10.6,8.9,11.7,' + | ||
253 | + '15.8C81.5,65.6,85,60,85,53.5C85,43.8,77.1,35.8,67.3,35.8z', | ||
254 | + | ||
233 | // --- Topology toolbar specific glyphs ---------------------- | 255 | // --- Topology toolbar specific glyphs ---------------------- |
234 | 256 | ||
235 | summary: "M95.8,9.2H14.2c-2.8,0-5,2.2-5,5v81.5c0,2.8,2.2,5,5," + | 257 | summary: "M95.8,9.2H14.2c-2.8,0-5,2.2-5,5v81.5c0,2.8,2.2,5,5," + | ... | ... |
1 | /* | 1 | /* |
2 | - * Copyright 2015 Open Networking Laboratory | 2 | + * Copyright 2015,2016 Open Networking Laboratory |
3 | * | 3 | * |
4 | * Licensed under the Apache License, Version 2.0 (the "License"); | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
5 | * you may not use this file except in compliance with the License. | 5 | * you may not use this file except in compliance with the License. |
... | @@ -53,6 +53,7 @@ | ... | @@ -53,6 +53,7 @@ |
53 | flowTable: 'flowTable', | 53 | flowTable: 'flowTable', |
54 | portTable: 'portTable', | 54 | portTable: 'portTable', |
55 | groupTable: 'groupTable', | 55 | groupTable: 'groupTable', |
56 | + meterTable: 'meterTable', | ||
56 | 57 | ||
57 | hostIcon_endstation: 'endstation', | 58 | hostIcon_endstation: 'endstation', |
58 | hostIcon_router: 'router', | 59 | hostIcon_router: 'router', | ... | ... |
... | @@ -26,6 +26,11 @@ | ... | @@ -26,6 +26,11 @@ |
26 | icon icon-id="groupTable" icon-size="36" | 26 | icon icon-id="groupTable" icon-size="36" |
27 | tooltip tt-msg="groupTip" | 27 | tooltip tt-msg="groupTip" |
28 | ng-click="nav('group')"></div> | 28 | ng-click="nav('group')"></div> |
29 | + | ||
30 | + <div ng-class="{active: !!selId}" | ||
31 | + icon icon-id="meterTable" icon-size="36" | ||
32 | + tooltip tt-msg="meterTip" | ||
33 | + ng-click="nav('meter')"></div> | ||
29 | </div> | 34 | </div> |
30 | </div> | 35 | </div> |
31 | 36 | ... | ... |
1 | /* | 1 | /* |
2 | - * Copyright 2015 Open Networking Laboratory | 2 | + * Copyright 2015,2016 Open Networking Laboratory |
3 | * | 3 | * |
4 | * Licensed under the Apache License, Version 2.0 (the "License"); | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
5 | * you may not use this file except in compliance with the License. | 5 | * you may not use this file except in compliance with the License. |
... | @@ -294,6 +294,7 @@ | ... | @@ -294,6 +294,7 @@ |
294 | $scope.flowTip = 'Show flow view for selected device'; | 294 | $scope.flowTip = 'Show flow view for selected device'; |
295 | $scope.portTip = 'Show port view for selected device'; | 295 | $scope.portTip = 'Show port view for selected device'; |
296 | $scope.groupTip = 'Show group view for selected device'; | 296 | $scope.groupTip = 'Show group view for selected device'; |
297 | + $scope.meterTip = 'Show meter view for selected device'; | ||
297 | 298 | ||
298 | // details panel handlers | 299 | // details panel handlers |
299 | handlers[detailsResp] = respDetailsCb; | 300 | handlers[detailsResp] = respDetailsCb; | ... | ... |
... | @@ -30,6 +30,11 @@ | ... | @@ -30,6 +30,11 @@ |
30 | icon icon-id="groupTable" icon-size="36" | 30 | icon icon-id="groupTable" icon-size="36" |
31 | tooltip tt-msg="groupTip" | 31 | tooltip tt-msg="groupTip" |
32 | ng-click="nav('group')"></div> | 32 | ng-click="nav('group')"></div> |
33 | + | ||
34 | + <div class="active" | ||
35 | + icon icon-id="meterTable" icon-size="36" | ||
36 | + tooltip tt-msg="meterTip" | ||
37 | + ng-click="nav('meter')"></div> | ||
33 | </div> | 38 | </div> |
34 | </div> | 39 | </div> |
35 | 40 | ... | ... |
1 | /* | 1 | /* |
2 | - * Copyright 2015 Open Networking Laboratory | 2 | + * Copyright 2015,2016 Open Networking Laboratory |
3 | * | 3 | * |
4 | * Licensed under the Apache License, Version 2.0 (the "License"); | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
5 | * you may not use this file except in compliance with the License. | 5 | * you may not use this file except in compliance with the License. |
... | @@ -40,6 +40,7 @@ | ... | @@ -40,6 +40,7 @@ |
40 | $scope.deviceTip = 'Show device table'; | 40 | $scope.deviceTip = 'Show device table'; |
41 | $scope.portTip = 'Show port view for this device'; | 41 | $scope.portTip = 'Show port view for this device'; |
42 | $scope.groupTip = 'Show group view for this device'; | 42 | $scope.groupTip = 'Show group view for this device'; |
43 | + $scope.meterTip = 'Show meter view for selected device'; | ||
43 | 44 | ||
44 | params = $location.search(); | 45 | params = $location.search(); |
45 | if (params.hasOwnProperty('devId')) { | 46 | if (params.hasOwnProperty('devId')) { | ... | ... |
1 | -<!-- | ||
2 | - ~ Copyright 2015 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 | - | ||
17 | <!-- Group partial HTML --> | 1 | <!-- Group partial HTML --> |
18 | <div id="ov-group"> | 2 | <div id="ov-group"> |
19 | <div class="tabular-header"> | 3 | <div class="tabular-header"> |
... | @@ -46,6 +30,11 @@ | ... | @@ -46,6 +30,11 @@ |
46 | 30 | ||
47 | <div class="current-view" | 31 | <div class="current-view" |
48 | icon icon-id="groupTable" icon-size="36"></div> | 32 | icon icon-id="groupTable" icon-size="36"></div> |
33 | + | ||
34 | + <div class="active" | ||
35 | + icon icon-id="meterTable" icon-size="36" | ||
36 | + tooltip tt-msg="meterTip" | ||
37 | + ng-click="nav('meter')"></div> | ||
49 | </div> | 38 | </div> |
50 | </div> | 39 | </div> |
51 | 40 | ... | ... |
1 | /* | 1 | /* |
2 | - * Copyright 2015 Open Networking Laboratory | 2 | + * Copyright 2015,2016 Open Networking Laboratory |
3 | * | 3 | * |
4 | * Licensed under the Apache License, Version 2.0 (the "License"); | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
5 | * you may not use this file except in compliance with the License. | 5 | * you may not use this file except in compliance with the License. |
... | @@ -40,6 +40,7 @@ | ... | @@ -40,6 +40,7 @@ |
40 | $scope.deviceTip = 'Show device table'; | 40 | $scope.deviceTip = 'Show device table'; |
41 | $scope.flowTip = 'Show flow view for this device'; | 41 | $scope.flowTip = 'Show flow view for this device'; |
42 | $scope.portTip = 'Show port view for this device'; | 42 | $scope.portTip = 'Show port view for this device'; |
43 | + $scope.meterTip = 'Show meter view for selected device'; | ||
43 | 44 | ||
44 | params = $location.search(); | 45 | params = $location.search(); |
45 | if (params.hasOwnProperty('devId')) { | 46 | if (params.hasOwnProperty('devId')) { | ... | ... |
1 | +/* | ||
2 | + * Copyright 2016 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 | + | ||
17 | +/* | ||
18 | + ONOS GUI -- Meter View -- CSS file | ||
19 | + */ | ||
20 | + | ||
21 | +#ov-meter h2 { | ||
22 | + display: inline-block; | ||
23 | +} | ||
24 | + | ||
25 | +#ov-meter div.ctrl-btns { | ||
26 | +} | ||
27 | + | ||
28 | +.light #ov-meter .current-view use { | ||
29 | + fill: white; | ||
30 | +} | ||
31 | +.dark #ov-meter .current-view use { | ||
32 | + fill: #304860; | ||
33 | +} | ||
34 | + | ||
35 | +.light #ov-meter .current-view rect { | ||
36 | + fill: deepskyblue; | ||
37 | +} | ||
38 | +.dark #ov-meter .current-view rect { | ||
39 | + fill: #eee; | ||
40 | +} | ||
41 | + | ||
42 | +.light #ov-meter tr:nth-child(4n + 1), | ||
43 | +.light #ov-meter tr:nth-child(4n + 2) { | ||
44 | + background-color: #eee; | ||
45 | +} | ||
46 | +.light #ov-meter tr:nth-child(4n + 3), | ||
47 | +.light #ov-meter tr:nth-child(4n) { | ||
48 | + background-color: #ddd; | ||
49 | +} | ||
50 | +.dark #ov-meter tr:nth-child(4n + 1), | ||
51 | +.dark #ov-meter tr:nth-child(4n + 2) { | ||
52 | + background-color: #444; | ||
53 | +} | ||
54 | +.dark #ov-meter tr:nth-child(4n + 3), | ||
55 | +.dark #ov-meter tr:nth-child(4n) { | ||
56 | + background-color: #333; | ||
57 | +} | ||
58 | + | ||
59 | +/* highlighted color */ | ||
60 | +.light #ov-meter tr:nth-child(4n + 1).data-change, | ||
61 | +.light #ov-meter tr:nth-child(4n + 2).data-change, | ||
62 | +.light #ov-meter tr:nth-child(4n + 3).data-change, | ||
63 | +.light #ov-meter tr:nth-child(4n).data-change { | ||
64 | + background-color: #FDFFDC; | ||
65 | +} | ||
66 | +.dark #ov-meter tr:nth-child(4n + 1).data-change, | ||
67 | +.dark #ov-meter tr:nth-child(4n + 2).data-change, | ||
68 | +.dark #ov-meter tr:nth-child(4n + 3).data-change, | ||
69 | +.dark #ov-meter tr:nth-child(4n).data-change { | ||
70 | + background-color: #5A5600; | ||
71 | +} | ||
72 | + | ||
73 | +#ov-meter td.bands { | ||
74 | + padding-left: 36px; | ||
75 | + opacity: 0.65; | ||
76 | +} | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
1 | +<!-- Meter partial HTML --> | ||
2 | +<div id="ov-meter"> | ||
3 | + <div class="tabular-header"> | ||
4 | + <h2> | ||
5 | + Meters for Device {{devId || "(No device selected)"}} | ||
6 | + ({{tableData.length}} total) | ||
7 | + </h2> | ||
8 | + <div class="ctrl-btns"> | ||
9 | + <div class="refresh" ng-class="{active: autoRefresh}" | ||
10 | + icon icon-size="36" icon-id="refresh" | ||
11 | + tooltip tt-msg="autoRefreshTip" | ||
12 | + ng-click="toggleRefresh()"></div> | ||
13 | + | ||
14 | + <div class="separator"></div> | ||
15 | + | ||
16 | + <div class="active" | ||
17 | + icon icon-id="deviceTable" icon-size="36" | ||
18 | + tooltip tt-msg="deviceTip" | ||
19 | + ng-click="nav('device')"></div> | ||
20 | + | ||
21 | + <div class="active" | ||
22 | + icon icon-id="flowTable" icon-size="36" | ||
23 | + tooltip tt-msg="flowTip" | ||
24 | + ng-click="nav('flow')"></div> | ||
25 | + | ||
26 | + <div class="active" | ||
27 | + icon icon-id="portTable" icon-size="36" | ||
28 | + tooltip tt-msg="portTip" | ||
29 | + ng-click="nav('port')"></div> | ||
30 | + | ||
31 | + <div class="active" | ||
32 | + icon icon-id="groupTable" icon-size="36" | ||
33 | + tooltip tt-msg="groupTip" | ||
34 | + ng-click="nav('group')"></div> | ||
35 | + | ||
36 | + <div class="current-view" | ||
37 | + icon icon-id="meterTable" icon-size="36"></div> | ||
38 | + </div> | ||
39 | + </div> | ||
40 | + | ||
41 | + <div class="summary-list" onos-table-resize> | ||
42 | + <div class="table-header" onos-sortable-header> | ||
43 | + <table> | ||
44 | + <tr> | ||
45 | + <td colId="id" sortable>Meter ID </td> | ||
46 | + <td colId="app_id" sortable>App ID </td> | ||
47 | + <td colId="state" sortable>State </td> | ||
48 | + <td colId="packets" sortable>Packets </td> | ||
49 | + <td colId="bytes" sortable>Bytes </td> | ||
50 | + </tr> | ||
51 | + </table> | ||
52 | + </div> | ||
53 | + | ||
54 | + <div class="table-body"> | ||
55 | + <table onos-flash-changes id-prop="id"> | ||
56 | + <tr ng-if="!tableData.length" class="no-data"> | ||
57 | + <td colspan="5"> | ||
58 | + No Meters found | ||
59 | + </td> | ||
60 | + </tr> | ||
61 | + | ||
62 | + <tr ng-repeat-start="meter in tableData track by $index" | ||
63 | + ng-repeat-complete row-id="{{meter.id}}"> | ||
64 | + <td>{{meter.id}}</td> | ||
65 | + <td>{{meter.app_id}}</td> | ||
66 | + <td>{{meter.state}}</td> | ||
67 | + <td>{{meter.packets}}</td> | ||
68 | + <td>{{meter.bytes}}</td> | ||
69 | + </tr> | ||
70 | + <tr row-id="{{meter.id}}" ng-repeat-end> | ||
71 | + <td class="bands" colspan="5" | ||
72 | + ng-bind-html="meter.bands"></td> | ||
73 | + </tr> | ||
74 | + </table> | ||
75 | + </div> | ||
76 | + | ||
77 | + </div> | ||
78 | + | ||
79 | +</div> | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
1 | +/* | ||
2 | + * Copyright 2016 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 | + | ||
17 | +/* | ||
18 | + ONOS GUI -- Meter View Module | ||
19 | + */ | ||
20 | +(function () { | ||
21 | + 'use strict'; | ||
22 | + | ||
23 | + // injected references | ||
24 | + var $log, $scope, $location, fs, tbs, ns; | ||
25 | + | ||
26 | + angular.module('ovMeter', []) | ||
27 | + .controller('OvMeterCtrl', | ||
28 | + ['$log', '$scope', '$location', '$sce', | ||
29 | + 'FnService', 'TableBuilderService', 'NavService', | ||
30 | + | ||
31 | + function (_$log_, _$scope_, _$location_, $sce, _fs_, _tbs_, _ns_) { | ||
32 | + var params; | ||
33 | + $log = _$log_; | ||
34 | + $scope = _$scope_; | ||
35 | + $location = _$location_; | ||
36 | + fs = _fs_; | ||
37 | + tbs = _tbs_; | ||
38 | + ns = _ns_; | ||
39 | + $scope.deviceTip = 'Show device table'; | ||
40 | + $scope.flowTip = 'Show flow view for this device'; | ||
41 | + $scope.portTip = 'Show port view for this device'; | ||
42 | + $scope.groupTip = 'Show group view for this device'; | ||
43 | + | ||
44 | + params = $location.search(); | ||
45 | + if (params.hasOwnProperty('devId')) { | ||
46 | + $scope.devId = params['devId']; | ||
47 | + } | ||
48 | + | ||
49 | + tbs.buildTable({ | ||
50 | + scope: $scope, | ||
51 | + tag: 'meter', | ||
52 | + query: params | ||
53 | + }); | ||
54 | + | ||
55 | + $scope.$watch('tableData', function () { | ||
56 | + if (!fs.isEmptyObject($scope.tableData)) { | ||
57 | + $scope.tableData.forEach(function (meter) { | ||
58 | + meter.bands = $sce.trustAsHtml(meter.bands); | ||
59 | + }); | ||
60 | + } | ||
61 | + }); | ||
62 | + | ||
63 | + $scope.nav = function (path) { | ||
64 | + if ($scope.devId) { | ||
65 | + ns.navTo(path, { devId: $scope.devId }); | ||
66 | + } | ||
67 | + }; | ||
68 | + | ||
69 | + $log.log('OvMeterCtrl has been created'); | ||
70 | + }]); | ||
71 | +}()); | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
1 | -<!-- | ||
2 | - ~ Copyright 2015 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 | - | ||
17 | <!-- Port partial HTML --> | 1 | <!-- Port partial HTML --> |
18 | <div id="ov-port"> | 2 | <div id="ov-port"> |
19 | <div class="tabular-header"> | 3 | <div class="tabular-header"> |
... | @@ -46,6 +30,11 @@ | ... | @@ -46,6 +30,11 @@ |
46 | icon icon-id="groupTable" icon-size="36" | 30 | icon icon-id="groupTable" icon-size="36" |
47 | tooltip tt-msg="groupTip" | 31 | tooltip tt-msg="groupTip" |
48 | ng-click="nav('group')"></div> | 32 | ng-click="nav('group')"></div> |
33 | + | ||
34 | + <div class="active" | ||
35 | + icon icon-id="meterTable" icon-size="36" | ||
36 | + tooltip tt-msg="meterTip" | ||
37 | + ng-click="nav('meter')"></div> | ||
49 | </div> | 38 | </div> |
50 | </div> | 39 | </div> |
51 | 40 | ... | ... |
1 | /* | 1 | /* |
2 | - * Copyright 2015 Open Networking Laboratory | 2 | + * Copyright 2015,2016 Open Networking Laboratory |
3 | * | 3 | * |
4 | * Licensed under the Apache License, Version 2.0 (the "License"); | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
5 | * you may not use this file except in compliance with the License. | 5 | * you may not use this file except in compliance with the License. |
... | @@ -40,6 +40,7 @@ | ... | @@ -40,6 +40,7 @@ |
40 | $scope.deviceTip = 'Show device table'; | 40 | $scope.deviceTip = 'Show device table'; |
41 | $scope.flowTip = 'Show flow view for this device'; | 41 | $scope.flowTip = 'Show flow view for this device'; |
42 | $scope.groupTip = 'Show group view for this device'; | 42 | $scope.groupTip = 'Show group view for this device'; |
43 | + $scope.meterTip = 'Show meter view for selected device'; | ||
43 | 44 | ||
44 | params = $location.search(); | 45 | params = $location.search(); |
45 | if (params.hasOwnProperty('devId')) { | 46 | if (params.hasOwnProperty('devId')) { | ... | ... |
1 | <!DOCTYPE html> | 1 | <!DOCTYPE html> |
2 | <!-- | 2 | <!-- |
3 | -~ Copyright 2014,2015 Open Networking Laboratory | 3 | +~ Copyright 2014-2016 Open Networking Laboratory |
4 | ~ | 4 | ~ |
5 | ~ Licensed under the Apache License, Version 2.0 (the "License"); | 5 | ~ Licensed under the Apache License, Version 2.0 (the "License"); |
6 | ~ you may not use this file except in compliance with the License. | 6 | ~ you may not use this file except in compliance with the License. |
... | @@ -118,6 +118,7 @@ | ... | @@ -118,6 +118,7 @@ |
118 | <script src="app/view/flow/flow.js"></script> | 118 | <script src="app/view/flow/flow.js"></script> |
119 | <script src="app/view/port/port.js"></script> | 119 | <script src="app/view/port/port.js"></script> |
120 | <script src="app/view/group/group.js"></script> | 120 | <script src="app/view/group/group.js"></script> |
121 | + <script src="app/view/meter/meter.js"></script> | ||
121 | <script src="app/view/link/link.js"></script> | 122 | <script src="app/view/link/link.js"></script> |
122 | <script src="app/view/host/host.js"></script> | 123 | <script src="app/view/host/host.js"></script> |
123 | <script src="app/view/intent/intent.js"></script> | 124 | <script src="app/view/intent/intent.js"></script> |
... | @@ -137,6 +138,7 @@ | ... | @@ -137,6 +138,7 @@ |
137 | <link rel="stylesheet" href="app/view/flow/flow.css"> | 138 | <link rel="stylesheet" href="app/view/flow/flow.css"> |
138 | <link rel="stylesheet" href="app/view/port/port.css"> | 139 | <link rel="stylesheet" href="app/view/port/port.css"> |
139 | <link rel="stylesheet" href="app/view/group/group.css"> | 140 | <link rel="stylesheet" href="app/view/group/group.css"> |
141 | + <link rel="stylesheet" href="app/view/meter/meter.css"> | ||
140 | <link rel="stylesheet" href="app/view/link/link.css"> | 142 | <link rel="stylesheet" href="app/view/link/link.css"> |
141 | <link rel="stylesheet" href="app/view/host/host.css"> | 143 | <link rel="stylesheet" href="app/view/host/host.css"> |
142 | <link rel="stylesheet" href="app/view/intent/intent.css"> | 144 | <link rel="stylesheet" href="app/view/intent/intent.css"> | ... | ... |
1 | /* | 1 | /* |
2 | - * Copyright 2014,2015 Open Networking Laboratory | 2 | + * Copyright 2014-2016 Open Networking Laboratory |
3 | * | 3 | * |
4 | * Licensed under the Apache License, Version 2.0 (the "License"); | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
5 | * you may not use this file except in compliance with the License. | 5 | * you may not use this file except in compliance with the License. |
... | @@ -41,6 +41,7 @@ | ... | @@ -41,6 +41,7 @@ |
41 | 'flow', | 41 | 'flow', |
42 | 'port', | 42 | 'port', |
43 | 'group', | 43 | 'group', |
44 | + 'meter', | ||
44 | 'host', | 45 | 'host', |
45 | 'app', | 46 | 'app', |
46 | 'intent', | 47 | 'intent', | ... | ... |
-
Please register or login to post a comment