admin: new route to display import report

This commit is contained in:
nemunaire 2017-12-12 07:11:56 +01:00 committed by Pierre-Olivier Mercier
parent a543be0255
commit d81f068eba
3 changed files with 45 additions and 0 deletions

1
admin/.gitignore vendored
View File

@ -2,3 +2,4 @@ admin
fic.db
PKI/
FILES/
static/full_import_report.json

View File

@ -47,4 +47,11 @@ func init() {
api.Router().GET("/views/*_", func(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {
http.ServeFile(w, r, path.Join(StaticDir, r.URL.Path))
})
api.Router().GET("/check_import.html", func(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {
http.ServeFile(w, r, path.Join(StaticDir, "check_import.html"))
})
api.Router().GET("/full_import_report.json", func(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {
http.ServeFile(w, r, path.Join(StaticDir, "full_import_report.json"))
})
}

View File

@ -0,0 +1,37 @@
<!DOCTYPE html>
<html>
<head>
<title>Rapport d'import FIC</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<style>li:hover { background: lightgrey; }
</style>
<script type="text/javascript">
function disp(data) {
Object.keys(data).map(function(theme) {
if (data[theme] != null) {
var title = document.createElement("h3");
title.id = theme;
title.innerHTML = theme;
document.getElementById("content").appendChild(title);
var row = document.createElement("ul");
row.type = "square";
for (var i = 0; i < data[theme].length; i++) {
var col = document.createElement("li");
col.innerHTML = data[theme][i];
row.appendChild(col);
}
document.getElementById("content").appendChild(row);
document.getElementById("content").appendChild(document.createElement("hr"));
}
});
}
</script>
</head>
<body class="container">
<h1>Rapport d'import FIC</h1>
<div id="content"></div>
<script src="full_import_report.json"></script>
</body>
</html>