Skip to content
Snippets Groups Projects
Commit 015ee201 authored by mathias.chouet's avatar mathias.chouet
Browse files

Lint code

parent 9e5f03cd
No related branches found
No related tags found
No related merge requests found
......@@ -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 { FormulaireService } from "./services/formulaire.service";
import { FormulaireDefinition } from "./formulaire/definition/form-definition";
......@@ -830,7 +829,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 {
......@@ -851,7 +850,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
......@@ -980,17 +979,16 @@ export class AppComponent implements OnInit, OnDestroy, Observer {
return runningPlatform;
}
/**
* détection de la fermeture de la page/navigateur et demande de confirmation
*/
@HostListener("window:beforeunload", ["$event"]) confirmExit($event) {
if (
this.appSetupService.warnBeforeTabClose
&& environment.production // 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 !";
}
/**
* détection de la fermeture de la page/navigateur et demande de confirmation
*/
@HostListener("window:beforeunload", [ "$event" ]) confirmExit($event) {
if (
this.appSetupService.warnBeforeTabClose
&& ! 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 !";
}
@HostListener("keydown", ["$event"]) onKeydown(event: any) {
......
......@@ -86,7 +86,7 @@ import { LogDrawerComponent } from "./components/log-drawer/log-drawer.component
import { ParamLinkComponent } from "./components/param-link/param-link.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";
......
......@@ -282,7 +282,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);
}
}
......
......@@ -161,7 +161,7 @@ export class DialogLoadSessionComponent {
}
}
this.loadingComplete = true;
} catch(err) {
} catch (err) {
console.error(err);
this.loadingError = true;
}
......
......@@ -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");
}
......
......@@ -220,8 +220,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);
......
......@@ -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",
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment