From 2b649f8683c422e9effa687a6f12fee19844c0f3 Mon Sep 17 00:00:00 2001 From: MatthijsSmets Date: Fri, 12 Jan 2024 16:34:11 +0100 Subject: [PATCH] chore: fix linting issues --- .../table-settings-modal.component.ts | 45 +++++-------------- src/app/shared/services/settings.service.ts | 12 ++--- 2 files changed, 15 insertions(+), 42 deletions(-) diff --git a/src/app/debug/table/table-settings-modal/table-settings-modal.component.ts b/src/app/debug/table/table-settings-modal/table-settings-modal.component.ts index 3cf268aa..119af963 100644 --- a/src/app/debug/table/table-settings-modal/table-settings-modal.component.ts +++ b/src/app/debug/table/table-settings-modal/table-settings-modal.component.ts @@ -1,11 +1,4 @@ -import { - Component, - ElementRef, - EventEmitter, - OnDestroy, - Output, - ViewChild, -} from '@angular/core'; +import { Component, ElementRef, EventEmitter, OnDestroy, Output, ViewChild } from '@angular/core'; import { UntypedFormControl, UntypedFormGroup } from '@angular/forms'; import { NgbModal } from '@ng-bootstrap/ng-bootstrap'; import { HttpService } from '../../../shared/services/http.service'; @@ -48,15 +41,12 @@ export class TableSettingsModalComponent implements OnDestroy { } subscribeToSettingsServiceObservables(): void { - this.showMultipleAtATimeSubscription = - this.settingsService.showMultipleAtATimeObservable.subscribe( - (value: boolean) => { - this.showMultipleAtATime = value; - this.settingsForm - .get('showMultipleFilesAtATime') - ?.setValue(this.showMultipleAtATime); - } - ); + this.showMultipleAtATimeSubscription = this.settingsService.showMultipleAtATimeObservable.subscribe( + (value: boolean) => { + this.showMultipleAtATime = value; + this.settingsForm.get('showMultipleFilesAtATime')?.setValue(this.showMultipleAtATime); + } + ); } setShowMultipleAtATime() { @@ -83,14 +73,9 @@ export class TableSettingsModalComponent implements OnDestroy { saveSettings(): void { const form: any = this.settingsForm.value; this.cookieService.set('generatorEnabled', form.generatorEnabled); - this.cookieService.set( - 'transformationEnabled', - form.transformationEnabled.toString() - ); + this.cookieService.set('transformationEnabled', form.transformationEnabled.toString()); this.httpService.postTransformation(form.transformation).subscribe(); - const generatorEnabled: string = String( - form.generatorEnabled === 'Enabled' - ); + const generatorEnabled: string = String(form.generatorEnabled === 'Enabled'); let data: any = { generatorEnabled: generatorEnabled, regexFilter: form.regexFilter, @@ -111,18 +96,14 @@ export class TableSettingsModalComponent implements OnDestroy { factoryReset(): void { this.settingsForm.reset(); this.settingsService.setShowMultipleAtATime(); - this.httpService - .resetSettings() - .subscribe((response) => this.saveResponseSetting(response)); + this.httpService.resetSettings().subscribe((response) => this.saveResponseSetting(response)); this.httpService.getTransformation(true).subscribe((resp) => { this.settingsForm.get('transformation')?.setValue(resp.transformation); }); } loadSettings(): void { - this.httpService - .getSettings() - .subscribe((response) => this.saveResponseSetting(response)); + this.httpService.getSettings().subscribe((response) => this.saveResponseSetting(response)); if (this.cookieService.get('transformationEnabled')) { this.settingsForm .get('transformationEnabled') @@ -130,9 +111,7 @@ export class TableSettingsModalComponent implements OnDestroy { } this.httpService.getTransformation(false).subscribe((response) => { - this.settingsForm - .get('transformation') - ?.setValue(response.transformation); + this.settingsForm.get('transformation')?.setValue(response.transformation); }); } diff --git a/src/app/shared/services/settings.service.ts b/src/app/shared/services/settings.service.ts index f61ee9f2..0249a9f1 100644 --- a/src/app/shared/services/settings.service.ts +++ b/src/app/shared/services/settings.service.ts @@ -13,21 +13,15 @@ export class SettingsService { private showMultipleAtATimeKey: string = 'showMultipleFilesAtATime'; private showMultipleAtATime: boolean = false; private showMultipleAtATimeSubject: Subject = new ReplaySubject(1); - public showMultipleAtATimeObservable: Observable = - this.showMultipleAtATimeSubject.asObservable(); + public showMultipleAtATimeObservable: Observable = this.showMultipleAtATimeSubject.asObservable(); public setShowMultipleAtATime(value: boolean = false): void { this.showMultipleAtATime = value; this.showMultipleAtATimeSubject.next(this.showMultipleAtATime); - localStorage.setItem( - this.showMultipleAtATimeKey, - String(this.showMultipleAtATime) - ); + localStorage.setItem(this.showMultipleAtATimeKey, String(this.showMultipleAtATime)); } private loadSettingsFromLocalStorage(): void { - this.setShowMultipleAtATime( - localStorage.getItem(this.showMultipleAtATimeKey) === 'true' - ); + this.setShowMultipleAtATime(localStorage.getItem(this.showMultipleAtATimeKey) === 'true'); } }