From af18c3c54e26fc124123d8aee839bc3602d3651d Mon Sep 17 00:00:00 2001 From: Brandon Clayton <bclayton@usgs.gov> Date: Wed, 27 Nov 2024 15:42:27 -0700 Subject: [PATCH] add dashboard --- .../app/dev/gmm/dashboard/app.component.html | 21 +++++++++ .../app/dev/gmm/dashboard/app.component.scss | 0 .../dev/gmm/dashboard/app.component.spec.ts | 30 ++++++++++++ .../app/dev/gmm/dashboard/app.component.ts | 47 +++++++++++++++++++ .../nshmp-apps/src/app/dev/gmm/gmm.routes.ts | 5 ++ .../dev/hazard/dashboard/app.component.html | 21 +++++++++ .../dev/hazard/dashboard/app.component.scss | 0 .../hazard/dashboard/app.component.spec.ts | 30 ++++++++++++ .../app/dev/hazard/dashboard/app.component.ts | 47 +++++++++++++++++++ .../src/app/dev/hazard/hazard.routes.ts | 5 ++ .../app/dev/math/dashboard/app.component.html | 21 +++++++++ .../app/dev/math/dashboard/app.component.scss | 0 .../dev/math/dashboard/app.component.spec.ts | 30 ++++++++++++ .../app/dev/math/dashboard/app.component.ts | 47 +++++++++++++++++++ .../math/exceedance-explorer/app.component.ts | 2 +- .../src/app/dev/math/math.routes.ts | 5 ++ 16 files changed, 310 insertions(+), 1 deletion(-) create mode 100644 projects/nshmp-apps/src/app/dev/gmm/dashboard/app.component.html create mode 100644 projects/nshmp-apps/src/app/dev/gmm/dashboard/app.component.scss create mode 100644 projects/nshmp-apps/src/app/dev/gmm/dashboard/app.component.spec.ts create mode 100644 projects/nshmp-apps/src/app/dev/gmm/dashboard/app.component.ts create mode 100644 projects/nshmp-apps/src/app/dev/hazard/dashboard/app.component.html create mode 100644 projects/nshmp-apps/src/app/dev/hazard/dashboard/app.component.scss create mode 100644 projects/nshmp-apps/src/app/dev/hazard/dashboard/app.component.spec.ts create mode 100644 projects/nshmp-apps/src/app/dev/hazard/dashboard/app.component.ts create mode 100644 projects/nshmp-apps/src/app/dev/math/dashboard/app.component.html create mode 100644 projects/nshmp-apps/src/app/dev/math/dashboard/app.component.scss create mode 100644 projects/nshmp-apps/src/app/dev/math/dashboard/app.component.spec.ts create mode 100644 projects/nshmp-apps/src/app/dev/math/dashboard/app.component.ts 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 new file mode 100644 index 000000000..389a2c0fd --- /dev/null +++ b/projects/nshmp-apps/src/app/dev/gmm/dashboard/app.component.html @@ -0,0 +1,21 @@ +<nshmp-lib-ng-template #template [navigationList]="navigationList" [title]=""> + <!-- Dashboard --> + <nshmp-lib-ng-dashboard [sections]="sections"> + <nshmp-lib-ng-dashboard-title> + USGS Development + <br /> + Earthquake Hazard Toolbox: + <br /> + Ground Motion Model 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/dev/gmm/dashboard/app.component.scss b/projects/nshmp-apps/src/app/dev/gmm/dashboard/app.component.scss new file mode 100644 index 000000000..e69de29bb diff --git a/projects/nshmp-apps/src/app/dev/gmm/dashboard/app.component.spec.ts b/projects/nshmp-apps/src/app/dev/gmm/dashboard/app.component.spec.ts new file mode 100644 index 000000000..10ce8a002 --- /dev/null +++ b/projects/nshmp-apps/src/app/dev/gmm/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/dev/gmm/dashboard/app.component.ts b/projects/nshmp-apps/src/app/dev/gmm/dashboard/app.component.ts new file mode 100644 index 000000000..f7275a6cd --- /dev/null +++ b/projects/nshmp-apps/src/app/dev/gmm/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 { + devGmmApps, + devNavigation, +} 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 = devNavigation(); + + sections: ApplicationSections[] = [ + { + gridClass: 'grid-col-10', + sections: [ + { + applications: devGmmApps().map(navigation => ({navigation})), + gridClass: 'grid-col-12 tablet-lg:grid-col-8 grid-offset-1', + }, + ], + }, + ]; +} diff --git a/projects/nshmp-apps/src/app/dev/gmm/gmm.routes.ts b/projects/nshmp-apps/src/app/dev/gmm/gmm.routes.ts index 2535e4b48..8cf6b0c4c 100644 --- a/projects/nshmp-apps/src/app/dev/gmm/gmm.routes.ts +++ b/projects/nshmp-apps/src/app/dev/gmm/gmm.routes.ts @@ -2,6 +2,11 @@ import {Routes} from '@angular/router'; /** Routes for dev GMM applications */ const routes: Routes = [ + { + loadComponent: () => + import('./dashboard/app.component').then(com => com.AppComponent), + path: '', + }, { loadComponent: () => import('./hanging-wall-effects/app.component').then( 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 new file mode 100644 index 000000000..389d2a21b --- /dev/null +++ b/projects/nshmp-apps/src/app/dev/hazard/dashboard/app.component.html @@ -0,0 +1,21 @@ +<nshmp-lib-ng-template #template [navigationList]="navigationList" [title]=""> + <!-- Dashboard --> + <nshmp-lib-ng-dashboard [sections]="sections"> + <nshmp-lib-ng-dashboard-title> + USGS Development + <br /> + 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/dev/hazard/dashboard/app.component.scss b/projects/nshmp-apps/src/app/dev/hazard/dashboard/app.component.scss new file mode 100644 index 000000000..e69de29bb diff --git a/projects/nshmp-apps/src/app/dev/hazard/dashboard/app.component.spec.ts b/projects/nshmp-apps/src/app/dev/hazard/dashboard/app.component.spec.ts new file mode 100644 index 000000000..10ce8a002 --- /dev/null +++ b/projects/nshmp-apps/src/app/dev/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/dev/hazard/dashboard/app.component.ts b/projects/nshmp-apps/src/app/dev/hazard/dashboard/app.component.ts new file mode 100644 index 000000000..6c827f6c1 --- /dev/null +++ b/projects/nshmp-apps/src/app/dev/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 { + devHazardApps, + devNavigation, +} 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 = devNavigation(); + + sections: ApplicationSections[] = [ + { + gridClass: 'grid-col-10', + sections: [ + { + applications: devHazardApps().map(navigation => ({navigation})), + gridClass: 'grid-col-12 tablet-lg:grid-col-8 grid-offset-1', + }, + ], + }, + ]; +} diff --git a/projects/nshmp-apps/src/app/dev/hazard/hazard.routes.ts b/projects/nshmp-apps/src/app/dev/hazard/hazard.routes.ts index 5e7bea624..8b81c2fb1 100644 --- a/projects/nshmp-apps/src/app/dev/hazard/hazard.routes.ts +++ b/projects/nshmp-apps/src/app/dev/hazard/hazard.routes.ts @@ -5,6 +5,11 @@ import {DynamicHazardCompareGuard} from './dynamic-compare/guards/dynamic-hazard /** Routes for dev hazard applications */ const routes: Routes = [ + { + loadComponent: () => + import('./dashboard/app.component').then(com => com.AppComponent), + path: '', + }, { canActivate: [() => inject(DynamicHazardCompareGuard).canActivate()], loadComponent: () => 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 new file mode 100644 index 000000000..56569f555 --- /dev/null +++ b/projects/nshmp-apps/src/app/dev/math/dashboard/app.component.html @@ -0,0 +1,21 @@ +<nshmp-lib-ng-template #template [navigationList]="navigationList" [title]=""> + <!-- Dashboard --> + <nshmp-lib-ng-dashboard [sections]="sections"> + <nshmp-lib-ng-dashboard-title> + USGS Development + <br /> + Earthquake Hazard Toolbox: + <br /> + Math 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/dev/math/dashboard/app.component.scss b/projects/nshmp-apps/src/app/dev/math/dashboard/app.component.scss new file mode 100644 index 000000000..e69de29bb diff --git a/projects/nshmp-apps/src/app/dev/math/dashboard/app.component.spec.ts b/projects/nshmp-apps/src/app/dev/math/dashboard/app.component.spec.ts new file mode 100644 index 000000000..10ce8a002 --- /dev/null +++ b/projects/nshmp-apps/src/app/dev/math/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/dev/math/dashboard/app.component.ts b/projects/nshmp-apps/src/app/dev/math/dashboard/app.component.ts new file mode 100644 index 000000000..9ecce1d8a --- /dev/null +++ b/projects/nshmp-apps/src/app/dev/math/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 { + devMathApps, + devNavigation, +} 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 = devNavigation(); + + sections: ApplicationSections[] = [ + { + gridClass: 'grid-col-10', + sections: [ + { + applications: devMathApps().map(navigation => ({navigation})), + gridClass: 'grid-col-12 tablet-lg:grid-col-8 grid-offset-1', + }, + ], + }, + ]; +} diff --git a/projects/nshmp-apps/src/app/dev/math/exceedance-explorer/app.component.ts b/projects/nshmp-apps/src/app/dev/math/exceedance-explorer/app.component.ts index 6fe0117fb..9040ede33 100644 --- a/projects/nshmp-apps/src/app/dev/math/exceedance-explorer/app.component.ts +++ b/projects/nshmp-apps/src/app/dev/math/exceedance-explorer/app.component.ts @@ -42,5 +42,5 @@ export class AppComponent { /** Navigation list for menu */ navigationList = devNavigation(); /** Application title */ - title = devApps().exceedanceExplorer.display; + title = devApps().math.exceedanceExplorer.display; } diff --git a/projects/nshmp-apps/src/app/dev/math/math.routes.ts b/projects/nshmp-apps/src/app/dev/math/math.routes.ts index ce59f47f5..864c1b0af 100644 --- a/projects/nshmp-apps/src/app/dev/math/math.routes.ts +++ b/projects/nshmp-apps/src/app/dev/math/math.routes.ts @@ -2,6 +2,11 @@ import {Routes} from '@angular/router'; /** Routes for math applications */ const routes: Routes = [ + { + loadComponent: () => + import('./dashboard/app.component').then(com => com.AppComponent), + path: '', + }, { loadComponent: () => import('./exceedance-explorer/app.component').then( -- GitLab