diff --git a/projects/planner/src/app/app-settings/app-settings.component.html b/projects/planner/src/app/app-settings/app-settings.component.html index 23914a95..5acfde77 100644 --- a/projects/planner/src/app/app-settings/app-settings.component.html +++ b/projects/planner/src/app/app-settings/app-settings.component.html @@ -47,6 +47,7 @@
+
diff --git a/projects/planner/src/app/app-settings/app-settings.component.spec.ts b/projects/planner/src/app/app-settings/app-settings.component.spec.ts index 2c61a984..d91c6bd7 100644 --- a/projects/planner/src/app/app-settings/app-settings.component.spec.ts +++ b/projects/planner/src/app/app-settings/app-settings.component.spec.ts @@ -84,7 +84,6 @@ describe('App settings component', () => { // TODO AppSettings: // * After changing units, also the range values need to be reloaded -// * Add save and load last form state. Do we want this? Or together with reset to default? // TODO missing test cases: diff --git a/projects/planner/src/app/app-settings/app-settings.component.ts b/projects/planner/src/app/app-settings/app-settings.component.ts index 160fa7cc..01a003e5 100644 --- a/projects/planner/src/app/app-settings/app-settings.component.ts +++ b/projects/planner/src/app/app-settings/app-settings.component.ts @@ -8,11 +8,10 @@ import { faUserCog } from '@fortawesome/free-solid-svg-icons'; import { SettingsNormalizationService } from '../shared/settings-normalization.service'; import { RangeConstants, UnitConversion } from '../shared/UnitConversion'; import { SubViewStorage } from '../shared/subViewStorage'; -import { DiveSchedules } from '../shared/dive.schedules'; import { ApplicationSettingsService } from '../shared/ApplicationSettings'; import { InputControls } from '../shared/inputcontrols'; import { ValidatorGroups } from '../shared/ValidatorGroups'; -import { Precision } from 'scuba-physics'; +import { Precision, GasDensity } from 'scuba-physics'; @Component({ selector: 'app-app-settings', @@ -31,7 +30,6 @@ export class AppSettingsComponent implements OnInit { constructor( public units: UnitConversion, private settingsNormalization: SettingsNormalizationService, - private schedules: DiveSchedules, private views: SubViewStorage, public appSettings: ApplicationSettingsService, private formBuilder: NonNullableFormBuilder, @@ -83,6 +81,15 @@ export class AppSettingsComponent implements OnInit { this.cd.detectChanges(); } + public resetToDefault(): void { + this.settingsForm.patchValue({ + imperialUnits: false, + maxDensity: GasDensity.recommendedMaximum + }); + + // don't apply yet, let the user to confirm + } + private reLoad(): void { this.settingsForm.patchValue({ maxDensity: this.maxDensity diff --git a/projects/planner/src/app/shared/ApplicationSettings.ts b/projects/planner/src/app/shared/ApplicationSettings.ts index da1506b7..4ce30059 100644 --- a/projects/planner/src/app/shared/ApplicationSettings.ts +++ b/projects/planner/src/app/shared/ApplicationSettings.ts @@ -1,7 +1,6 @@ import { Injectable } from '@angular/core'; import { UnitConversion } from './UnitConversion'; import { AppSettings } from './models'; -import { GasDensity } from "scuba-physics"; @Injectable() export class ApplicationSettingsService {