diff --git a/jalhyd_branch b/jalhyd_branch index 1f7391f92b6a3792204e07e99f71f643cc35e7e1..1708de1ed75a0c664861ea0bffa66800fa724d19 100644 --- a/jalhyd_branch +++ b/jalhyd_branch @@ -1 +1 @@ -master +22-ajout-de-la-calculette-passe-a-enrochement-simple diff --git a/package-lock.json b/package-lock.json index 43f4146dec4d3c6e85369b75fc169ed96337cb94..cd9130a3786ecb166541f907c2a7c9345bda2c60 100644 --- a/package-lock.json +++ b/package-lock.json @@ -4624,7 +4624,7 @@ }, "jalhyd": { "version": "file:../jalhyd/jalhyd-1.0.0.tgz", - "integrity": "sha1-mc8VVFiB+OWUy8RNmswEUzFqIY0=" + "integrity": "sha1-9m5xV+HX20MPMf8mY8ZfQLa1oUA=" }, "jasmine": { "version": "2.8.0", diff --git a/src/app/components/result-element/horizontal-result-element.component.ts b/src/app/components/result-element/horizontal-result-element.component.ts index 48b269ce9d3a3c227641d7bea716cdfd072dda33..d53b5f5e9803cb406b2824ab480246eadedf7be9 100644 --- a/src/app/components/result-element/horizontal-result-element.component.ts +++ b/src/app/components/result-element/horizontal-result-element.component.ts @@ -33,12 +33,14 @@ export class HorizontalResultElementComponent extends ResultElementBaseComponent super.ngOnChanges(); this.vcRef.clear(); - if (this._headerKeys && this._resultElement) + if (this._headerKeys && this._resultElement) { for (const h of this._headerKeys) { let v = this._resultElement.extraResults[h]; - if (typeof (v) === "number") + if (typeof (v) === "number") { v = this.intlService.formatResult(h, v); + } this.vcRef.createEmbeddedView(this.tdTemplate, { extraResultValue: v }); } + } } } diff --git a/src/app/components/result-element/result-element-base.component.ts b/src/app/components/result-element/result-element-base.component.ts index 90247172240ecaae5672a9734a265ce51467cb14..94c088431d49f1844851cd2d331ce409dd21b59f 100644 --- a/src/app/components/result-element/result-element-base.component.ts +++ b/src/app/components/result-element/result-element-base.component.ts @@ -49,7 +49,7 @@ export class ResultElementBaseComponent implements OnChanges { /** * true si pas de texte à afficher dans le tooltip */ - protected _emptyTooltip: boolean = false; + protected _emptyTooltip = false; protected appSetupService: ApplicationSetupService; @@ -73,23 +73,24 @@ export class ResultElementBaseComponent implements OnChanges { const nDigits = this.appSetupService.displayDigits; const r: ResultElement = this._resultElement; - this._hasValue = r != undefined && r.vCalc != undefined; - this._hasError = r == undefined || (r.vCalc == undefined && r.extraResults.length > 0); + this._hasValue = r !== undefined && r.vCalc !== undefined; + this._hasError = r === undefined || (r.vCalc === undefined && r.extraResults.length > 0); this._value = this._hasValue ? this._value = r.vCalc.toFixed(nDigits) : " "; // texte du tooltip let res = ""; - if (this._resultElement != undefined) - for (let m of this._resultElement.log.messages) { - if (res.length > 0) + if (this._resultElement !== undefined) { + for (const m of this._resultElement.log.messages) { + if (res.length > 0) { res += "<br/>"; + } res += this.intlService.localizeMessage(m); } - + } this._htmlTooltip = res; - this._emptyTooltip = this._htmlTooltip.length == 0; + this._emptyTooltip = this._htmlTooltip.length === 0; } private get hasValue() { diff --git a/src/app/services/internationalisation/internationalisation.service.ts b/src/app/services/internationalisation/internationalisation.service.ts index 346d18504333c87acdc1b401345ec86c553ab8c3..38e27c01e268148f6114dd20b219f18377fc59ad 100644 --- a/src/app/services/internationalisation/internationalisation.service.ts +++ b/src/app/services/internationalisation/internationalisation.service.ts @@ -212,19 +212,15 @@ export class InternationalisationService extends Observable { } /** - * met en forme ou traduit un résultat en fonction du libellé qui l'accompagne - * @todo Il manque un formalisme clair permettant de différencier les valeurs numériques des ENUM + * Met en forme un extraResult en fonction du libellé qui l'accompagne + * Les extraResult avec le terme "ENUM_" sont traduit avec le message INFO_EXTRARES_ENUM_[Nom de la variable après ENUM_] */ public formatResult(label: string, value: number): string { - const match = this.parseLabel(label); - if (match) { - if (match[3] !== "Q") { // Le débit est une valeur numérique, tous les autres sont des ENUM ??? - // Label du type ouvrage[n].XXX => message INFO_EXTRARES_ENUM_OUVRAGE_XXX_value - return this.localizeText(`INFO_EXTRARES_ENUM_${match[1].toUpperCase()}_${match[3].toUpperCase()}_${value}`); - } + const match = label.indexOf("ENUM_"); + if (match > -1) { + return this.localizeText(`INFO_EXTRARES_${label.substring(match).toUpperCase()}_${value}`); } - const appSetupService = ServiceFactory.instance.applicationSetupService; - const nDigits = appSetupService.displayDigits; + const nDigits = ServiceFactory.instance.applicationSetupService.displayDigits; return value.toFixed(nDigits); } diff --git a/src/locale/messages.fr.json b/src/locale/messages.fr.json index 3cb8daae24f03201f72f3b68ef4c7a6a07caa44f..009816ca474d25844489f33deac770cac3c7c3a9 100644 --- a/src/locale/messages.fr.json +++ b/src/locale/messages.fr.json @@ -38,18 +38,21 @@ "INFO_CONDUITEDISTRIBUTRICE_TITRE": "Conduite distributrice", "INFO_COURBEREMOUS_TITRE": "Courbes de remous", "INFO_DEVER_TITRE": "Lois de déversoirs dénoyés", - "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_ENUM_MACRORUGOFLOWTYPE_0": "Emergent", + "INFO_EXTRARES_ENUM_MACRORUGOFLOWTYPE_1": "Quasi-émergent", + "INFO_EXTRARES_ENUM_MACRORUGOFLOWTYPE_2": "Immergé", + "INFO_EXTRARES_ENUM_STRUCTUREFLOWMODE_0": "Surface libre", + "INFO_EXTRARES_ENUM_STRUCTUREFLOWMODE_1": "En charge", + "INFO_EXTRARES_ENUM_STRUCTUREFLOWMODE_2": "Débit nul", + "INFO_EXTRARES_ENUM_STRUCTUREFLOWREGIME_0": "Dénoyé", + "INFO_EXTRARES_ENUM_STRUCTUREFLOWREGIME_1": "Partiellement noyé", + "INFO_EXTRARES_ENUM_STRUCTUREFLOWREGIME_2": "Noyé", + "INFO_EXTRARES_ENUM_STRUCTUREFLOWREGIME_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)", "INFO_EXTRARES_LIB_EC": "EC: Énergie cinétique (m)", - "INFO_EXTRARES_LIB_FLOWTYPE": "Type d'écoulement", + "INFO_EXTRARES_LIB_ENUM_MACRORUGOFLOWTYPE": "Type d'écoulement", "INFO_EXTRARES_LIB_FLU": "Ligne d'eau fluviale", "INFO_EXTRARES_LIB_FR": "Froude", "INFO_EXTRARES_LIB_HS": "Charge spécifique (m)", @@ -58,8 +61,8 @@ "INFO_EXTRARES_LIB_IMP": "Impulsion (N)", "INFO_EXTRARES_LIB_J": "Perte de charge (m)", "INFO_EXTRARES_LIB_OUVRAGE_Q": "Débit (m³/s)", - "INFO_EXTRARES_LIB_OUVRAGE_Q_MODE": "Type d'écoulement", - "INFO_EXTRARES_LIB_OUVRAGE_Q_REGIME": "Régime", + "INFO_EXTRARES_LIB_OUVRAGE_Q_ENUM_STRUCTUREFLOWMODE": "Type d'écoulement", + "INFO_EXTRARES_LIB_OUVRAGE_Q_ENUM_STRUCTUREFLOWREGIME": "Régime", "INFO_EXTRARES_LIB_P": "Périmètre mouillé (m)", "INFO_EXTRARES_LIB_PV": "Puissance volumique dissipée (W/m³)", "INFO_EXTRARES_LIB_Q": "Débit (m³/s)",