mirror of
https://github.com/opennetworkinglab/onos.git
synced 2025-10-17 10:21:52 +02:00
Added keyboard shortcut to show/hide instance panel
Change-Id: I88bed44fe84a91ca870d67d0428b95c4a30dab85
This commit is contained in:
parent
a78f060013
commit
01ddf60a74
@ -2,7 +2,7 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
// injected refs
|
// injected refs
|
||||||
var $log, ps, sus, gs, ts;
|
var $log, ps, sus, gs, flash, ts;
|
||||||
|
|
||||||
// api from topo
|
// api from topo
|
||||||
var api;
|
var api;
|
||||||
@ -238,6 +238,26 @@
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function toggle(x) {
|
||||||
|
var kev = (x === 'keyev'),
|
||||||
|
on,
|
||||||
|
verb;
|
||||||
|
|
||||||
|
if (kev) {
|
||||||
|
on = oiBox.toggle();
|
||||||
|
} else {
|
||||||
|
on = Boolean(x);
|
||||||
|
if (on) {
|
||||||
|
oiBox.show();
|
||||||
|
} else {
|
||||||
|
oiBox.hide();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
verb = on ? 'Show' : 'Hide';
|
||||||
|
flash.flash(verb + ' instances panel');
|
||||||
|
return on;
|
||||||
|
}
|
||||||
|
|
||||||
function destroy() {
|
function destroy() {
|
||||||
ts.removeListener(updateInstances);
|
ts.removeListener(updateInstances);
|
||||||
|
|
||||||
@ -250,20 +270,22 @@
|
|||||||
|
|
||||||
angular.module('ovTopo2')
|
angular.module('ovTopo2')
|
||||||
.factory('Topo2InstanceService',
|
.factory('Topo2InstanceService',
|
||||||
['$log', 'PanelService', 'SvgUtilService', 'GlyphService',
|
['$log', 'PanelService', 'SvgUtilService', 'GlyphService', 'FlashService',
|
||||||
'ThemeService',
|
'ThemeService',
|
||||||
|
|
||||||
function (_$log_, _ps_, _sus_, _gs_, _ts_) {
|
function (_$log_, _ps_, _sus_, _gs_, _flash_, _ts_) {
|
||||||
$log = _$log_;
|
$log = _$log_;
|
||||||
ps = _ps_;
|
ps = _ps_;
|
||||||
sus = _sus_;
|
sus = _sus_;
|
||||||
gs = _gs_;
|
gs = _gs_;
|
||||||
|
flash = _flash_;
|
||||||
ts = _ts_;
|
ts = _ts_;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
initInst: initInst,
|
initInst: initInst,
|
||||||
allInstances: allInstances,
|
allInstances: allInstances,
|
||||||
destroy: destroy
|
destroy: destroy,
|
||||||
|
toggle: toggle
|
||||||
};
|
};
|
||||||
}]);
|
}]);
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
(function () {
|
(function () {
|
||||||
|
|
||||||
// Injected Services
|
// Injected Services
|
||||||
var ks, t2ps, t2ms;
|
var ks, t2ps, t2ms, ps, t2is;
|
||||||
var topo2ForceService;
|
var topo2ForceService;
|
||||||
|
|
||||||
// Commmands
|
// Commmands
|
||||||
@ -25,6 +25,7 @@
|
|||||||
L: [cycleDeviceLabels, 'Cycle device labels'],
|
L: [cycleDeviceLabels, 'Cycle device labels'],
|
||||||
G: [openMapSelection, 'Select background geo map'],
|
G: [openMapSelection, 'Select background geo map'],
|
||||||
B: [toggleMap, 'Toggle background geo map'],
|
B: [toggleMap, 'Toggle background geo map'],
|
||||||
|
I: [toggleInstancePanel, 'Toggle ONOS Instance Panel']
|
||||||
};
|
};
|
||||||
|
|
||||||
function init(t2fs) {
|
function init(t2fs) {
|
||||||
@ -45,6 +46,13 @@
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var prefsState = {};
|
||||||
|
|
||||||
|
function updatePrefsState(what, b) {
|
||||||
|
prefsState[what] = b ? 1 : 0;
|
||||||
|
ps.setPrefs('topo_prefs', prefsState);
|
||||||
|
}
|
||||||
|
|
||||||
function cycleDeviceLabels() {
|
function cycleDeviceLabels() {
|
||||||
var deviceLabelIndex = t2ps.get('dlbls') + 1;
|
var deviceLabelIndex = t2ps.get('dlbls') + 1;
|
||||||
t2ps.set('dlbls', deviceLabelIndex % 3);
|
t2ps.set('dlbls', deviceLabelIndex % 3);
|
||||||
@ -59,14 +67,20 @@
|
|||||||
t2ms.toggle(x);
|
t2ms.toggle(x);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function toggleInstancePanel(x) {
|
||||||
|
updatePrefsState('insts', t2is.toggle(x));
|
||||||
|
}
|
||||||
|
|
||||||
angular.module('ovTopo2')
|
angular.module('ovTopo2')
|
||||||
.factory('Topo2KeyCommandService',
|
.factory('Topo2KeyCommandService',
|
||||||
['KeyService', 'Topo2PrefsService', 'Topo2MapService',
|
['KeyService', 'Topo2PrefsService', 'Topo2MapService', 'PrefsService',
|
||||||
|
'Topo2InstanceService',
|
||||||
function (_ks_, _t2ps_, _t2ms_) {
|
function (_ks_, _t2ps_, _t2ms_, _ps_, _t2is_) {
|
||||||
|
|
||||||
t2ps = _t2ps_;
|
t2ps = _t2ps_;
|
||||||
t2ms = _t2ms_;
|
t2ms = _t2ms_;
|
||||||
|
t2is = _t2is_;
|
||||||
|
ps = _ps_;
|
||||||
ks = _ks_;
|
ks = _ks_;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user