[ONOS-7967] GUI2 Device icon not shown on an Firewall, Optical_amplifier etc device in Topo view
Change-Id: I099d7c24a70cfab2e64134bc7ae8cac6830698df
(cherry picked from commit 4747ecee33141a8fb3e3abefad91d984c8576798)
diff --git a/web/gui2-fw-lib/projects/gui2-fw-lib/src/lib/svg/glyph.service.ts b/web/gui2-fw-lib/projects/gui2-fw-lib/src/lib/svg/glyph.service.ts
index c51af7a..20d5026 100644
--- a/web/gui2-fw-lib/projects/gui2-fw-lib/src/lib/svg/glyph.service.ts
+++ b/web/gui2-fw-lib/projects/gui2-fw-lib/src/lib/svg/glyph.service.ts
@@ -161,7 +161,7 @@
*
* Note: defs should be a D3 selection of a single <defs> element
*/
- loadDefs(defs, glyphIds: string[], noClear: boolean) {
+ loadDefs(defs, glyphIds: string[], noClear: boolean, asName?: string[]) {
const list = this.fs.isA(glyphIds) || this.ids();
if (!noClear) {
@@ -170,18 +170,22 @@
}
// load up the requested glyphs
- list.forEach((id) => {
+ list.forEach((id, idx) => {
const g = this.glyph(id);
+ let asNameStr: string = asName[idx];
+ if (!asNameStr) {
+ asNameStr = id;
+ }
if (g) {
if (noClear) {
// quick exit if symbol is already present
// TODO: check if this should be a continue or break instead
- if (defs.select('symbol#' + g.id).size() > 0) {
+ if (defs.select('symbol#' + asNameStr).size() > 0) {
return;
}
}
defs.append('symbol')
- .attr('id', g.id)
+ .attr('id', asNameStr)
.attr('viewBox', g.vb)
.append('path')
.attr('d', g.d);
diff --git a/web/gui2-fw-lib/projects/gui2-fw-lib/src/lib/svg/icon.service.ts b/web/gui2-fw-lib/projects/gui2-fw-lib/src/lib/svg/icon.service.ts
index 51e4f6b..673cd20 100644
--- a/web/gui2-fw-lib/projects/gui2-fw-lib/src/lib/svg/icon.service.ts
+++ b/web/gui2-fw-lib/projects/gui2-fw-lib/src/lib/svg/icon.service.ts
@@ -46,10 +46,14 @@
['thatsNoMoon', 'thatsNoMoon'],
['m_ports', 'm_ports'],
['m_switch', 'm_switch'],
+ ['switch', 'm_switch'],
['m_roadm', 'm_roadm'],
+ ['roadm', 'm_roadm'],
['m_router', 'm_router'],
+ ['router', 'm_router'],
['m_uiAttached', 'm_uiAttached'],
['m_endstation', 'm_endstation'],
+ ['endstation', 'm_endstation'],
['m_summary', 'm_summary'],
['m_details', 'm_details'],
['m_oblique', 'm_oblique'],
@@ -69,10 +73,17 @@
['m_virtual', 'm_virtual'],
['m_other', 'm_other'],
['m_bgpSpeaker', 'm_bgpSpeaker'],
+ ['bgpSpeaker', 'm_bgpSpeaker'],
['m_otn', 'm_otn'],
+ ['otn', 'm_otn'],
+ ['m_terminal_device', 'm_otn'],
+ ['m_ols', 'm_roadm'],
['m_roadm_otn', 'm_roadm_otn'],
+ ['roadm_otn', 'm_roadm_otn'],
['m_fiberSwitch', 'm_fiberSwitch'],
+ ['fiber_switch', 'm_fiberSwitch'],
['m_microwave', 'm_microwave'],
+ ['microwave', 'm_microwave'],
['m_relatedIntents', 'm_relatedIntents'],
['m_intentTraffic', 'm_intentTraffic'],
['m_firewall', 'm_firewall'],
@@ -89,6 +100,7 @@
['m_shortestPath', 'm_shortestPath'],
['m_disjointPaths', 'm_disjointPaths'],
['m_region', 'm_region'],
+ ['virtual', 'cord'],
['topo', 'topo'],
['bird', 'bird'],
@@ -251,8 +263,8 @@
if (!glyphName) {
glyphName = iconCls;
}
- this.gs.loadDefs(this.ensureIconLibDefs(), [glyphName], true);
- this.log.debug('icon definition', iconCls, 'added to defs');
+ this.gs.loadDefs(this.ensureIconLibDefs(), [glyphName], true, [iconCls]);
+ this.log.debug('icon definition', glyphName, 'added to defs as', iconCls);
}
diff --git a/web/gui2-topo-lib/projects/gui2-topo-lib/src/lib/topology/topology.component.ts b/web/gui2-topo-lib/projects/gui2-topo-lib/src/lib/topology/topology.component.ts
index 7a59801..35daf9d 100644
--- a/web/gui2-topo-lib/projects/gui2-topo-lib/src/lib/topology/topology.component.ts
+++ b/web/gui2-topo-lib/projects/gui2-topo-lib/src/lib/topology/topology.component.ts
@@ -204,33 +204,44 @@
this.doLion();
}
- this.is.loadIconDef('bird');
this.is.loadIconDef('active');
- this.is.loadIconDef('uiAttached');
- this.is.loadIconDef('m_switch');
- this.is.loadIconDef('m_roadm');
- this.is.loadIconDef('m_router');
- this.is.loadIconDef('m_uiAttached');
- this.is.loadIconDef('m_endstation');
- this.is.loadIconDef('m_ports');
- this.is.loadIconDef('m_summary');
- this.is.loadIconDef('m_details');
- this.is.loadIconDef('m_map');
- this.is.loadIconDef('m_selectMap');
+ this.is.loadIconDef('bgpSpeaker');
+ this.is.loadIconDef('bird');
+ this.is.loadIconDef('deviceTable');
+ this.is.loadIconDef('fiber_switch');
+ this.is.loadIconDef('flowTable');
+ this.is.loadIconDef('groupTable');
+ this.is.loadIconDef('m_allTraffic');
this.is.loadIconDef('m_cycleLabels');
this.is.loadIconDef('m_cycleGridDisplay');
- this.is.loadIconDef('m_resetZoom');
- this.is.loadIconDef('m_eqMaster');
- this.is.loadIconDef('m_unknown');
- this.is.loadIconDef('m_allTraffic');
- this.is.loadIconDef('deviceTable');
- this.is.loadIconDef('flowTable');
- this.is.loadIconDef('portTable');
- this.is.loadIconDef('groupTable');
- this.is.loadIconDef('meterTable');
- this.is.loadIconDef('triangleUp');
this.is.loadIconDef('m_disjointPaths');
+ this.is.loadIconDef('m_details');
+ this.is.loadIconDef('m_endstation');
+ this.is.loadIconDef('m_eqMaster');
this.is.loadIconDef('m_fiberSwitch');
+ this.is.loadIconDef('m_firewall');
+ this.is.loadIconDef('m_map');
+ this.is.loadIconDef('m_microwave');
+ this.is.loadIconDef('m_ols');
+ this.is.loadIconDef('m_otn');
+ this.is.loadIconDef('m_ports');
+ this.is.loadIconDef('m_resetZoom');
+ this.is.loadIconDef('m_roadm');
+ this.is.loadIconDef('m_roadm_otn');
+ this.is.loadIconDef('m_router');
+ this.is.loadIconDef('m_selectMap');
+ this.is.loadIconDef('m_summary');
+ this.is.loadIconDef('m_switch');
+ this.is.loadIconDef('m_terminal_device');
+ this.is.loadIconDef('m_uiAttached');
+ this.is.loadIconDef('m_unknown');
+ this.is.loadIconDef('meterTable');
+ this.is.loadIconDef('microwave');
+ this.is.loadIconDef('otn');
+ this.is.loadIconDef('portTable');
+ this.is.loadIconDef('roadm_otn');
+ this.is.loadIconDef('triangleUp');
+ this.is.loadIconDef('uiAttached');
this.log.debug('Topology component constructed');
}