Improved configuration export and fixed the bug of modal not closing on export.

This commit is contained in:
VakarisZ 2021-06-02 12:57:54 +03:00
parent 624fda10cb
commit 8b86e40259
2 changed files with 7 additions and 8 deletions

View File

@ -8,7 +8,7 @@ import '../../styles/components/configuration-components/ExportConfigModal.scss'
type Props = { type Props = {
show: boolean, show: boolean,
onClick: () => void onHide: () => void
} }
const ConfigExportModal = (props: Props) => { const ConfigExportModal = (props: Props) => {
@ -45,12 +45,13 @@ const ConfigExportModal = (props: Props) => {
); );
} }
FileSaver.saveAs(configToExport, 'monkey.conf'); FileSaver.saveAs(configToExport, 'monkey.conf');
props.onHide();
}) })
} }
return ( return (
<Modal show={props.show} <Modal show={props.show}
onHide={props.onClick} onHide={props.onHide}
size={'lg'} size={'lg'}
className={'config-export-modal'}> className={'config-export-modal'}>
<Modal.Header closeButton> <Modal.Header closeButton>

View File

@ -228,16 +228,14 @@ class ConfigurePageComponent extends AuthComponent {
renderConfigExportModal = () => { renderConfigExportModal = () => {
return (<ConfigExportModal show={this.state.showConfigExportModal} return (<ConfigExportModal show={this.state.showConfigExportModal}
onClick={this.onExport}/>) onHide={() => {
} this.setState({showConfigExportModal: false});
}}/>);
onExport = () => {
this.setState({showConfigExportModal: false})
} }
renderConfigImportModal = () => { renderConfigImportModal = () => {
return (<ConfigImportModal show={this.state.showConfigImportModal} return (<ConfigImportModal show={this.state.showConfigImportModal}
onClose={this.onClose}/>) onClose={this.onClose}/>);
} }
onClose = (importSuccessful) => { onClose = (importSuccessful) => {