diff --git a/projects/nshmp-apps/src/app/internal/aws/submit-haz-jobs/components/config-example/config-example.component.ts b/projects/nshmp-apps/src/app/internal/aws/submit-haz-jobs/components/config-example/config-example.component.ts index 6379492babc975db5acefc30908403a8deb5d3e3..09d9b2b8aa1e9f66d3f780625872e8f789c4bddd 100644 --- a/projects/nshmp-apps/src/app/internal/aws/submit-haz-jobs/components/config-example/config-example.component.ts +++ b/projects/nshmp-apps/src/app/internal/aws/submit-haz-jobs/components/config-example/config-example.component.ts @@ -3,6 +3,11 @@ import * as YAML from 'yaml'; import {AppService} from '../../services/app.service'; +export enum ExampleType { + JSON = 'JSON', + YAML = 'YAML', +} + /** * YAML or JSON example of HTTP POST to run hazard on AWS. */ @@ -14,7 +19,7 @@ import {AppService} from '../../services/app.service'; }) export class ConfigExampleComponent implements OnInit { /** The example type */ - readonly type = input('YAML' || 'JSON'); + readonly type = input<ExampleType>(); /** JSON example */ exampleJson = `\n${JSON.stringify(this.service.exampleConfig(), null, 2)}`; @@ -33,8 +38,11 @@ export class ConfigExampleComponent implements OnInit { constructor(private service: AppService) {} ngOnInit(): void { - this.example = this.type() === 'YAML' ? this.exampleYml : this.exampleJson; + this.example = + this.type() === ExampleType.YAML ? this.exampleYml : this.exampleJson; this.exampleArray = - this.type() === 'YAML' ? this.exampleYmlArray : this.exampleJsonArray; + this.type() === ExampleType.YAML + ? this.exampleYmlArray + : this.exampleJsonArray; } } diff --git a/projects/nshmp-apps/src/app/internal/aws/submit-haz-jobs/components/content/content.component.html b/projects/nshmp-apps/src/app/internal/aws/submit-haz-jobs/components/content/content.component.html index 29ed91b7f1f818d40e3d807108c30361382916cd..9f1fca03a830b5d2a9209dfe32235c4b9cb8b286 100644 --- a/projects/nshmp-apps/src/app/internal/aws/submit-haz-jobs/components/content/content.component.html +++ b/projects/nshmp-apps/src/app/internal/aws/submit-haz-jobs/components/content/content.component.html @@ -23,10 +23,10 @@ </mat-tab> <mat-tab #jsonTab label="JSON Example"> - <app-config-example type="JSON" /> + <app-config-example [type]="Type.JSON" /> </mat-tab> <mat-tab #yamlTab label="YAML Example"> - <app-config-example type="YAML" /> + <app-config-example [type]="Type.YAML" /> </mat-tab> </mat-tab-group>