diff --git a/package-lock.json b/package-lock.json index 9f47f05372aa543223b3382f5a189a0ab54ffaaa..52b2f63e7ec667e164bd9a0e08656b223c109b2c 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.23.0", - "@ghsc/nshmp-template": "^18.1.0", + "@ghsc/nshmp-lib-ng": "^18.23.1", + "@ghsc/nshmp-template": "^18.2.0", "@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.23.0", - "resolved": "https://code.usgs.gov/api/v4/projects/12416/packages/npm/@ghsc/nshmp-lib-ng/-/@ghsc/nshmp-lib-ng-18.23.0.tgz", - "integrity": "sha1-TprRpdO8zTo68ZnCUOdauYkWGJk=", + "version": "18.23.1", + "resolved": "https://code.usgs.gov/api/v4/projects/12416/packages/npm/@ghsc/nshmp-lib-ng/-/@ghsc/nshmp-lib-ng-18.23.1.tgz", + "integrity": "sha1-Tl0NKxnzEuNXYg52VYKCLgb5HUw=", "dependencies": { "tslib": "^2.3.0" }, @@ -4644,9 +4644,9 @@ } }, "node_modules/@ghsc/nshmp-template": { - "version": "18.1.0", - "resolved": "https://code.usgs.gov/api/v4/projects/1416/packages/npm/@ghsc/nshmp-template/-/@ghsc/nshmp-template-18.1.0.tgz", - "integrity": "sha1-b6kU+adoQMmNrsHd5ZDLE09X08I=", + "version": "18.2.0", + "resolved": "https://code.usgs.gov/api/v4/projects/1416/packages/npm/@ghsc/nshmp-template/-/@ghsc/nshmp-template-18.2.0.tgz", + "integrity": "sha1-iR13fpkP/V5I6xH2kWTlP8xRLXE=", "dependencies": { "tslib": "^2.3.1" }, diff --git a/package.json b/package.json index 61c922fc5f7f84c529d65aa7aa5ceca3a6c9a8f1..3f7c8fe037fc6673fbe1356c93e8dd27834f68e6 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.23.0", - "@ghsc/nshmp-template": "^18.1.0", + "@ghsc/nshmp-lib-ng": "^18.23.1", + "@ghsc/nshmp-template": "^18.2.0", "@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/hazard/dashboard/app.component.html b/projects/nshmp-apps/src/app/hazard/dashboard/app.component.html new file mode 100644 index 0000000000000000000000000000000000000000..b20dfdbe0bb641fd0a40c4663239fd589b237eb5 --- /dev/null +++ b/projects/nshmp-apps/src/app/hazard/dashboard/app.component.html @@ -0,0 +1,19 @@ +<nshmp-lib-ng-template #template [navigationList]="navigationList" [title]=""> + <!-- Dashboard --> + <nshmp-lib-ng-dashboard [sections]="sections"> + <nshmp-lib-ng-dashboard-title> + USGS Earthquake Hazard Toolbox: + <br /> + Hazard Applications + </nshmp-lib-ng-dashboard-title> + <nshmp-lib-ng-dashboard-description /> + </nshmp-lib-ng-dashboard> + + <!-- About page --> + <nshmp-lib-ng-about-page> + <nshmp-lib-ng-about-content + [showSavingSettingPanel]="false" + [showUsingApplicationPanel]="false" + /> + </nshmp-lib-ng-about-page> +</nshmp-lib-ng-template> diff --git a/projects/nshmp-apps/src/app/hazard/dashboard/app.component.scss b/projects/nshmp-apps/src/app/hazard/dashboard/app.component.scss new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/projects/nshmp-apps/src/app/hazard/dashboard/app.component.spec.ts b/projects/nshmp-apps/src/app/hazard/dashboard/app.component.spec.ts new file mode 100644 index 0000000000000000000000000000000000000000..10ce8a0027da801bcb011e66163c0de975d46b49 --- /dev/null +++ b/projects/nshmp-apps/src/app/hazard/dashboard/app.component.spec.ts @@ -0,0 +1,30 @@ +import {provideHttpClient} from '@angular/common/http'; +import {ComponentFixture, TestBed} from '@angular/core/testing'; +import {provideNoopAnimations} from '@angular/platform-browser/animations'; +import {provideRouter} from '@angular/router'; + +import {AppComponent} from './app.component'; + +describe('AppComponent', () => { + let component: AppComponent; + let fixture: ComponentFixture<AppComponent>; + + beforeEach(async () => { + await TestBed.configureTestingModule({ + imports: [AppComponent], + providers: [ + provideHttpClient(), + provideNoopAnimations(), + provideRouter([]), + ], + }).compileComponents(); + + fixture = TestBed.createComponent(AppComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/projects/nshmp-apps/src/app/hazard/dashboard/app.component.ts b/projects/nshmp-apps/src/app/hazard/dashboard/app.component.ts new file mode 100644 index 0000000000000000000000000000000000000000..4963010c32c7ae9765af74af55b440ac3ff8fe36 --- /dev/null +++ b/projects/nshmp-apps/src/app/hazard/dashboard/app.component.ts @@ -0,0 +1,47 @@ +import {Component} from '@angular/core'; +import { + NshmpLibNgAboutContentComponent, + NshmpLibNgAboutPageComponent, +} from '@ghsc/nshmp-lib-ng/about'; +import { + ApplicationSections, + NshmpLibNgDashboardComponent, + NshmpLibNgDashboardDescriptionComponent, + NshmpLibNgDashboardTitleComponent, + NshmpLibNgTemplateComponent, +} from '@ghsc/nshmp-lib-ng/nshmp'; +import { + hazardApps, + navigation, +} from 'projects/nshmp-apps/src/shared/utils/navigation.utils'; + +@Component({ + imports: [ + NshmpLibNgTemplateComponent, + NshmpLibNgAboutPageComponent, + NshmpLibNgDashboardComponent, + NshmpLibNgDashboardTitleComponent, + NshmpLibNgDashboardDescriptionComponent, + NshmpLibNgAboutContentComponent, + ], + selector: 'app-app', + standalone: true, + styleUrl: './app.component.scss', + templateUrl: './app.component.html', +}) +export class AppComponent { + /** Navigation list for menu */ + navigationList = navigation(); + + sections: ApplicationSections[] = [ + { + gridClass: 'grid-col-10', + sections: [ + { + applications: hazardApps().map(navigation => ({navigation})), + gridClass: 'grid-col-12 tablet-lg:grid-col-8 grid-offset-1', + }, + ], + }, + ]; +} diff --git a/projects/nshmp-apps/src/app/hazard/hazard.routes.ts b/projects/nshmp-apps/src/app/hazard/hazard.routes.ts index c6e780ea06c533ec032d09f2db408b3da5276e77..58efd4ed6869ae06bf13156f221f7c7bc31a5bed 100644 --- a/projects/nshmp-apps/src/app/hazard/hazard.routes.ts +++ b/projects/nshmp-apps/src/app/hazard/hazard.routes.ts @@ -2,6 +2,11 @@ import {Routes} from '@angular/router'; /** Hazard application routes */ const routes: Routes = [ + { + loadComponent: () => + import('./dashboard/app.component').then(com => com.AppComponent), + path: '', + }, { loadComponent: () => import('./disagg/app.component').then(com => com.AppComponent), diff --git a/projects/nshmp-apps/src/shared/models/applications.model.ts b/projects/nshmp-apps/src/shared/models/applications.model.ts index 7645c2953889de74e0ae97eaa1e9684ad420a8cb..a61a95a9781bb7de3f1685e14d635584cc1c5385 100644 --- a/projects/nshmp-apps/src/shared/models/applications.model.ts +++ b/projects/nshmp-apps/src/shared/models/applications.model.ts @@ -89,6 +89,8 @@ export interface GmmApplications { * Hazard applications. */ export interface HazardApplications { + /** Hazard dashboard */ + dashboard: Navigation; /** Disaggregation application */ disagg: Navigation; /** Dynamic hazard calculation application */ diff --git a/projects/nshmp-apps/src/shared/utils/applications.utils.ts b/projects/nshmp-apps/src/shared/utils/applications.utils.ts index 9bd9e93d27c1abe9fd1c0a888f134e95f8b8bcf5..6f08a6257ced845ac8066cb1c4695ae2b342efe2 100644 --- a/projects/nshmp-apps/src/shared/utils/applications.utils.ts +++ b/projects/nshmp-apps/src/shared/utils/applications.utils.ts @@ -33,6 +33,11 @@ export function apps(): Applications { }, }, hazard: { + dashboard: { + display: 'Hazard Dashboard', + routerLink: '/hazard', + showInDashboard: false, + }, disagg: { display: 'Disaggregation', routerLink: '/hazard/disagg', diff --git a/projects/nshmp-apps/src/shared/utils/navigation.utils.ts b/projects/nshmp-apps/src/shared/utils/navigation.utils.ts index b67ec2629008cb4bc85449742a673b60e05c4418..d9a6082add1f324bb52489fe355d69373d4106d2 100644 --- a/projects/nshmp-apps/src/shared/utils/navigation.utils.ts +++ b/projects/nshmp-apps/src/shared/utils/navigation.utils.ts @@ -9,19 +9,14 @@ const DEV_APPS = ApplicationsUtils.devApps(); * Returns the list of design map application. */ export function designMapApps(): Navigation[] { - return [APPS.designMaps.rtgm]; + return Object.values(APPS.designMaps) as Navigation[]; } /** * Returns the list of AWS applications. */ export function devAwsApps(): Navigation[] { - return [ - DEV_APPS.aws.checkHazJobs, - DEV_APPS.aws.hazJobHistory, - DEV_APPS.aws.submitHazJobs, - DEV_APPS.aws.terminateHazJobs, - ]; + return Object.values(DEV_APPS.aws) as Navigation[]; } /** @@ -56,7 +51,14 @@ export function devNavigation(): NavigationList[] { * Returns the list of ground motion model applications. */ export function gmmApps(): Navigation[] { - return [APPS.gmm.distance, APPS.gmm.magnitude, APPS.gmm.spectra]; + return Object.values(APPS.gmm) as Navigation[]; +} + +/** + * Returns list of hazard applications. + */ +export function hazardApps(): Navigation[] { + return Object.values(APPS.hazard) as Navigation[]; } /** @@ -80,7 +82,8 @@ export function navigation(): NavigationList[] { navigation: [APPS.dashboard], }, { - navigation: mainApps(), + navigation: hazardApps(), + subHeader: 'Hazard', }, { navigation: sourceModelApps(), @@ -98,6 +101,9 @@ export function navigation(): NavigationList[] { navigation: ncmApps(), subHeader: 'National Crustal Model', }, + { + navigation: [APPS.services], + }, ]; return [...navigation]; @@ -107,12 +113,12 @@ export function navigation(): NavigationList[] { * Returns the list of NCM appliations. */ export function ncmApps(): Navigation[] { - return [APPS.ncm.geophysicalProfiles]; + return Object.values(APPS.ncm) as Navigation[]; } /** * Returns the list of source model applicaitons. */ export function sourceModelApps(): Navigation[] { - return [APPS.source.data, APPS.source.mfd, APPS.source.rateAndProbability]; + return Object.values(APPS.source) as Navigation[]; }