From df076e61aabbed2d84510d0af56633dac14e163d Mon Sep 17 00:00:00 2001 From: "mathias.chouet" <mathias.chouet@irstea.fr> Date: Tue, 16 Apr 2019 11:21:46 +0200 Subject: [PATCH] =?UTF-8?q?Fix=20#164=20-=20syst=C3=A8me=20de=20rapport=20?= =?UTF-8?q?de=20bug=20par=20email?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- jalhyd_branch | 3 +-- src/app/app.component.html | 4 ++++ src/app/app.component.ts | 20 ++++++++++++++++++++ src/locale/messages.en.json | 3 +++ src/locale/messages.fr.json | 3 +++ 5 files changed, 31 insertions(+), 2 deletions(-) diff --git a/jalhyd_branch b/jalhyd_branch index 1d743538b..1f7391f92 100644 --- a/jalhyd_branch +++ b/jalhyd_branch @@ -1,2 +1 @@ -75-section-parametree-calculer-systematiquement-toutes-les-variables-meme-avec-un-parametre-qui-varie - +master diff --git a/src/app/app.component.html b/src/app/app.component.html index 0b4c83e46..debbcf61f 100644 --- a/src/app/app.component.html +++ b/src/app/app.component.html @@ -89,6 +89,10 @@ <mat-icon>settings</mat-icon> {{ uitextSidenavParams }} </a> + <a id="side-nav-bug-report" (click)="reportBug(); sidenav.close()"> + <mat-icon>report_problem</mat-icon> + {{ uitextSidenavReportBug }} + </a> <a id="side-nav-help" target="_blank" href="assets/docs-fr/" (click)="sidenav.close()"> <mat-icon>help</mat-icon> {{ uitextSidenavHelp }} diff --git a/src/app/app.component.ts b/src/app/app.component.ts index 9f7ad4caf..d0bd51471 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -152,6 +152,10 @@ export class AppComponent implements OnInit, OnDestroy, Observer { return this.intlService.localizeText("INFO_MENU_EMPTY_SESSION_TITLE"); } + public get uitextSidenavReportBug() { + return this.intlService.localizeText("INFO_MENU_REPORT_BUG"); + } + public get uitextSidenavHelp() { return this.intlService.localizeText("INFO_MENU_HELP_TITLE"); } @@ -411,6 +415,22 @@ export class AppComponent implements OnInit, OnDestroy, Observer { }); } + /** + * Demande au client d'envoyer un email (génère un lien mailto:), pré-rempli + * avec un texte standard, et le contenu de la session au format JSON + */ + public reportBug() { + const recipient = "cassiopee@g-eau.fr"; + const subject = "[ISSUE] " + this.intlService.localizeText("INFO_REPORT_BUG_SUBJECT"); + let body = this.intlService.localizeText("INFO_REPORT_BUG_BODY"); + // add session description + body += Session.getInstance().serialise(); + body = encodeURIComponent(body); + + const mailtoURL = `mailto:${recipient}?subject=${subject}&body=${body}`; + window.location.href = mailtoURL; + } + public get revisionInfo(): any { return { jalhyd: { diff --git a/src/locale/messages.en.json b/src/locale/messages.en.json index b6ae5181f..ec00572b4 100644 --- a/src/locale/messages.en.json +++ b/src/locale/messages.en.json @@ -139,6 +139,7 @@ "INFO_MENU_HELP_TITLE": "Help", "INFO_MENU_LOAD_SESSION_TITLE": "Load session", "INFO_MENU_NOUVELLE_CALC": "New calculation module", + "INFO_MENU_REPORT_BUG": "Report an issue", "INFO_MENU_SAVE_SESSION_TITLE": "Save session", "INFO_MENU_SELECT_CALC": "Select calculator module", "INFO_MENU_EMPTY_SESSION_TITLE": "New session", @@ -212,6 +213,8 @@ "INFO_REMOUS_LARGEUR_BERGE": "Width at embankment level = %B% m", "INFO_REMOUS_RESSAUT_DEHORS": "Hydraulic jump detected %sens% abscissa %x% m", "INFO_REMOUS_RESSAUT_HYDRO": "Hydraulic jump detected between abscissa %xmin% and %xmax% m", + "INFO_REPORT_BUG_SUBJECT": "Issue report", + "INFO_REPORT_BUG_BODY": "This is an issue report.\n\nPlease describe quickly the issue you encoutered, and the steps you followed.\n\n1. ...\n2. ...\n\n\nDO NOT MODIFY TEXT BELOW THIS LINE\n--------------------------------------------\n\n", "INFO_REQUIRES": "requires", "INFO_SECTIONPARAMETREE_TITRE": "Parametric section", "INFO_SECTIONPARAMETREE_TITRE_COURT": "Param. section", diff --git a/src/locale/messages.fr.json b/src/locale/messages.fr.json index ec972c18d..b035a3bb4 100644 --- a/src/locale/messages.fr.json +++ b/src/locale/messages.fr.json @@ -136,6 +136,7 @@ "INFO_LINKED_VALUE_EXTRA_RESULT_OF": "%s (%s, résultat complémentaire de %s)", "INFO_MENU_HELP_TITLE": "Aide", "INFO_MENU_LOAD_SESSION_TITLE": "Charger une session", + "INFO_MENU_REPORT_BUG": "Signaler un problème", "INFO_MENU_SAVE_SESSION_TITLE": "Enregistrer la session", "INFO_MENU_SELECT_CALC": "Choisir un module de calcul", "INFO_MENU_EMPTY_SESSION_TITLE": "Nouvelle session", @@ -212,6 +213,8 @@ "INFO_REMOUS_LARGEUR_BERGE": "Largeur au niveau des berges = %B% m", "INFO_REMOUS_RESSAUT_DEHORS": "Ressaut hydraulique détecté à l'%sens% de l'abscisse %x% m", "INFO_REMOUS_RESSAUT_HYDRO": "Ressaut hydraulique détecté entre les abscisses %xmin% et %xmax% m", + "INFO_REPORT_BUG_SUBJECT": "Rapport d'erreur", + "INFO_REPORT_BUG_BODY": "Ceci est un rapport d'erreur.\n\nMerci de décrire rapidement ci-dessous le problème rencontré, et les étapes qui vous y ont mené.\n\n1. ...\n2. ...\n\n\nNE PAS MODIFIER LE TEXTE SOUS CETTE LIGNE\n--------------------------------------------\n\n", "INFO_REQUIRES": "dépend de", "INFO_SECTIONPARAMETREE_TITRE": "Section paramétrée", "INFO_SECTIONPARAMETREE_TITRE_COURT": "Sec. param.", -- GitLab