forked from p15670423/monkey
Merge pull request #415 from VakarisZ/config_submit_bugfix
Bugfix: can't submit on import
This commit is contained in:
commit
cc5795d99c
|
@ -295,13 +295,12 @@ class ConfigurePageComponent extends AuthComponent {
|
||||||
this.setState({PBAlinuxFile: [], PBAwinFile: []});
|
this.setState({PBAlinuxFile: [], PBAwinFile: []});
|
||||||
}
|
}
|
||||||
|
|
||||||
onReadFile = (event) => {
|
setConfigOnImport = (event) => {
|
||||||
try {
|
try {
|
||||||
this.setState({
|
this.setState({
|
||||||
configuration: JSON.parse(event.target.result),
|
configuration: JSON.parse(event.target.result),
|
||||||
lastAction: 'import_success'
|
lastAction: 'import_success'
|
||||||
}, () => {this.sendConfig(); this.setInitialConfig(JSON.parse(event.target.result))});
|
}, () => {this.sendConfig(); this.setInitialConfig(JSON.parse(event.target.result))});
|
||||||
this.currentSection = 'basic';
|
|
||||||
this.currentFormData = {};
|
this.currentFormData = {};
|
||||||
} catch(SyntaxError) {
|
} catch(SyntaxError) {
|
||||||
this.setState({lastAction: 'import_failure'});
|
this.setState({lastAction: 'import_failure'});
|
||||||
|
@ -335,7 +334,7 @@ class ConfigurePageComponent extends AuthComponent {
|
||||||
|
|
||||||
importConfig = (event) => {
|
importConfig = (event) => {
|
||||||
let reader = new FileReader();
|
let reader = new FileReader();
|
||||||
reader.onload = this.onReadFile;
|
reader.onload = this.setConfigOnImport;
|
||||||
reader.readAsText(event.target.files[0]);
|
reader.readAsText(event.target.files[0]);
|
||||||
event.target.value = null;
|
event.target.value = null;
|
||||||
};
|
};
|
||||||
|
@ -494,7 +493,6 @@ class ConfigurePageComponent extends AuthComponent {
|
||||||
} else if(this.state.selectedSection !== 'attack') {
|
} else if(this.state.selectedSection !== 'attack') {
|
||||||
content = this.renderConfigContent(displayedSchema)
|
content = this.renderConfigContent(displayedSchema)
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Col xs={12} lg={10}>
|
<Col xs={12} lg={10}>
|
||||||
{this.renderAttackAlertModal()}
|
{this.renderAttackAlertModal()}
|
||||||
|
|
Loading…
Reference in New Issue