diff --git a/src/app/app.component.html b/src/app/app.component.html index f86bdcf9bbb7cda5524966b6405fbf4b5e304af9..31505818846adc6e70916a3dfbf7eeeecc20cd17 100644 --- a/src/app/app.component.html +++ b/src/app/app.component.html @@ -56,9 +56,9 @@ </header> <main> - <mat-sidenav-container fxFlexFill class="example-container"> + <!-- side panel --> <mat-sidenav class="sidenav" #sidenav fxLayout="column" > <div fxLayout="column"> <a id="close-side-nav" class="closebtn" (click)="sidenav.close()">×</a> @@ -67,6 +67,10 @@ <mat-icon>add</mat-icon> {{ uitextSidenavNewCalc }} </a> + <a id="side-nav-empty-session" (click)="emptySession(); sidenav.close()"> + <mat-icon>insert_drive_file</mat-icon> + {{ uitextSidenavEmptySession }} + </a> <a id="side-nav-load-session" (click)="loadSession(); sidenav.close()"> <mat-icon>folder_open</mat-icon> {{ uitextSidenavLoadSession }} diff --git a/src/app/app.component.ts b/src/app/app.component.ts index 3ba18abb19ef648ec3bd52e102032140bb210896..47d70b4ce6ca425cf4317d2659889b4e2c90a401 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -47,7 +47,7 @@ export class AppComponent implements OnInit, OnDestroy, Observer { /** * id du formulaire courant - * on utilise pas directement FormulaireService.currentFormId pour éviter l'erreur + * on utilise pas directement FormulaireService.currentFormId pour éviter l'erreur * ExpressionChangedAfterItHasBeenCheckedError */ private _currentFormId: string; @@ -124,6 +124,10 @@ export class AppComponent implements OnInit, OnDestroy, Observer { return this.intlService.localizeText("INFO_MENU_SAVE_SESSION_TITLE"); } + public get uitextSidenavEmptySession() { + return this.intlService.localizeText("INFO_MENU_EMPTY_SESSION_TITLE"); + } + public get uitextSidenavHelp() { return this.intlService.localizeText("INFO_MENU_HELP_TITLE"); } @@ -268,7 +272,6 @@ export class AppComponent implements OnInit, OnDestroy, Observer { const elems = []; for (const c of calcList) { if (c.selected) { - console.log(c.title); const form: FormulaireDefinition = this.formulaireService.getFormulaireFromId(c.uid); elems.push(form.JSONserialise()); } @@ -335,11 +338,17 @@ export class AppComponent implements OnInit, OnDestroy, Observer { this._routerCurrentComponent = a; } - // flag d'affichage des repères des colonnes Bootstrap : uniquement en mode dev - // cf. src/environments/*, ng build --env=<mode> (par ex : ng build --env=prod) - public get ruler(): boolean { - // return !environment.production; - return false; + /** + * restarts a fresh session by closing all calculators + */ + public emptySession() { + // @TODO replace with nice modal + if (confirm(this.intlService.localizeText("INFO_EMPTY_SESSION_DIALOGUE_TEXT"))) { + for (const c of this._calculators) { + const form = this.formulaireService.getFormulaireFromId(c.uid); + this.closeCalculator(form); + } + } } public loadSession() { diff --git a/src/locale/messages.en.json b/src/locale/messages.en.json index 2c46e42035ee93bb15a8ab15134487d8077e82f8..c6f0d1796b3bc3e9d259f85ea39180f965242351 100644 --- a/src/locale/messages.en.json +++ b/src/locale/messages.en.json @@ -38,6 +38,7 @@ "INFO_CONDUITEDISTRIBUTRICE_TITRE": "Distributor pipe", "INFO_COURBEREMOUS_TITRE": "Backwater curves", "INFO_DEVER_TITRE": "Free flow weir stage-discharge laws", +<<<<<<< 81116b3ae675b90a82d894f617c9a85f2f95782f "INFO_EXTRARES_ENUM_MACRORUGOFLOWTYPE_0": "Emergent", "INFO_EXTRARES_ENUM_MACRORUGOFLOWTYPE_1": "Quasi-emergent", "INFO_EXTRARES_ENUM_MACRORUGOFLOWTYPE_2": "Submerged", @@ -48,6 +49,17 @@ "INFO_EXTRARES_ENUM_STRUCTUREFLOWREGIME_1": "Partially submerged", "INFO_EXTRARES_ENUM_STRUCTUREFLOWREGIME_2": "Submerged", "INFO_EXTRARES_ENUM_STRUCTUREFLOWREGIME_3": "Zero flow", +======= + "INFO_EMPTY_SESSION_DIALOGUE_TEXT": "Warning ! All open calculators will be lost. Continue ?", + "INFO_EMPTY_SESSION_DIALOGUE_TITRE": "New session", + "INFO_EXTRARES_ENUM_OUVRAGE_Q_MODE_0": "Weir", + "INFO_EXTRARES_ENUM_OUVRAGE_Q_MODE_1": "Orifice", + "INFO_EXTRARES_ENUM_OUVRAGE_Q_MODE_2": "Zero flow", + "INFO_EXTRARES_ENUM_OUVRAGE_Q_REGIME_0": "Free flow", + "INFO_EXTRARES_ENUM_OUVRAGE_Q_REGIME_1": "Partially submerged", + "INFO_EXTRARES_ENUM_OUVRAGE_Q_REGIME_2": "Submerged", + "INFO_EXTRARES_ENUM_OUVRAGE_Q_REGIME_3": "Zero flow", +>>>>>>> Fix #103 bouton pour vider la session "INFO_EXTRARES_LIB_B": "Surface width (m)", "INFO_EXTRARES_LIB_CV": "Cv: Velocity coefficient", "INFO_EXTRARES_LIB_CVQT": "CV.QT: Corrected discharge (m³/s)", @@ -103,6 +115,7 @@ "INFO_MENU_LOAD_SESSION_TITLE": "Load session", "INFO_MENU_NOUVELLE_CALC": "New calculation module", "INFO_MENU_SAVE_SESSION_TITLE": "Save session", + "INFO_MENU_EMPTY_SESSION_TITLE": "New session", "INFO_OPTION_NO": "No", "INFO_OPTION_YES": "Yes", "INFO_OUVRAGE": "Structure", diff --git a/src/locale/messages.fr.json b/src/locale/messages.fr.json index 05c3822a9579b28ea311783c349bd0065744912d..ea07fae8ea1b7971905e34c2f8e21e8905797961 100644 --- a/src/locale/messages.fr.json +++ b/src/locale/messages.fr.json @@ -33,7 +33,7 @@ "INFO_CALCULATOR_PARAMFIXES": "Paramètres fixés", "INFO_CALCULATOR_VALEURS": "Valeurs", "INFO_CLOISONS_TITRE": "Passe à bassin : Cloisons", - "INFO_CLOSE_DIALOGUE_TEXT": "Attention ! Les paramètres et résultats de la calculette seront perdus. Vraiment fermer ?", + "INFO_CLOSE_DIALOGUE_TEXT": "Attention ! Les paramètres et résultats de la calculette seront perdus. Vraiment fermer ?", "INFO_CLOSE_DIALOGUE_TITRE": "Confirmer la fermeture", "INFO_CONDUITEDISTRIBUTRICE_TITRE": "Conduite distributrice", "INFO_COURBEREMOUS_TITRE": "Courbes de remous", @@ -48,6 +48,15 @@ "INFO_EXTRARES_ENUM_STRUCTUREFLOWREGIME_1": "Partiellement noyé", "INFO_EXTRARES_ENUM_STRUCTUREFLOWREGIME_2": "Noyé", "INFO_EXTRARES_ENUM_STRUCTUREFLOWREGIME_3": "Débit nul", + "INFO_EMPTY_SESSION_DIALOGUE_TEXT": "Attention ! Toutes les calculettes ouvertes seront perdues. Continuer ?", + "INFO_EMPTY_SESSION_DIALOGUE_TITRE": "Démarrer une nouvelle session", + "INFO_EXTRARES_ENUM_OUVRAGE_Q_MODE_0": "Surface libre", + "INFO_EXTRARES_ENUM_OUVRAGE_Q_MODE_1": "En charge", + "INFO_EXTRARES_ENUM_OUVRAGE_Q_MODE_2": "Débit nul", + "INFO_EXTRARES_ENUM_OUVRAGE_Q_REGIME_0": "Dénoyé", + "INFO_EXTRARES_ENUM_OUVRAGE_Q_REGIME_1": "Partiellement noyé", + "INFO_EXTRARES_ENUM_OUVRAGE_Q_REGIME_2": "Noyé", + "INFO_EXTRARES_ENUM_OUVRAGE_Q_REGIME_3": "Débit nul", "INFO_EXTRARES_LIB_B": "Largeur au miroir (m)", "INFO_EXTRARES_LIB_CV": "Cv: Coefficient de vitesse d'approche", "INFO_EXTRARES_LIB_CVQT": "CV.QT: Débit corrigé (m³/s)", @@ -101,6 +110,7 @@ "INFO_MENU_HELP_TITLE": "Aide", "INFO_MENU_LOAD_SESSION_TITLE": "Charger une session", "INFO_MENU_SAVE_SESSION_TITLE": "Enregistrer la session", + "INFO_MENU_EMPTY_SESSION_TITLE": "Nouvelle session", "INFO_MENU_NOUVELLE_CALC": "Nouveau module de calcul", "INFO_MACRORUGO_TITRE": "Passe à macro-rugosité", "INFO_OPTION_NO": "Non",