diff --git a/src/app/app.component.ts b/src/app/app.component.ts index 0f826164d9e28892f2c4f6c1321ed659d2764756..678296355757316751daa713cea7bd949849ca18 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -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