DM-328, add modal checkbox and preference toggle for opening modal by default for DocuMine.
This commit is contained in:
parent
25cb4abad4
commit
0648f69a2f
@ -6,7 +6,7 @@ import { AccountSideNavComponent } from './account-side-nav/account-side-nav.com
|
||||
import { BaseAccountScreenComponent } from './base-account-screen/base-account-screen-component';
|
||||
import { NotificationPreferencesService } from './services/notification-preferences.service';
|
||||
import { TranslateModule } from '@ngx-translate/core';
|
||||
import { IconButtonComponent, IqserHelpModeModule } from '@iqser/common-ui';
|
||||
import { IconButtonComponent, IqserAllowDirective, IqserHelpModeModule } from '@iqser/common-ui';
|
||||
import { PreferencesComponent } from './screens/preferences/preferences.component';
|
||||
import { SideNavComponent } from '@iqser/common-ui/lib/shared';
|
||||
|
||||
@ -20,6 +20,7 @@ import { SideNavComponent } from '@iqser/common-ui/lib/shared';
|
||||
IqserHelpModeModule,
|
||||
IconButtonComponent,
|
||||
SideNavComponent,
|
||||
IqserAllowDirective,
|
||||
],
|
||||
providers: [NotificationPreferencesService],
|
||||
})
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
<form (submit)="save()" [formGroup]="form">
|
||||
<form [formGroup]="form">
|
||||
<div class="dialog-content">
|
||||
<div *ngIf="currentScreen === screens.WARNING_PREFERENCES" class="content-delimiter"></div>
|
||||
<div class="dialog-content-left">
|
||||
@ -13,6 +13,11 @@
|
||||
{{ 'preferences-screen.form.show-suggestions-in-preview' | translate }}
|
||||
</mat-slide-toggle>
|
||||
</div>
|
||||
<div class="iqser-input-group" *allow="roles.getRss">
|
||||
<mat-slide-toggle color="primary" formControlName="openStructuredComponentManagementDialogByDefault">
|
||||
{{ 'preferences-screen.form.open-structured-view-by-default' | translate }}
|
||||
</mat-slide-toggle>
|
||||
</div>
|
||||
</ng-container>
|
||||
<ng-container *ngIf="currentScreen === screens.WARNING_PREFERENCES">
|
||||
<p class="warnings-subtitle">{{ 'preferences-screen.warnings-subtitle' | translate }}</p>
|
||||
@ -38,7 +43,6 @@
|
||||
(action)="save()"
|
||||
[disabled]="!valid || !changed"
|
||||
[label]="'preferences-screen.actions.save' | translate"
|
||||
[submit]="true"
|
||||
[type]="iconButtonTypes.primary"
|
||||
></iqser-icon-button>
|
||||
</div>
|
||||
|
||||
@ -10,6 +10,7 @@ interface PreferencesForm {
|
||||
// preferences
|
||||
autoExpandFiltersOnActions: boolean;
|
||||
displaySuggestionsInPreview: boolean;
|
||||
openStructuredComponentManagementDialogByDefault: boolean;
|
||||
// warnings preferences
|
||||
unapprovedSuggestionsWarning: boolean;
|
||||
loadAllAnnotationsWarning: boolean;
|
||||
@ -35,6 +36,7 @@ export class PreferencesComponent extends BaseFormComponent {
|
||||
readonly currentScreen: Screen;
|
||||
readonly screens = Screens;
|
||||
initialFormValue: PreferencesForm;
|
||||
readonly roles = Roles;
|
||||
|
||||
constructor(
|
||||
readonly userPreferenceService: UserPreferenceService,
|
||||
@ -48,6 +50,9 @@ export class PreferencesComponent extends BaseFormComponent {
|
||||
// preferences
|
||||
autoExpandFiltersOnActions: [this.userPreferenceService.getAutoExpandFiltersOnActions()],
|
||||
displaySuggestionsInPreview: [this.userPreferenceService.getDisplaySuggestionsInPreview()],
|
||||
openStructuredComponentManagementDialogByDefault: [
|
||||
this.userPreferenceService.getOpenStructuredComponentManagementDialogByDefault(),
|
||||
],
|
||||
// warnings preferences
|
||||
unapprovedSuggestionsWarning: [this.userPreferenceService.getUnapprovedSuggestionsWarning()],
|
||||
loadAllAnnotationsWarning: [this.userPreferenceService.getBool(PreferencesKeys.loadAllAnnotationsWarning)],
|
||||
@ -68,6 +73,12 @@ export class PreferencesComponent extends BaseFormComponent {
|
||||
if (this.form.controls.displaySuggestionsInPreview.value !== this.userPreferenceService.getDisplaySuggestionsInPreview()) {
|
||||
await this.userPreferenceService.toggleDisplaySuggestionsInPreview();
|
||||
}
|
||||
if (
|
||||
this.form.controls.openStructuredComponentManagementDialogByDefault.value !==
|
||||
this.userPreferenceService.getOpenStructuredComponentManagementDialogByDefault()
|
||||
) {
|
||||
await this.userPreferenceService.toggleOpenStructuredComponentManagementDialogByDefault();
|
||||
}
|
||||
if (this.form.controls.unapprovedSuggestionsWarning.value !== this.userPreferenceService.getUnapprovedSuggestionsWarning()) {
|
||||
await this.userPreferenceService.toggleUnapprovedSuggestionsWarning();
|
||||
}
|
||||
@ -83,12 +94,20 @@ export class PreferencesComponent extends BaseFormComponent {
|
||||
}
|
||||
|
||||
await this.userPreferenceService.reload();
|
||||
this.form.patchValue({
|
||||
autoExpandFiltersOnActions: this.userPreferenceService.getAutoExpandFiltersOnActions(),
|
||||
displaySuggestionsInPreview: this.userPreferenceService.getDisplaySuggestionsInPreview(),
|
||||
unapprovedSuggestionsWarning: this.userPreferenceService.getUnapprovedSuggestionsWarning(),
|
||||
});
|
||||
this.#patchValues();
|
||||
|
||||
this.initialFormValue = this.form.getRawValue();
|
||||
this._changeRef.markForCheck();
|
||||
}
|
||||
|
||||
#patchValues() {
|
||||
this.form.patchValue({
|
||||
autoExpandFiltersOnActions: this.userPreferenceService.getAutoExpandFiltersOnActions(),
|
||||
displaySuggestionsInPreview: this.userPreferenceService.getDisplaySuggestionsInPreview(),
|
||||
openStructuredComponentManagementDialogByDefault:
|
||||
this.userPreferenceService.getOpenStructuredComponentManagementDialogByDefault(),
|
||||
unapprovedSuggestionsWarning: this.userPreferenceService.getUnapprovedSuggestionsWarning(),
|
||||
loadAllAnnotationsWarning: this.userPreferenceService.getBool(PreferencesKeys.loadAllAnnotationsWarning),
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@ -80,6 +80,13 @@
|
||||
></iqser-icon-button>
|
||||
|
||||
<div [translate]="'rss-dialog.actions.close'" class="all-caps-label cancel" mat-dialog-close></div>
|
||||
<mat-checkbox
|
||||
class="ml-auto"
|
||||
color="primary"
|
||||
(change)="toggleOpenStructuredComponentManagementDialogByDefault()"
|
||||
[checked]="openStructuredComponentManagementDialogByDefault()"
|
||||
>Display by default when opening documents</mat-checkbox
|
||||
>
|
||||
</div>
|
||||
|
||||
<iqser-circle-button (action)="close()" class="dialog-close" icon="iqser:close"></iqser-circle-button>
|
||||
|
||||
@ -63,3 +63,7 @@ ul {
|
||||
.output-data > div:nth-child(8n + 12) {
|
||||
background: var(--iqser-grey-8);
|
||||
}
|
||||
|
||||
.ml-auto {
|
||||
margin-left: auto;
|
||||
}
|
||||
|
||||
@ -17,8 +17,10 @@ interface RssData {
|
||||
})
|
||||
export class RssDialogComponent extends BaseDialogComponent implements OnInit {
|
||||
readonly circleButtonTypes = CircleButtonTypes;
|
||||
|
||||
readonly rssData = signal<RssEntry | undefined>(undefined);
|
||||
readonly openStructuredComponentManagementDialogByDefault = signal(
|
||||
this.userPreferences.getOpenStructuredComponentManagementDialogByDefault(),
|
||||
);
|
||||
|
||||
constructor(
|
||||
protected readonly _dialogRef: MatDialogRef<RssDialogComponent>,
|
||||
@ -56,6 +58,14 @@ export class RssDialogComponent extends BaseDialogComponent implements OnInit {
|
||||
return this.exportJSON();
|
||||
}
|
||||
|
||||
async toggleOpenStructuredComponentManagementDialogByDefault() {
|
||||
await this.userPreferences.toggleOpenStructuredComponentManagementDialogByDefault();
|
||||
await this.userPreferences.reload();
|
||||
this.openStructuredComponentManagementDialogByDefault.set(
|
||||
this.userPreferences.getOpenStructuredComponentManagementDialogByDefault(),
|
||||
);
|
||||
}
|
||||
|
||||
async undo(originalKey: string) {
|
||||
this._loadingService.start();
|
||||
await firstValueFrom(this._rssService.revertOverride(this.data.file.dossierId, this.data.file.fileId, [originalKey]));
|
||||
|
||||
@ -317,6 +317,8 @@ export class FilePreviewScreenComponent
|
||||
this.pdfProxyService.configureElements();
|
||||
this.#restoreOldFilters();
|
||||
document.documentElement.addEventListener('fullscreenchange', this.fullscreenListener);
|
||||
|
||||
this.#openRssDialogIfDefault();
|
||||
}
|
||||
|
||||
ngAfterViewInit() {
|
||||
@ -831,4 +833,13 @@ export class FilePreviewScreenComponent
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
#openRssDialogIfDefault() {
|
||||
if (
|
||||
this.permissionsService.canViewRssDialog() &&
|
||||
this.userPreferenceService.getOpenStructuredComponentManagementDialogByDefault()
|
||||
) {
|
||||
this.openRSSView();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -354,6 +354,10 @@ export class PermissionsService {
|
||||
return this._iqserPermissionsService.has(Roles.rules.write) && this.isAdmin();
|
||||
}
|
||||
|
||||
canViewRssDialog() {
|
||||
return this._iqserPermissionsService.has(Roles.getRss);
|
||||
}
|
||||
|
||||
#canDeleteEntity(entity: Dictionary): boolean {
|
||||
return !entity.systemManaged;
|
||||
}
|
||||
|
||||
@ -10,6 +10,7 @@ export const PreferencesKeys = {
|
||||
displaySuggestionsInPreview: 'Display-Suggestions-In-Preview',
|
||||
unapprovedSuggestionsWarning: 'Unapproved-Suggestions-Warning',
|
||||
loadAllAnnotationsWarning: 'Load-All-Annotations-Warning',
|
||||
openStructuredComponentManagementDialogByDefault: 'Open-Structured-Component-Management-By-Default',
|
||||
} as const;
|
||||
|
||||
@Injectable({
|
||||
@ -53,6 +54,15 @@ export class UserPreferenceService extends IqserUserPreferenceService {
|
||||
await this.save(PreferencesKeys.autoExpandFiltersOnActions, nextValue);
|
||||
}
|
||||
|
||||
getOpenStructuredComponentManagementDialogByDefault(): boolean {
|
||||
return this._getAttribute(PreferencesKeys.openStructuredComponentManagementDialogByDefault, 'false') === 'true';
|
||||
}
|
||||
|
||||
async toggleOpenStructuredComponentManagementDialogByDefault(): Promise<void> {
|
||||
const nextValue = (!this.getOpenStructuredComponentManagementDialogByDefault()).toString();
|
||||
await this.save(PreferencesKeys.openStructuredComponentManagementDialogByDefault, nextValue);
|
||||
}
|
||||
|
||||
getDisplaySuggestionsInPreview(): boolean {
|
||||
return this._getAttribute(PreferencesKeys.displaySuggestionsInPreview, 'false') === 'true';
|
||||
}
|
||||
|
||||
@ -1860,6 +1860,7 @@
|
||||
"form": {
|
||||
"auto-expand-filters-on-action": "",
|
||||
"load-all-annotations-warning": "",
|
||||
"open-structured-view-by-default": "",
|
||||
"show-suggestions-in-preview": "",
|
||||
"unapproved-suggestions-warning": ""
|
||||
},
|
||||
|
||||
@ -1860,6 +1860,7 @@
|
||||
"form": {
|
||||
"auto-expand-filters-on-action": "Auto-expand filters on my actions",
|
||||
"load-all-annotations-warning": "Warning regarding loading all annotations at once in file preview",
|
||||
"open-structured-view-by-default": "Display structured component management modal by default",
|
||||
"show-suggestions-in-preview": "Display suggestions in document preview",
|
||||
"unapproved-suggestions-warning": "Warning regarding unapproved suggestions in document Preview mode"
|
||||
},
|
||||
|
||||
@ -1860,6 +1860,7 @@
|
||||
"form": {
|
||||
"auto-expand-filters-on-action": "",
|
||||
"load-all-annotations-warning": "",
|
||||
"open-structured-view-by-default": "",
|
||||
"show-suggestions-in-preview": "",
|
||||
"unapproved-suggestions-warning": ""
|
||||
},
|
||||
|
||||
@ -1860,6 +1860,7 @@
|
||||
"form": {
|
||||
"auto-expand-filters-on-action": "Auto expand filters on my actions",
|
||||
"load-all-annotations-warning": "Warning regarding loading all annotations at once in file preview",
|
||||
"open-structured-view-by-default": "Display structured component management modal by default",
|
||||
"show-suggestions-in-preview": "Display suggestions in document preview",
|
||||
"unapproved-suggestions-warning": "Warning regarding unapproved suggestions in document Preview mode"
|
||||
},
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user