diff --git a/projects/nshmp-apps/src/app/dev/aws/submit-haz-jobs/services/app.service.ts b/projects/nshmp-apps/src/app/dev/aws/submit-haz-jobs/services/app.service.ts index 93f224e24395bda5a4a0aaef250775ab6570d996..40f1bdcbf5d617fab51b23064a90e59023e986b5 100644 --- a/projects/nshmp-apps/src/app/dev/aws/submit-haz-jobs/services/app.service.ts +++ b/projects/nshmp-apps/src/app/dev/aws/submit-haz-jobs/services/app.service.ts @@ -50,6 +50,7 @@ export class AppService implements AppServiceModel<AppState, RunNshmpHazForm> { this.defaultFormValues().overrideNshmpLib ), }); + /** Application state */ readonly state = signal<AppState>(this.initialState()); @@ -65,37 +66,6 @@ export class AppService implements AppServiceModel<AppState, RunNshmpHazForm> { this.formGroup.controls.nshmpConfig.controls.returnPeriod.disable(); } - /** - * HTTP POST example for service call. - */ - exampleConfig(): RunNshmpHazHttpPostConfig { - const values = this.defaultFormValues(); - - return { - calcConfig: { - output: { - directory: 'example-hazard-out', - }, - }, - cloudConfig: { - instanceType: values.cloudConfig.instanceType, - }, - mapConfig: { - region: 'CONUS', - title: 'Total Mean Hazard', - }, - nshmpConfig: { - className: values.nshmpConfig.className, - email: 'user@usgs.gov', - modelGitUrl: values.nshmpConfig.modelGitUrl, - modelSha: values.nshmpConfig.modelSha, - siteFileUrl: - 'https://code.usgs.gov/ghsc/nshmp/nshmp-haz/-/raw/main/etc/examples/3-sites-file/sites.geojson', - sourceCodeGitUrl: values.nshmpConfig.sourceCodeGitUrl, - sourceCodeSha: values.nshmpConfig.sourceCodeSha, - }, - }; - } /** * Returns the value of the main content tab. */ @@ -167,19 +137,6 @@ export class AppService implements AppServiceModel<AppState, RunNshmpHazForm> { ); } - /** - * Form field bounds. - */ - formBounds(): Record<string, NumberBounds> { - return { - /** Return period bounds */ - returnPeriod: { - max: 20000.0, - min: 1.0, - }, - }; - } - defaultFormValues(): RunNshmpHazForm { return { cloudConfig: { @@ -208,6 +165,51 @@ export class AppService implements AppServiceModel<AppState, RunNshmpHazForm> { }; } + /** + * HTTP POST example for service call. + */ + exampleConfig(): RunNshmpHazHttpPostConfig { + const values = this.defaultFormValues(); + + return { + calcConfig: { + output: { + directory: 'example-hazard-out', + }, + }, + cloudConfig: { + instanceType: values.cloudConfig.instanceType, + }, + mapConfig: { + region: 'CONUS', + title: 'Total Mean Hazard', + }, + nshmpConfig: { + className: values.nshmpConfig.className, + email: 'user@usgs.gov', + modelGitUrl: values.nshmpConfig.modelGitUrl, + modelSha: values.nshmpConfig.modelSha, + siteFileUrl: + 'https://code.usgs.gov/ghsc/nshmp/nshmp-haz/-/raw/main/etc/examples/3-sites-file/sites.geojson', + sourceCodeGitUrl: values.nshmpConfig.sourceCodeGitUrl, + sourceCodeSha: values.nshmpConfig.sourceCodeSha, + }, + }; + } + + /** + * Form field bounds. + */ + formBounds(): Record<string, NumberBounds> { + return { + /** Return period bounds */ + returnPeriod: { + max: 20000.0, + min: 1.0, + }, + }; + } + /** * Call GitLab to get NSHM latest tag. */ @@ -253,6 +255,7 @@ export class AppService implements AppServiceModel<AppState, RunNshmpHazForm> { * @param files The files to import */ importConfigFile(files: FileList): void { + this.resetForm(); for (const file of Array.from(files)) { this.readFile(file) .then(content => this.importConfig(content, file)) @@ -277,7 +280,10 @@ export class AppService implements AppServiceModel<AppState, RunNshmpHazForm> { */ resetForm(): void { this.formGroup.reset(this.defaultFormValues()); - this.updateState({calcConfig: null}); + this.updateState({ + calcConfig: null, + serviceResponse: null, + }); } /**