ui: improve names in unsafeItemSelected
This commit is contained in:
parent
75bf30913a
commit
95af08a5fa
|
@ -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
|
||||
);
|
||||
|
|
Loading…
Reference in New Issue