Fixed bugs in config import backend (related to json parsing and stringifying) and front end (unsafe import warning overlay)

This commit is contained in:
VakarisZ 2021-06-03 13:30:27 +03:00
parent b407094a2f
commit c25ea0edf8
3 changed files with 12 additions and 4 deletions

View File

@ -48,7 +48,7 @@ class ConfigurationImport(flask_restful.Resource):
return ResponseContents().form_response() return ResponseContents().form_response()
else: else:
return ResponseContents( return ResponseContents(
config=config, config=json.dumps(config),
config_schema=ConfigService.get_config_schema(), config_schema=ConfigService.get_config_schema(),
import_status="unsafe_options_verification_required", import_status="unsafe_options_verification_required",
status_code=403, status_code=403,

View File

@ -62,9 +62,9 @@ const ConfigImportModal = (props: Props) => {
setUploadStatus(UploadStatuses.error); setUploadStatus(UploadStatuses.error);
setErrorMessage(res['message']); setErrorMessage(res['message']);
} else if (res['import_status'] === 'unsafe_options_verification_required') { } else if (res['import_status'] === 'unsafe_options_verification_required') {
if (isUnsafeOptionSelected(res['config_schema'], res['config'])) { if (isUnsafeOptionSelected(res['config_schema'], JSON.parse(res['config']))) {
setShowUnsafeOptionsConfirmation(true); setShowUnsafeOptionsConfirmation(true);
setCandidateConfig(JSON.stringify(res['config'])); setCandidateConfig(res['config']);
} else { } else {
setUnsafeOptionsVerified(true); setUnsafeOptionsVerified(true);
setConfigContents(res['config']); setConfigContents(res['config']);
@ -133,8 +133,8 @@ const ConfigImportModal = (props: Props) => {
</Modal.Title> </Modal.Title>
</Modal.Header> </Modal.Header>
<Modal.Body> <Modal.Body>
{showVerificationDialog()}
<div className={`mb-3 config-import-option`}> <div className={`mb-3 config-import-option`}>
{showVerificationDialog()}
<Form> <Form>
<Form.File id='importConfigFileSelector' <Form.File id='importConfigFileSelector'
label='Please choose a configuration file' label='Please choose a configuration file'

View File

@ -19,3 +19,11 @@
display: inline-block; display: inline-block;
width: auto; width: auto;
} }
.fade.modal.show.unsafe-config-options-confirmation-modal {
z-index: 2000;
}
.modal-backdrop.unsafe-config-options-confirmation-modal-backdrop {
z-index: 1900;
}