Skip to content
Snippets Groups Projects
Commit 0ac6477b authored by Clayton, Brandon Scott's avatar Clayton, Brandon Scott
Browse files

reactive form

parent fbb18add
No related branches found
No related tags found
1 merge request!442Signals and Reactive Forms: hanging wall effects
@if (form$ | async; as form) {
<div class="grid-row parameter-summary">
<div class="grid-col-12 tablet-lg:grid-col-6">
<mat-list class="parameter-list">
<mat-list-item>
<span class="parameter">Ground Motion Models</span>:
<div class="grid-row parameter-summary">
<div class="grid-col-12 tablet-lg:grid-col-6">
<mat-list class="parameter-list">
<mat-list-item>
<span class="parameter">Ground Motion Models</span>:
</mat-list-item>
@for (gmmSource of form?.value?.gmmSource; track gmmSource) {
<mat-list-item class="indent-list font-small">
{{ gmmSource.gmm.display }}
</mat-list-item>
@for (gmmSource of unbox(form?.value?.gmmSource); track gmmSource) {
<mat-list-item class="indent-list font-small">
{{ gmmSource.gmm.display }}
</mat-list-item>
}
</mat-list>
</div>
}
</mat-list>
</div>
<div class="grid-col-12 tablet-lg:grid-col-3">
<mat-list class="parameter-list">
<div class="grid-col-12 tablet-lg:grid-col-3">
<mat-list class="parameter-list">
<mat-list-item>
<span class="parameter">IMT</span>:
{{ imtIdToDisplay(form?.value?.imt) }}
</mat-list-item>
@if (form.value.multiSelectableParam === GmmFormControlIds.MW) {
<mat-list-item>
<span class="parameter">IMT</span>:
{{ imtIdToDisplay(form?.value?.imt) }}
<span class="parameter">Magnitude</span>:
</mat-list-item>
@if (form.value.multiSelectableParam === GmmFormControlIds.MW) {
<mat-list-item>
<span class="parameter">Magnitude</span>:
</mat-list-item>
@for (Mw of unbox(form?.value?.MwMulti); track Mw) {
<mat-list-item class="indent-list">
{{ Mw }}
</mat-list-item>
}
} @else {
<mat-list-item>
<span class="parameter">Magnitude</span>:
{{ form?.value?.Mw }}
@for (Mw of form?.value?.MwMulti; track Mw) {
<mat-list-item class="indent-list">
{{ Mw }}
</mat-list-item>
}
} @else {
<mat-list-item>
<span class="parameter"> Z<sub>TOR</sub> </span>:
{{ form?.value?.zTor }} km
<span class="parameter">Magnitude</span>:
{{ form?.value?.Mw }}
</mat-list-item>
}
<mat-list-item>
<span class="parameter">Dip</span>: {{ form?.value?.dip }}°
</mat-list-item>
<mat-list-item>
<span class="parameter"> Z<sub>TOR</sub> </span>:
{{ form?.value?.zTor }} km
</mat-list-item>
<mat-list-item>
<span class="parameter">Width</span>: {{ form?.value?.width }} km
</mat-list-item>
</mat-list>
</div>
<mat-list-item>
<span class="parameter">Dip</span>: {{ form?.value?.dip }}°
</mat-list-item>
<div class="grid-col-12 tablet-lg:grid-col-3">
<mat-list class="parameter-list">
@if (form.value.multiSelectableParam === GmmFormControlIds.VS30) {
<mat-list-item> <span class="parameter">Vs30</span>: </mat-list-item>
<mat-list-item>
<span class="parameter">Width</span>: {{ form?.value?.width }} km
</mat-list-item>
</mat-list>
</div>
@for (vs30 of unbox(form?.value?.vs30Multi); track vs30) {
<mat-list-item class="indent-list">
{{ vs30 }}
<sup>&nbsp;m</sup>/<sub>s</sub>
</mat-list-item>
}
} @else {
<mat-list-item>
<span class="parameter">Vs30</span>: {{ form?.value?.vs30 }}
<div class="grid-col-12 tablet-lg:grid-col-3">
<mat-list class="parameter-list">
@if (form.value.multiSelectableParam === GmmFormControlIds.VS30) {
<mat-list-item> <span class="parameter">Vs30</span>: </mat-list-item>
@for (vs30 of form?.value?.vs30Multi; track vs30) {
<mat-list-item class="indent-list">
{{ vs30 }}
<sup>&nbsp;m</sup>/<sub>s</sub>
</mat-list-item>
}
} @else {
<mat-list-item>
<span class="parameter"> Z<sub>1.0</sub> </span>:
{{ form?.value?.z1p0 }}
@if (form?.value?.z1p0) {
<span>&nbsp;km</span>
}
<span class="parameter">Vs30</span>: {{ form?.value?.vs30 }}
<sup>&nbsp;m</sup>/<sub>s</sub>
</mat-list-item>
}
<mat-list-item>
<span class="parameter"> Z<sub>2.5</sub> </span>:
{{ form?.value?.z2p5 }}
@if (form?.value?.z2p5) {
<span>&nbsp;km</span>
}
</mat-list-item>
<mat-list-item>
<span class="parameter"> Z<sub>1.0</sub> </span>:
{{ form?.value?.z1p0 }}
@if (form?.value?.z1p0) {
<span>&nbsp;km</span>
}
</mat-list-item>
<mat-list-item>
<span class="parameter"> Z<sub>SED</sub> </span>:
{{ form?.value?.zSed }}
@if (form?.value?.zSed) {
<span>&nbsp;km</span>
}
</mat-list-item>
<mat-list-item>
<span class="parameter"> Z<sub>2.5</sub> </span>:
{{ form?.value?.z2p5 }}
@if (form?.value?.z2p5) {
<span>&nbsp;km</span>
}
</mat-list-item>
<mat-list-item>
<span class="parameters">Epistemic Uncertainty</span>:
{{ form?.value?.showEpistemicUncertainty ? 'On' : 'Off' }}
</mat-list-item>
</mat-list>
</div>
<mat-list-item>
<span class="parameter"> Z<sub>SED</sub> </span>:
{{ form?.value?.zSed }}
@if (form?.value?.zSed) {
<span>&nbsp;km</span>
}
</mat-list-item>
<mat-list-item>
<span class="parameters">Epistemic Uncertainty</span>:
{{ form?.value?.showEpistemicUncertainty ? 'On' : 'Off' }}
</mat-list-item>
</mat-list>
</div>
}
</div>
import {AsyncPipe} from '@angular/common';
import {Component} from '@angular/core';
import {MatList, MatListItem} from '@angular/material/list';
import {GmmFormControlIds, gmmUtils} from '@ghsc/nshmp-lib-ng/gmm';
import {unbox} from 'ngrx-forms';
import {map} from 'rxjs';
import {GmmFormControlIds, gmmUtils} from '@ghsc/nshmp-lib-no-ngrx/gmm';
import {AppFacade} from '../../state/app.facade';
......@@ -23,16 +21,9 @@ export class ParameterSummaryComponent {
/** Function to convert IMT id to display */
imtIdToDisplay = gmmUtils.imtIdToDisplay;
/** ngrx-forms unbox function */
unbox = unbox;
/** Control form field state */
form$ = this.facade.controlPanelForm$;
/** List of GMMs */
gmms$ = this.facade.usage$.pipe(
map(usage => usage?.response?.parameters?.gmm.values)
);
form = this.facade.controlPanelForm;
constructor(private facade: AppFacade) {}
}
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