Integrated personnal data navigator

This commit is contained in:
Pierre HUBERT 2019-01-20 18:04:09 +01:00
parent 32c484b41a
commit a03fc1a745
3 changed files with 47 additions and 8 deletions

View File

@ -25,18 +25,51 @@ ComunicWeb.components.account.export.worker = {
ComunicWeb.components.account.export.ui.updateMessage("Got text data");
ComunicWeb.components.account.export.ui.updateProgress(10);
//Parse data
ComunicWeb.components.account.export.worker.parse(result);
//Get explorer
ComunicWeb.components.account.export.worker.getExplorer(result);
});
},
/**
* Second step for export : Get and open personnal data explorer
*
* @param {Object} data Text data about the account (data not modified at this stage)
*/
getExplorer: function(data){
ComunicWeb.components.account.export.ui.updateMessage("Getting data explorer");
ComunicWeb.components.account.export.ui.updateProgress(15);
JSZipUtils.getBinaryContent(ComunicWeb.__config.assetsURL+"zip/personnal-data-export-navigator.zip", function(err, file){
if(err != null){
ComunicWeb.debug.logMessage("Could not get personnal data export navigator!");
ComunicWeb.components.account.export.ui.exportFatalError(e);
return;
}
JSZip.loadAsync(file).then(function(zip){
//Ready to parse data
ComunicWeb.components.account.export.worker.parse(data, zip);
}).catch(function(){
ComunicWeb.debug.logMessage("Could not parse personnal data export navigator!");
ComunicWeb.components.account.export.ui.exportFatalError(e);
return;
});
});
},
/**
* Parse account text data into ZIP file
*
* @param {Object} data Text data about the account
* @param {ZIP} zip The ZIP object to fill
*/
parse: function(data){
parse: function(data, zip){
//Get UI shorcut
var ui = ComunicWeb.components.account.export.ui;
@ -77,9 +110,6 @@ ComunicWeb.components.account.export.worker = {
//Determine the list of files to download
var files_list = this._generate_files_list(data);
//Create zip file
var zip = new JSZip();
//Add raw json file
zip.file("source.json", JSON.stringify(data));

View File

@ -1,6 +1,7 @@
#!/bin/bash
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
rm -f personnal-data-export-navigator.zip
cd personnal-data-export-navigator;
zip -r personnal-data-export-navigator.zip assets Export.html
mv personnal-data-export-navigator.zip ../

View File

@ -177,6 +177,7 @@ if(file_exists(OUTPUT_DIRECTORY))
mkdir(OUTPUT_DIRECTORY, 0777, true);
mkdir($path_release_assets, 0777, true);
mkdir($path_release_assets."/css", 0777, true);
mkdir($path_release_assets."/zip", 0777, true);
@ -237,6 +238,13 @@ rcopy($path_debug_assets."css/dark_theme.css", $path_release_assets."css/dark_th
//Copy pacman
rcopy($path_debug_assets."3rdparty/pacman", $path_release_assets."3rdparty/pacman");
//Build and copy personnal data navigator
notice("Build personnal data export navigator and add it to built files");
exec($path_debug_assets."zip/personnal-data-export-navigator-builder.sh");
rcopy($path_debug_assets."zip/personnal-data-export-navigator.zip", $path_release_assets."zip/personnal-data-export-navigator.zip");
//Begin to write root PHP File
notice("Generate PHP root file");
$page_src = '<?php