Merge branch 'VM/RED-8882' into 'master'

RED-8882 - moved help mode dialog preference into iqser-user-preferences.service

Closes RED-8882

See merge request redactmanager/red-ui!427
This commit is contained in:
Nicoleta Panaghiu 2024-05-20 16:13:31 +02:00
commit cfde7dc6a8
3 changed files with 6 additions and 16 deletions

View File

@ -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),
});
}
}

View File

@ -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<void> {
await this.save(PreferencesKeys.removeRecommendationDefaultExtraOption, defaultOption.toString());
}
getHelpModeDialog(): boolean {
return this._getAttribute(PreferencesKeys.helpModeDialog, 'false') === 'true';
}
async toggleHelpModeDialog(): Promise<void> {
const nextValue = (!this.getHelpModeDialog()).toString();
await this.save(PreferencesKeys.helpModeDialog, nextValue);
}
}

@ -1 +1 @@
Subproject commit 848e46cf6abc9cafbca5158540e34c65e8dde73d
Subproject commit 174d77d2eaedb17b2e729efdc29a07e7942e46e5