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

View File

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

View File

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

View File

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