forked from p15670423/monkey
Hide the input fields for directories to be encrypted if "Should encrypt" option is disabled
This change will enhance the UX by hiding the irrelevant inputs. This also allows us to add further logic to dynamically hide/show or otherwise modify uiSchema
This commit is contained in:
parent
889df554ae
commit
16f97f2811
|
@ -0,0 +1,21 @@
|
||||||
|
|
||||||
|
const manipulatorList = [ransomwareDirManipulator]
|
||||||
|
|
||||||
|
function applyUiSchemaManipulators(selectedSection,
|
||||||
|
formData,
|
||||||
|
uiSchema) {
|
||||||
|
for(let i = 0; i < manipulatorList.length; i++){
|
||||||
|
manipulatorList[i](selectedSection, formData, uiSchema);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function ransomwareDirManipulator(selectedSection,
|
||||||
|
formData,
|
||||||
|
uiSchema) {
|
||||||
|
if (selectedSection === 'ransomware'){
|
||||||
|
uiSchema.encryption.directories =
|
||||||
|
{'ui:disabled': !formData['encryption']['enabled']};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default applyUiSchemaManipulators;
|
|
@ -16,6 +16,7 @@ import UnsafeOptionsWarningModal from '../configuration-components/UnsafeOptions
|
||||||
import isUnsafeOptionSelected from '../utils/SafeOptionValidator.js';
|
import isUnsafeOptionSelected from '../utils/SafeOptionValidator.js';
|
||||||
import ConfigExportModal from '../configuration-components/ExportConfigModal';
|
import ConfigExportModal from '../configuration-components/ExportConfigModal';
|
||||||
import ConfigImportModal from '../configuration-components/ImportConfigModal';
|
import ConfigImportModal from '../configuration-components/ImportConfigModal';
|
||||||
|
import applyUiSchemaManipulators from '../configuration-components/UISchemaManipulators.tsx';
|
||||||
|
|
||||||
const ATTACK_URL = '/api/attack';
|
const ATTACK_URL = '/api/attack';
|
||||||
const CONFIG_URL = '/api/configuration/island';
|
const CONFIG_URL = '/api/configuration/island';
|
||||||
|
@ -417,6 +418,10 @@ class ConfigurePageComponent extends AuthComponent {
|
||||||
formProperties['className'] = 'config-form';
|
formProperties['className'] = 'config-form';
|
||||||
formProperties['liveValidate'] = true;
|
formProperties['liveValidate'] = true;
|
||||||
|
|
||||||
|
applyUiSchemaManipulators(this.state.selectedSection,
|
||||||
|
formProperties['formData'],
|
||||||
|
formProperties['uiSchema']);
|
||||||
|
|
||||||
if (this.state.selectedSection === 'internal') {
|
if (this.state.selectedSection === 'internal') {
|
||||||
return (<InternalConfig {...formProperties}/>)
|
return (<InternalConfig {...formProperties}/>)
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue