forked from p34709852/monkey
Make sure (1) config is updated before exporting; (2) plaintext config is exported correctly
This commit is contained in:
parent
f4b5d341cf
commit
d67e84a6a7
|
@ -38,7 +38,8 @@ const ConfigExportModal = (props: Props) => {
|
|||
.then(res => {
|
||||
let configToExport = res['to_export'];
|
||||
if (res['is_plaintext'] === true) {
|
||||
const configAsBinary = new Blob([configToExport], {type: 'text/plain;charset=utf-8'});
|
||||
const configAsBinary = new Blob([JSON.stringify(configToExport, null, 2)],
|
||||
{type: 'text/plain;charset=utf-8'});
|
||||
FileSaver.saveAs(configAsBinary, 'monkey.conf');
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -369,6 +369,11 @@ class ConfigurePageComponent extends AuthComponent {
|
|||
this.authFetch(apiEndpoint, request_options);
|
||||
}
|
||||
|
||||
exportConfig = () => {
|
||||
this.updateConfigSection();
|
||||
this.setState({showConfigExportModal: true});
|
||||
};
|
||||
|
||||
sendConfig() {
|
||||
return (
|
||||
this.authFetch('/api/configuration/island',
|
||||
|
@ -500,9 +505,7 @@ class ConfigurePageComponent extends AuthComponent {
|
|||
Import config
|
||||
</button>
|
||||
<button type='button'
|
||||
onClick={() => {
|
||||
this.setState({showConfigExportModal: true})
|
||||
}}
|
||||
onClick={this.exportConfig}
|
||||
className='btn btn-info btn-lg' style={{margin: '5px'}}>
|
||||
Export config
|
||||
</button>
|
||||
|
|
Loading…
Reference in New Issue