Skip to content
Snippets Groups Projects
Commit 466dac28 authored by mathias.chouet's avatar mathias.chouet
Browse files

Rapport de bug : ajout des titres de modules dans le fichier de session

parent f5e8f67d
No related branches found
No related tags found
1 merge request!44Resolve "Ajouter un système de rapport de bug, qui envoie un email contenant le fichier de session"
......@@ -301,8 +301,12 @@ export class AppComponent implements OnInit, OnDestroy, Observer {
* @param calcList modules to save
* @param filename
*/
private saveSession(calcList: any[], filename) {
const elems = [];
private saveSession(calcList: any[], filename: string) {
const session: string = this.buildSessionFile(calcList);
this.formulaireService.downloadTextFile(session, filename);
}
private buildSessionFile(calcList: any[]): string {
const serialiseOptions: { [key: string]: {} } = {};
for (const c of calcList) {
if (c.selected) {
......@@ -311,8 +315,7 @@ export class AppComponent implements OnInit, OnDestroy, Observer {
};
}
}
const session: string = Session.getInstance().serialise(serialiseOptions);
this.formulaireService.downloadTextFile(session, filename);
return Session.getInstance().serialise(serialiseOptions);
}
/**
......@@ -426,7 +429,19 @@ export class AppComponent implements OnInit, OnDestroy, Observer {
let body = this.intlService.localizeText("INFO_REPORT_BUG_BODY");
// add session description
let session = Session.getInstance().serialise();
// get all forms
const list = [];
for (const c of this._calculators) {
list.push({
title: c.title,
uid: c.uid,
selected: true
});
}
let session = this.buildSessionFile(list);
// compress
session = pako.deflate(session, { to: "string" }); // gzip (zlib)
session = btoa(session); // base64
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment