diff --git a/src/app/app.component.ts b/src/app/app.component.ts index 2a71b16a8f204896e189c7dd5881527c71af7bb5..4c4f43902ead4f2859e6bcb868713baecea49935 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -7,7 +7,6 @@ import { CdkDragDrop, moveItemInArray } from "@angular/cdk/drag-drop"; import { Observer, jalhydDateRev, jalhydVersion, CalculatorType, Session } from "jalhyd"; -import { environment } from "../environments/environment"; import { I18nService } from "./services/internationalisation.service"; import { ErrorService } from "./services/error.service"; import { FormulaireService } from "./services/formulaire.service"; @@ -663,7 +662,7 @@ export class AppComponent implements OnInit, OnDestroy, Observer { const existingNotes = Session.getInstance().documentation; // load try { - const data = await this.formulaireService.loadSession(f, info) + const data = await this.formulaireService.loadSession(f, info); if (data.hasErrors) { this.notificationsService.notify(this.intlService.localizeText("ERROR_PROBLEM_LOADING_SESSION"), 3500); } else { @@ -684,7 +683,7 @@ export class AppComponent implements OnInit, OnDestroy, Observer { } } } - } catch(err) { + } catch (err) { this.notificationsService.notify(this.intlService.localizeText("ERROR_LOADING_SESSION"), 3500); console.error("error loading session - ", err); // rollback to ensure session is clean @@ -869,7 +868,7 @@ export class AppComponent implements OnInit, OnDestroy, Observer { @HostListener("window:beforeunload", [ "$event" ]) confirmExit($event) { if ( this.appSetupService.warnBeforeTabClose - && environment.production // otherwise prevents dev server to reload app after recompiling + && ! isDevMode() // otherwise prevents dev server to reload app after recompiling ) { // affecter une valeur différente de null provoque l'affichage d'un dialogue de confirmation, mais le texte n'est pas affiché $event.returnValue = "Your data will be lost !"; diff --git a/src/app/app.module.ts b/src/app/app.module.ts index e7d78e13b15adf7ba542bd17742db71d1d348c30..6cade944fb08dc23ce34413b9e48581b8458c0ef 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -85,7 +85,7 @@ import { ParamLinkComponent } from "./components/param-link/param-link.component import { SelectModelFieldLineComponent } from "./components/select-model-field-line/select-model-field-line.component"; import { PabProfileChartComponent } from "./components/pab-profile-chart/pab-profile-chart.component"; import { PabTableComponent } from "./components/pab-table/pab-table.component"; -import { PbSchemaComponent } from './components/pb-schema/pb-schema.component'; +import { PbSchemaComponent } from "./components/pb-schema/pb-schema.component"; import { VariableResultsSelectorComponent } from "./components/variable-results-selector/variable-results-selector.component"; import { QuicknavComponent } from "./components/quicknav/quicknav.component"; import { ModulesDiagramComponent } from "./components/modules-diagram/modules-diagram.component"; diff --git a/src/app/components/calculator-list/calculator-list.component.ts b/src/app/components/calculator-list/calculator-list.component.ts index 5f47f388c7a0b45fb45d04e4019cccc1c3e76fd4..81b255b73d9f806a57d2dbce210d5921278f2425 100644 --- a/src/app/components/calculator-list/calculator-list.component.ts +++ b/src/app/components/calculator-list/calculator-list.component.ts @@ -205,7 +205,7 @@ export class CalculatorListComponent implements OnInit { const d = await this.httpService.httpGetBlobRequestPromise(realPath); const f: any = new Blob([d], { type: "application/json" }); this.appComponent.loadSessionFile(f); - } catch(e) { + } catch (e) { console.error("could not load session file", e); } } diff --git a/src/app/components/dialog-edit-param-values/dialog-edit-param-values.component.ts b/src/app/components/dialog-edit-param-values/dialog-edit-param-values.component.ts index 7da1e632c09e9dcb65956a268df582f92131a3a1..3c419f000945cd25d2e946e2d8518ad516727484 100644 --- a/src/app/components/dialog-edit-param-values/dialog-edit-param-values.component.ts +++ b/src/app/components/dialog-edit-param-values/dialog-edit-param-values.component.ts @@ -215,7 +215,10 @@ export class DialogEditParamValuesComponent implements OnInit { if (this.param.paramDefinition.step === 0) { return 0; } else { - return Math.max(0, Math.ceil((this.param.paramDefinition.max - this.param.paramDefinition.min) / this.param.paramDefinition.step) + 1); + return Math.max( + 0, + Math.ceil((this.param.paramDefinition.max - this.param.paramDefinition.min) / this.param.paramDefinition.step) + 1 + ); } } catch (e) { // min > max or something, silent fail diff --git a/src/app/components/dialog-load-session/dialog-load-session.component.ts b/src/app/components/dialog-load-session/dialog-load-session.component.ts index 291de8698821ed377d9bb6a05c657edbb1e223e7..3f1af0f0df08a5c5c4e56c282e2baa347b5ecb58 100644 --- a/src/app/components/dialog-load-session/dialog-load-session.component.ts +++ b/src/app/components/dialog-load-session/dialog-load-session.component.ts @@ -161,7 +161,7 @@ export class DialogLoadSessionComponent { } } this.loadingComplete = true; - } catch(err) { + } catch (err) { console.error(err); this.loadingError = true; } diff --git a/src/app/components/dialog-new-pb-cloison/dialog-new-pb-cloison.component.ts b/src/app/components/dialog-new-pb-cloison/dialog-new-pb-cloison.component.ts index 7798238d6a4bcacc3c0a6e0a69f0062a096032ed..a249ca8149f3b335e8acfc01ef0d9178a54ffd44 100644 --- a/src/app/components/dialog-new-pb-cloison/dialog-new-pb-cloison.component.ts +++ b/src/app/components/dialog-new-pb-cloison/dialog-new-pb-cloison.component.ts @@ -33,7 +33,7 @@ export class DialogNewPbCloisonComponent implements OnInit { public get availableUpstreamIndexes(): number[] { // add river upstream as "0" - let ab: number[] = [ 0 ]; + const ab: number[] = [ 0 ]; for (let i = 0; i < this.availableBasins.length; i++) { ab.push(i + 1); } @@ -41,7 +41,7 @@ export class DialogNewPbCloisonComponent implements OnInit { } public get availableDownstreamIndexes(): number[] { - let ab: number[] = [ ]; + const ab: number[] = [ ]; for (let i = 0; i < this.availableBasins.length; i++) { ab.push(i + 1); } @@ -58,9 +58,9 @@ export class DialogNewPbCloisonComponent implements OnInit { */ public basinIsSelectable(index: number, downstream: boolean = false): boolean { if (downstream) { - return (this.upstreamIndex === 0 || index > this.upstreamIndex) + return (this.upstreamIndex === 0 || index > this.upstreamIndex); } else { - return (this.downstreamIndex === 0 || index < this.downstreamIndex) + return (this.downstreamIndex === 0 || index < this.downstreamIndex); } } @@ -117,7 +117,7 @@ export class DialogNewPbCloisonComponent implements OnInit { public get uitextValidate() { return this.i18nService.localizeText("INFO_OPTION_VALIDATE"); } - + public get uitextCancel() { return this.i18nService.localizeText("INFO_OPTION_CANCEL"); } diff --git a/src/app/components/jet-results/jet-results.component.ts b/src/app/components/jet-results/jet-results.component.ts index 50d8a1a1df5782adedfe615da6cd47490d1ebdd3..9d991de254e2cdb2be024d3b4b7b82922c82e7d0 100644 --- a/src/app/components/jet-results/jet-results.component.ts +++ b/src/app/components/jet-results/jet-results.component.ts @@ -28,7 +28,7 @@ export class JetResultsComponent extends FixedVarResultsComponent { return this.hasResults && ( this._fixedResults && this._fixedResults.result && this._fixedResults.result.sourceNub.result.ok || - this._varResults&& this._varResults.result && this._varResults.result.sourceNub.result.ok + this._varResults && this._varResults.result && this._varResults.result.sourceNub.result.ok ); } diff --git a/src/app/formulaire/elements/select-field.ts b/src/app/formulaire/elements/select-field.ts index 468dca562ce0919c0e895c99e93ba6d2ff9c461e..79d8e9cd936719bb4b227655fc6349600224c6b4 100644 --- a/src/app/formulaire/elements/select-field.ts +++ b/src/app/formulaire/elements/select-field.ts @@ -197,8 +197,6 @@ export class SelectField extends Field { const loiDebit = child.properties.getPropValue("loiDebit"); const stCode = StructureProperties.findCompatibleStructure(loiDebit, nub as ParallelStructure); const stName = StructureType[stCode]; - // console.log(`__device_loi_debit__ : child=${child.constructor.name}, loiDebit=${loiDebit}, stCode=${stCode}, stName=${stName}`); - // console.log("(child.properties)", child.properties.props); for (const ld of la[stName]) { const e: SelectEntry = new SelectEntry(this._entriesBaseId + LoiDebit[ld], ld); this.addEntry(e); diff --git a/src/app/services/app-setup.service.ts b/src/app/services/app-setup.service.ts index 7a2d2a30b9f4d8f14ddbf019cab78397211b92c1..e31d1e37b4ae50b9320f0733fba3734eb327f26f 100644 --- a/src/app/services/app-setup.service.ts +++ b/src/app/services/app-setup.service.ts @@ -115,7 +115,7 @@ export class ApplicationSetupService extends Observable { * Restore configuration values */ public async restoreDefaultValues(): Promise<any> { - await this.readValuesFromConfig() + await this.readValuesFromConfig(); // notify I18nService this.notifyObservers({ action: "languagePreferenceChanged", diff --git a/src/app/services/formulaire.service.ts b/src/app/services/formulaire.service.ts index 3cb284a73316c3b3af529e91ea66439e084f72cb..6650d9ff061603c9b0352953cc64115d718ac48c 100644 --- a/src/app/services/formulaire.service.ts +++ b/src/app/services/formulaire.service.ts @@ -96,7 +96,7 @@ export class FormulaireService extends Observable { try { const localisation = await this.loadLocalisationForLang(calc, lang); return localisation as StringMap; - } catch(e) { + } catch (e) { console.error(e); // try default lang (the one in the config file) ? const fallbackLang = this.appSetupService.fallbackLanguage; @@ -125,7 +125,7 @@ export class FormulaireService extends Observable { this._languageCache[ct] = this._languageCache[ct] || {}; this._languageCache[ct][lang] = localisation; return localisation as StringMap; - } catch(e) { + } catch (e) { throw new Error(`LOCALISATION_FILE_NOT_FOUND "${f}"`); } }