|
|
@ -93,7 +93,8 @@ export async function featuresMenu(previousMenuChoice = 0) { |
|
|
|
const serviceName = answer.features_menu.replace(/^service_/, '') |
|
|
|
const serviceName = answer.features_menu.replace(/^service_/, '') |
|
|
|
const service = new SystemServiceManager(serviceName) |
|
|
|
const service = new SystemServiceManager(serviceName) |
|
|
|
const nameWithoutDot = serviceName.split('.')[0] + ' service' |
|
|
|
const nameWithoutDot = serviceName.split('.')[0] + ' service' |
|
|
|
await oneFeatureMenu(nameWithoutDot, service, undefined, true) |
|
|
|
console.log('calling service menu with true') |
|
|
|
|
|
|
|
await oneFeatureMenu(nameWithoutDot, service, true) |
|
|
|
return answer.features_menu |
|
|
|
return answer.features_menu |
|
|
|
} |
|
|
|
} |
|
|
|
switch(answer.features_menu) { |
|
|
|
switch(answer.features_menu) { |
|
|
@ -144,7 +145,8 @@ function oneFeatureMenuChoices(name, feature, status, isCustom = false) { |
|
|
|
|
|
|
|
|
|
|
|
if(isCustom) { |
|
|
|
if(isCustom) { |
|
|
|
featureChoices.push({ name: 'Remove from list', value: () => { |
|
|
|
featureChoices.push({ name: 'Remove from list', value: () => { |
|
|
|
removeCustomService(name) |
|
|
|
const nameWithoutLabel = name.replace(/ service/, '') |
|
|
|
|
|
|
|
removeCustomService(nameWithoutLabel) |
|
|
|
featuresChoices = null |
|
|
|
featuresChoices = null |
|
|
|
}
|
|
|
|
}
|
|
|
|
}) |
|
|
|
}) |
|
|
@ -169,7 +171,7 @@ function oneFeatureMenuChoices(name, feature, status, isCustom = false) { |
|
|
|
// Each feature can also have subfeatures/featuare submodules. These are simply features not listed in the main AO Features list
|
|
|
|
// Each feature can also have subfeatures/featuare submodules. These are simply features not listed in the main AO Features list
|
|
|
|
// Instead, their (usually shorter list of) menu items are listed flattened alongside the feature's menu items (no submenus)
|
|
|
|
// Instead, their (usually shorter list of) menu items are listed flattened alongside the feature's menu items (no submenus)
|
|
|
|
// This has better usability than submenus, giving users more contexual cues at the same time about where they are in the menus
|
|
|
|
// This has better usability than submenus, giving users more contexual cues at the same time about where they are in the menus
|
|
|
|
export async function oneFeatureMenu(name, feature) { |
|
|
|
export async function oneFeatureMenu(name, feature, isCustom = false) { |
|
|
|
console.log(`\n${headerStyle(name)}`) |
|
|
|
console.log(`\n${headerStyle(name)}`) |
|
|
|
if(feature.description && feature.description?.length >= 1) { |
|
|
|
if(feature.description && feature.description?.length >= 1) { |
|
|
|
console.log('\n' + feature.description + '\n') |
|
|
|
console.log('\n' + feature.description + '\n') |
|
|
@ -177,10 +179,10 @@ export async function oneFeatureMenu(name, feature) { |
|
|
|
let featureChoices = [] |
|
|
|
let featureChoices = [] |
|
|
|
const stopSpinner = spinner('Loading status...') |
|
|
|
const stopSpinner = spinner('Loading status...') |
|
|
|
const status = feature?.status() || false |
|
|
|
const status = feature?.status() || false |
|
|
|
featureChoices = oneFeatureMenuChoices(name, feature, status) |
|
|
|
featureChoices = oneFeatureMenuChoices(name, feature, status, isCustom) |
|
|
|
if(feature.submodules && Array.isArray(feature.submodules)) { |
|
|
|
if(feature.submodules && Array.isArray(feature.submodules)) { |
|
|
|
feature.submodules.forEach(subfeature => { |
|
|
|
feature.submodules.forEach(subfeature => { |
|
|
|
const submoduleChoices = oneFeatureMenuChoices(subfeature.name, subfeature) |
|
|
|
const submoduleChoices = oneFeatureMenuChoices(subfeature.name, subfeature, undefined, isCustom) |
|
|
|
if(submoduleChoices && submoduleChoices.length >= 1) { |
|
|
|
if(submoduleChoices && submoduleChoices.length >= 1) { |
|
|
|
featureChoices = featureChoices.concat(submoduleChoices) |
|
|
|
featureChoices = featureChoices.concat(submoduleChoices) |
|
|
|
} |
|
|
|
} |
|
|
|