ONOS-6730: Topo View i18n:
- Completed remainder of topology view modules.
- fixed some ESLint issues.
Change-Id: I9cf474198cc4d30be629a2b05cbe19a3bbb43811
diff --git a/web/gui/src/main/resources/org/onosproject/ui/lion/_config/core.view.Topo.lioncfg b/web/gui/src/main/resources/org/onosproject/ui/lion/_config/core.view.Topo.lioncfg
index ed18b10..3697a85 100644
--- a/web/gui/src/main/resources/org/onosproject/ui/lion/_config/core.view.Topo.lioncfg
+++ b/web/gui/src/main/resources/org/onosproject/ui/lion/_config/core.view.Topo.lioncfg
@@ -28,8 +28,8 @@
from cf.QuickHelp import qh_hint_close_detail
-from cc.Action import show, hide, enable, disable, select
-from cc.Network import devices, links, hosts, topology_sccs, intents, tunnels, flows, ports, protocol, uri, mac, ip, vlan, device, host
+from cc.Action import show, hide, enable, disable, select, purged, withdrawn, resubmitted, added
+from cc.Network import devices, links, hosts, topology_sccs, intents, tunnels, flows, ports, protocol, uri, mac, ip, vlan, device, host, intent
from cc.Props import version, vendor, hw_version, sw_version, serial_number, latitude, longitude, grid_y, grid_x
from cc.State import visible, hidden, vlan_none, expected, not_expected
from cc.Ui import click, shift_click, drag, cmd_scroll, cmd_drag, ok, close
diff --git a/web/gui/src/main/resources/org/onosproject/ui/lion/core/common/Action.properties b/web/gui/src/main/resources/org/onosproject/ui/lion/core/common/Action.properties
index 4a8311c..14efa87 100644
--- a/web/gui/src/main/resources/org/onosproject/ui/lion/core/common/Action.properties
+++ b/web/gui/src/main/resources/org/onosproject/ui/lion/core/common/Action.properties
@@ -15,6 +15,7 @@
#
#
+# Present Tense
install=Install
start=Start
pause=Pause
@@ -28,3 +29,9 @@
enable=Enable
disable=Disable
select=Select
+
+# Past Tense
+purged=purged
+withdrawn=withdrawn
+resubmitted=resubmitted
+added=added
diff --git a/web/gui/src/main/resources/org/onosproject/ui/lion/core/common/Action_es.properties b/web/gui/src/main/resources/org/onosproject/ui/lion/core/common/Action_es.properties
index f90ca88..cd1d275 100644
--- a/web/gui/src/main/resources/org/onosproject/ui/lion/core/common/Action_es.properties
+++ b/web/gui/src/main/resources/org/onosproject/ui/lion/core/common/Action_es.properties
@@ -15,6 +15,7 @@
#
#
+# Present Tense
install=Instalar
start=Iniciar
pause=Pausar
@@ -28,3 +29,9 @@
enable=Enable (es)
disable=Disable (es)
select=Select (es)
+
+# Past Tense
+purged=purged (es)
+withdrawn=withdrawn (es)
+resubmitted=resubmitted (es)
+added=added (es)
diff --git a/web/gui/src/main/resources/org/onosproject/ui/lion/core/common/Action_it.properties b/web/gui/src/main/resources/org/onosproject/ui/lion/core/common/Action_it.properties
index 4c5d6c9..0678eb2 100644
--- a/web/gui/src/main/resources/org/onosproject/ui/lion/core/common/Action_it.properties
+++ b/web/gui/src/main/resources/org/onosproject/ui/lion/core/common/Action_it.properties
@@ -15,6 +15,7 @@
#
#
+# Present Tense
install=Installa
start=Inizia
pause=Pausa
@@ -28,3 +29,9 @@
enable=Enable (it)
disable=Disable (it)
select=Select (it)
+
+# Past Tense
+purged=purged (it)
+withdrawn=withdrawn (it)
+resubmitted=resubmitted (it)
+added=added (it)
diff --git a/web/gui/src/main/resources/org/onosproject/ui/lion/core/common/Action_ko.properties b/web/gui/src/main/resources/org/onosproject/ui/lion/core/common/Action_ko.properties
index 2cf0ba1..a2e72c3 100644
--- a/web/gui/src/main/resources/org/onosproject/ui/lion/core/common/Action_ko.properties
+++ b/web/gui/src/main/resources/org/onosproject/ui/lion/core/common/Action_ko.properties
@@ -15,6 +15,7 @@
#
#
+# Present Tense
install=설치
start=시작
pause=중지
@@ -28,3 +29,9 @@
enable=Enable (ko)
disable=Disable (ko)
select=Select (ko)
+
+# Past Tense
+purged=purged (ko)
+withdrawn=withdrawn (ko)
+resubmitted=resubmitted (ko)
+added=added (ko)
diff --git a/web/gui/src/main/resources/org/onosproject/ui/lion/core/common/Action_zh_CN.properties b/web/gui/src/main/resources/org/onosproject/ui/lion/core/common/Action_zh_CN.properties
index ab6fffa..271687f 100644
--- a/web/gui/src/main/resources/org/onosproject/ui/lion/core/common/Action_zh_CN.properties
+++ b/web/gui/src/main/resources/org/onosproject/ui/lion/core/common/Action_zh_CN.properties
@@ -15,6 +15,7 @@
#
#
+# Present Tense
install=安装
start=开始
pause=暂停
@@ -28,3 +29,9 @@
enable=Enable (zh_CN)
disable=Disable (zh_CN)
select=Select (zh_CN)
+
+# Past Tense
+purged=purged (zh_CN)
+withdrawn=withdrawn (zh_CN)
+resubmitted=resubmitted (zh_CN)
+added=added (zh_CN)
diff --git a/web/gui/src/main/resources/org/onosproject/ui/lion/core/common/Action_zh_TW.properties b/web/gui/src/main/resources/org/onosproject/ui/lion/core/common/Action_zh_TW.properties
index bf299ac..ed86135 100644
--- a/web/gui/src/main/resources/org/onosproject/ui/lion/core/common/Action_zh_TW.properties
+++ b/web/gui/src/main/resources/org/onosproject/ui/lion/core/common/Action_zh_TW.properties
@@ -15,6 +15,7 @@
#
#
+# Present Tense
install=安裝
start=開始
pause=暫停
@@ -28,3 +29,9 @@
enable=Enable (zh_TW)
disable=Disable (zh_TW)
select=Select (zh_TW)
+
+# Past Tense
+purged=purged (zh_TW)
+withdrawn=withdrawn (zh_TW)
+resubmitted=resubmitted (zh_TW)
+added=added (zh_TW)
diff --git a/web/gui/src/main/resources/org/onosproject/ui/lion/core/view/Topo.properties b/web/gui/src/main/resources/org/onosproject/ui/lion/core/view/Topo.properties
index a534c5f..0c82575 100644
--- a/web/gui/src/main/resources/org/onosproject/ui/lion/core/view/Topo.properties
+++ b/web/gui/src/main/resources/org/onosproject/ui/lion/core/view/Topo.properties
@@ -79,6 +79,37 @@
fl_oblique_view=Oblique View
fl_normal_view=Normal View
+fl_monitoring_canceled=Monitoring Canceled
+fl_selecting_intent=Selecting Intent
+
+# Core Overlays
+ov_tt_protected_intents=Protected Intents Overlay
+ov_tt_traffic=Traffic Overlay
+ov_tt_none=No Overlay
+
+# Traffic Overlay
+tr_btn_create_h2h_flow=Create Host-to-Host Flow
+tr_btn_create_msrc_flow=Create Multi-Source Flow
+tr_btn_show_device_flows=Show Device Flows
+tr_btn_show_related_traffic=Show Related Traffic
+tr_btn_cancel_monitoring=Cancel traffic monitoring
+tr_btn_monitor_all=Monitor all traffic
+tr_btn_show_dev_link_flows=Show device link flows
+tr_btn_show_all_rel_intents=Show all related intents
+tr_btn_show_prev_rel_intent=Show previous related intent
+tr_btn_show_next_rel_intent=Show next related intent
+tr_btn_monitor_sel_intent=Monitor traffic of selected intent
+tr_fl_fstats_bytes=Flow Stats (bytes)
+tr_fl_pstats_bits=Port Stats (bits / second)
+tr_fl_pstats_pkts=Port Stats (packets / second)
+tr_fl_dev_flows=Device Flows
+tr_fl_rel_paths=Related Paths
+tr_fl_prev_rel_int=Previous related intent
+tr_fl_next_rel_int=Next related intent
+tr_fl_traf_on_path=Traffic on Selected Path
+tr_fl_h2h_flow_added=Host-to-Host flow added
+tr_fl_multisrc_flow=Multi-Source Flow
+
# Button tooltips
btn_show_view_device=Show Device View
btn_show_view_flow=Show Flow View for this Device
diff --git a/web/gui/src/main/resources/org/onosproject/ui/lion/core/view/Topo_it.properties b/web/gui/src/main/resources/org/onosproject/ui/lion/core/view/Topo_it.properties
index 8354573..a08c629 100644
--- a/web/gui/src/main/resources/org/onosproject/ui/lion/core/view/Topo_it.properties
+++ b/web/gui/src/main/resources/org/onosproject/ui/lion/core/view/Topo_it.properties
@@ -79,6 +79,37 @@
fl_oblique_view=Oblique View (it)
fl_normal_view=Normal View (it)
+fl_monitoring_canceled=Monitoring Canceled (it)
+fl_selecting_intent=Selecting Intent (it)
+
+# Core Overlays
+ov_tt_protected_intents=Protected Intents Overlay (it)
+ov_tt_traffic=Traffic Overlay (it)
+ov_tt_none=No Overlay (it)
+
+# Traffic Overlay
+tr_btn_create_h2h_flow=Create Host-to-Host Flow (it)
+tr_btn_create_msrc_flow=Create Multi-Source Flow (it)
+tr_btn_show_device_flows=Show Device Flows (it)
+tr_btn_show_related_traffic=Show Related Traffic (it)
+tr_btn_cancel_monitoring=Cancel traffic monitoring (it)
+tr_btn_monitor_all=Monitor all traffic (it)
+tr_btn_show_dev_link_flows=Show device link flows (it)
+tr_btn_show_all_rel_intents=Show all related intents (it)
+tr_btn_show_prev_rel_intent=Show previous related intent (it)
+tr_btn_show_next_rel_intent=Show next related intent (it)
+tr_btn_monitor_sel_intent=Monitor traffic of selected intent (it)
+tr_fl_fstats_bytes=Flow Stats (bytes) (it)
+tr_fl_pstats_bits=Port Stats (bits / second) (it)
+tr_fl_pstats_pkts=Port Stats (packets / second) (it)
+tr_fl_dev_flows=Device Flows (it)
+tr_fl_rel_paths=Related Paths (it)
+tr_fl_prev_rel_int=Previous related intent (it)
+tr_fl_next_rel_int=Next related intent (it)
+tr_fl_traf_on_path=Traffic on Selected Path (it)
+tr_fl_h2h_flow_added=Host-to-Host flow added (it)
+tr_fl_multisrc_flow=Multi-Source Flow (it)
+
# Button tooltips
btn_show_view_device=Show Device View (it)
btn_show_view_flow=Show Flow View for this Device (it)
diff --git a/web/gui/src/main/webapp/app/fw/layer/quickhelp.js b/web/gui/src/main/webapp/app/fw/layer/quickhelp.js
index 46a5c79..92721cb 100644
--- a/web/gui/src/main/webapp/app/fw/layer/quickhelp.js
+++ b/web/gui/src/main/webapp/app/fw/layer/quickhelp.js
@@ -270,7 +270,7 @@
addRow(mkArrRow(vgest));
}
- function qhlion_title() {
+ function qhlionTitle() {
var lion = ls.bundle('core.fw.QuickHelp');
return lion('qh_title');
}
@@ -286,7 +286,7 @@
.attr('rx', 8);
pane.append('text')
- .text(qhlion_title())
+ .text(qhlionTitle())
.attr({
class: 'title',
dy: '1.2em',
diff --git a/web/gui/src/main/webapp/app/fw/util/keys.js b/web/gui/src/main/webapp/app/fw/util/keys.js
index 45ba410..2dc8974 100644
--- a/web/gui/src/main/webapp/app/fw/util/keys.js
+++ b/web/gui/src/main/webapp/app/fw/util/keys.js
@@ -167,25 +167,25 @@
function qhlion() {
return ls.bundle('core.fw.QuickHelp');
}
- function qhlion_show_hide() {
+ function qhlionShowHide() {
return qhlion()('qh_hint_show_hide_qh');
}
- function qhlion_hint_esc() {
+ function qhlionHintEsc() {
return qhlion()('qh_hint_esc');
}
- function qhlion_hint_t() {
+ function qhlionHintT() {
return qhlion()('qh_hint_t');
}
function setupGlobalKeys() {
angular.extend(keyHandler, {
globalKeys: {
- backSlash: [quickHelp, qhlion_show_hide],
- slash: [quickHelp, qhlion_show_hide],
- esc: [escapeKey, qhlion_hint_esc],
- T: [toggleTheme, qhlion_hint_t],
+ backSlash: [quickHelp, qhlionShowHide],
+ slash: [quickHelp, qhlionShowHide],
+ esc: [escapeKey, qhlionHintEsc],
+ T: [toggleTheme, qhlionHintT],
},
globalFormat: ['backSlash', 'slash', 'esc', 'T'],
diff --git a/web/gui/src/main/webapp/app/fw/widget/tableDetail.js b/web/gui/src/main/webapp/app/fw/widget/tableDetail.js
index 466b08c..2777454 100644
--- a/web/gui/src/main/webapp/app/fw/widget/tableDetail.js
+++ b/web/gui/src/main/webapp/app/fw/widget/tableDetail.js
@@ -26,6 +26,10 @@
// constants
// var refreshInterval = 2000;
+ /*
+ * NOTE: work-in-progress; this relates to ONOS-5579 (currently stalled)
+ */
+
function noop() {}
// TODO: describe the input object for the main function
diff --git a/web/gui/src/main/webapp/app/view/app/app.js b/web/gui/src/main/webapp/app/view/app/app.js
index 67b6040..a01dd2e 100644
--- a/web/gui/src/main/webapp/app/view/app/app.js
+++ b/web/gui/src/main/webapp/app/view/app/app.js
@@ -59,16 +59,16 @@
// note: url is handled separately
// deferred localization strings
- var warn_deactivate,
- warn_own_risk,
+ var warnDeactivate,
+ warnOwnRisk,
friendlyProps,
lion;
function doLion() {
lion = ls.bundle('core.view.App');
- warn_deactivate = lion('dlg_warn_deactivate');
- warn_own_risk = lion('dlg_warn_own_risk');
+ warnDeactivate = lion('dlg_warn_deactivate');
+ warnOwnRisk = lion('dlg_warn_own_risk');
friendlyProps = [
lion('app_id'), lion('state'), lion('category'), lion('version'),
@@ -314,9 +314,9 @@
content.append('p').text(lion(action) + ' ' + itemId);
if (strongWarning[itemId]) {
content.append('p').html(
- fs.sanitize(warn_deactivate) +
+ fs.sanitize(warnDeactivate) +
'<br>' +
- fs.sanitize(warn_own_risk)
+ fs.sanitize(warnOwnRisk)
).classed('strong', true);
}
return content;
diff --git a/web/gui/src/main/webapp/app/view/flow/flow.js b/web/gui/src/main/webapp/app/view/flow/flow.js
index cca29db..f8c6491 100644
--- a/web/gui/src/main/webapp/app/view/flow/flow.js
+++ b/web/gui/src/main/webapp/app/view/flow/flow.js
@@ -22,7 +22,7 @@
'use strict';
// injected references
- var $log, $scope, $location, fs, tbs, ns, mast, ps, wss, is, ks;
+ var $log, $scope, $location, fs, tbs, ns, mast, ps, wss, is;
// internal state
var detailsPanel,
@@ -34,18 +34,11 @@
selDiv,
topSelTable,
topTrtTable,
- bottom,
iconDiv,
- nameDiv,
wSize;
-
// constants
var topPdg = 28,
- ctnrPdg = 24,
- scrollSize = 17,
- portsTblPdg = 50,
- htPdg = 479,
wtPdg = 532,
pName = 'flow-details-panel',
@@ -106,7 +99,7 @@
}
function setUpPanel() {
- var container, closeBtn, tblDiv;
+ var container, closeBtn;
detailsPanel.empty();
container = detailsPanel.append('div').classed('container', true);
diff --git a/web/gui/src/main/webapp/app/view/topo/topo.js b/web/gui/src/main/webapp/app/view/topo/topo.js
index ba0bc7d..04b552c 100644
--- a/web/gui/src/main/webapp/app/view/topo/topo.js
+++ b/web/gui/src/main/webapp/app/view/topo/topo.js
@@ -346,7 +346,7 @@
g = noDevsLayer.append('g');
gs.addGlyph(g, 'bird', 100).attr('class', 'noDevsBird');
- g.append('text').text('').attr({x: 120, y: 80 });
+ g.append('text').text('').attr({ x: 120, y: 80 });
recenterLabel(g);
showNoDevs(true);
}
@@ -729,6 +729,7 @@
tis.setLionBundle(topoLion);
tms.setLionBundle(topoLion);
tps.setLionBundle(topoLion);
+ ttbs.setLionBundle(topoLion);
// now we have the map projection, we are ready for
// the server to send us device/host data...
diff --git a/web/gui/src/main/webapp/app/view/topo/topoForce.js b/web/gui/src/main/webapp/app/view/topo/topoForce.js
index 6da55fa..f3a2d0e 100644
--- a/web/gui/src/main/webapp/app/view/topo/topoForce.js
+++ b/web/gui/src/main/webapp/app/view/topo/topoForce.js
@@ -1118,6 +1118,7 @@
tls.setLionBundle(bundle);
tos.setLionBundle(bundle);
tov.setLionBundle(bundle);
+ tss.setLionBundle(bundle);
}
angular.module('ovTopo')
diff --git a/web/gui/src/main/webapp/app/view/topo/topoLink.js b/web/gui/src/main/webapp/app/view/topo/topoLink.js
index d4f1dfe..26acea5 100644
--- a/web/gui/src/main/webapp/app/view/topo/topoLink.js
+++ b/web/gui/src/main/webapp/app/view/topo/topoLink.js
@@ -23,7 +23,7 @@
'use strict';
// injected refs
- var $log, fs, flash, tss, tps, tov;
+ var $log, fs, flash, tss;
// internal state
var api,
@@ -329,15 +329,12 @@
angular.module('ovTopo')
.factory('TopoLinkService',
['$log', 'FnService', 'FlashService', 'TopoSelectService',
- 'TopoPanelService', 'TopoOverlayService',
- function (_$log_, _fs_, _flash_, _tss_, _tps_, _tov_) {
+ function (_$log_, _fs_, _flash_, _tss_) {
$log = _$log_;
fs = _fs_;
flash = _flash_;
tss = _tss_;
- tps = _tps_;
- tov = _tov_;
function initLink(_api_, _td3_) {
api = _api_;
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 09ff7b6..4e9133a 100644
--- a/web/gui/src/main/webapp/app/view/topo/topoOverlay.js
+++ b/web/gui/src/main/webapp/app/view/topo/topoOverlay.js
@@ -147,7 +147,7 @@
angular.forEach(overlays, function (ov) {
rset.push({
gid: ov._glyphId,
- tooltip: (ov.tooltip || '(no tooltip)'),
+ tooltip: (ov.tooltip || ''),
cb: function () {
tbSelection(ov.overlayId, switchFn);
},
@@ -302,19 +302,20 @@
cb && cb();
}
- // Temporary function to allow overlays to modify link detail data
- // in the client. (In the near future, this will be done on the server).
- function modifyLinkDataHook(data, extra) {
- var cb = _hook('modifylinkdata');
- return cb && extra ? cb(data, extra) : data;
- }
-
// Request from Intent View to visualize an intent on the topo view
function showIntentHook(intentData) {
var cb = _hook('showIntent');
return cb && cb(intentData);
}
+ // 'core.view.Topo' lion bundle will be injected here.
+ // NOTE: if an overlay wants additional bundles, it should use the
+ // LionService to request them at this time.
+ function injectLion(topoBundle) {
+ var cb = _hook('injectLion');
+ return cb && cb(topoBundle);
+ }
+
// === -----------------------------------------------------
// Event (from server) Handlers
@@ -419,6 +420,12 @@
// invoked after the localization bundle has been received from the server
function setLionBundle(bundle) {
topoLion = bundle;
+ // also inject the topo lion bundle to all overlays that request it
+ angular.forEach(overlays, function (ov) {
+ var hooks = fs.isO(ov.hooks) || {},
+ inj = fs.isF(hooks.injectLion);
+ inj && inj(bundle);
+ });
}
// ========================================================================
@@ -455,7 +462,6 @@
multiSelect: multiSelectHook,
mouseOver: mouseOverHook,
mouseOut: mouseOutHook,
- modifyLinkData: modifyLinkDataHook,
showIntent: showIntentHook,
},
diff --git a/web/gui/src/main/webapp/app/view/topo/topoProtectedIntent.js b/web/gui/src/main/webapp/app/view/topo/topoProtectedIntent.js
index 085ff4b..ac381ff 100644
--- a/web/gui/src/main/webapp/app/view/topo/topoProtectedIntent.js
+++ b/web/gui/src/main/webapp/app/view/topo/topoProtectedIntent.js
@@ -25,6 +25,11 @@
// injected refs
var flash, wss;
+ // function to be replaced by the localization bundle function
+ var topoLion = function (x) {
+ return '#tproti#' + x + '#';
+ };
+
// internal state
var showingProtectedIntent = null;
@@ -38,14 +43,14 @@
showingProtectedIntent = false;
wss.sendEvent('cancelProtectedIntentHighlight');
- flash.flash('Monitoring canceled');
+ flash.flash(topoLion('fl_monitoring_canceled'));
return true;
}
// force the system to create a single intent selection
function showProtectedIntent(data) {
wss.sendEvent('selectProtectedIntent', data);
- flash.flash('Selecting Intent ' + data.key);
+ flash.flash(topoLion('fl_selecting_intent') + ' ' + data.key);
showingProtectedIntent = true;
}
@@ -64,6 +69,7 @@
// TODO: Remove references
initProtectedIntents: function (_api_) {},
destroyProtectedIntents: function () { },
+ setLionBundle: function (bundle) { topoLion = bundle; },
// invoked from toolbar overlay buttons or keystrokes
cancelHighlights: cancelHighlights,
diff --git a/web/gui/src/main/webapp/app/view/topo/topoProtectedIntentOverlay.js b/web/gui/src/main/webapp/app/view/topo/topoProtectedIntentOverlay.js
index 3cfea34..6eabe4f 100644
--- a/web/gui/src/main/webapp/app/view/topo/topoProtectedIntentOverlay.js
+++ b/web/gui/src/main/webapp/app/view/topo/topoProtectedIntentOverlay.js
@@ -25,17 +25,18 @@
// injected refs
var $log, tov, tpis;
+ // function to be replaced by the localization bundle function
+ var topoLion = function (x) {
+ return '#tprotiov#' + x + '#';
+ };
+
// NOTE: no internal state here -- see topoProtectedIntents for that
- // NOTE: providing button disabling requires too big a refactoring of
- // the button factory etc. Will have to be done another time.
-
-
// traffic overlay definition
var overlay = {
overlayId: 'protectedIntent',
glyphId: 'm_ips',
- tooltip: 'Protected Intents Overlay',
+ tooltip: function () { return topoLion('ov_tt_protected_intents'); },
activate: function () {
$log.debug('Protected Intent overlay ACTIVATED');
@@ -43,7 +44,7 @@
deactivate: function () {
tpis.cancelHighlights();
- $log.debug('Protected Intent DEACTIVATED');
+ $log.debug('Protected Intent overlay DEACTIVATED');
},
hooks: {
@@ -52,15 +53,19 @@
// Must return true to consume ESC, false otherwise.
return tpis.cancelHighlights();
},
- // intent visualization hook
+ // intent visualization hooks
acceptIntent: function (type) {
// accept only intents with type "Protected"
return (type.startsWith('Protected'));
},
showIntent: function (info) {
- $log.debug('^^ topoProtectedIntentsOverlay.showintent() ^^', info);
tpis.showProtectedIntent(info);
},
+ // localization bundle injection hook
+ injectLion: function (bundle) {
+ topoLion = bundle;
+ tpis.setLionBundle(bundle);
+ },
},
};
diff --git a/web/gui/src/main/webapp/app/view/topo/topoSelect.js b/web/gui/src/main/webapp/app/view/topo/topoSelect.js
index 7b4decc..a0e8c31 100644
--- a/web/gui/src/main/webapp/app/view/topo/topoSelect.js
+++ b/web/gui/src/main/webapp/app/view/topo/topoSelect.js
@@ -37,6 +37,11 @@
// internal state
var hovered, selections, selectOrder, consumeClick;
+ // function to be replaced by the localization bundle function
+ var topoLion = function (x) {
+ return '#tsel#' + x + '#';
+ };
+
function setInitialState() {
hovered = null; // the node over which the mouse is hovering
selections = {}; // currently selected nodes (by id)
@@ -65,7 +70,7 @@
function nodeMouseOver(m) {
if (!m.dragStarted) {
- if (hovered != m) {
+ if (hovered !== m) {
hovered = m;
tov.hooks.mouseOver({
id: m.id,
@@ -101,7 +106,7 @@
n = d3.select(el);
} else {
api.node().each(function (d) {
- if (d == obj) {
+ if (d === obj) {
n = d3.select(el = this);
}
});
@@ -250,16 +255,16 @@
if (nSel() === 2) {
tps.addAction({
id: 'host-flow-btn',
- gid: 'endstation',
+ gid: 'm_endstation',
cb: tts.addHostIntent,
- tt: 'Create Host-to-Host Flow',
+ tt: function () { return topoLion('tr_btn_create_h2h_flow'); },
});
} else if (nSel() >= 2) {
tps.addAction({
id: 'mult-src-flow-btn',
gid: 'flows',
cb: tts.addMultiSourceIntent,
- tt: 'Create Multi-Source Flow',
+ tt: function () { return topoLion('tr_btn_create_msrc_flow'); },
});
}
}
@@ -362,6 +367,7 @@
clickConsumed: clickConsumed,
selectionContext: selectionContext,
reselect: reselect,
+ setLionBundle: function (bundle) { topoLion = bundle; },
};
}]);
}());
diff --git a/web/gui/src/main/webapp/app/view/topo/topoToolbar.js b/web/gui/src/main/webapp/app/view/topo/topoToolbar.js
index fa86f82..8b37002 100644
--- a/web/gui/src/main/webapp/app/view/topo/topoToolbar.js
+++ b/web/gui/src/main/webapp/app/view/topo/topoToolbar.js
@@ -29,6 +29,11 @@
// getActionEntry
// setUpKeys
+ // function to be replaced by the localization bundle function
+ var topoLion = function (x) {
+ return '#ttbar#' + x + '#';
+ };
+
// internal state
var toolbar, keyData, cachedState, thirdRow, ovRset, ovIndex;
@@ -36,7 +41,7 @@
var name = 'topo-tbar',
cooktag = 'topo_prefs',
soa = 'switchOverlayActions: ',
- selOver = 'Select overlay here ⇧',
+ selOver = '************',
defaultOverlay = 'traffic';
@@ -134,7 +139,7 @@
// tooltip function invoked at the time the tooltip is displayed
value.tt = function () {
- return fs.isF(ttfn) ? ttfn() : "" + ttfn;
+ return fs.isF(ttfn) ? ttfn() : '' + ttfn;
};
});
}
@@ -188,7 +193,7 @@
// generate radio button set for overlays; start with 'none'
var rset = [{
gid: 'm_unknown',
- tooltip: 'No Overlay',
+ tooltip: topoLion('ov_tt_none'),
cb: function () {
tov.tbSelection(null, switchOverlayActions);
},
@@ -236,7 +241,11 @@
value = keyBindings[key];
bid = oid + '-' + key;
gid = tov.mkGlyphId(oid, value.gid);
- tt = value.tt + ' (' + key + ')';
+ tt = function () {
+ var ttfn = value.tt,
+ txt = fs.isF(ttfn) ? ttfn() : ttfn;
+ return txt + ' (' + key + ')';
+ };
thirdRow.addButton(bid, gid, value.cb, tt);
}
});
@@ -333,6 +342,7 @@
selectOverlay: selectOverlay,
defaultPrefs: defaultPrefsState,
fnkey: fnkey,
+ setLionBundle: function (bundle) { topoLion = bundle; },
};
}]);
}());
diff --git a/web/gui/src/main/webapp/app/view/topo/topoTraffic.js b/web/gui/src/main/webapp/app/view/topo/topoTraffic.js
index e6b66fc..640a233 100644
--- a/web/gui/src/main/webapp/app/view/topo/topoTraffic.js
+++ b/web/gui/src/main/webapp/app/view/topo/topoTraffic.js
@@ -25,6 +25,11 @@
// injected refs
var $log, flash, wss, api;
+ // function to be replaced by the localization bundle function
+ var topoLion = function (x) {
+ return '#ttraf#' + x + '#';
+ };
+
/*
API to topoForce
hovered()
@@ -37,11 +42,7 @@
'portStatsBitSec',
'portStatsPktSec',
],
- allTrafficMsgs = [
- 'Flow Stats (bytes)',
- 'Port Stats (bits / second)',
- 'Port Stats (packets / second)',
- ];
+ allTrafficMsgs = []; // filled in with localized messages
// internal state
var trafficMode = null,
@@ -52,6 +53,16 @@
// === -----------------------------------------------------
// Helper functions
+ function setLionBundle(bundle) {
+ $log.debug('topoTraffic: setting Lion bundle');
+ topoLion = bundle;
+ allTrafficMsgs = [
+ topoLion('tr_fl_fstats_bytes'),
+ topoLion('tr_fl_pstats_bits'),
+ topoLion('tr_fl_pstats_pkts'),
+ ];
+ }
+
// invoked in response to change in selection and/or mouseover/out:
function requestTrafficForMode(mouse) {
if (trafficMode === 'flows') {
@@ -112,7 +123,7 @@
trafficMode = hoverMode = null;
wss.sendEvent('cancelTraffic');
- flash.flash('Traffic monitoring canceled');
+ flash.flash(topoLion('fl_monitoring_canceled'));
return true;
}
@@ -129,20 +140,20 @@
function showDeviceLinkFlows() {
trafficMode = hoverMode = 'flows';
requestDeviceLinkFlows();
- flash.flash('Device Flows');
+ flash.flash(topoLion('tr_fl_dev_flows'));
}
function showRelatedIntents() {
trafficMode = hoverMode = 'intents';
requestRelatedIntents();
- flash.flash('Related Paths');
+ flash.flash(topoLion('tr_fl_rel_paths'));
}
function showPrevIntent() {
if (trafficMode === 'intents') {
hoverMode = null;
wss.sendEvent('requestPrevRelatedIntent');
- flash.flash('Previous related intent');
+ flash.flash(topoLion('tr_fl_prev_rel_int'));
}
}
@@ -150,7 +161,7 @@
if (trafficMode === 'intents') {
hoverMode = null;
wss.sendEvent('requestNextRelatedIntent');
- flash.flash('Next related intent');
+ flash.flash(topoLion('tr_fl_next_rel_int'));
}
}
@@ -158,7 +169,7 @@
if (trafficMode === 'intents') {
hoverMode = null;
wss.sendEvent('requestSelectedIntentTraffic');
- flash.flash('Traffic on Selected Path');
+ flash.flash(topoLion('tr_fl_traf_on_path'));
}
}
@@ -167,7 +178,7 @@
trafficMode = 'intents';
hoverMode = null;
wss.sendEvent('selectIntent', data);
- flash.flash('Selecting Intent ' + data.key);
+ flash.flash(topoLion('fl_selecting_intent') + ' ' + data.key);
}
@@ -176,6 +187,7 @@
function addHostIntent() {
var so = api.selectOrder();
+
wss.sendEvent('addHostIntent', {
one: so[0],
two: so[1],
@@ -183,11 +195,12 @@
});
trafficMode = 'intents';
hoverMode = null;
- flash.flash('Host-to-Host flow added');
+ flash.flash(topoLion('tr_fl_h2h_flow_added'));
}
function removeIntent(d) {
- $log.debug('Entering removeIntent');
+ var action = topoLion(d.intentPurge ? 'purged' : 'withdrawn');
+
wss.sendEvent('removeIntent', {
appId: d.appId,
appName: d.appName,
@@ -196,12 +209,10 @@
});
trafficMode = 'intents';
hoverMode = null;
- var txt = d.intentPurge ? 'purged' : 'withdrawn';
- flash.flash('Intent ' + txt);
+ flash.flash(topoLion('intent') + ' ' + action);
}
function resubmitIntent(d) {
- $log.debug('Entering resubmitIntent');
wss.sendEvent('resubmitIntent', {
appId: d.appId,
appName: d.appName,
@@ -210,11 +221,12 @@
});
trafficMode = 'intents';
hoverMode = null;
- flash.flash('Intent resubmitted');
+ flash.flash(topoLion('intent') + ' ' + topoLion('resubmitted'));
}
function addMultiSourceIntent() {
var so = api.selectOrder();
+
wss.sendEvent('addMultiSourceIntent', {
src: so.slice(0, so.length - 1),
dst: so[so.length - 1],
@@ -222,15 +234,14 @@
});
trafficMode = 'intents';
hoverMode = null;
- flash.flash('Multi-Source flow added');
+ flash.flash(topoLion('tr_fl_multisrc_flow') + ' ' + topoLion('added'));
}
function removeIntents() {
- $log.debug('Entering removeIntents');
wss.sendEvent('removeIntents', {});
trafficMode = 'intents';
hoverMode = null;
- flash.flash('Intent are purged');
+ flash.flash(topoLion('intents') + ' ' + topoLion('purged'));
}
@@ -239,7 +250,7 @@
angular.module('ovTopo')
.factory('TopoTrafficService',
- ['$log', 'FnService', 'WebSocketService',
+ ['$log', 'FlashService', 'WebSocketService',
function (_$log_, _flash_, _wss_) {
$log = _$log_;
@@ -263,13 +274,14 @@
// invoked from mouseover/mouseout and selection change
requestTrafficForMode: requestTrafficForMode,
- // TODO: these should move to new UI demo app
// invoked from buttons on detail (multi-select) panel
addHostIntent: addHostIntent,
addMultiSourceIntent: addMultiSourceIntent,
removeIntent: removeIntent,
resubmitIntent: resubmitIntent,
removeIntents: removeIntents,
+
+ setLionBundle: setLionBundle,
};
}]);
}());
diff --git a/web/gui/src/main/webapp/app/view/topo/topoTrafficNew.js b/web/gui/src/main/webapp/app/view/topo/topoTrafficNew.js
index 687fdab..143aa30 100644
--- a/web/gui/src/main/webapp/app/view/topo/topoTrafficNew.js
+++ b/web/gui/src/main/webapp/app/view/topo/topoTrafficNew.js
@@ -26,6 +26,11 @@
// injected refs
var $log, tov, tts;
+ // function to be replaced by the localization bundle function
+ var topoLion = function (x) {
+ return '#ttrafov#' + x + '#';
+ };
+
// NOTE: no internal state here -- see TopoTrafficService for that
// NOTE: providing button disabling requires too big a refactoring of
@@ -36,7 +41,7 @@
var overlay = {
overlayId: 'traffic',
glyphId: 'm_allTraffic',
- tooltip: 'Traffic Overlay',
+ tooltip: function () { return topoLion('ov_tt_traffic'); },
// NOTE: Traffic glyphs already installed as part of the base ONOS set.
@@ -54,13 +59,13 @@
buttons: {
showDeviceFlows: {
gid: 'm_flows',
- tt: 'Show Device Flows',
+ tt: function () { return topoLion('tr_btn_show_device_flows'); },
cb: function (data) { tts.showDeviceLinkFlows(); },
},
showRelatedTraffic: {
gid: 'm_relatedIntents',
- tt: 'Show Related Traffic',
+ tt: function () { return topoLion('tr_btn_show_related_traffic'); },
cb: function (data) { tts.showRelatedIntents(); },
},
},
@@ -70,38 +75,38 @@
keyBindings: {
0: {
cb: function () { tts.cancelTraffic(true); },
- tt: 'Cancel traffic monitoring',
+ tt: function () { return topoLion('tr_btn_cancel_monitoring'); },
gid: 'm_xMark',
},
A: {
cb: function () { tts.showAllTraffic(); },
- tt: 'Monitor all traffic',
+ tt: function () { return topoLion('tr_btn_monitor_all'); },
gid: 'm_allTraffic',
},
F: {
cb: function () { tts.showDeviceLinkFlows(); },
- tt: 'Show device link flows',
+ tt: function () { return topoLion('tr_btn_show_dev_link_flows'); },
gid: 'm_flows',
},
V: {
cb: function () { tts.showRelatedIntents(); },
- tt: 'Show all related intents',
+ tt: function () { return topoLion('tr_btn_show_all_rel_intents'); },
gid: 'm_relatedIntents',
},
leftArrow: {
cb: function () { tts.showPrevIntent(); },
- tt: 'Show previous related intent',
+ tt: function () { return topoLion('tr_btn_show_prev_rel_intent'); },
gid: 'm_prev',
},
rightArrow: {
cb: function () { tts.showNextIntent(); },
- tt: 'Show next related intent',
+ tt: function () { return topoLion('tr_btn_show_next_rel_intent'); },
gid: 'm_next',
},
W: {
cb: function () { tts.showSelectedIntentTraffic(); },
- tt: 'Monitor traffic of selected intent',
+ tt: function () { return topoLion('tr_btn_monitor_sel_intent'); },
gid: 'm_intentTraffic',
},
@@ -147,6 +152,11 @@
$log.debug('^^ trafficOverlay.showintent() ^^', info);
tts.selectIntent(info);
},
+ // localization bundle injection hook
+ injectLion: function (bundle) {
+ topoLion = bundle;
+ tts.setLionBundle(bundle);
+ },
},
};
diff --git a/web/gui/src/main/webapp/tests/app/view/topo/topoSelect-spec.js b/web/gui/src/main/webapp/tests/app/view/topo/topoSelect-spec.js
index cbb134b..3914101 100644
--- a/web/gui/src/main/webapp/tests/app/view/topo/topoSelect-spec.js
+++ b/web/gui/src/main/webapp/tests/app/view/topo/topoSelect-spec.js
@@ -43,7 +43,8 @@
'deselectAll', 'updateDetail',
'hovered', 'selectOrder',
'somethingSelected',
- 'clickConsumed', 'selectionContext', 'reselect'
+ 'clickConsumed', 'selectionContext', 'reselect',
+ 'setLionBundle',
])).toBeTruthy();
});
diff --git a/web/gui/src/main/webapp/tests/app/view/topo/topoToolbar-spec.js b/web/gui/src/main/webapp/tests/app/view/topo/topoToolbar-spec.js
index d521078..dfc8f86 100644
--- a/web/gui/src/main/webapp/tests/app/view/topo/topoToolbar-spec.js
+++ b/web/gui/src/main/webapp/tests/app/view/topo/topoToolbar-spec.js
@@ -45,7 +45,7 @@
expect(fs.areFunctions(ttbs, [
'init', 'createToolbar', 'destroyToolbar',
'keyListener', 'toggleToolbar', 'setDefaultOverlay',
- 'fnkey'
+ 'fnkey', 'setLionBundle',
])).toBeTruthy();
});
diff --git a/web/gui/src/main/webapp/tests/app/view/topo/topoTraffic-spec.js b/web/gui/src/main/webapp/tests/app/view/topo/topoTraffic-spec.js
index 12e4849..2d65b16 100644
--- a/web/gui/src/main/webapp/tests/app/view/topo/topoTraffic-spec.js
+++ b/web/gui/src/main/webapp/tests/app/view/topo/topoTraffic-spec.js
@@ -51,6 +51,7 @@
'removeIntent',
'resubmitIntent',
'removeIntents',
+ 'setLionBundle',
])).toBeTruthy();
});