Skip to content
Snippets Groups Projects
Commit 87b0da68 authored by francois.grand's avatar francois.grand
Browse files

Ajout du contrôle de validité des URLs concernant l'affichage des formulaires...

Ajout du contrôle de validité des URLs concernant l'affichage des formulaires et retour à la liste des calculettes en cas de pb
closes #22
parent edf16b09
No related branches found
No related tags found
No related merge requests found
......@@ -109,6 +109,10 @@ export class AppComponent implements OnInit, OnDestroy, Observer {
}
);
break;
case "invalidid":
this.toList();
break;
}
}
}
......@@ -125,6 +129,10 @@ export class AppComponent implements OnInit, OnDestroy, Observer {
private newCalc() {
this.closeNav();
this.toList();
}
private toList() {
this.router.navigate(['/list']);
}
......
<div class="row">
<div *ngIf="hasData()" class="row">
<div class="col">
<h1>{{uitextTitre}}</h1>
</div>
......@@ -6,19 +6,19 @@
<field-set *ngFor="let fs of fieldSets" [style.display]="getFieldsetStyleDisplay(fs.id)" [fieldSet]=fs (onRadio)=onRadioClick($event)
(onSelectChange)=onSelectChanged($event)></field-set>
<div class="row ">
<div *ngIf="hasData()" class="row">
<div class="col text-center">
<p></p>
</div>
</div>
<div class="row ">
<div *ngIf="hasData()" class="row">
<div class="col text-center">
<button type="button" class="button_compute" name="Calculer" (click)="doCompute()">{{uitextCalculer}}</button>
</div>
</div>
<div class="row ">
<div *ngIf="hasData()" class="row">
<div class="col text-center">
<p></p>
</div>
......
......@@ -47,6 +47,10 @@ export class GenericCalculatorComponent implements OnInit, DoCheck, OnDestroy, O
return this._formulaire.getFieldSets();
}
private hasData() {
return this._formulaire != undefined;
}
private get uitextTitre() {
switch (this._formulaire.calculatorType) {
case CalculatorType.ConduiteDistributrice:
......@@ -102,7 +106,8 @@ export class GenericCalculatorComponent implements OnInit, DoCheck, OnDestroy, O
this._formulaire = this.formulaireService.getFormulaireFromId(uid);
this.resultsComponent.formulaire = this._formulaire;
this._formulaire.updateNodeType();
if (this._formulaire != undefined)
this._formulaire.updateNodeType();
});
}
......
......@@ -32,9 +32,16 @@ export class CalculatorResultsComponent {
public set formulaire(f: FormulaireDefinition) {
this._formulaire = f;
this.fixedVarResultsComponent.results = f.fixVarResults;
this.sectionResultsComponent.results = f.sectionResults;
this.remousResultsComponent.results = f.remousResults;
if (this._formulaire == undefined) {
this.fixedVarResultsComponent.results = undefined;
this.sectionResultsComponent.results = undefined;
this.remousResultsComponent.results = undefined;
}
else {
this.fixedVarResultsComponent.results = f.fixVarResults;
this.sectionResultsComponent.results = f.sectionResults;
this.remousResultsComponent.results = f.remousResults;
}
}
public updateView() {
......
......@@ -5,7 +5,7 @@
</div>
<div class="row">
<div class="col-10 mx-auto">
<chart *ngIf="_results.extraGraph" [type]="graph2_type" [data]="graph2_data" [options]="graph2_options"></chart>
<chart *ngIf="extraGraph" [type]="graph2_type" [data]="graph2_data" [options]="graph2_options"></chart>
</div>
</div>
......@@ -31,12 +31,12 @@
<tr>
<th>{{uitextAbscisse}}</th>
<th>{{uitextTirant}}</th>
<th>{{_results.extraParamLabel}}</th>
<th>{{extraParamLabel}}</th>
<th>{{uitextTirant}}</th>
<th>{{_results.extraParamLabel}}</th>
<th>{{extraParamLabel}}</th>
</tr>
</thead>
<tr *ngFor="let r of _results.series; let i=index" [class]="getResultClass(i)">
<tr *ngFor="let r of series; let i=index" [class]="getResultClass(i)">
<td>{{r.abs}}</td>
<td>{{r.flu}}</td>
<td>{{r.extraFlu}}</td>
......
......@@ -88,6 +88,18 @@ export class RemousResultsComponent {
return this.intlService.localizeText("INFO_REMOUSRESULTS_TIRANTCRITIQUE")
}
private get extraGraph(): boolean {
return this._results == undefined ? false : this._results.extraGraph;
}
private get series(): Object[] {
return this._results == undefined ? [] : this._results.series;
}
private get extraParamLabel(): string {
return this._results == undefined ? undefined : this._results.extraParamLabel;
}
public set results(r: RemousResults) {
this._results = r;
this.updateView();
......
......@@ -116,7 +116,12 @@ export class FormulaireService extends Observable {
if (f.uid == uid)
return f;
throw "FormulaireService.getFormulaire() : unkown form id " + uid;
this.notifyObservers({
"action": "invalidid",
"formid": uid
});
return undefined;
}
public getInputField(formId: number, elemId: string): InputField {
......
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