From fe7b750253e9c2ef528987f39e8d555e37670465 Mon Sep 17 00:00:00 2001 From: Brandon Clayton <bclayton@usgs.gov> Date: Fri, 13 Dec 2024 10:05:45 -0700 Subject: [PATCH 1/8] update deps --- package-lock.json | 16 ++++++++-------- package.json | 4 ++-- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/package-lock.json b/package-lock.json index 10f9760bd..33425496f 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 5f5509149..babaa0481 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", -- GitLab From de981a2aeb9119f8fca14385cff1ad21dc44b51e Mon Sep 17 00:00:00 2001 From: Brandon Clayton <bclayton@usgs.gov> Date: Fri, 13 Dec 2024 10:06:02 -0700 Subject: [PATCH 2/8] change label --- projects/nshmp-apps/src/app/app.routes.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/projects/nshmp-apps/src/app/app.routes.ts b/projects/nshmp-apps/src/app/app.routes.ts index 8a399b38d..c04ac7678 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', }, -- GitLab From 91ef644f4f4352103d448fdf1380e43b6bf80e86 Mon Sep 17 00:00:00 2001 From: Brandon Clayton <bclayton@usgs.gov> Date: Fri, 13 Dec 2024 10:06:19 -0700 Subject: [PATCH 3/8] add router link --- .../src/app/dashboard/app.component.ts | 26 ++++++++++++++----- 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/projects/nshmp-apps/src/app/dashboard/app.component.ts b/projects/nshmp-apps/src/app/dashboard/app.component.ts index 3e9a33fcf..fb0bbe4ec 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', }, ], -- GitLab From 37d0464fa5962f7cc20b5452dcd3da6eb745b7e3 Mon Sep 17 00:00:00 2001 From: Brandon Clayton <bclayton@usgs.gov> Date: Fri, 13 Dec 2024 10:06:41 -0700 Subject: [PATCH 4/8] add title --- .../nshmp-apps/src/app/dev/dashboard/app.component.html | 6 +++++- projects/nshmp-apps/src/app/dev/dashboard/app.component.ts | 2 ++ .../nshmp-apps/src/app/dev/gmm/dashboard/app.component.html | 6 +++++- .../nshmp-apps/src/app/dev/gmm/dashboard/app.component.ts | 2 ++ .../src/app/dev/hazard/dashboard/app.component.html | 6 +++++- .../src/app/dev/hazard/dashboard/app.component.ts | 2 ++ .../src/app/dev/math/dashboard/app.component.html | 6 +++++- .../nshmp-apps/src/app/dev/math/dashboard/app.component.ts | 2 ++ .../nshmp-apps/src/app/gmm/dashboard/app.component.html | 6 +++++- projects/nshmp-apps/src/app/gmm/dashboard/app.component.ts | 2 ++ .../nshmp-apps/src/app/hazard/dashboard/app.component.html | 6 +++++- .../nshmp-apps/src/app/hazard/dashboard/app.component.ts | 2 ++ .../src/app/internal/dashboard/app.component.html | 6 +++++- .../nshmp-apps/src/app/internal/dashboard/app.component.ts | 2 ++ .../nshmp-apps/src/app/ncm/dashboard/app.component.html | 6 +++++- projects/nshmp-apps/src/app/ncm/dashboard/app.component.ts | 2 ++ .../nshmp-apps/src/app/source/dashboard/app.component.html | 6 +++++- .../nshmp-apps/src/app/source/dashboard/app.component.ts | 2 ++ 18 files changed, 63 insertions(+), 9 deletions(-) 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 19568f897..8c2c6ecff 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 fc22fe0f0..4e6d8365f 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 389a2c0fd..b1cc26d58 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 f7275a6cd..79f6025a2 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/hazard/dashboard/app.component.html b/projects/nshmp-apps/src/app/dev/hazard/dashboard/app.component.html index 389d2a21b..cd1fb0e48 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 6c827f6c1..ada40f9e3 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/math/dashboard/app.component.html b/projects/nshmp-apps/src/app/dev/math/dashboard/app.component.html index 56569f555..755f5e99f 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 9ecce1d8a..9a1d7e51d 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 ee3e46652..8304e735c 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 682b13bdf..f071f9f5a 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/hazard/dashboard/app.component.html b/projects/nshmp-apps/src/app/hazard/dashboard/app.component.html index b20dfdbe0..baf20fa7d 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 4963010c3..466b802f8 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/internal/dashboard/app.component.html b/projects/nshmp-apps/src/app/internal/dashboard/app.component.html index 2384d26ae..d4913aec9 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 42fbf6918..d3ce98b92 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/ncm/dashboard/app.component.html b/projects/nshmp-apps/src/app/ncm/dashboard/app.component.html index 35b0fc397..4e34e88b8 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 7a677f638..2cd182194 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/source/dashboard/app.component.html b/projects/nshmp-apps/src/app/source/dashboard/app.component.html index a39713d9b..be11ff361 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 a19b283ac..1f3231e03 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', -- GitLab From 5ce1845fc52f8938223ee013aadc7c566f921d10 Mon Sep 17 00:00:00 2001 From: Brandon Clayton <bclayton@usgs.gov> Date: Fri, 13 Dec 2024 10:06:50 -0700 Subject: [PATCH 5/8] show in menu --- .../nshmp-apps/src/shared/utils/applications.utils.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/projects/nshmp-apps/src/shared/utils/applications.utils.ts b/projects/nshmp-apps/src/shared/utils/applications.utils.ts index 1cbaa5e17..187f3c625 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', -- GitLab From dccfdc06a953113b896dce588f6676bc2a3b5656 Mon Sep 17 00:00:00 2001 From: Brandon Clayton <bclayton@usgs.gov> Date: Fri, 13 Dec 2024 10:06:57 -0700 Subject: [PATCH 6/8] add service method --- .../nshmp-apps/src/shared/utils/navigation.utils.ts | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/projects/nshmp-apps/src/shared/utils/navigation.utils.ts b/projects/nshmp-apps/src/shared/utils/navigation.utils.ts index 9b66d1f3a..bdc7a1a02 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]; } /** -- GitLab From 828ee8fb50d241e785b8d196f01d160a6c7f71c4 Mon Sep 17 00:00:00 2001 From: Brandon Clayton <bclayton@usgs.gov> Date: Fri, 13 Dec 2024 10:51:45 -0700 Subject: [PATCH 7/8] switch to location service for url query --- .../designmaps/rtgm/services/app.service.ts | 16 +++++++-------- .../services/app.service.ts | 14 ++++++------- .../dynamic-compare/services/app.service.ts | 17 ++++++++-------- .../app/gmm/distance/services/app.service.ts | 17 ++++++++-------- .../app/gmm/magnitude/services/app.service.ts | 17 ++++++++-------- .../app/gmm/spectra/services/app.service.ts | 17 ++++++++-------- .../app/hazard/disagg/services/app.service.ts | 20 ++++++++----------- .../hazard/dynamic/services/app.service.ts | 19 ++++++++---------- .../app/hazard/static/services/app.service.ts | 19 ++++++++---------- .../check-haz-jobs/services/app.service.ts | 17 ++++++++-------- .../haz-job-history/services/app.service.ts | 17 ++++++++-------- .../job-submitted/job-submitted.component.ts | 3 +-- .../submit-haz-jobs/services/app.service.ts | 1 - .../services/app.service.ts | 17 ++++++++-------- .../services/app.service.ts | 18 +++++++++-------- .../app/source/mfd/services/app.service.ts | 17 ++++++++-------- .../source/model-maps/services/app.service.ts | 16 +++++++-------- .../app/source/rates/services/app.service.ts | 15 +++++++------- 18 files changed, 130 insertions(+), 147 deletions(-) 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 bc507d2e3..4f466b187 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/gmm/hanging-wall-effects/services/app.service.ts b/projects/nshmp-apps/src/app/dev/gmm/hanging-wall-effects/services/app.service.ts index 27a096678..83aed91b3 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/dynamic-compare/services/app.service.ts b/projects/nshmp-apps/src/app/dev/hazard/dynamic-compare/services/app.service.ts index 6e6a78a10..77fab0a95 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(); @@ -879,13 +881,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/gmm/distance/services/app.service.ts b/projects/nshmp-apps/src/app/gmm/distance/services/app.service.ts index 15e16e663..1d6c721e8 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 3f25429b0..f1b2fcc87 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 869346cef..8ccd925cc 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/disagg/services/app.service.ts b/projects/nshmp-apps/src/app/hazard/disagg/services/app.service.ts index 3658b3e6d..551e055c9 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 02276f630..d5e280b28 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 de874e6c7..8ad4b174a 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 b7777715c..6353510b4 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 797140795..df579cc4d 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 ddc0532a7..e93371632 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 404fbf14a..08eac8789 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 8b5b4b56a..0ad70cbcd 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/ncm/geophysical-profiles/services/app.service.ts b/projects/nshmp-apps/src/app/ncm/geophysical-profiles/services/app.service.ts index cd895db09..adc3948c2 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(); @@ -546,15 +547,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/mfd/services/app.service.ts b/projects/nshmp-apps/src/app/source/mfd/services/app.service.ts index 9d95d18d7..5a25b8a13 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 4b8e84e30..1ea217d2f 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 a90a60d0a..edd7eaea3 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 { -- GitLab From eb360f0d90813412fd6996842da9922a9a10457b Mon Sep 17 00:00:00 2001 From: Brandon Clayton <bclayton@usgs.gov> Date: Fri, 13 Dec 2024 11:20:27 -0700 Subject: [PATCH 8/8] fix query --- .../dynamic-compare/services/app.service.ts | 20 +++++++++++-------- .../internal/shared/services/auth.service.ts | 1 - .../services/app.service.ts | 7 +++++-- 3 files changed, 17 insertions(+), 11 deletions(-) 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 77fab0a95..e4ff3a383 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 @@ -621,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) @@ -652,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(); @@ -870,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, 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 b18c00d3e..504d9fe00 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/geophysical-profiles/services/app.service.ts b/projects/nshmp-apps/src/app/ncm/geophysical-profiles/services/app.service.ts index adc3948c2..5cc0b5125 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 @@ -218,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 ); @@ -241,7 +243,6 @@ export class AppService usageResponse, }); - this.addLocationForm(); this.initialFormSet(); }); } @@ -371,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(); }); -- GitLab