UI: Simplify configuraton exporting

This commit is contained in:
Ilija Lazoroski 2022-07-21 15:01:43 +02:00
parent 89299bac6d
commit 261eb3828e
2 changed files with 7 additions and 10 deletions

View File

@ -15,7 +15,7 @@
"release:patch": "npm version patch && npm publish && git push --follow-tags",
"serve": "node server.js --env=dev",
"serve:dist": "node server.js --env=dist",
"start": "webpack-dev-server --mode development --open --history-api-fallback --port 8000 --host local-ip"
"start": "webpack-dev-server --mode development --open --history-api-fallback --port 8000 --host 192.168.56.103"
},
"repository": "",
"keywords": [],

View File

@ -23,20 +23,17 @@ const ConfigExportModal = (props: Props) => {
}
function onSubmit() {
let config = reformatConfig(props.configuration, true);
let configuration = reformatConfig(props.configuration, true);
let credentials = props.credentials;
let config_export = {'metadata': {}, 'configuration': null, 'credentials': null};
let metadata = {'encrypted': false};
if (radioValue === 'password') {
config_export.configuration = encryptText(JSON.stringify(config), pass);
config_export.credentials = encryptText(JSON.stringify(credentials), pass);
config_export.metadata = {'encrypted': true};
} else {
config_export.configuration = config;
config_export.credentials = credentials;
config_export.metadata = {'encrypted': false};
configuration = encryptText(JSON.stringify(configuration), pass);
credentials = encryptText(JSON.stringify(credentials), pass);
metadata = {'encrypted': true};
}
let config_export = {'metadata': metadata, 'configuration': configuration, 'credentials': credentials};
let export_json = JSON.stringify(config_export, null, 2);
let export_blob = new Blob(
[export_json],