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()
else:
return ResponseContents(
config=config,
config=json.dumps(config),
config_schema=ConfigService.get_config_schema(),
import_status="unsafe_options_verification_required",
status_code=403,

View File

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

View File

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