Cleaned out deadwood, now that bit rate link styles are processed server-side.
Change-Id: I57a95c84b10fd4f3640739ba3f1988d06a12e1d2
diff --git a/web/gui/src/main/webapp/app/fw/util/fn.js b/web/gui/src/main/webapp/app/fw/util/fn.js
index 0d5d4cc..e3b9600 100644
--- a/web/gui/src/main/webapp/app/fw/util/fn.js
+++ b/web/gui/src/main/webapp/app/fw/util/fn.js
@@ -265,12 +265,6 @@
return str.indexOf(suffix, str.length - suffix.length) !== -1;
}
- function parseBitRate(str) {
- return Number(str.replace(/,/, '')
- .replace(/\s+.bps/i, '')
- .replace(/\.\d*/, ''));
- }
-
// return true if the given debug flag was specified in the query params
function debugOn(tag) {
return debugFlags[tag];
@@ -471,7 +465,6 @@
noPx: noPx,
noPxStyle: noPxStyle,
endsWith: endsWith,
- parseBitRate: parseBitRate,
addToTrie: addToTrie,
removeFromTrie: removeFromTrie,
trieLookup: trieLookup,
diff --git a/web/gui/src/main/webapp/app/view/topo/topoOverlay.js b/web/gui/src/main/webapp/app/view/topo/topoOverlay.js
index d51d8fc..f953911 100644
--- a/web/gui/src/main/webapp/app/view/topo/topoOverlay.js
+++ b/web/gui/src/main/webapp/app/view/topo/topoOverlay.js
@@ -393,32 +393,15 @@
});
data.links.forEach(function (link) {
- var ldata = api.findLinkById(link.id),
- lab = link.label,
- units, portcls, magnitude;
+ var ldata = api.findLinkById(link.id);
if (ldata && ldata.el && !ldata.el.empty()) {
if (!link.subdue) {
api.unsupLink(ldata.key, less);
}
ldata.el.classed(link.css, true);
- ldata.label = lab;
+ ldata.label = link.label;
- // TODO: this needs to be pulled out into traffic overlay
- // inject additional styling for port-based traffic
- if (fs.endsWith(lab, 'bps')) {
- units = lab.substring(lab.length-4);
- portcls = 'port-traffic-' + units;
-
- // for GBps
- if (units.substring(0,1) === 'G') {
- magnitude = fs.parseBitRate(lab);
- if (magnitude >= 9) {
- portcls += '-choked'
- }
- }
- ldata.el.classed(portcls, true);
- }
} else {
$log.warn('HILITE: no link element:', link.id);
}
diff --git a/web/gui/src/main/webapp/tests/app/fw/util/fn-spec.js b/web/gui/src/main/webapp/tests/app/fw/util/fn-spec.js
index bc434ca..6f999a6 100644
--- a/web/gui/src/main/webapp/tests/app/fw/util/fn-spec.js
+++ b/web/gui/src/main/webapp/tests/app/fw/util/fn-spec.js
@@ -216,7 +216,7 @@
'isMobile', 'isChrome', 'isSafari', 'isFirefox',
'debugOn', 'debug',
'find', 'inArray', 'removeFromArray', 'isEmptyObject', 'sameObjProps', 'containsObj', 'cap',
- 'eecode', 'noPx', 'noPxStyle', 'endsWith', 'parseBitRate', 'addToTrie', 'removeFromTrie', 'trieLookup',
+ 'eecode', 'noPx', 'noPxStyle', 'endsWith', 'addToTrie', 'removeFromTrie', 'trieLookup',
'classNames', 'extend'
])).toBeTruthy();
});
@@ -425,25 +425,5 @@
expect(fs.endsWith("barfood", "foo")).toBe(false);
});
- // === Tests for parseBitRate()
- it('should return 5 - a', function () {
- expect(fs.parseBitRate('5.47 KBps')).toBe(5);
- });
-
- it('should return 5 - b', function () {
- expect(fs.parseBitRate('5. KBps')).toBe(5);
- });
-
- it('should return 5 - c', function () {
- expect(fs.parseBitRate('5 KBps')).toBe(5);
- });
-
- it('should return 5 - d', function () {
- expect(fs.parseBitRate('5 Kbps')).toBe(5);
- });
-
- it('should return 2001', function () {
- expect(fs.parseBitRate('2,001.59 Gbps')).toBe(2001);
- });
});