From 466dac28d295de1be59fe7eb86130e760cd3a862 Mon Sep 17 00:00:00 2001 From: "mathias.chouet" <mathias.chouet@irstea.fr> Date: Thu, 25 Apr 2019 14:48:59 +0200 Subject: [PATCH] Rapport de bug : ajout des titres de modules dans le fichier de session --- src/app/app.component.ts | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/src/app/app.component.ts b/src/app/app.component.ts index 0f826164d..678296355 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 -- GitLab