GUI -- General GUI backend cleanup and bug fixes. Added custom formatters for ex…
…isting tables, unit test for Enum Formatter, and more glyphs. Change-Id: I956f1faf6a59e535094d45b811980f822b084be0
Showing
11 changed files
with
178 additions
and
70 deletions
| 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 | +package org.onosproject.ui.table.cell; | ||
| 18 | + | ||
| 19 | +import org.junit.Test; | ||
| 20 | +import org.onosproject.ui.table.CellFormatter; | ||
| 21 | + | ||
| 22 | +import static org.junit.Assert.assertEquals; | ||
| 23 | + | ||
| 24 | +/** | ||
| 25 | + * Unit tests for {@link EnumFormatter}. | ||
| 26 | + */ | ||
| 27 | +public class EnumFormatterTest { | ||
| 28 | + | ||
| 29 | + enum TestEnum { | ||
| 30 | + ADDED, | ||
| 31 | + PENDING_ADD, | ||
| 32 | + WAITING_AUDIT_COMPLETE | ||
| 33 | + } | ||
| 34 | + | ||
| 35 | + private CellFormatter fmt = EnumFormatter.INSTANCE; | ||
| 36 | + | ||
| 37 | + @Test | ||
| 38 | + public void nullValue() { | ||
| 39 | + assertEquals("null value", "", fmt.format(null)); | ||
| 40 | + } | ||
| 41 | + | ||
| 42 | + @Test | ||
| 43 | + public void noUnderscores() { | ||
| 44 | + assertEquals("All caps", "Added", fmt.format(TestEnum.ADDED)); | ||
| 45 | + } | ||
| 46 | + | ||
| 47 | + @Test | ||
| 48 | + public void underscores() { | ||
| 49 | + assertEquals("All caps with underscores", | ||
| 50 | + "Pending Add", fmt.format(TestEnum.PENDING_ADD)); | ||
| 51 | + } | ||
| 52 | + | ||
| 53 | + @Test | ||
| 54 | + public void multiUnderscores() { | ||
| 55 | + assertEquals("All caps with underscores", | ||
| 56 | + "Waiting Audit Complete", | ||
| 57 | + fmt.format(TestEnum.WAITING_AUDIT_COMPLETE)); | ||
| 58 | + } | ||
| 59 | + | ||
| 60 | +} |
| ... | @@ -39,6 +39,8 @@ import java.util.Collections; | ... | @@ -39,6 +39,8 @@ import java.util.Collections; |
| 39 | import java.util.List; | 39 | import java.util.List; |
| 40 | import java.util.Set; | 40 | import java.util.Set; |
| 41 | 41 | ||
| 42 | +import static org.apache.commons.lang.WordUtils.capitalizeFully; | ||
| 43 | + | ||
| 42 | /** | 44 | /** |
| 43 | * Message handler for device view related messages. | 45 | * Message handler for device view related messages. |
| 44 | */ | 46 | */ |
| ... | @@ -157,7 +159,7 @@ public class DeviceViewMessageHandler extends UiMessageHandler { | ... | @@ -157,7 +159,7 @@ public class DeviceViewMessageHandler extends UiMessageHandler { |
| 157 | ObjectNode data = MAPPER.createObjectNode(); | 159 | ObjectNode data = MAPPER.createObjectNode(); |
| 158 | 160 | ||
| 159 | data.put(ID, deviceId.toString()); | 161 | data.put(ID, deviceId.toString()); |
| 160 | - data.put(TYPE, device.type().toString()); | 162 | + data.put(TYPE, capitalizeFully(device.type().toString())); |
| 161 | data.put(TYPE_IID, getTypeIconId(device)); | 163 | data.put(TYPE_IID, getTypeIconId(device)); |
| 162 | data.put(MFR, device.manufacturer()); | 164 | data.put(MFR, device.manufacturer()); |
| 163 | data.put(HW, device.hwVersion()); | 165 | data.put(HW, device.hwVersion()); |
| ... | @@ -190,8 +192,8 @@ public class DeviceViewMessageHandler extends UiMessageHandler { | ... | @@ -190,8 +192,8 @@ public class DeviceViewMessageHandler extends UiMessageHandler { |
| 190 | LinkService ls = get(LinkService.class); | 192 | LinkService ls = get(LinkService.class); |
| 191 | String name = p.annotations().value(AnnotationKeys.PORT_NAME); | 193 | String name = p.annotations().value(AnnotationKeys.PORT_NAME); |
| 192 | 194 | ||
| 193 | - port.put(ID, p.number().toString()); | 195 | + port.put(ID, capitalizeFully(p.number().toString())); |
| 194 | - port.put(TYPE, p.type().toString()); | 196 | + port.put(TYPE, capitalizeFully(p.type().toString())); |
| 195 | port.put(SPEED, p.portSpeed()); | 197 | port.put(SPEED, p.portSpeed()); |
| 196 | port.put(ENABLED, p.isEnabled()); | 198 | port.put(ENABLED, p.isEnabled()); |
| 197 | port.put(NAME, name != null ? name : ""); | 199 | port.put(NAME, name != null ? name : ""); | ... | ... |
| ... | @@ -22,14 +22,14 @@ import com.google.common.collect.ImmutableSet; | ... | @@ -22,14 +22,14 @@ import com.google.common.collect.ImmutableSet; |
| 22 | import org.onosproject.net.DeviceId; | 22 | import org.onosproject.net.DeviceId; |
| 23 | import org.onosproject.net.flow.FlowEntry; | 23 | import org.onosproject.net.flow.FlowEntry; |
| 24 | import org.onosproject.net.flow.FlowRuleService; | 24 | import org.onosproject.net.flow.FlowRuleService; |
| 25 | -import org.onosproject.net.flow.TrafficSelector; | ||
| 26 | -import org.onosproject.net.flow.TrafficTreatment; | ||
| 27 | import org.onosproject.net.flow.criteria.Criterion; | 25 | import org.onosproject.net.flow.criteria.Criterion; |
| 28 | import org.onosproject.net.flow.instructions.Instruction; | 26 | import org.onosproject.net.flow.instructions.Instruction; |
| 29 | import org.onosproject.ui.RequestHandler; | 27 | import org.onosproject.ui.RequestHandler; |
| 30 | import org.onosproject.ui.UiMessageHandler; | 28 | import org.onosproject.ui.UiMessageHandler; |
| 29 | +import org.onosproject.ui.table.CellFormatter; | ||
| 31 | import org.onosproject.ui.table.TableModel; | 30 | import org.onosproject.ui.table.TableModel; |
| 32 | import org.onosproject.ui.table.TableRequestHandler; | 31 | import org.onosproject.ui.table.TableRequestHandler; |
| 32 | +import org.onosproject.ui.table.cell.EnumFormatter; | ||
| 33 | import org.onosproject.ui.table.cell.IntComparator; | 33 | import org.onosproject.ui.table.cell.IntComparator; |
| 34 | import org.onosproject.ui.table.cell.LongComparator; | 34 | import org.onosproject.ui.table.cell.LongComparator; |
| 35 | 35 | ||
| ... | @@ -37,9 +37,6 @@ import java.util.Collection; | ... | @@ -37,9 +37,6 @@ import java.util.Collection; |
| 37 | import java.util.List; | 37 | import java.util.List; |
| 38 | import java.util.Set; | 38 | import java.util.Set; |
| 39 | 39 | ||
| 40 | -import static org.apache.commons.lang.WordUtils.capitalizeFully; | ||
| 41 | - | ||
| 42 | - | ||
| 43 | /** | 40 | /** |
| 44 | * Message handler for flow view related messages. | 41 | * Message handler for flow view related messages. |
| 45 | */ | 42 | */ |
| ... | @@ -95,6 +92,10 @@ public class FlowViewMessageHandler extends UiMessageHandler { | ... | @@ -95,6 +92,10 @@ public class FlowViewMessageHandler extends UiMessageHandler { |
| 95 | tm.setComparator(TIMEOUT, IntComparator.INSTANCE); | 92 | tm.setComparator(TIMEOUT, IntComparator.INSTANCE); |
| 96 | tm.setComparator(PACKETS, LongComparator.INSTANCE); | 93 | tm.setComparator(PACKETS, LongComparator.INSTANCE); |
| 97 | tm.setComparator(BYTES, LongComparator.INSTANCE); | 94 | tm.setComparator(BYTES, LongComparator.INSTANCE); |
| 95 | + | ||
| 96 | + tm.setFormatter(SELECTOR, new SelectorFormatter()); | ||
| 97 | + tm.setFormatter(TREATMENT, new TreatmentFormatter()); | ||
| 98 | + tm.setFormatter(STATE, EnumFormatter.INSTANCE); | ||
| 98 | return tm; | 99 | return tm; |
| 99 | } | 100 | } |
| 100 | 101 | ||
| ... | @@ -116,73 +117,50 @@ public class FlowViewMessageHandler extends UiMessageHandler { | ... | @@ -116,73 +117,50 @@ public class FlowViewMessageHandler extends UiMessageHandler { |
| 116 | .cell(GROUP_ID, flow.groupId().id()) | 117 | .cell(GROUP_ID, flow.groupId().id()) |
| 117 | .cell(TABLE_ID, flow.tableId()) | 118 | .cell(TABLE_ID, flow.tableId()) |
| 118 | .cell(PRIORITY, flow.priority()) | 119 | .cell(PRIORITY, flow.priority()) |
| 119 | - .cell(SELECTOR, getSelectorString(flow)) | 120 | + .cell(SELECTOR, flow) |
| 120 | - .cell(TREATMENT, getTreatmentString(flow)) | 121 | + .cell(TREATMENT, flow) |
| 121 | .cell(TIMEOUT, flow.timeout()) | 122 | .cell(TIMEOUT, flow.timeout()) |
| 122 | .cell(PERMANENT, flow.isPermanent()) | 123 | .cell(PERMANENT, flow.isPermanent()) |
| 123 | - .cell(STATE, capitalizeFully(flow.state().toString())) | 124 | + .cell(STATE, flow.state()) |
| 124 | .cell(PACKETS, flow.packets()) | 125 | .cell(PACKETS, flow.packets()) |
| 125 | .cell(BYTES, flow.bytes()); | 126 | .cell(BYTES, flow.bytes()); |
| 126 | } | 127 | } |
| 127 | 128 | ||
| 128 | - private String getSelectorString(FlowEntry f) { | 129 | + private final class SelectorFormatter implements CellFormatter { |
| 129 | - String result; | 130 | + @Override |
| 130 | - TrafficSelector selector = f.selector(); | 131 | + public String format(Object value) { |
| 131 | - Set<Criterion> criteria = selector.criteria(); | 132 | + FlowEntry flow = (FlowEntry) value; |
| 133 | + Set<Criterion> criteria = flow.selector().criteria(); | ||
| 132 | 134 | ||
| 133 | - if (criteria.isEmpty()) { | 135 | + if (criteria.isEmpty()) { |
| 134 | - result = "(No traffic selectors for this flow)"; | 136 | + return "(No traffic selector criteria for this flow)"; |
| 135 | - } else { | 137 | + } |
| 136 | - StringBuilder sb = new StringBuilder("Criteria = "); | 138 | + StringBuilder sb = new StringBuilder("Criteria: "); |
| 137 | for (Criterion c : criteria) { | 139 | for (Criterion c : criteria) { |
| 138 | - sb.append(capitalizeFully(c.type().toString())).append(COMMA); | 140 | + sb.append(c).append(COMMA); |
| 139 | } | 141 | } |
| 140 | - result = removeTrailingComma(sb).toString(); | 142 | + removeTrailingComma(sb); |
| 141 | - } | ||
| 142 | - return result; | ||
| 143 | - } | ||
| 144 | 143 | ||
| 145 | - private String getTreatmentString(FlowEntry f) { | 144 | + return sb.toString(); |
| 146 | - TrafficTreatment treatment = f.treatment(); | ||
| 147 | - List<Instruction> deferred = treatment.deferred(); | ||
| 148 | - List<Instruction> immediate = treatment.immediate(); | ||
| 149 | - boolean haveDef = !deferred.isEmpty(); | ||
| 150 | - boolean haveImm = !immediate.isEmpty(); | ||
| 151 | - boolean both = haveDef && haveImm; | ||
| 152 | - boolean neither = !haveDef && !haveImm; | ||
| 153 | - String result; | ||
| 154 | - | ||
| 155 | - if (neither) { | ||
| 156 | - result = "(No traffic treatment instructions for this flow)"; | ||
| 157 | - } else { | ||
| 158 | - StringBuilder sb = new StringBuilder(); | ||
| 159 | - addDeferred(sb, deferred); | ||
| 160 | - if (both) { | ||
| 161 | - sb.append(COMMA); | ||
| 162 | - } | ||
| 163 | - addImmediate(sb, immediate); | ||
| 164 | - result = sb.toString(); | ||
| 165 | } | 145 | } |
| 166 | - return result; | ||
| 167 | } | 146 | } |
| 168 | 147 | ||
| 169 | - private void addDeferred(StringBuilder sb, List<Instruction> deferred) { | 148 | + private final class TreatmentFormatter implements CellFormatter { |
| 170 | - if (!deferred.isEmpty()) { | 149 | + @Override |
| 171 | - sb.append("Deferred instructions = "); | 150 | + public String format(Object value) { |
| 172 | - for (Instruction i : deferred) { | 151 | + FlowEntry flow = (FlowEntry) value; |
| 173 | - sb.append(capitalizeFully(i.type().toString())).append(COMMA); | 152 | + List<Instruction> instructions = flow.treatment().allInstructions(); |
| 174 | - } | ||
| 175 | - removeTrailingComma(sb); | ||
| 176 | - } | ||
| 177 | - } | ||
| 178 | 153 | ||
| 179 | - private void addImmediate(StringBuilder sb, List<Instruction> immediate) { | 154 | + if (instructions.isEmpty()) { |
| 180 | - if (!immediate.isEmpty()) { | 155 | + return "(No traffic treatment instructions for this flow)"; |
| 181 | - sb.append("Immediate instructions = "); | 156 | + } |
| 182 | - for (Instruction i : immediate) { | 157 | + StringBuilder sb = new StringBuilder("Treatment Instructions: "); |
| 183 | - sb.append(capitalizeFully(i.type().toString())).append(COMMA); | 158 | + for (Instruction i : instructions) { |
| 159 | + sb.append(i).append(COMMA); | ||
| 184 | } | 160 | } |
| 185 | removeTrailingComma(sb); | 161 | removeTrailingComma(sb); |
| 162 | + | ||
| 163 | + return sb.toString(); | ||
| 186 | } | 164 | } |
| 187 | } | 165 | } |
| 188 | 166 | ... | ... |
| ... | @@ -123,9 +123,9 @@ public class GroupViewMessageHandler extends UiMessageHandler { | ... | @@ -123,9 +123,9 @@ public class GroupViewMessageHandler extends UiMessageHandler { |
| 123 | 123 | ||
| 124 | for (GroupBucket b : buckets) { | 124 | for (GroupBucket b : buckets) { |
| 125 | sb.append("Bytes: ") | 125 | sb.append("Bytes: ") |
| 126 | - .append(Long.toString(b.bytes())) | 126 | + .append(b.bytes()) |
| 127 | .append(" Packets: ") | 127 | .append(" Packets: ") |
| 128 | - .append(Long.toString(b.packets())) | 128 | + .append(b.packets()) |
| 129 | .append(" Actions: ") | 129 | .append(" Actions: ") |
| 130 | .append(b.treatment().allInstructions()) | 130 | .append(b.treatment().allInstructions()) |
| 131 | .append(COMMA); | 131 | .append(COMMA); | ... | ... |
| ... | @@ -17,16 +17,19 @@ package org.onosproject.ui.impl; | ... | @@ -17,16 +17,19 @@ package org.onosproject.ui.impl; |
| 17 | 17 | ||
| 18 | import com.fasterxml.jackson.databind.node.ObjectNode; | 18 | import com.fasterxml.jackson.databind.node.ObjectNode; |
| 19 | import com.google.common.collect.ImmutableSet; | 19 | import com.google.common.collect.ImmutableSet; |
| 20 | +import org.onlab.packet.IpAddress; | ||
| 20 | import org.onosproject.net.AnnotationKeys; | 21 | import org.onosproject.net.AnnotationKeys; |
| 21 | import org.onosproject.net.Host; | 22 | import org.onosproject.net.Host; |
| 22 | import org.onosproject.net.host.HostService; | 23 | import org.onosproject.net.host.HostService; |
| 23 | import org.onosproject.ui.RequestHandler; | 24 | import org.onosproject.ui.RequestHandler; |
| 24 | import org.onosproject.ui.UiMessageHandler; | 25 | import org.onosproject.ui.UiMessageHandler; |
| 26 | +import org.onosproject.ui.table.CellFormatter; | ||
| 25 | import org.onosproject.ui.table.TableModel; | 27 | import org.onosproject.ui.table.TableModel; |
| 26 | import org.onosproject.ui.table.TableRequestHandler; | 28 | import org.onosproject.ui.table.TableRequestHandler; |
| 27 | import org.onosproject.ui.table.cell.HostLocationFormatter; | 29 | import org.onosproject.ui.table.cell.HostLocationFormatter; |
| 28 | 30 | ||
| 29 | import java.util.Collection; | 31 | import java.util.Collection; |
| 32 | +import java.util.Set; | ||
| 30 | 33 | ||
| 31 | import static com.google.common.base.Strings.isNullOrEmpty; | 34 | import static com.google.common.base.Strings.isNullOrEmpty; |
| 32 | 35 | ||
| ... | @@ -72,6 +75,7 @@ public class HostViewMessageHandler extends UiMessageHandler { | ... | @@ -72,6 +75,7 @@ public class HostViewMessageHandler extends UiMessageHandler { |
| 72 | protected TableModel createTableModel() { | 75 | protected TableModel createTableModel() { |
| 73 | TableModel tm = super.createTableModel(); | 76 | TableModel tm = super.createTableModel(); |
| 74 | tm.setFormatter(LOCATION, HostLocationFormatter.INSTANCE); | 77 | tm.setFormatter(LOCATION, HostLocationFormatter.INSTANCE); |
| 78 | + tm.setFormatter(IPS, new IpSetFormatter()); | ||
| 75 | return tm; | 79 | return tm; |
| 76 | } | 80 | } |
| 77 | 81 | ||
| ... | @@ -97,5 +101,30 @@ public class HostViewMessageHandler extends UiMessageHandler { | ... | @@ -97,5 +101,30 @@ public class HostViewMessageHandler extends UiMessageHandler { |
| 97 | return HOST_ICON_PREFIX + | 101 | return HOST_ICON_PREFIX + |
| 98 | (isNullOrEmpty(hostType) ? "endstation" : hostType); | 102 | (isNullOrEmpty(hostType) ? "endstation" : hostType); |
| 99 | } | 103 | } |
| 104 | + | ||
| 105 | + private final class IpSetFormatter implements CellFormatter { | ||
| 106 | + private static final String COMMA = ", "; | ||
| 107 | + | ||
| 108 | + @Override | ||
| 109 | + public String format(Object value) { | ||
| 110 | + Set<IpAddress> ips = (Set<IpAddress>) value; | ||
| 111 | + if (ips.isEmpty()) { | ||
| 112 | + return "(No IP Addresses for this host)"; | ||
| 113 | + } | ||
| 114 | + StringBuilder sb = new StringBuilder(); | ||
| 115 | + for (IpAddress ip : ips) { | ||
| 116 | + sb.append(ip.toString()) | ||
| 117 | + .append(COMMA); | ||
| 118 | + } | ||
| 119 | + removeTrailingComma(sb); | ||
| 120 | + return sb.toString(); | ||
| 121 | + } | ||
| 122 | + | ||
| 123 | + private StringBuilder removeTrailingComma(StringBuilder sb) { | ||
| 124 | + int pos = sb.lastIndexOf(COMMA); | ||
| 125 | + sb.delete(pos, sb.length()); | ||
| 126 | + return sb; | ||
| 127 | + } | ||
| 128 | + } | ||
| 100 | } | 129 | } |
| 101 | } | 130 | } | ... | ... |
This diff is collapsed. Click to expand it.
| ... | @@ -28,6 +28,7 @@ import org.onosproject.ui.impl.TopologyViewMessageHandlerBase.BiLink; | ... | @@ -28,6 +28,7 @@ import org.onosproject.ui.impl.TopologyViewMessageHandlerBase.BiLink; |
| 28 | import org.onosproject.ui.table.TableModel; | 28 | import org.onosproject.ui.table.TableModel; |
| 29 | import org.onosproject.ui.table.TableRequestHandler; | 29 | import org.onosproject.ui.table.TableRequestHandler; |
| 30 | import org.onosproject.ui.table.cell.ConnectPointFormatter; | 30 | import org.onosproject.ui.table.cell.ConnectPointFormatter; |
| 31 | +import org.onosproject.ui.table.cell.EnumFormatter; | ||
| 31 | 32 | ||
| 32 | import java.util.Collection; | 33 | import java.util.Collection; |
| 33 | import java.util.Map; | 34 | import java.util.Map; |
| ... | @@ -83,6 +84,7 @@ public class LinkViewMessageHandler extends UiMessageHandler { | ... | @@ -83,6 +84,7 @@ public class LinkViewMessageHandler extends UiMessageHandler { |
| 83 | TableModel tm = super.createTableModel(); | 84 | TableModel tm = super.createTableModel(); |
| 84 | tm.setFormatter(ONE, ConnectPointFormatter.INSTANCE); | 85 | tm.setFormatter(ONE, ConnectPointFormatter.INSTANCE); |
| 85 | tm.setFormatter(TWO, ConnectPointFormatter.INSTANCE); | 86 | tm.setFormatter(TWO, ConnectPointFormatter.INSTANCE); |
| 87 | + tm.setFormatter(TYPE, EnumFormatter.INSTANCE); | ||
| 86 | return tm; | 88 | return tm; |
| 87 | } | 89 | } |
| 88 | 90 | ||
| ... | @@ -113,7 +115,7 @@ public class LinkViewMessageHandler extends UiMessageHandler { | ... | @@ -113,7 +115,7 @@ public class LinkViewMessageHandler extends UiMessageHandler { |
| 113 | if (link.two != null && link.two.type() != link.one.type()) { | 115 | if (link.two != null && link.two.type() != link.one.type()) { |
| 114 | sb.append(" / ").append(link.two.type()); | 116 | sb.append(" / ").append(link.two.type()); |
| 115 | } | 117 | } |
| 116 | - return sb.toString().toLowerCase(); | 118 | + return sb.toString(); |
| 117 | } | 119 | } |
| 118 | 120 | ||
| 119 | private String linkState(BiLink link) { | 121 | private String linkState(BiLink link) { | ... | ... |
| ... | @@ -152,6 +152,40 @@ | ... | @@ -152,6 +152,40 @@ |
| 152 | '4.3S57.5,83.5,55.1,83.5zM84.2,63.2c0-2.3-1.9-4.3-4.3-4.3s-4.3,' + | 152 | '4.3S57.5,83.5,55.1,83.5zM84.2,63.2c0-2.3-1.9-4.3-4.3-4.3s-4.3,' + |
| 153 | '1.9-4.3,4.3s1.9,4.3,4.3,4.3S84.2,65.5,84.2,63.2z', | 153 | '1.9-4.3,4.3s1.9,4.3,4.3,4.3S84.2,65.5,84.2,63.2z', |
| 154 | 154 | ||
| 155 | + portTable: 'M15.9,19.1h-8v-13h8V19.1z M90.5,6.1H75.6v13h14.9V6.1' + | ||
| 156 | + 'z M71.9,6.1H56.9v13h14.9V6.1z M53.2,6.1H38.3v13h14.9V6.1z M34.5,' + | ||
| 157 | + '6.1H19.6v13h14.9V6.1z M102.2,6.1h-8v13h8V6.1z M102.6,23.6v78.5H' + | ||
| 158 | + '8.2V23.6H102.6z M85.5,37.7c0-0.7-0.4-1.3-0.9-1.3H26.2c-0.5,0-' + | ||
| 159 | + '0.9,0.6-0.9,1.3v34.6c0,0.7,0.4,1.3,0.9,1.3h11v9.6c0,1.1,0.5,2,' + | ||
| 160 | + '1.2,2h9.1c0,0.2,0,0.3,0,0.5v3c0,1.1,0.5,2,1.2,2h13.5c0.6,0,1.2-' + | ||
| 161 | + '0.9,1.2-2v-3c0-0.2,0-0.3,0-0.5h9.1c0.6,0,1.2-0.9,1.2-2v-9.6h11' + | ||
| 162 | + 'c0.5,0,0.9-0.6,0.9-1.3V37.7z M30.2,40h-1v8h1V40zM75.2,40h-2.1v8' + | ||
| 163 | + 'h2.1V40z M67.7,40h-2.1v8h2.1V40z M60.2,40h-2.1v8h2.1V40z M52.7,' + | ||
| 164 | + '40h-2.1v8h2.1V40z M45.2,40h-2.1v8h2.1V40zM37.7,40h-2.1v8h2.1V40' + | ||
| 165 | + 'z M81.6,40h-1v8h1V40z', | ||
| 166 | + | ||
| 167 | + groupTable: 'M16,19.1H8v-13h8V19.1z M90.6,6.1H75.7v13h14.9V6.1z ' + | ||
| 168 | + 'M71.9,6.1H57v13h14.9V6.1z M53.3,6.1H38.4v13h14.9V6.1z M34.6,6.1' + | ||
| 169 | + 'H19.7v13h14.9V6.1z M102.3,6.1h-8v13h8V6.1z M45.7,52.7c0.2-5.6,' + | ||
| 170 | + '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,' + | ||
| 171 | + '17.7c0,6.3,3.3,11.9,8.3,15C34.8,61.5,39.4,55.6,45.7,52.7z M51.9,' + | ||
| 172 | + '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,' + | ||
| 173 | + '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,' + | ||
| 174 | + '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,' + | ||
| 175 | + '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,' + | ||
| 176 | + '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' + | ||
| 177 | + '-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,' + | ||
| 178 | + '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' + | ||
| 179 | + '-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,' + | ||
| 180 | + '55.4z M102.3,23.6v78.5H8V23.6H102.3z M89,53.5c0-12-9.7-21.7-' + | ||
| 181 | + '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,' + | ||
| 182 | + '0-21.7,9.7-21.7,21.7c0,8.5,4.9,15.9,12,19.4C33.6,84.6,43.2,94,' + | ||
| 183 | + '54.9,94c11.7,0,21.2-9.3,21.7-20.9C84,69.7,89,62.2,89,53.5z M' + | ||
| 184 | + '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,' + | ||
| 185 | + '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' + | ||
| 186 | + '-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,' + | ||
| 187 | + '15.8C81.5,65.6,85,60,85,53.5C85,43.8,77.1,35.8,67.3,35.8z', | ||
| 188 | + | ||
| 155 | // --- Topology toolbar specific glyphs ---------------------- | 189 | // --- Topology toolbar specific glyphs ---------------------- |
| 156 | 190 | ||
| 157 | summary: "M95.8,9.2H14.2c-2.8,0-5,2.2-5,5v81.5c0,2.8,2.2,5,5," + | 191 | summary: "M95.8,9.2H14.2c-2.8,0-5,2.2-5,5v81.5c0,2.8,2.2,5,5," + | ... | ... |
| ... | @@ -130,7 +130,7 @@ | ... | @@ -130,7 +130,7 @@ |
| 130 | bns.button( | 130 | bns.button( |
| 131 | btnsDiv, | 131 | btnsDiv, |
| 132 | bName + '-ports', | 132 | bName + '-ports', |
| 133 | - 'chain', | 133 | + 'portTable', |
| 134 | function () { | 134 | function () { |
| 135 | ns.navTo(portPath, { devId: details.id }); | 135 | ns.navTo(portPath, { devId: details.id }); |
| 136 | }, | 136 | }, |
| ... | @@ -142,9 +142,6 @@ | ... | @@ -142,9 +142,6 @@ |
| 142 | var tr = tbody.append('tr'); | 142 | var tr = tbody.append('tr'); |
| 143 | 143 | ||
| 144 | portCols.forEach(function (col) { | 144 | portCols.forEach(function (col) { |
| 145 | - if (col === 'type' || col === 'id') { | ||
| 146 | - port[col] = fs.cap(port[col]); | ||
| 147 | - } | ||
| 148 | tr.append('td').html(port[col]); | 145 | tr.append('td').html(port[col]); |
| 149 | }); | 146 | }); |
| 150 | } | 147 | } | ... | ... |
| ... | @@ -257,7 +257,7 @@ | ... | @@ -257,7 +257,7 @@ |
| 257 | }); | 257 | }); |
| 258 | tps.addAction({ | 258 | tps.addAction({ |
| 259 | id: 'ports-table-btn', | 259 | id: 'ports-table-btn', |
| 260 | - gid: 'chain', | 260 | + gid: 'portTable', |
| 261 | cb: function () { | 261 | cb: function () { |
| 262 | ns.navTo(portPath, { devId: data.props['URI'] }); | 262 | ns.navTo(portPath, { devId: data.props['URI'] }); |
| 263 | }, | 263 | }, | ... | ... |
| ... | @@ -20,12 +20,15 @@ | ... | @@ -20,12 +20,15 @@ |
| 20 | describe('factory: fw/svg/glyph.js', function() { | 20 | describe('factory: fw/svg/glyph.js', function() { |
| 21 | var $log, fs, gs, d3Elem, svg; | 21 | var $log, fs, gs, d3Elem, svg; |
| 22 | 22 | ||
| 23 | - var numBaseGlyphs = 39, | 23 | + var numBaseGlyphs = 41, |
| 24 | vbBird = '352 224 113 112', | 24 | vbBird = '352 224 113 112', |
| 25 | vbGlyph = '0 0 110 110', | 25 | vbGlyph = '0 0 110 110', |
| 26 | vbBadge = '0 0 10 10', | 26 | vbBadge = '0 0 10 10', |
| 27 | longPrefix = 'M95.8,9.2H14.2c-2.8,0-5,2.2-5,5v81.5c0,2.8,2.2,5,5,' + | 27 | longPrefix = 'M95.8,9.2H14.2c-2.8,0-5,2.2-5,5v81.5c0,2.8,2.2,5,5,' + |
| 28 | '5h81.5c2.8,0,5-2.2,5-5V14.2C100.8,11.5,98.5,9.2,95.8,9.2z ', | 28 | '5h81.5c2.8,0,5-2.2,5-5V14.2C100.8,11.5,98.5,9.2,95.8,9.2z ', |
| 29 | + tablePrefix = 'M15.9,19.1h-8v-13h8V19.1z M90.5,6.1H75.6v13h14.9V6.1' + | ||
| 30 | + 'z M71.9,6.1H56.9v13h14.9V6.1z M53.2,6.1H38.3v13h14.9V6.1z M34.5,' + | ||
| 31 | + '6.1H19.6v13h14.9V6.1z M102.2,6.1h-8v13h8V6.1z ', | ||
| 29 | prefixLookup = { | 32 | prefixLookup = { |
| 30 | bird: 'M427.7,300.4', | 33 | bird: 'M427.7,300.4', |
| 31 | unknown: 'M35,40a5', | 34 | unknown: 'M35,40a5', |
| ... | @@ -42,7 +45,9 @@ describe('factory: fw/svg/glyph.js', function() { | ... | @@ -42,7 +45,9 @@ describe('factory: fw/svg/glyph.js', function() { |
| 42 | refresh: 'M102.6,40.8L88.4', | 45 | refresh: 'M102.6,40.8L88.4', |
| 43 | 46 | ||
| 44 | // navigation specific glyphs | 47 | // navigation specific glyphs |
| 45 | - flowTable: 'M15.9,19.1h-8v-13h', | 48 | + flowTable: tablePrefix + 'M102.2,23.6H7.9v', |
| 49 | + portTable: tablePrefix + 'M102.6,23.6v78.5H', | ||
| 50 | + groupTable: 'M16,19.1H8v-13h', | ||
| 46 | 51 | ||
| 47 | // toolbar specific glyphs | 52 | // toolbar specific glyphs |
| 48 | summary: longPrefix + 'M16.7', | 53 | summary: longPrefix + 'M16.7', |
| ... | @@ -81,7 +86,8 @@ describe('factory: fw/svg/glyph.js', function() { | ... | @@ -81,7 +86,8 @@ describe('factory: fw/svg/glyph.js', function() { |
| 81 | glyphIds = [ | 86 | glyphIds = [ |
| 82 | 'unknown', 'node', 'switch', 'roadm', 'endstation', 'router', | 87 | 'unknown', 'node', 'switch', 'roadm', 'endstation', 'router', |
| 83 | 'bgpSpeaker', 'chain', 'crown', 'lock', 'topo', 'refresh', | 88 | 'bgpSpeaker', 'chain', 'crown', 'lock', 'topo', 'refresh', |
| 84 | - 'flowTable', 'summary', 'details', 'ports', 'map', 'cycleLabels', | 89 | + 'flowTable', 'portTable', 'groupTable', |
| 90 | + 'summary', 'details', 'ports', 'map', 'cycleLabels', | ||
| 85 | 'oblique', 'filters', 'resetZoom', 'relatedIntents', 'nextIntent', | 91 | 'oblique', 'filters', 'resetZoom', 'relatedIntents', 'nextIntent', |
| 86 | 'prevIntent', 'intentTraffic', 'allTraffic', 'flows', 'eqMaster' | 92 | 'prevIntent', 'intentTraffic', 'allTraffic', 'flows', 'eqMaster' |
| 87 | ], | 93 | ], | ... | ... |
-
Please register or login to post a comment