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", "release:patch": "npm version patch && npm publish && git push --follow-tags",
"serve": "node server.js --env=dev", "serve": "node server.js --env=dev",
"serve:dist": "node server.js --env=dist", "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": "", "repository": "",
"keywords": [], "keywords": [],

View File

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