From a94479589ba7bb587c0295047e830dbfef7b65cc Mon Sep 17 00:00:00 2001 From: Brandon Clayton <bclayton@usgs.gov> Date: Wed, 27 Nov 2024 15:41:59 -0700 Subject: [PATCH] add aws dashboard --- .../src/app/internal/aws/aws.routes.ts | 5 ++ .../aws/check-haz-jobs/app.component.ts | 8 ++-- .../check-haz-jobs/services/app.service.ts | 4 +- .../internal/aws/dashboard/app.component.html | 21 +++++++++ .../internal/aws/dashboard/app.component.scss | 0 .../aws/dashboard/app.component.spec.ts | 30 ++++++++++++ .../internal/aws/dashboard/app.component.ts | 47 +++++++++++++++++++ .../aws/haz-job-history/app.component.ts | 8 ++-- .../haz-job-history/services/app.service.ts | 4 +- .../aws/submit-haz-jobs/app.component.ts | 8 ++-- .../components/history/history.component.ts | 4 +- .../job-submitted/job-submitted.component.ts | 4 +- .../aws/terminate-haz-jobs/app.component.ts | 8 ++-- .../services/app.service.ts | 4 +- 14 files changed, 129 insertions(+), 26 deletions(-) create mode 100644 projects/nshmp-apps/src/app/internal/aws/dashboard/app.component.html create mode 100644 projects/nshmp-apps/src/app/internal/aws/dashboard/app.component.scss create mode 100644 projects/nshmp-apps/src/app/internal/aws/dashboard/app.component.spec.ts create mode 100644 projects/nshmp-apps/src/app/internal/aws/dashboard/app.component.ts diff --git a/projects/nshmp-apps/src/app/internal/aws/aws.routes.ts b/projects/nshmp-apps/src/app/internal/aws/aws.routes.ts index 66c5a618c..966d2a81f 100644 --- a/projects/nshmp-apps/src/app/internal/aws/aws.routes.ts +++ b/projects/nshmp-apps/src/app/internal/aws/aws.routes.ts @@ -1,6 +1,11 @@ import {Routes} from '@angular/router'; const routes: Routes = [ + { + loadComponent: () => + import('./dashboard/app.component').then(com => com.AppComponent), + path: '', + }, { loadComponent: () => import('./check-haz-jobs/app.component').then(com => com.AppComponent), diff --git a/projects/nshmp-apps/src/app/internal/aws/check-haz-jobs/app.component.ts b/projects/nshmp-apps/src/app/internal/aws/check-haz-jobs/app.component.ts index 12aa73e9c..d6f700a2a 100644 --- a/projects/nshmp-apps/src/app/internal/aws/check-haz-jobs/app.component.ts +++ b/projects/nshmp-apps/src/app/internal/aws/check-haz-jobs/app.component.ts @@ -6,8 +6,8 @@ import { NshmpTemplateControlPanelComponent, NshmpTemplatePlotContentComponent, } from '@ghsc/nshmp-template'; -import {devApps} from 'projects/nshmp-apps/src/shared/utils/applications.utils'; -import {devNavigation} from 'projects/nshmp-apps/src/shared/utils/navigation.utils'; +import {internalApps} from 'projects/nshmp-apps/src/shared/utils/applications.utils'; +import {internalNavigation} from 'projects/nshmp-apps/src/shared/utils/navigation.utils'; import {AboutComponent} from './components/about/about.component'; import {ContentComponent} from './components/content/content.component'; @@ -40,9 +40,9 @@ import {AppService} from './services/app.service'; }) export class AppComponent implements OnInit { /** Navigation list for menu */ - navigationList = devNavigation(); + navigationList = internalNavigation(); /** Application title */ - title = devApps().aws.checkHazJobs.display; + title = internalApps().aws.checkHazJobs.display; constructor(private service: AppService) {} 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 27a493a70..b7777715c 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 @@ -13,7 +13,7 @@ import {Response} from '@ghsc/nshmp-utils-ts/libs/nshmp-ws-utils'; import {EC2} from 'aws-sdk'; import {environment} from 'projects/nshmp-apps/src/environments/environment'; import {AppServiceModel} from 'projects/nshmp-apps/src/shared/models/app-service.model'; -import {devApps} from 'projects/nshmp-apps/src/shared/utils/applications.utils'; +import {internalApps} from 'projects/nshmp-apps/src/shared/utils/applications.utils'; import {catchError} from 'rxjs'; import {ControlForm} from '../models/control-form.model'; @@ -242,7 +242,7 @@ export class AppService implements AppServiceModel<AppState, ControlForm> { }; this.router - .navigate([devApps().aws.checkHazJobs.routerLink], { + .navigate([internalApps().aws.checkHazJobs.routerLink], { queryParams: { ...query, }, diff --git a/projects/nshmp-apps/src/app/internal/aws/dashboard/app.component.html b/projects/nshmp-apps/src/app/internal/aws/dashboard/app.component.html new file mode 100644 index 000000000..d8f47ed31 --- /dev/null +++ b/projects/nshmp-apps/src/app/internal/aws/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 Internal + <br /> + Earthquake Hazard Toolbox: + <br /> + AWS 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/internal/aws/dashboard/app.component.scss b/projects/nshmp-apps/src/app/internal/aws/dashboard/app.component.scss new file mode 100644 index 000000000..e69de29bb diff --git a/projects/nshmp-apps/src/app/internal/aws/dashboard/app.component.spec.ts b/projects/nshmp-apps/src/app/internal/aws/dashboard/app.component.spec.ts new file mode 100644 index 000000000..10ce8a002 --- /dev/null +++ b/projects/nshmp-apps/src/app/internal/aws/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/internal/aws/dashboard/app.component.ts b/projects/nshmp-apps/src/app/internal/aws/dashboard/app.component.ts new file mode 100644 index 000000000..f0f2cf4a2 --- /dev/null +++ b/projects/nshmp-apps/src/app/internal/aws/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 { + internalAwsApps, + internalNavigation, +} 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 = internalNavigation(); + + sections: ApplicationSections[] = [ + { + gridClass: 'grid-col-10', + sections: [ + { + applications: internalAwsApps().map(navigation => ({navigation})), + gridClass: 'grid-col-12 tablet-lg:grid-col-8 grid-offset-1', + }, + ], + }, + ]; +} diff --git a/projects/nshmp-apps/src/app/internal/aws/haz-job-history/app.component.ts b/projects/nshmp-apps/src/app/internal/aws/haz-job-history/app.component.ts index d490449fd..ff4fecffe 100644 --- a/projects/nshmp-apps/src/app/internal/aws/haz-job-history/app.component.ts +++ b/projects/nshmp-apps/src/app/internal/aws/haz-job-history/app.component.ts @@ -6,8 +6,8 @@ import { NshmpTemplateControlPanelComponent, NshmpTemplatePlotContentComponent, } from '@ghsc/nshmp-template'; -import {devApps} from 'projects/nshmp-apps/src/shared/utils/applications.utils'; -import {devNavigation} from 'projects/nshmp-apps/src/shared/utils/navigation.utils'; +import {internalApps} from 'projects/nshmp-apps/src/shared/utils/applications.utils'; +import {internalNavigation} from 'projects/nshmp-apps/src/shared/utils/navigation.utils'; import {AboutComponent} from './components/about/about.component'; import {ContentComponent} from './components/content/content.component'; @@ -38,9 +38,9 @@ import {AppService} from './services/app.service'; }) export class AppComponent implements OnInit { /** Navigation list for menu */ - navigationList = devNavigation(); + navigationList = internalNavigation(); /** Application title */ - title = devApps().aws.hazJobHistory.display; + title = internalApps().aws.hazJobHistory.display; constructor(private service: AppService) {} 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 cff795551..797140795 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 @@ -6,7 +6,7 @@ import {NshmpService, nshmpUtils} from '@ghsc/nshmp-lib-ng/nshmp'; import {DynamoDBItem} from '@ghsc/nshmp-utils-ts/libs/aws/run-nshmp-haz'; import {environment} from 'projects/nshmp-apps/src/environments/environment'; import {AppServiceModel} from 'projects/nshmp-apps/src/shared/models/app-service.model'; -import {devApps} from 'projects/nshmp-apps/src/shared/utils/applications.utils'; +import {internalApps} from 'projects/nshmp-apps/src/shared/utils/applications.utils'; import {ControlForm} from '../models/control-form.model'; import {AppState} from '../models/state.model'; @@ -170,7 +170,7 @@ export class AppService implements AppServiceModel<AppState, ControlForm> { }; this.router - .navigate([devApps().aws.hazJobHistory.routerLink], { + .navigate([internalApps().aws.hazJobHistory.routerLink], { queryParams: { ...query, }, diff --git a/projects/nshmp-apps/src/app/internal/aws/submit-haz-jobs/app.component.ts b/projects/nshmp-apps/src/app/internal/aws/submit-haz-jobs/app.component.ts index 4ec472351..d9967b88e 100644 --- a/projects/nshmp-apps/src/app/internal/aws/submit-haz-jobs/app.component.ts +++ b/projects/nshmp-apps/src/app/internal/aws/submit-haz-jobs/app.component.ts @@ -1,8 +1,8 @@ import {Component, OnInit} from '@angular/core'; import {NshmpLibNgAboutPageComponent} from '@ghsc/nshmp-lib-ng/about'; import {NshmpLibNgTemplateComponent} from '@ghsc/nshmp-lib-ng/nshmp'; -import {devApps} from 'projects/nshmp-apps/src/shared/utils/applications.utils'; -import {devNavigation} from 'projects/nshmp-apps/src/shared/utils/navigation.utils'; +import {internalApps} from 'projects/nshmp-apps/src/shared/utils/applications.utils'; +import {internalNavigation} from 'projects/nshmp-apps/src/shared/utils/navigation.utils'; import {AboutComponent} from './components/about/about.component'; import {ContentComponent} from './components/content/content.component'; @@ -29,9 +29,9 @@ import {AppService} from './services/app.service'; }) export class AppComponent implements OnInit { /** Navigation list for menu */ - navigationList = devNavigation(); + navigationList = internalNavigation(); /** Application title */ - title = devApps().aws.submitHazJobs.display; + title = internalApps().aws.submitHazJobs.display; constructor(private service: AppService) {} diff --git a/projects/nshmp-apps/src/app/internal/aws/submit-haz-jobs/components/history/history.component.ts b/projects/nshmp-apps/src/app/internal/aws/submit-haz-jobs/components/history/history.component.ts index 2438bb00d..aba858c61 100644 --- a/projects/nshmp-apps/src/app/internal/aws/submit-haz-jobs/components/history/history.component.ts +++ b/projects/nshmp-apps/src/app/internal/aws/submit-haz-jobs/components/history/history.component.ts @@ -24,7 +24,7 @@ import { RunNshmpHazResponseData, } from '@ghsc/nshmp-utils-ts/libs/aws/run-nshmp-haz'; import {Response} from '@ghsc/nshmp-utils-ts/libs/nshmp-ws-utils'; -import {devApps} from 'projects/nshmp-apps/src/shared/utils/applications.utils'; +import {internalApps} from 'projects/nshmp-apps/src/shared/utils/applications.utils'; import {AppService} from '../../services/app.service'; @@ -53,7 +53,7 @@ import {AppService} from '../../services/app.service'; templateUrl: './history.component.html', }) export class HistoryComponent { - awsLinks = devApps().aws; + awsLinks = internalApps().aws; history = this.service.history; 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 c0989f62c..ddc0532a7 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 @@ -13,7 +13,7 @@ import {MatExpansionModule} from '@angular/material/expansion'; import {Router} from '@angular/router'; import {YamlPipe} from '@ghsc/nshmp-lib-ng/aws'; import {RunNshmpHazResponseData} from '@ghsc/nshmp-utils-ts/libs/aws/run-nshmp-haz'; -import {devApps} from 'projects/nshmp-apps/src/shared/utils/applications.utils'; +import {internalApps} from 'projects/nshmp-apps/src/shared/utils/applications.utils'; import {AppService} from '../../services/app.service'; @@ -52,7 +52,7 @@ export class JobSubmittedComponent { this.router.createUrlTree( [ this.location.prepareExternalUrl( - devApps().aws.checkHazJobs.routerLink + internalApps().aws.checkHazJobs.routerLink ), ], { diff --git a/projects/nshmp-apps/src/app/internal/aws/terminate-haz-jobs/app.component.ts b/projects/nshmp-apps/src/app/internal/aws/terminate-haz-jobs/app.component.ts index a3180091c..5e3984aba 100644 --- a/projects/nshmp-apps/src/app/internal/aws/terminate-haz-jobs/app.component.ts +++ b/projects/nshmp-apps/src/app/internal/aws/terminate-haz-jobs/app.component.ts @@ -1,8 +1,8 @@ import {Component, OnInit} from '@angular/core'; import {NshmpLibNgAboutPageComponent} from '@ghsc/nshmp-lib-ng/about'; import {NshmpLibNgTemplateComponent} from '@ghsc/nshmp-lib-ng/nshmp'; -import {devApps} from 'projects/nshmp-apps/src/shared/utils/applications.utils'; -import {devNavigation} from 'projects/nshmp-apps/src/shared/utils/navigation.utils'; +import {internalApps} from 'projects/nshmp-apps/src/shared/utils/applications.utils'; +import {internalNavigation} from 'projects/nshmp-apps/src/shared/utils/navigation.utils'; import {AboutComponent} from './components/about/about.component'; import {ContentComponent} from './components/content/content.component'; @@ -29,9 +29,9 @@ import {AppService} from './services/app.service'; }) export class AppComponent implements OnInit { /** Navigation list for menu */ - navigationList = devNavigation(); + navigationList = internalNavigation(); /** Application title */ - title = devApps().aws.terminateHazJobs.display; + title = internalApps().aws.terminateHazJobs.display; constructor(private service: AppService) {} 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 0516aa9fb..8b5b4b56a 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 @@ -13,7 +13,7 @@ import {Response} from '@ghsc/nshmp-utils-ts/libs/nshmp-ws-utils'; import {EC2} from 'aws-sdk'; import {environment} from 'projects/nshmp-apps/src/environments/environment'; import {AppServiceModel} from 'projects/nshmp-apps/src/shared/models/app-service.model'; -import {devApps} from 'projects/nshmp-apps/src/shared/utils/applications.utils'; +import {internalApps} from 'projects/nshmp-apps/src/shared/utils/applications.utils'; import {AppState} from '../models/state.model'; @@ -155,7 +155,7 @@ export class AppService implements AppServiceModel<AppState, IdForm> { }; this.router - .navigate([devApps().aws.terminateHazJobs.routerLink], { + .navigate([internalApps().aws.terminateHazJobs.routerLink], { queryParams: { ...query, }, -- GitLab