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_WINDOWS = '/api/fileUpload/PBAwindows';
function unsafeItemSelected(options, selectedOptions) {
let item_safety = new Map();
options.forEach(i => item_safety[i.enum[0]] = i.safe);
function isUnsafeItemSelected(allOptions, selectedOptions) {
let optionSafety = new Map();
allOptions.forEach(i => optionSafety[i.enum[0]] = i.safe);
for (let selected of selectedOptions) {
if (!item_safety[selected]) {
return true;
}
}
for (let selected of selectedOptions) {
if (!optionSafety[selected]) {
return true;
}
}
return false;
return false;
}
class ConfigurePageComponent extends AuthComponent {
@ -135,21 +135,21 @@ class ConfigurePageComponent extends AuthComponent {
}
unsafeExploiterSelected(config) {
return unsafeItemSelected(
return isUnsafeItemSelected(
this.state.schema.definitions.exploiter_classes.anyOf,
config.basic.exploiters.exploiter_classes
);
}
unsafePostBreachActionSelected(config) {
return unsafeItemSelected(
return isUnsafeItemSelected(
this.state.schema.definitions.post_breach_actions.anyOf,
config.monkey.post_breach.post_breach_actions
);
}
unsafeSystemInfoCollectorSelected(config) {
return unsafeItemSelected(
return isUnsafeItemSelected(
this.state.schema.definitions.system_info_collector_classes.anyOf,
config.monkey.system_info.system_info_collector_classes
);