ui: improve names in unsafeItemSelected

This commit is contained in:
Mike Salvatore 2021-02-26 11:26:05 -05:00
parent 75bf30913a
commit 95af08a5fa
1 changed files with 12 additions and 12 deletions

View File

@ -18,17 +18,17 @@ const CONFIG_URL = '/api/configuration/island';
export const API_PBA_LINUX = '/api/fileUpload/PBAlinux'; export const API_PBA_LINUX = '/api/fileUpload/PBAlinux';
export const API_PBA_WINDOWS = '/api/fileUpload/PBAwindows'; export const API_PBA_WINDOWS = '/api/fileUpload/PBAwindows';
function unsafeItemSelected(options, selectedOptions) { function isUnsafeItemSelected(allOptions, selectedOptions) {
let item_safety = new Map(); let optionSafety = new Map();
options.forEach(i => item_safety[i.enum[0]] = i.safe); allOptions.forEach(i => optionSafety[i.enum[0]] = i.safe);
for (let selected of selectedOptions) { for (let selected of selectedOptions) {
if (!item_safety[selected]) { if (!optionSafety[selected]) {
return true; return true;
} }
} }
return false; return false;
} }
class ConfigurePageComponent extends AuthComponent { class ConfigurePageComponent extends AuthComponent {
@ -135,21 +135,21 @@ class ConfigurePageComponent extends AuthComponent {
} }
unsafeExploiterSelected(config) { unsafeExploiterSelected(config) {
return unsafeItemSelected( return isUnsafeItemSelected(
this.state.schema.definitions.exploiter_classes.anyOf, this.state.schema.definitions.exploiter_classes.anyOf,
config.basic.exploiters.exploiter_classes config.basic.exploiters.exploiter_classes
); );
} }
unsafePostBreachActionSelected(config) { unsafePostBreachActionSelected(config) {
return unsafeItemSelected( return isUnsafeItemSelected(
this.state.schema.definitions.post_breach_actions.anyOf, this.state.schema.definitions.post_breach_actions.anyOf,
config.monkey.post_breach.post_breach_actions config.monkey.post_breach.post_breach_actions
); );
} }
unsafeSystemInfoCollectorSelected(config) { unsafeSystemInfoCollectorSelected(config) {
return unsafeItemSelected( return isUnsafeItemSelected(
this.state.schema.definitions.system_info_collector_classes.anyOf, this.state.schema.definitions.system_info_collector_classes.anyOf,
config.monkey.system_info.system_info_collector_classes config.monkey.system_info.system_info_collector_classes
); );