diff --git a/package-lock.json b/package-lock.json index 10f9760bd8575ffe5e94e2ec233e6052736ffc29..33425496fec241bc08e56f7ff6abd0c9e6b7392f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -21,8 +21,8 @@ "@asymmetrik/ngx-leaflet": "^18.0.1", "@compodoc/compodoc": "^1.1.26", "@ghsc/disagg-d3": "^0.13.0", - "@ghsc/nshmp-lib-ng": "^18.24.0", - "@ghsc/nshmp-template": "^18.3.0", + "@ghsc/nshmp-lib-ng": "^18.25.1", + "@ghsc/nshmp-template": "^18.4.2", "@ghsc/nshmp-utils-ts": "^3.12.1", "angular-plotly.js": "^6.0.0", "d3": "^7.9.0", @@ -4632,9 +4632,9 @@ } }, "node_modules/@ghsc/nshmp-lib-ng": { - "version": "18.24.0", - "resolved": "https://code.usgs.gov/api/v4/projects/12416/packages/npm/@ghsc/nshmp-lib-ng/-/@ghsc/nshmp-lib-ng-18.24.0.tgz", - "integrity": "sha1-CZaWKhpn24v0dowD7jB6qb0eX7M=", + "version": "18.25.1", + "resolved": "https://code.usgs.gov/api/v4/projects/12416/packages/npm/@ghsc/nshmp-lib-ng/-/@ghsc/nshmp-lib-ng-18.25.1.tgz", + "integrity": "sha1-9TtMDz2ghcNinrFw4s5Aw5CCULA=", "dependencies": { "tslib": "^2.3.0" }, @@ -4644,9 +4644,9 @@ } }, "node_modules/@ghsc/nshmp-template": { - "version": "18.3.0", - "resolved": "https://code.usgs.gov/api/v4/projects/1416/packages/npm/@ghsc/nshmp-template/-/@ghsc/nshmp-template-18.3.0.tgz", - "integrity": "sha1-UIuGtvLUtgPgQ6gVr2Ko32QIJGM=", + "version": "18.4.2", + "resolved": "https://code.usgs.gov/api/v4/projects/1416/packages/npm/@ghsc/nshmp-template/-/@ghsc/nshmp-template-18.4.2.tgz", + "integrity": "sha1-9tQ6qwEsnQwzmmW9CTn1o1TRxyA=", "dependencies": { "tslib": "^2.3.1" }, diff --git a/package.json b/package.json index 5f5509149f0c585fbc7472d566b434fbac4846dd..babaa048111ae0622a3806cedccb6f1b153aa891 100644 --- a/package.json +++ b/package.json @@ -45,8 +45,8 @@ "@asymmetrik/ngx-leaflet": "^18.0.1", "@compodoc/compodoc": "^1.1.26", "@ghsc/disagg-d3": "^0.13.0", - "@ghsc/nshmp-lib-ng": "^18.24.0", - "@ghsc/nshmp-template": "^18.3.0", + "@ghsc/nshmp-lib-ng": "^18.25.1", + "@ghsc/nshmp-template": "^18.4.2", "@ghsc/nshmp-utils-ts": "^3.12.1", "angular-plotly.js": "^6.0.0", "d3": "^7.9.0", diff --git a/projects/nshmp-apps/src/app/app.routes.ts b/projects/nshmp-apps/src/app/app.routes.ts index 8a399b38d501089b5daa51e4c6b26d50c6c9316d..c04ac767881299b00a0db492a6dddf41d685a79b 100644 --- a/projects/nshmp-apps/src/app/app.routes.ts +++ b/projects/nshmp-apps/src/app/app.routes.ts @@ -23,7 +23,7 @@ const routes: Routes = [ { children: ncmRoutes(), data: { - label: 'NCM Dashboard', + label: 'NCM', }, path: 'ncm', }, @@ -31,7 +31,7 @@ const routes: Routes = [ { children: designMapsRoutes(), data: { - label: 'Design Maps Dashboard', + label: 'Design Maps', }, path: 'designmaps', }, @@ -39,7 +39,7 @@ const routes: Routes = [ { children: devRoutes(), data: { - label: 'Dev Dashboard', + label: 'Development', }, path: 'dev', }, @@ -47,7 +47,7 @@ const routes: Routes = [ { children: gmmRoutes(), data: { - label: 'GMM Dashboard', + label: 'GMM', }, path: 'gmm', }, @@ -55,7 +55,7 @@ const routes: Routes = [ { children: hazardRoutes(), data: { - label: 'Hazard Dashboard', + label: 'Hazard', }, path: 'hazard', }, @@ -63,7 +63,7 @@ const routes: Routes = [ { children: internalRoutes(), data: { - label: 'Internal Dashboard', + label: 'Internal', }, path: 'internal', }, @@ -71,7 +71,7 @@ const routes: Routes = [ { children: sourceRoutes(), data: { - label: 'Source Model Dashboard', + label: 'Source Model', }, path: 'source', }, diff --git a/projects/nshmp-apps/src/app/dashboard/app.component.ts b/projects/nshmp-apps/src/app/dashboard/app.component.ts index 3e9a33fcf43eefb51c0fafe66df7628254d526bb..fb0bbe4ecb495b20ee9524f7071838e49681cea6 100644 --- a/projects/nshmp-apps/src/app/dashboard/app.component.ts +++ b/projects/nshmp-apps/src/app/dashboard/app.component.ts @@ -8,12 +8,14 @@ import { NshmpLibNgTemplateComponent, } from '@ghsc/nshmp-lib-ng/nshmp'; +import {apps} from '../../shared/utils/applications.utils'; import { designMapApps, gmmApps, - mainApps, + hazardApps, navigation, ncmApps, + serviceApps, sourceModelApps, } from '../../shared/utils/navigation.utils'; import {AboutComponent} from './components/about/about.component'; @@ -45,22 +47,26 @@ export class AppComponent { private designMapApps = designMapApps(); /** The GMM applications */ private gmmApps = gmmApps(); - /** The main applications */ - private mainApps = mainApps(); + /** Hazard applications */ + private hazardApps = hazardApps(); /** NCM apps */ private ncmApps = ncmApps(); /** Source model applications */ private sourceModelApps = sourceModelApps(); + /** Service applications */ + private serviceApps = serviceApps(); sections: ApplicationSections[] = [ { sections: [ { - applications: this.mainApps.map(navigation => ({navigation})), + applications: this.hazardApps.map(navigation => ({navigation})), + routerLink: apps().hazard.dashboard.routerLink, + title: 'Hazard', }, { - applications: this.designMapApps.map(navigation => ({navigation})), - title: 'Design Maps', + applications: this.serviceApps.map(navigation => ({navigation})), + title: 'Services', }, ], }, @@ -68,14 +74,22 @@ export class AppComponent { sections: [ { applications: this.sourceModelApps.map(navigation => ({navigation})), + routerLink: apps().source.dashboard.routerLink, title: 'Source Model', }, { applications: this.gmmApps.map(navigation => ({navigation})), + routerLink: apps().gmm.dashboard.routerLink, title: 'Ground Motion Models', }, + { + applications: this.designMapApps.map(navigation => ({navigation})), + routerLink: apps().designMaps.dashboard.routerLink, + title: 'Design Maps', + }, { applications: this.ncmApps.map(navigation => ({navigation})), + routerLink: apps().ncm.dashboard.routerLink, title: 'National Crustal Model', }, ], diff --git a/projects/nshmp-apps/src/app/designmaps/rtgm/services/app.service.ts b/projects/nshmp-apps/src/app/designmaps/rtgm/services/app.service.ts index bc507d2e3c0d3790aca5f28926e75c351c5099f2..4f466b187b23c9623855d56e3a2220f1f1903776 100644 --- a/projects/nshmp-apps/src/app/designmaps/rtgm/services/app.service.ts +++ b/projects/nshmp-apps/src/app/designmaps/rtgm/services/app.service.ts @@ -1,7 +1,8 @@ +import {Location as LocationService} from '@angular/common'; import {HttpParams} from '@angular/common/http'; import {computed, Injectable, Signal, signal} from '@angular/core'; import {AbstractControl, FormBuilder, Validators} from '@angular/forms'; -import {ActivatedRoute, Router} from '@angular/router'; +import {ActivatedRoute} from '@angular/router'; import { HazardControlForm, HazardService, @@ -103,8 +104,8 @@ export class AppService private spinnerService: SpinnerService, private nshmpService: NshmpService, private route: ActivatedRoute, - private router: Router, - private hazardService: HazardService + private hazardService: HazardService, + private location: LocationService ) { super(); this.addValidators(); @@ -912,11 +913,10 @@ export class AppService } private updateUrl(): void { - this.router - .navigate([apps().designMaps.rtgm.routerLink], { - queryParams: this.formGroup.getRawValue(), - }) - .catch((error: Error) => this.nshmpService.throwError$(error)); + this.location.replaceState( + apps().designMaps.rtgm.routerLink, + new HttpParams().appendAll(this.formGroup.getRawValue()).toString() + ); } private usageFormValues(parameters: RtgmUsageParameters): ControlForm { diff --git a/projects/nshmp-apps/src/app/dev/dashboard/app.component.html b/projects/nshmp-apps/src/app/dev/dashboard/app.component.html index 19568f897d61cb473a96cce4fb377258535caec2..8c2c6ecffb3a307c8c159cb3a3b46a3f163d7420 100644 --- a/projects/nshmp-apps/src/app/dev/dashboard/app.component.html +++ b/projects/nshmp-apps/src/app/dev/dashboard/app.component.html @@ -1,4 +1,8 @@ -<nshmp-lib-ng-template #template [navigationList]="navigationList"> +<nshmp-lib-ng-template + #template + [navigationList]="navigationList" + [title]="title" +> <!-- Dashboard --> <nshmp-lib-ng-dashboard [sections]="sections"> <nshmp-lib-ng-dashboard-title> diff --git a/projects/nshmp-apps/src/app/dev/dashboard/app.component.ts b/projects/nshmp-apps/src/app/dev/dashboard/app.component.ts index fc22fe0f0c64b4113fa9748666f4008dd26221ef..4e6d8365fcfa8986f8778f9b4401a647f6fbf180 100644 --- a/projects/nshmp-apps/src/app/dev/dashboard/app.component.ts +++ b/projects/nshmp-apps/src/app/dev/dashboard/app.component.ts @@ -34,6 +34,8 @@ export class AppComponent { /** Navigation list for menu */ navigationList = nav.devNavigation(); + title = 'Development Applications'; + /** Main development applications */ private mainApps = nav.devMainApps(); diff --git a/projects/nshmp-apps/src/app/dev/gmm/dashboard/app.component.html b/projects/nshmp-apps/src/app/dev/gmm/dashboard/app.component.html index 389a2c0fdcf728e3193e7472f0deb41ebd34c4a2..b1cc26d5884ee690e40b2a13f0bc9885ce7bf06e 100644 --- a/projects/nshmp-apps/src/app/dev/gmm/dashboard/app.component.html +++ b/projects/nshmp-apps/src/app/dev/gmm/dashboard/app.component.html @@ -1,4 +1,8 @@ -<nshmp-lib-ng-template #template [navigationList]="navigationList" [title]=""> +<nshmp-lib-ng-template + #template + [navigationList]="navigationList" + [title]="title" +> <!-- Dashboard --> <nshmp-lib-ng-dashboard [sections]="sections"> <nshmp-lib-ng-dashboard-title> diff --git a/projects/nshmp-apps/src/app/dev/gmm/dashboard/app.component.ts b/projects/nshmp-apps/src/app/dev/gmm/dashboard/app.component.ts index f7275a6cdd22b5560f1a63ab313e848b4518eaa6..79f6025a23884c5d121fe9c83400a8f3f9a9c7f2 100644 --- a/projects/nshmp-apps/src/app/dev/gmm/dashboard/app.component.ts +++ b/projects/nshmp-apps/src/app/dev/gmm/dashboard/app.component.ts @@ -33,6 +33,8 @@ export class AppComponent { /** Navigation list for menu */ navigationList = devNavigation(); + title = 'GMM Applications'; + sections: ApplicationSections[] = [ { gridClass: 'grid-col-10', diff --git a/projects/nshmp-apps/src/app/dev/gmm/hanging-wall-effects/services/app.service.ts b/projects/nshmp-apps/src/app/dev/gmm/hanging-wall-effects/services/app.service.ts index 27a0966784796cf5773c37e0e26b4133dceea1a7..83aed91b3179a006f39c346f12c2681358be0d5a 100644 --- a/projects/nshmp-apps/src/app/dev/gmm/hanging-wall-effects/services/app.service.ts +++ b/projects/nshmp-apps/src/app/dev/gmm/hanging-wall-effects/services/app.service.ts @@ -1,3 +1,5 @@ +import {Location as LocationService} from '@angular/common'; +import {HttpParams} from '@angular/common/http'; import {Injectable, signal} from '@angular/core'; import {AbstractControl, FormBuilder, Validators} from '@angular/forms'; import {ActivatedRoute, Router} from '@angular/router'; @@ -72,6 +74,7 @@ export class AppService private nshmpService: NshmpService, private formBuilder: FormBuilder, private route: ActivatedRoute, + private location: LocationService, private router: Router ) { super(); @@ -562,12 +565,9 @@ export class AppService zTor: value.zTor?.toString(), }; - this.router - .navigate([devApps().gmm.hangingWallEffects.routerLink], { - queryParams: { - ...query, - }, - }) - .catch((error: Error) => this.nshmpService.throwError$(error)); + this.location.replaceState( + devApps().gmm.hangingWallEffects.routerLink, + new HttpParams().appendAll({...query}).toString() + ); } } diff --git a/projects/nshmp-apps/src/app/dev/hazard/dashboard/app.component.html b/projects/nshmp-apps/src/app/dev/hazard/dashboard/app.component.html index 389d2a21b6a519e7dcffea32e4e9fb05f75f8064..cd1fb0e4826ae4e1aaa5f099da8f7642cc9a3eb0 100644 --- a/projects/nshmp-apps/src/app/dev/hazard/dashboard/app.component.html +++ b/projects/nshmp-apps/src/app/dev/hazard/dashboard/app.component.html @@ -1,4 +1,8 @@ -<nshmp-lib-ng-template #template [navigationList]="navigationList" [title]=""> +<nshmp-lib-ng-template + #template + [navigationList]="navigationList" + [title]="title" +> <!-- Dashboard --> <nshmp-lib-ng-dashboard [sections]="sections"> <nshmp-lib-ng-dashboard-title> diff --git a/projects/nshmp-apps/src/app/dev/hazard/dashboard/app.component.ts b/projects/nshmp-apps/src/app/dev/hazard/dashboard/app.component.ts index 6c827f6c1f7870aed51cb846af146f98848d0659..ada40f9e30612a7efb096feaddff3b550ab68ad2 100644 --- a/projects/nshmp-apps/src/app/dev/hazard/dashboard/app.component.ts +++ b/projects/nshmp-apps/src/app/dev/hazard/dashboard/app.component.ts @@ -33,6 +33,8 @@ export class AppComponent { /** Navigation list for menu */ navigationList = devNavigation(); + title = 'Hazard Applications'; + sections: ApplicationSections[] = [ { gridClass: 'grid-col-10', diff --git a/projects/nshmp-apps/src/app/dev/hazard/dynamic-compare/services/app.service.ts b/projects/nshmp-apps/src/app/dev/hazard/dynamic-compare/services/app.service.ts index 6e6a78a102c558912dc488b85137fc5d53d60b3f..e4ff3a383d4885a8e772e4daa0c232c366617ccb 100644 --- a/projects/nshmp-apps/src/app/dev/hazard/dynamic-compare/services/app.service.ts +++ b/projects/nshmp-apps/src/app/dev/hazard/dynamic-compare/services/app.service.ts @@ -1,6 +1,8 @@ +import {Location as LocationService} from '@angular/common'; +import {HttpParams} from '@angular/common/http'; import {computed, Injectable, Signal, signal} from '@angular/core'; import {AbstractControl, FormBuilder, Validators} from '@angular/forms'; -import {ActivatedRoute, Router} from '@angular/router'; +import {ActivatedRoute} from '@angular/router'; import {HazardService, hazardUtils} from '@ghsc/nshmp-lib-ng/hazard'; import { FormGroupControls, @@ -85,7 +87,7 @@ export class AppService private spectraPlotsService: SpectraPlotsService, private hazardService: HazardService, private route: ActivatedRoute, - private router: Router + private location: LocationService ) { super(); this.addValidators(); @@ -619,12 +621,8 @@ export class AppService const formValues: ControlForm = { commonReturnPeriods: defaultValues.commonReturnPeriods, imt: this.getImt(query.imt, defaultValues.imt), - latitude: query.latitude - ? Number.parseFloat(query.latitude) - : defaultValues.latitude, - longitude: query.longitude - ? Number.parseFloat(query.longitude) - : defaultValues.longitude, + latitude: defaultValues.latitude, + longitude: defaultValues.longitude, maxDirection: query.maxDirection !== undefined ? (JSON.parse(query.maxDirection) as boolean) @@ -650,6 +648,14 @@ export class AppService }; this.formGroup.patchValue(formValues); + this.formGroup.patchValue({ + latitude: query.latitude + ? Number.parseFloat(query.latitude) + : defaultValues.latitude, + longitude: query.longitude + ? Number.parseFloat(query.longitude) + : defaultValues.longitude, + }); if (this.formGroup.valid) { this.nshmpService.selectPlotControl(); @@ -868,8 +874,8 @@ export class AppService const query: Query = { imt: value.imt, - latitude: value.latitude?.toString(), - longitude: value.longitude?.toString(), + latitude: value.latitude.toFixed(), + longitude: value.longitude.toFixed(), maxDirection: String(value.maxDirection), model: value.model, modelCompare: value.modelCompare, @@ -879,13 +885,10 @@ export class AppService vs30: value.vs30?.toString(), }; - this.router - .navigate([devApps().hazard.dynamicCompare.routerLink], { - queryParams: { - ...query, - }, - }) - .catch((error: Error) => this.nshmpService.throwError$(error)); + this.location.replaceState( + devApps().hazard.dynamicCompare.routerLink, + new HttpParams().appendAll({...query}).toString() + ); } } diff --git a/projects/nshmp-apps/src/app/dev/math/dashboard/app.component.html b/projects/nshmp-apps/src/app/dev/math/dashboard/app.component.html index 56569f555f18ce131d8497a4bdff82c980f01160..755f5e99ff48d224d4bfd75a7c7f0b0713ba1a02 100644 --- a/projects/nshmp-apps/src/app/dev/math/dashboard/app.component.html +++ b/projects/nshmp-apps/src/app/dev/math/dashboard/app.component.html @@ -1,4 +1,8 @@ -<nshmp-lib-ng-template #template [navigationList]="navigationList" [title]=""> +<nshmp-lib-ng-template + #template + [navigationList]="navigationList" + [title]="title" +> <!-- Dashboard --> <nshmp-lib-ng-dashboard [sections]="sections"> <nshmp-lib-ng-dashboard-title> diff --git a/projects/nshmp-apps/src/app/dev/math/dashboard/app.component.ts b/projects/nshmp-apps/src/app/dev/math/dashboard/app.component.ts index 9ecce1d8a5c240c168ede347467a98795a37ec69..9a1d7e51d21d442389f72b90c14fa704f7a48e9f 100644 --- a/projects/nshmp-apps/src/app/dev/math/dashboard/app.component.ts +++ b/projects/nshmp-apps/src/app/dev/math/dashboard/app.component.ts @@ -33,6 +33,8 @@ export class AppComponent { /** Navigation list for menu */ navigationList = devNavigation(); + title = 'Math Applications'; + sections: ApplicationSections[] = [ { gridClass: 'grid-col-10', diff --git a/projects/nshmp-apps/src/app/gmm/dashboard/app.component.html b/projects/nshmp-apps/src/app/gmm/dashboard/app.component.html index ee3e466527f048ef6dc829063f6c601ce51e179b..8304e735c9efad2e6fda278dfbc55b389ac80cc9 100644 --- a/projects/nshmp-apps/src/app/gmm/dashboard/app.component.html +++ b/projects/nshmp-apps/src/app/gmm/dashboard/app.component.html @@ -1,4 +1,8 @@ -<nshmp-lib-ng-template #template [navigationList]="navigationList" [title]=""> +<nshmp-lib-ng-template + #template + [navigationList]="navigationList" + [title]="title" +> <!-- Dashboard --> <nshmp-lib-ng-dashboard [sections]="sections"> <nshmp-lib-ng-dashboard-title> diff --git a/projects/nshmp-apps/src/app/gmm/dashboard/app.component.ts b/projects/nshmp-apps/src/app/gmm/dashboard/app.component.ts index 682b13bdfaf981ad8ae6d492fb616d668d520c39..f071f9f5a587a7109a0511fc226b6851fb42ff4f 100644 --- a/projects/nshmp-apps/src/app/gmm/dashboard/app.component.ts +++ b/projects/nshmp-apps/src/app/gmm/dashboard/app.component.ts @@ -33,6 +33,8 @@ export class AppComponent { /** Navigation list for menu */ navigationList = navigation(); + title = 'GMM Applications'; + sections: ApplicationSections[] = [ { gridClass: 'grid-col-10', diff --git a/projects/nshmp-apps/src/app/gmm/distance/services/app.service.ts b/projects/nshmp-apps/src/app/gmm/distance/services/app.service.ts index 15e16e6637fed1ceaa1050b7c7811237a5026086..1d6c721e84b5b1c9e00f4fbfcff0a13c4fefc0c3 100644 --- a/projects/nshmp-apps/src/app/gmm/distance/services/app.service.ts +++ b/projects/nshmp-apps/src/app/gmm/distance/services/app.service.ts @@ -1,6 +1,8 @@ +import {Location as LocationService} from '@angular/common'; +import {HttpParams} from '@angular/common/http'; import {computed, Injectable, Signal, signal} from '@angular/core'; import {AbstractControl, FormBuilder, Validators} from '@angular/forms'; -import {ActivatedRoute, Router} from '@angular/router'; +import {ActivatedRoute} from '@angular/router'; import { GmmAppQueryImt, gmmUtils, @@ -68,7 +70,7 @@ export class AppService private nshmpService: NshmpService, private spinnerService: SpinnerService, private route: ActivatedRoute, - private router: Router + private location: LocationService ) { super(); this.addValidators(); @@ -527,12 +529,9 @@ export class AppService zTor: value.zTor?.toString(), }; - this.router - .navigate([apps().gmm.distance.routerLink], { - queryParams: { - ...query, - }, - }) - .catch((error: Error) => this.nshmpService.throwError$(error)); + this.location.replaceState( + apps().gmm.distance.routerLink, + new HttpParams().appendAll({...query}).toString() + ); } } diff --git a/projects/nshmp-apps/src/app/gmm/magnitude/services/app.service.ts b/projects/nshmp-apps/src/app/gmm/magnitude/services/app.service.ts index 3f25429b0379083d9e4c012d50d5fdb2cb2684cb..f1b2fcc87cb0e0b6db488d83e06d0bafa7664cd1 100644 --- a/projects/nshmp-apps/src/app/gmm/magnitude/services/app.service.ts +++ b/projects/nshmp-apps/src/app/gmm/magnitude/services/app.service.ts @@ -1,6 +1,8 @@ +import {Location as LocationService} from '@angular/common'; +import {HttpParams} from '@angular/common/http'; import {computed, Injectable, Signal, signal} from '@angular/core'; import {AbstractControl, FormBuilder, Validators} from '@angular/forms'; -import {ActivatedRoute, Router} from '@angular/router'; +import {ActivatedRoute} from '@angular/router'; import { GmmAppQueryImt, gmmUtils, @@ -76,7 +78,7 @@ export class AppService private nshmpService: NshmpService, private spinnerService: SpinnerService, private route: ActivatedRoute, - private router: Router + private location: LocationService ) { super(); this.addValidators(); @@ -561,13 +563,10 @@ export class AppService zTor: value.zTor?.toString(), }; - this.router - .navigate([apps().gmm.magnitude.routerLink], { - queryParams: { - ...query, - }, - }) - .catch((error: Error) => this.nshmpService.throwError$(error)); + this.location.replaceState( + apps().gmm.magnitude.routerLink, + new HttpParams().appendAll({...query}).toString() + ); } /** diff --git a/projects/nshmp-apps/src/app/gmm/spectra/services/app.service.ts b/projects/nshmp-apps/src/app/gmm/spectra/services/app.service.ts index 869346cefaacbaf885331049db93f6e537fd028a..8ccd925cc4bfb4a2fe6d4369cfdbd1860fec5be6 100644 --- a/projects/nshmp-apps/src/app/gmm/spectra/services/app.service.ts +++ b/projects/nshmp-apps/src/app/gmm/spectra/services/app.service.ts @@ -1,3 +1,5 @@ +import {Location as LocationService} from '@angular/common'; +import {HttpParams} from '@angular/common/http'; import {computed, Injectable, Signal, signal} from '@angular/core'; import { AbstractControl, @@ -5,7 +7,7 @@ import { FormControl, Validators, } from '@angular/forms'; -import {ActivatedRoute, Router} from '@angular/router'; +import {ActivatedRoute} from '@angular/router'; import { GmmAppQuery, gmmUtils, @@ -95,7 +97,7 @@ export class AppService private nshmpService: NshmpService, private spinnerService: SpinnerService, private route: ActivatedRoute, - private router: Router + private location: LocationService ) { super(); this.addValidators(); @@ -837,13 +839,10 @@ export class AppService zTor: value.zTor?.toString(), }; - this.router - .navigate([apps().gmm.spectra.routerLink], { - queryParams: { - ...query, - }, - }) - .catch((error: Error) => this.nshmpService.throwError$(error)); + this.location.replaceState( + apps().gmm.spectra.routerLink, + new HttpParams().appendAll({...query}).toString() + ); } /** diff --git a/projects/nshmp-apps/src/app/hazard/dashboard/app.component.html b/projects/nshmp-apps/src/app/hazard/dashboard/app.component.html index b20dfdbe0bb641fd0a40c4663239fd589b237eb5..baf20fa7d7e1851fa7544e30408c2cfea6af35d9 100644 --- a/projects/nshmp-apps/src/app/hazard/dashboard/app.component.html +++ b/projects/nshmp-apps/src/app/hazard/dashboard/app.component.html @@ -1,4 +1,8 @@ -<nshmp-lib-ng-template #template [navigationList]="navigationList" [title]=""> +<nshmp-lib-ng-template + #template + [navigationList]="navigationList" + [title]="title" +> <!-- Dashboard --> <nshmp-lib-ng-dashboard [sections]="sections"> <nshmp-lib-ng-dashboard-title> diff --git a/projects/nshmp-apps/src/app/hazard/dashboard/app.component.ts b/projects/nshmp-apps/src/app/hazard/dashboard/app.component.ts index 4963010c32c7ae9765af74af55b440ac3ff8fe36..466b802f8abc10eb713a431db9fac47d6a7cb5c0 100644 --- a/projects/nshmp-apps/src/app/hazard/dashboard/app.component.ts +++ b/projects/nshmp-apps/src/app/hazard/dashboard/app.component.ts @@ -33,6 +33,8 @@ export class AppComponent { /** Navigation list for menu */ navigationList = navigation(); + title = 'Hazard Applications'; + sections: ApplicationSections[] = [ { gridClass: 'grid-col-10', diff --git a/projects/nshmp-apps/src/app/hazard/disagg/services/app.service.ts b/projects/nshmp-apps/src/app/hazard/disagg/services/app.service.ts index 3658b3e6ddd431854d36a906583842ac3532d02b..551e055c98fdb1ea182df9b2a4877fea80c63bdc 100644 --- a/projects/nshmp-apps/src/app/hazard/disagg/services/app.service.ts +++ b/projects/nshmp-apps/src/app/hazard/disagg/services/app.service.ts @@ -1,4 +1,5 @@ -import {HttpClient} from '@angular/common/http'; +import {Location as LocationService} from '@angular/common'; +import {HttpClient, HttpParams} from '@angular/common/http'; import { computed, Inject, @@ -8,7 +9,7 @@ import { signal, } from '@angular/core'; import {AbstractControl, FormBuilder, Validators} from '@angular/forms'; -import {ActivatedRoute, Router} from '@angular/router'; +import {ActivatedRoute} from '@angular/router'; import { DisaggControlForm, DisaggTarget, @@ -83,8 +84,8 @@ export class AppService private nshmpService: NshmpService, private hazardService: HazardService, private route: ActivatedRoute, - private router: Router, private http: HttpClient, + private location: LocationService, @Inject(LOCALE_ID) private localId: string ) { super(); @@ -755,15 +756,10 @@ export class AppService } private updateUrl(): void { - const value = this.formGroup.getRawValue(); - - this.router - .navigate([apps().hazard.disagg.routerLink], { - queryParams: { - ...value, - }, - }) - .catch((error: Error) => this.nshmpService.throwError$(error)); + this.location.replaceState( + apps().hazard.disagg.routerLink, + new HttpParams().appendAll(this.formGroup.getRawValue()).toString() + ); } private updateUsageUrl() { diff --git a/projects/nshmp-apps/src/app/hazard/dynamic/services/app.service.ts b/projects/nshmp-apps/src/app/hazard/dynamic/services/app.service.ts index 02276f6306cbb03b410379eba9f8884cabfa6374..d5e280b2854e205eb3cb4d1bbbf9096989de76a8 100644 --- a/projects/nshmp-apps/src/app/hazard/dynamic/services/app.service.ts +++ b/projects/nshmp-apps/src/app/hazard/dynamic/services/app.service.ts @@ -1,3 +1,5 @@ +import {Location as LocationService} from '@angular/common'; +import {HttpParams} from '@angular/common/http'; import {computed, Injectable, Signal, signal} from '@angular/core'; import { AbstractControl, @@ -5,7 +7,7 @@ import { FormGroup, Validators, } from '@angular/forms'; -import {ActivatedRoute, Router} from '@angular/router'; +import {ActivatedRoute} from '@angular/router'; import { DynamicHazardControlForm, HazardPlots, @@ -80,7 +82,7 @@ export class AppService private nshmpService: NshmpService, private hazardService: HazardService, private route: ActivatedRoute, - private router: Router + private location: LocationService ) { super(); this.addValidators(); @@ -703,15 +705,10 @@ export class AppService } private updateUrl(): void { - const values = this.formGroup.getRawValue(); - - this.router - .navigate([apps().hazard.dynamic.routerLink], { - queryParams: { - ...values, - }, - }) - .catch((error: Error) => this.nshmpService.throwError$(error)); + this.location.replaceState( + apps().hazard.dynamic.routerLink, + new HttpParams().appendAll(this.formGroup.getRawValue()).toString() + ); } private updateUsageUrl() { diff --git a/projects/nshmp-apps/src/app/hazard/static/services/app.service.ts b/projects/nshmp-apps/src/app/hazard/static/services/app.service.ts index de874e6c75d625abe98ad46bb85ed609a07e2d84..8ad4b174a3b0a8f2313a66850b710b32035c972e 100644 --- a/projects/nshmp-apps/src/app/hazard/static/services/app.service.ts +++ b/projects/nshmp-apps/src/app/hazard/static/services/app.service.ts @@ -1,3 +1,5 @@ +import {Location as LocationService} from '@angular/common'; +import {HttpParams} from '@angular/common/http'; import {computed, Injectable, Signal, signal} from '@angular/core'; import { AbstractControl, @@ -5,7 +7,7 @@ import { FormGroup, Validators, } from '@angular/forms'; -import {ActivatedRoute, Router} from '@angular/router'; +import {ActivatedRoute} from '@angular/router'; import { HazardAppQuery, HazardControlForm, @@ -85,7 +87,7 @@ export class AppService private nshmpService: NshmpService, private hazardService: HazardService, private route: ActivatedRoute, - private router: Router + private location: LocationService ) { super(); this.addValidators(); @@ -816,15 +818,10 @@ export class AppService } private updateUrl(): void { - const values = this.formGroup.getRawValue(); - - this.router - .navigate([apps().hazard.static.routerLink], { - queryParams: { - ...values, - }, - }) - .catch((error: Error) => this.nshmpService.throwError$(error)); + this.location.replaceState( + apps().hazard.static.routerLink, + new HttpParams().appendAll(this.formGroup.getRawValue()).toString() + ); } private updateUsageUrl() { diff --git a/projects/nshmp-apps/src/app/internal/aws/check-haz-jobs/services/app.service.ts b/projects/nshmp-apps/src/app/internal/aws/check-haz-jobs/services/app.service.ts index b7777715c06beb97d67441c702b34bae690fa5a9..6353510b4f5f5e2838d82b4bb3c2a5c3b013db4e 100644 --- a/projects/nshmp-apps/src/app/internal/aws/check-haz-jobs/services/app.service.ts +++ b/projects/nshmp-apps/src/app/internal/aws/check-haz-jobs/services/app.service.ts @@ -1,6 +1,8 @@ +import {Location as LocationService} from '@angular/common'; +import {HttpParams} from '@angular/common/http'; import {computed, Injectable, Signal, signal} from '@angular/core'; import {AbstractControl, FormBuilder, Validators} from '@angular/forms'; -import {ActivatedRoute, Router} from '@angular/router'; +import {ActivatedRoute} from '@angular/router'; import { AwsService, JobHistoryRequestData, @@ -48,7 +50,7 @@ export class AppService implements AppServiceModel<AppState, ControlForm> { private nshmpService: NshmpService, private awsService: AwsService, private route: ActivatedRoute, - private router: Router + private location: LocationService ) { this.addValidators(); @@ -241,12 +243,9 @@ export class AppService implements AppServiceModel<AppState, ControlForm> { id: this.formGroup.getRawValue().id, }; - this.router - .navigate([internalApps().aws.checkHazJobs.routerLink], { - queryParams: { - ...query, - }, - }) - .catch((error: Error) => this.nshmpService.throwError$(error)); + this.location.replaceState( + internalApps().aws.checkHazJobs.routerLink, + new HttpParams().appendAll(query).toString() + ); } } diff --git a/projects/nshmp-apps/src/app/internal/aws/haz-job-history/services/app.service.ts b/projects/nshmp-apps/src/app/internal/aws/haz-job-history/services/app.service.ts index 7971407954ace37ac44265221a3234f468a889a1..df579cc4d77bcb336f0ae5e69b8d7a4ad941acbd 100644 --- a/projects/nshmp-apps/src/app/internal/aws/haz-job-history/services/app.service.ts +++ b/projects/nshmp-apps/src/app/internal/aws/haz-job-history/services/app.service.ts @@ -1,6 +1,8 @@ +import {Location as LocationService} from '@angular/common'; +import {HttpParams} from '@angular/common/http'; import {computed, Injectable, Signal, signal} from '@angular/core'; import {FormBuilder, Validators} from '@angular/forms'; -import {ActivatedRoute, Router} from '@angular/router'; +import {ActivatedRoute} from '@angular/router'; import {AwsService} from '@ghsc/nshmp-lib-ng/aws'; import {NshmpService, nshmpUtils} from '@ghsc/nshmp-lib-ng/nshmp'; import {DynamoDBItem} from '@ghsc/nshmp-utils-ts/libs/aws/run-nshmp-haz'; @@ -33,7 +35,7 @@ export class AppService implements AppServiceModel<AppState, ControlForm> { private nshmpService: NshmpService, private awsService: AwsService, private route: ActivatedRoute, - private router: Router + private location: LocationService ) { this.addValidators(); this.formGroup.valueChanges.subscribe(() => this.updateUrl()); @@ -169,12 +171,9 @@ export class AppService implements AppServiceModel<AppState, ControlForm> { id: this.formGroup.getRawValue().id, }; - this.router - .navigate([internalApps().aws.hazJobHistory.routerLink], { - queryParams: { - ...query, - }, - }) - .catch((error: Error) => this.nshmpService.throwError$(error)); + this.location.replaceState( + internalApps().aws.hazJobHistory.routerLink, + new HttpParams().appendAll(query).toString() + ); } } diff --git a/projects/nshmp-apps/src/app/internal/aws/submit-haz-jobs/components/job-submitted/job-submitted.component.ts b/projects/nshmp-apps/src/app/internal/aws/submit-haz-jobs/components/job-submitted/job-submitted.component.ts index ddc0532a752d169de15770a658ce66936983e8de..e93371632bd2881811c1aa0a8afe9204b388b2cf 100644 --- a/projects/nshmp-apps/src/app/internal/aws/submit-haz-jobs/components/job-submitted/job-submitted.component.ts +++ b/projects/nshmp-apps/src/app/internal/aws/submit-haz-jobs/components/job-submitted/job-submitted.component.ts @@ -1,5 +1,5 @@ import {CdkScrollable} from '@angular/cdk/scrolling'; -import {AsyncPipe, Location} from '@angular/common'; +import {Location} from '@angular/common'; import {Component} from '@angular/core'; import {MatButton} from '@angular/material/button'; import {MatCardModule} from '@angular/material/card'; @@ -28,7 +28,6 @@ import {AppService} from '../../services/app.service'; MatDialogActions, MatButton, MatDialogClose, - AsyncPipe, YamlPipe, MatCardModule, MatExpansionModule, diff --git a/projects/nshmp-apps/src/app/internal/aws/submit-haz-jobs/services/app.service.ts b/projects/nshmp-apps/src/app/internal/aws/submit-haz-jobs/services/app.service.ts index 404fbf14a096c11a0da90c93f4a7b12aa3a51f3b..08eac8789c5dae172e34fa66f4db5fe06db8ab3c 100644 --- a/projects/nshmp-apps/src/app/internal/aws/submit-haz-jobs/services/app.service.ts +++ b/projects/nshmp-apps/src/app/internal/aws/submit-haz-jobs/services/app.service.ts @@ -420,7 +420,6 @@ export class AppService implements AppServiceModel<AppState, RunNshmpHazForm> { controls.email.addValidators([ control => Validators.required(control), control => Validators.email(control), - Validators.pattern(/@usgs.gov$/), ]); controls.modelGitUrl.addValidators([ diff --git a/projects/nshmp-apps/src/app/internal/aws/terminate-haz-jobs/services/app.service.ts b/projects/nshmp-apps/src/app/internal/aws/terminate-haz-jobs/services/app.service.ts index 8b5b4b56adb616605af73de0c6042617e1beaeec..0ad70cbcdcc1ef5e7008248c57be6edb97274092 100644 --- a/projects/nshmp-apps/src/app/internal/aws/terminate-haz-jobs/services/app.service.ts +++ b/projects/nshmp-apps/src/app/internal/aws/terminate-haz-jobs/services/app.service.ts @@ -1,6 +1,8 @@ +import {Location as LocationService} from '@angular/common'; +import {HttpParams} from '@angular/common/http'; import {computed, Injectable, Signal, signal} from '@angular/core'; import {FormBuilder, Validators} from '@angular/forms'; -import {ActivatedRoute, Router} from '@angular/router'; +import {ActivatedRoute} from '@angular/router'; import { AwsService, IdForm, @@ -33,7 +35,7 @@ export class AppService implements AppServiceModel<AppState, IdForm> { private nshmpService: NshmpService, private awsService: AwsService, private route: ActivatedRoute, - private router: Router + private location: LocationService ) { this.addValidators(); this.formGroup.valueChanges.subscribe(() => this.updateUrl()); @@ -154,12 +156,9 @@ export class AppService implements AppServiceModel<AppState, IdForm> { id: this.formGroup.getRawValue().id, }; - this.router - .navigate([internalApps().aws.terminateHazJobs.routerLink], { - queryParams: { - ...query, - }, - }) - .catch((error: Error) => this.nshmpService.throwError$(error)); + this.location.replaceState( + internalApps().aws.terminateHazJobs.routerLink, + new HttpParams().appendAll(query).toString() + ); } } diff --git a/projects/nshmp-apps/src/app/internal/dashboard/app.component.html b/projects/nshmp-apps/src/app/internal/dashboard/app.component.html index 2384d26ae35e3c78c73bcc2c37f069e6bc6a1d45..d4913aec9b7c6b09797294e403ac861688972075 100644 --- a/projects/nshmp-apps/src/app/internal/dashboard/app.component.html +++ b/projects/nshmp-apps/src/app/internal/dashboard/app.component.html @@ -1,4 +1,8 @@ -<nshmp-lib-ng-template #template [navigationList]="navigationList"> +<nshmp-lib-ng-template + #template + [navigationList]="navigationList" + [title]="title" +> <!-- Dashboard --> <nshmp-lib-ng-dashboard [sections]="sections"> <nshmp-lib-ng-dashboard-title> diff --git a/projects/nshmp-apps/src/app/internal/dashboard/app.component.ts b/projects/nshmp-apps/src/app/internal/dashboard/app.component.ts index 42fbf69187601c51eae73de510a7ed9a56cab5cc..d3ce98b923d744b23f34940a2ffe53239fff8184 100644 --- a/projects/nshmp-apps/src/app/internal/dashboard/app.component.ts +++ b/projects/nshmp-apps/src/app/internal/dashboard/app.component.ts @@ -36,6 +36,8 @@ export class AppComponent implements OnInit, OnDestroy { /** Navigation list for menu */ navigationList = nav.internalNavigation(); + title = 'Internal Applications'; + /** AWS applications */ private awsApps = nav.internalAwsApps(); diff --git a/projects/nshmp-apps/src/app/internal/shared/services/auth.service.ts b/projects/nshmp-apps/src/app/internal/shared/services/auth.service.ts index b18c00d3e321ace8a40f57b3306d123ba28a4a7e..504d9fe00434c36223c213b25b3b3fce53d3d304 100644 --- a/projects/nshmp-apps/src/app/internal/shared/services/auth.service.ts +++ b/projects/nshmp-apps/src/app/internal/shared/services/auth.service.ts @@ -29,7 +29,6 @@ export class AuthService { return this.http.get<AuthResponse>(this.url).pipe( map(response => { - console.log(response); ref.close(); if (!response.isAuthorized) { diff --git a/projects/nshmp-apps/src/app/ncm/dashboard/app.component.html b/projects/nshmp-apps/src/app/ncm/dashboard/app.component.html index 35b0fc3979cb93c2dc36bf4feefbcb73a1c0666c..4e34e88b86eb7095b3b97fc1105734698ebbd187 100644 --- a/projects/nshmp-apps/src/app/ncm/dashboard/app.component.html +++ b/projects/nshmp-apps/src/app/ncm/dashboard/app.component.html @@ -1,4 +1,8 @@ -<nshmp-lib-ng-template #template [navigationList]="navigationList" [title]=""> +<nshmp-lib-ng-template + #template + [navigationList]="navigationList" + [title]="title" +> <!-- Dashboard --> <nshmp-lib-ng-dashboard [sections]="sections"> <nshmp-lib-ng-dashboard-title> diff --git a/projects/nshmp-apps/src/app/ncm/dashboard/app.component.ts b/projects/nshmp-apps/src/app/ncm/dashboard/app.component.ts index 7a677f638d236d6c4d2c19bc88f761e6748c8c75..2cd182194e8085155b22f01cf7a41016cd3bf327 100644 --- a/projects/nshmp-apps/src/app/ncm/dashboard/app.component.ts +++ b/projects/nshmp-apps/src/app/ncm/dashboard/app.component.ts @@ -33,6 +33,8 @@ export class AppComponent { /** Navigation list for menu */ navigationList = navigation(); + title = 'NCM Applications'; + sections: ApplicationSections[] = [ { gridClass: 'grid-col-10', diff --git a/projects/nshmp-apps/src/app/ncm/geophysical-profiles/services/app.service.ts b/projects/nshmp-apps/src/app/ncm/geophysical-profiles/services/app.service.ts index cd895db09ad8f8211983734bc043e387392f812c..5cc0b5125a8efcc189a91023908822fa578e28f3 100644 --- a/projects/nshmp-apps/src/app/ncm/geophysical-profiles/services/app.service.ts +++ b/projects/nshmp-apps/src/app/ncm/geophysical-profiles/services/app.service.ts @@ -1,7 +1,8 @@ +import {Location as LocationService} from '@angular/common'; import {HttpParams} from '@angular/common/http'; import {computed, Injectable, Signal, signal} from '@angular/core'; import {FormBuilder, Validators} from '@angular/forms'; -import {ActivatedRoute, Router} from '@angular/router'; +import {ActivatedRoute} from '@angular/router'; import { FormGroupControls, NshmpService, @@ -68,7 +69,7 @@ export class AppService private spinnerService: SpinnerService, private nshmpService: NshmpService, private route: ActivatedRoute, - private router: Router + private location: LocationService ) { super(); @@ -217,6 +218,8 @@ export class AppService * Initialize application, call usage. */ init(): void { + this.formGroup.controls.locations.clear(); + const spinnerRef = this.spinnerService.show( SpinnerService.MESSAGE_METADATA ); @@ -240,7 +243,6 @@ export class AppService usageResponse, }); - this.addLocationForm(); this.initialFormSet(); }); } @@ -370,9 +372,11 @@ export class AppService } else { locations.push(this.queryToLocation(query.location)); } + } else { + this.addLocationForm(); } - locations.slice(0, -1).forEach(() => { + locations.forEach(() => { this.addLocationForm(); }); @@ -546,15 +550,16 @@ export class AppService .map(control => control.getRawValue()) .map(value => `${value.latitude},${value.longitude}`); - this.router - .navigate([apps().ncm.geophysicalProfiles.routerLink], { - queryParams: { + this.location.replaceState( + apps().ncm.geophysicalProfiles.routerLink, + new HttpParams() + .appendAll({ depthInc: values.depthInc, depthMax: values.depthMax, depthMin: values.depthMin, location, - }, - }) - .catch((error: Error) => this.nshmpService.throwError$(error)); + }) + .toString() + ); } } diff --git a/projects/nshmp-apps/src/app/source/dashboard/app.component.html b/projects/nshmp-apps/src/app/source/dashboard/app.component.html index a39713d9b34abad6f55e9e2bc11c1a30c7676772..be11ff361a9ab2f34561830996cf0a2602c8f29f 100644 --- a/projects/nshmp-apps/src/app/source/dashboard/app.component.html +++ b/projects/nshmp-apps/src/app/source/dashboard/app.component.html @@ -1,4 +1,8 @@ -<nshmp-lib-ng-template #template [navigationList]="navigationList" [title]=""> +<nshmp-lib-ng-template + #template + [navigationList]="navigationList" + [title]="title" +> <!-- Dashboard --> <nshmp-lib-ng-dashboard [sections]="sections"> <nshmp-lib-ng-dashboard-title> diff --git a/projects/nshmp-apps/src/app/source/dashboard/app.component.ts b/projects/nshmp-apps/src/app/source/dashboard/app.component.ts index a19b283acfda3311353dbc7c031970ef15598f1a..1f3231e030a5b71a5a885feb92ee8bb551cbce13 100644 --- a/projects/nshmp-apps/src/app/source/dashboard/app.component.ts +++ b/projects/nshmp-apps/src/app/source/dashboard/app.component.ts @@ -33,6 +33,8 @@ export class AppComponent { /** Navigation list for menu */ navigationList = navigation(); + title = 'Source Model Applications'; + sections: ApplicationSections[] = [ { gridClass: 'grid-col-10', diff --git a/projects/nshmp-apps/src/app/source/mfd/services/app.service.ts b/projects/nshmp-apps/src/app/source/mfd/services/app.service.ts index 9d95d18d7b185d6ac98bd8f0233f6c11aca51cd3..5a25b8a13feb4f0e184c1b78a5560a3598b98645 100644 --- a/projects/nshmp-apps/src/app/source/mfd/services/app.service.ts +++ b/projects/nshmp-apps/src/app/source/mfd/services/app.service.ts @@ -1,3 +1,5 @@ +import {Location as LocationService} from '@angular/common'; +import {HttpParams} from '@angular/common/http'; import {computed, Injectable, Signal, signal} from '@angular/core'; import { AbstractControl, @@ -5,7 +7,7 @@ import { FormGroup, Validators, } from '@angular/forms'; -import {ActivatedRoute, Router} from '@angular/router'; +import {ActivatedRoute} from '@angular/router'; import {HazardService, hazardUtils} from '@ghsc/nshmp-lib-ng/hazard'; import { FormGroupControls, @@ -109,7 +111,7 @@ export class AppService private nshmpService: NshmpService, private hazardService: HazardService, private route: ActivatedRoute, - private router: Router + private location: LocationService ) { super(); this.formGroup.controls.mfdType.disable(); @@ -904,13 +906,10 @@ export class AppService weightedMfds: values.weightedMfds.toString(), }; - this.router - .navigate([apps().source.mfd.routerLink], { - queryParams: { - ...queryParams, - }, - }) - .catch((error: Error) => this.nshmpService.throwError$(error)); + this.location.replaceState( + apps().source.mfd.routerLink, + new HttpParams().appendAll({...queryParams}).toString() + ); } private updateUsageUrl() { diff --git a/projects/nshmp-apps/src/app/source/model-maps/services/app.service.ts b/projects/nshmp-apps/src/app/source/model-maps/services/app.service.ts index 4b8e84e30953bea76f9080ad6b6ed7ee1e4c6fd2..1ea217d2f968f8dd11364b0787129a789c5dcf8f 100644 --- a/projects/nshmp-apps/src/app/source/model-maps/services/app.service.ts +++ b/projects/nshmp-apps/src/app/source/model-maps/services/app.service.ts @@ -1,4 +1,5 @@ -import {HttpClient} from '@angular/common/http'; +import {Location as LocationService} from '@angular/common'; +import {HttpClient, HttpParams} from '@angular/common/http'; import {computed, Injectable, NgZone, Signal, signal} from '@angular/core'; import { AbstractControl, @@ -6,7 +7,7 @@ import { FormControl, Validators, } from '@angular/forms'; -import {ActivatedRoute, Router} from '@angular/router'; +import {ActivatedRoute} from '@angular/router'; import {HazardService} from '@ghsc/nshmp-lib-ng/hazard'; import {mapUtils} from '@ghsc/nshmp-lib-ng/map'; import { @@ -132,7 +133,7 @@ export class AppService implements AppServiceModel<AppState, ControlForm> { private http: HttpClient, private zone: NgZone, private route: ActivatedRoute, - private router: Router + private location: LocationService ) { this.addValidators(); } @@ -1289,10 +1290,9 @@ export class AppService implements AppServiceModel<AppState, ControlForm> { } private updateUrl(): void { - this.router - .navigate([apps().source.data.routerLink], { - queryParams: this.formGroup.getRawValue(), - }) - .catch((error: Error) => this.nshmpService.throwError$(error)); + this.location.replaceState( + apps().source.data.routerLink, + new HttpParams().appendAll(this.formGroup.getRawValue()).toString() + ); } } diff --git a/projects/nshmp-apps/src/app/source/rates/services/app.service.ts b/projects/nshmp-apps/src/app/source/rates/services/app.service.ts index a90a60d0a1362dbb37c6fa7f2a6260c396f4b0de..edd7eaea300058f7fe76c28853d89f62af864d8c 100644 --- a/projects/nshmp-apps/src/app/source/rates/services/app.service.ts +++ b/projects/nshmp-apps/src/app/source/rates/services/app.service.ts @@ -1,6 +1,8 @@ +import {Location as LocationService} from '@angular/common'; +import {HttpParams} from '@angular/common/http'; import {computed, Injectable, Signal, signal} from '@angular/core'; import {FormBuilder} from '@angular/forms'; -import {ActivatedRoute, Router} from '@angular/router'; +import {ActivatedRoute} from '@angular/router'; import {HazardService, hazardUtils} from '@ghsc/nshmp-lib-ng/hazard'; import { NshmpService, @@ -59,7 +61,7 @@ export class AppService private spinnerService: SpinnerService, private hazardService: HazardService, private route: ActivatedRoute, - private router: Router + private location: LocationService ) { super(); this.addValidators(); @@ -460,11 +462,10 @@ export class AppService * Update to URL query parameters. */ private updateUrl(): void { - this.router - .navigate([apps().source.rateAndProbability.routerLink], { - queryParams: this.formGroup.getRawValue(), - }) - .catch((error: Error) => this.nshmpService.throwError$(error)); + this.location.replaceState( + apps().source.rateAndProbability.routerLink, + new HttpParams().appendAll(this.formGroup.getRawValue()).toString() + ); } private updateUsageUrl(): void { diff --git a/projects/nshmp-apps/src/shared/utils/applications.utils.ts b/projects/nshmp-apps/src/shared/utils/applications.utils.ts index 1cbaa5e1738cb4150beef255ffe59da324529849..187f3c625e8405c0e9df969e441be0920a0eac88 100644 --- a/projects/nshmp-apps/src/shared/utils/applications.utils.ts +++ b/projects/nshmp-apps/src/shared/utils/applications.utils.ts @@ -13,7 +13,7 @@ export const TOOLBOX_NAME = 'USGS Earthquake Hazard Toolbox'; export function apps(): Applications { return { dashboard: { - display: 'Dashboard', + display: 'Home', routerLink: '/', }, designMaps: { @@ -21,6 +21,7 @@ export function apps(): Applications { display: 'Design Maps Dashboard', routerLink: '/designmaps', showInDashboard: false, + showInMenu: false, }, rtgm: { display: 'Risk-Targeted Ground Motion', @@ -32,6 +33,7 @@ export function apps(): Applications { display: 'GMM Dashboard', routerLink: '/gmm', showInDashboard: false, + showInMenu: false, }, distance: { display: 'Ground Motion vs. Distance', @@ -51,6 +53,7 @@ export function apps(): Applications { display: 'Hazard Dashboard', routerLink: '/hazard', showInDashboard: false, + showInMenu: false, }, disagg: { display: 'Disaggregation', @@ -70,6 +73,7 @@ export function apps(): Applications { display: 'NCM Dashboard', routerLink: '/ncm', showInDashboard: false, + showInMenu: false, }, geophysicalProfiles: { display: 'NCM Geophysical Profiles', @@ -85,6 +89,7 @@ export function apps(): Applications { display: 'Source Model Dashboard', routerLink: '/source', showInDashboard: false, + showInMenu: false, }, data: { display: 'Model Maps', @@ -110,12 +115,14 @@ export function devApps(): DevApplications { dashboard: { display: 'Development Dashboard', routerLink: '/dev', + // showInMenu: false, }, gmm: { dashboard: { display: 'Development GMM Dashboard', routerLink: '/dev/gmm', showInDashboard: false, + showInMenu: false, }, hangingWallEffects: { display: 'Hanging Wall Effects', @@ -127,6 +134,7 @@ export function devApps(): DevApplications { display: 'Development Hazard Dashboard', routerLink: '/dev/hazard', showInDashboard: false, + showInMenu: false, }, dynamicCompare: { display: 'Dynamic Hazard Compare', @@ -138,6 +146,7 @@ export function devApps(): DevApplications { display: 'Development Math Dashboard', routerLink: '/dev/math', showInDashboard: false, + showInMenu: false, }, exceedanceExplorer: { display: 'Exceedance Explorer', diff --git a/projects/nshmp-apps/src/shared/utils/navigation.utils.ts b/projects/nshmp-apps/src/shared/utils/navigation.utils.ts index 9b66d1f3a6057e080f71963394e85e3a6e284ac2..bdc7a1a02c9fefaf7669573977de233d723b711e 100644 --- a/projects/nshmp-apps/src/shared/utils/navigation.utils.ts +++ b/projects/nshmp-apps/src/shared/utils/navigation.utils.ts @@ -101,15 +101,10 @@ export function internalNavigation(): NavigationList[] { } /** - * Returns the list of main applications. + * Returns the list services apps. */ -export function mainApps(): Navigation[] { - return [ - APPS.hazard.disagg, - APPS.hazard.dynamic, - APPS.hazard.static, - APPS.services, - ]; +export function serviceApps(): Navigation[] { + return [APPS.services]; } /**