UI: Fix UiSchema manipulators to use payloads section

This commit is contained in:
Ilija Lazoroski 2022-07-04 15:04:30 +02:00
parent a37157b086
commit 3bbbca783d
3 changed files with 13 additions and 5 deletions

View File

@ -12,7 +12,7 @@ function applyUiSchemaManipulators(selectedSection,
function ransomwareDirManipulator(selectedSection, function ransomwareDirManipulator(selectedSection,
formData, formData,
uiSchema) { uiSchema) {
if (selectedSection === 'ransomware'){ if (selectedSection === 'payloads'){
uiSchema.encryption.directories = uiSchema.encryption.directories =
{'ui:disabled': !formData['encryption']['enabled']}; {'ui:disabled': !formData['encryption']['enabled']};
} }

View File

@ -74,9 +74,18 @@ export default function UiSchema(props) {
info_box : { info_box : {
'ui:field': InfoBox 'ui:field': InfoBox
}, },
directories: {
// Directory inputs are dynamically hidden
},
text_box: { text_box: {
'ui:field': TextBox 'ui:field': TextBox
},
enabled: {
'ui:widget': 'hidden'
} }
},
other_behaviors : {
'ui:widget': 'hidden'
} }
}, },
custom_pbas: { custom_pbas: {

View File

@ -74,6 +74,9 @@ class ConfigurePageComponent extends AuthComponent {
.then(data => { .then(data => {
let sections = []; let sections = [];
let monkeyConfig = data[0]; let monkeyConfig = data[0];
// TODO: Fix when we add plugins
monkeyConfig['payloads'] = monkeyConfig['payloads'][0]['options'];
this.setInitialConfig(monkeyConfig); this.setInitialConfig(monkeyConfig);
for (let sectionKey of this.getSectionsOrder()) { for (let sectionKey of this.getSectionsOrder()) {
sections.push({ sections.push({
@ -269,10 +272,6 @@ class ConfigurePageComponent extends AuthComponent {
this.currentSection = key; this.currentSection = key;
let selectedSectionData = this.state.configuration[key]; let selectedSectionData = this.state.configuration[key];
if(key == 'payloads') {
selectedSectionData = this.state.configuration[key][0]['options'];
}
this.setState({ this.setState({
selectedSection: key, selectedSection: key,
currentFormData: selectedSectionData currentFormData: selectedSectionData