From 0630b0e078d6d17804551d3c22911f98e54cab47 Mon Sep 17 00:00:00 2001 From: Valentin Mihai Date: Mon, 20 May 2024 17:10:55 +0300 Subject: [PATCH] RED-8882 - moved help mode dialog preference into iqser-user-preferences.service --- .../screens/preferences/preferences.component.ts | 10 +++++----- apps/red-ui/src/app/users/user-preference.service.ts | 10 ---------- libs/common-ui | 2 +- 3 files changed, 6 insertions(+), 16 deletions(-) diff --git a/apps/red-ui/src/app/modules/account/screens/preferences/preferences.component.ts b/apps/red-ui/src/app/modules/account/screens/preferences/preferences.component.ts index b09e2163b..c33a60f26 100644 --- a/apps/red-ui/src/app/modules/account/screens/preferences/preferences.component.ts +++ b/apps/red-ui/src/app/modules/account/screens/preferences/preferences.component.ts @@ -1,7 +1,7 @@ import { ChangeDetectionStrategy, ChangeDetectorRef, Component, OnInit } from '@angular/core'; import { FormBuilder, FormGroup } from '@angular/forms'; import { ActivatedRoute } from '@angular/router'; -import { BaseFormComponent, getConfig, IqserPermissionsService, isIqserDevMode, LoadingService } from '@iqser/common-ui'; +import { BaseFormComponent, getConfig, IqserPermissionsService, isIqserDevMode, KEYS, LoadingService } from '@iqser/common-ui'; import { AsControl } from '@iqser/common-ui/lib/utils'; import { Roles } from '@users/roles'; import { PreferencesKeys, UserPreferenceService } from '@users/user-preference.service'; @@ -56,7 +56,7 @@ export class PreferencesComponent extends BaseFormComponent implements OnInit { tableExtractionType: [this.userPreferenceService.getTableExtractionType()], // warnings preferences loadAllAnnotationsWarning: [this.userPreferenceService.getBool(PreferencesKeys.loadAllAnnotationsWarning)], - helpModeDialog: [this.userPreferenceService.getBool(PreferencesKeys.helpModeDialog)], + helpModeDialog: [this.userPreferenceService.getBool(KEYS.helpModeDialog)], }); if (!this._permissionsService.has(Roles.managePreferences)) { @@ -97,8 +97,8 @@ export class PreferencesComponent extends BaseFormComponent implements OnInit { ); } - if (this.form.controls.helpModeDialog.value !== this.userPreferenceService.getBool(PreferencesKeys.helpModeDialog)) { - await this.userPreferenceService.save(PreferencesKeys.helpModeDialog, String(this.form.controls.helpModeDialog.value)); + if (this.form.controls.helpModeDialog.value !== this.userPreferenceService.getBool(KEYS.helpModeDialog)) { + await this.userPreferenceService.save(KEYS.helpModeDialog, String(this.form.controls.helpModeDialog.value)); } await this.userPreferenceService.reload(); @@ -114,7 +114,7 @@ export class PreferencesComponent extends BaseFormComponent implements OnInit { openScmDialogByDefault: this.userPreferenceService.getOpenScmDialogByDefault(), tableExtractionType: this.userPreferenceService.getTableExtractionType(), loadAllAnnotationsWarning: this.userPreferenceService.getBool(PreferencesKeys.loadAllAnnotationsWarning), - helpModeDialog: this.userPreferenceService.getBool(PreferencesKeys.helpModeDialog), + helpModeDialog: this.userPreferenceService.getBool(KEYS.helpModeDialog), }); } } diff --git a/apps/red-ui/src/app/users/user-preference.service.ts b/apps/red-ui/src/app/users/user-preference.service.ts index bf55347b7..6f2f85211 100644 --- a/apps/red-ui/src/app/users/user-preference.service.ts +++ b/apps/red-ui/src/app/users/user-preference.service.ts @@ -22,7 +22,6 @@ export const PreferencesKeys = { removeRedactionDefaultExtraOption: 'Remove-Redaction-Default-Extra', removeRecommendationDefaultExtraOption: 'Remove-Recommendation-Default-Extra', removeHintDefaultExtraOption: 'Remove-Hint-Default-Extra', - helpModeDialog: 'Help-Mode-Dialog', } as const; @Injectable({ @@ -180,13 +179,4 @@ export class UserPreferenceService extends IqserUserPreferenceService { async saveRemoveRecommendationDefaultExtraOption(defaultOption: boolean | string): Promise { await this.save(PreferencesKeys.removeRecommendationDefaultExtraOption, defaultOption.toString()); } - - getHelpModeDialog(): boolean { - return this._getAttribute(PreferencesKeys.helpModeDialog, 'false') === 'true'; - } - - async toggleHelpModeDialog(): Promise { - const nextValue = (!this.getHelpModeDialog()).toString(); - await this.save(PreferencesKeys.helpModeDialog, nextValue); - } } diff --git a/libs/common-ui b/libs/common-ui index 848e46cf6..174d77d2e 160000 --- a/libs/common-ui +++ b/libs/common-ui @@ -1 +1 @@ -Subproject commit 848e46cf6abc9cafbca5158540e34c65e8dde73d +Subproject commit 174d77d2eaedb17b2e729efdc29a07e7942e46e5