* Fix 'noHistory' flag and it's usage to be more natural

* Add 'popParent' menu flag (works like 'noHistory' used to)
This commit is contained in:
Bryan Ashby 2017-12-02 19:06:07 -07:00
parent 1849d275f5
commit 7f80f4a7af
4 changed files with 14 additions and 13 deletions

View File

@ -215,16 +215,14 @@
desc: Applying
options: {
pause: true
cls: true
cls: true
menuFlags: [ "noHistory" ]
}
}
newUserApplication: {
module: nua
art: NUA
options: {
menuFlags: [ "noHistory" ]
}
next: [
{
// Initial SysOp does not send feedback to themselves
@ -333,6 +331,7 @@
options: {
pause: true
cls: true
menuFlags: [ "noHistory" ]
}
}
@ -344,9 +343,6 @@
module: nua
art: NUA
fallback: logoff
options: {
menuFlags: [ "noHistory" ]
}
next: newUserFeedbackToSysOpPreamble
form: {
0: {
@ -2720,7 +2716,7 @@
art: FBNORES
options: {
pause: true
menuFlags: [ "noHistory" ]
menuFlags: [ "noHistory", "popParent" ]
}
}
@ -3011,7 +3007,7 @@
art: FEMPTYQ
options: {
pause: true
menuFlags: [ "noHistory" ]
menuFlags: [ "noHistory", "popParent" ]
}
}

View File

@ -40,7 +40,7 @@ exports.getModule = class FileAreaSelectModule extends MenuModule {
extraArgs : {
filterCriteria : filterCriteria,
},
menuFlags : [ 'noHistory' ],
menuFlags : [ 'popParent' ],
};
return this.gotoMenu(this.menuConfig.config.fileBaseListEntriesMenu || 'fileBaseListEntries', menuOpts, cb);

View File

@ -112,7 +112,7 @@ exports.getModule = class FileBaseSearch extends MenuModule {
extraArgs : {
filterCriteria : filterCriteria,
},
menuFlags : [ 'noHistory' ],
menuFlags : [ 'popParent' ],
};
return this.gotoMenu(this.menuConfig.config.fileBaseListEntriesMenu || 'fileBaseListEntries', menuOpts, cb);

View File

@ -129,15 +129,19 @@ module.exports = class MenuStack {
} else {
self.client.log.debug( { menuName : name }, 'Goto menu module');
const menuFlags = (options && Array.isArray(options.menuFlags)) ? options.menuFlags : modInst.menuConfig.options.menuFlags;
if(currentModuleInfo) {
// save stack state
currentModuleInfo.savedState = currentModuleInfo.instance.getSaveState();
currentModuleInfo.instance.leave();
const menuFlags = (options && Array.isArray(options.menuFlags)) ? options.menuFlags : modInst.menuConfig.options.menuFlags;
if(currentModuleInfo.menuFlags.includes('noHistory')) {
this.pop();
}
if(menuFlags.includes('noHistory')) {
if(menuFlags.includes('popParent')) {
this.pop().instance.leave(); // leave & remove current
}
}
@ -146,6 +150,7 @@ module.exports = class MenuStack {
name : name,
instance : modInst,
extraArgs : loadOpts.extraArgs,
menuFlags : menuFlags,
});
// restore previous state if requested