Skip to content
Snippets Groups Projects
Commit c2ddfad8 authored by Josefine Wegert's avatar Josefine Wegert
Browse files

minor changes,work in progress:stop spinner and redirect to homepage after download

parent a7d7a478
Branches
No related tags found
No related merge requests found
......@@ -9,8 +9,7 @@ const fsReaddir = require('fs-readdir');
const JSZip = require('jszip');
const exphbs = require('express-handlebars');
// global.jQuery = require('jquery');
// const bootstrap = require('bootstrap');
//initializer
const initGitRepos = require('./initializers/gitRepos.js');
//load names of available download files
......@@ -36,10 +35,9 @@ app.use(bodyParser.json());
//TODO add spinner for telling user to wait until initialization is done
//initGitRepos.initialize(downloadFiles);
//routes
app.get('/', function(req, res){
//initGitRepos.initialize(downloadFiles);
res.render('home', {downloadFiles: downloadNames});
});
......@@ -57,7 +55,7 @@ app.use(bodyParser.json());
app.get('/download', function(req, res, next){
//holds promises for backend and/or frontend
//holds promises for backend and/or frontend for synchronizing
const promiseArray = []
const checkedFiles = req.query.checkedFiles.split(',');
......@@ -69,7 +67,7 @@ app.use(bodyParser.json());
frontendChecked = checkedFiles.find(function(file){
return file === 'explorviz-ui-frontend';
});
//the user is not allowed to check plugins without having checked frontend or backend
if(!(backendChecked || frontendChecked)){
res.render('home', {downloadFiles: downloadNames});
}
......@@ -146,8 +144,15 @@ function createZip(zip){
console.log('error in createZip:', error);
}).on('finish', function () {
console.log('explorviz-builds.zip written.');
res.download('explorviz-builds.zip');
//how to redirect to home page?
res.download('explorviz-builds.zip', function(error){
if(error){
let response =
'There was an error during your build. ' +
'Please contact "explorviz-developers-request@listserv.dfn.de" ' +
'and add the following information: ' + error;
res.send(response);
}
});
});
})
......@@ -159,5 +164,6 @@ function createZip(zip){
});
app.listen(3000);
console.log("Downloader started on port 3000.");
\ No newline at end of file
......@@ -89,12 +89,6 @@ var exec = require('child_process').exec;
};
// module.exports = {
// initBackend,
// initBackendPlugins,
// initFrontend
// }
module.exports = {
initialize
}
\ No newline at end of file
......@@ -10,15 +10,12 @@
"license": "Apache-2.0",
"dependencies": {
"body-parser": "^1.17.1",
"bootstrap": "^3.3.7",
"child_process": "^1.0.2",
"express": "^4.15.2",
"express-handlebars": "^3.0.0",
"fs": "0.0.1-security",
"fs-readdir": "0.0.3",
"jquery": "^3.2.1",
"jszip": "^3.1.3",
"node-zip": "^1.1.1",
"path": "^0.12.7",
"spinkit": "^1.2.5"
},
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment