Simon Hunt

ONOS-4805: Choice of selected overlay persisted server side -- restored across login sessions.

Change-Id: I17e0e06a2fcc33958ffd42cd51acb42a302de57e
......@@ -652,9 +652,8 @@
tis.initInst({ showMastership: tfs.showMastership });
tps.initPanels();
// temporary solution for persisting user settings
restoreConfigFromPrefs();
ttbs.setDefaultOverlay();
ttbs.setDefaultOverlay(prefsState.ovidx);
$log.debug('registered overlays...', tov.list());
$log.log('OvTopoCtrl has been created');
......
......@@ -80,6 +80,7 @@
porthl: 1,
bg: 0,
spr: 0,
ovidx: 1, // default to traffic overlay
toolbar: 0
},
prefsMap = {
......@@ -199,6 +200,9 @@
tds.closeDialog();
thirdRow.clear();
// persist our choice of overlay...
persistTopoPrefs('ovidx', ovIndex[oid] || 0);
if (!order.length) {
thirdRow.setText(selOver);
thirdRow.classed('right', true);
......@@ -264,15 +268,22 @@
}
}
function toggleToolbar() {
toolbar.toggle();
function persistTopoPrefs(key, val) {
var prefs = ps.getPrefs(cooktag, defaultPrefsState);
prefs.toolbar = !prefs.toolbar;
prefs[key] = val === undefined ? !prefs[key] : val;
ps.setPrefs('topo_prefs', prefs);
}
function setDefaultOverlay() {
function toggleToolbar() {
toolbar.toggle();
persistTopoPrefs('toolbar');
}
function setDefaultOverlay(prefsIdx) {
var idx = ovIndex[defaultOverlay] || 0;
if (prefsIdx >= 0 && prefsIdx < ovRset.size()) {
idx = prefsIdx;
}
ovRset.selectedIndex(idx);
}
......