RED-5401 - Admin option to show suggestions in preview
This commit is contained in:
parent
2591d3a874
commit
8586e66fb1
@ -6,6 +6,11 @@
|
||||
{{ 'preferences-screen.form.auto-expand-filters-on-action' | translate }}
|
||||
</mat-slide-toggle>
|
||||
</div>
|
||||
<div class="iqser-input-group">
|
||||
<mat-slide-toggle color="primary" formControlName="showSuggestionsInPreview">
|
||||
{{ 'preferences-screen.form.show-suggestions-in-preview' | translate }}
|
||||
</mat-slide-toggle>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@ -5,6 +5,7 @@ import { BaseFormComponent } from '@iqser/common-ui';
|
||||
|
||||
interface PreferencesForm {
|
||||
autoExpandFiltersOnActions: boolean;
|
||||
showSuggestionsInPreview: boolean;
|
||||
|
||||
[k: string]: any;
|
||||
}
|
||||
@ -25,6 +26,7 @@ export class PreferencesComponent extends BaseFormComponent {
|
||||
super();
|
||||
this.form = this._formBuilder.group({
|
||||
autoExpandFiltersOnActions: [this.userPreferenceService.getAutoExpandFiltersOnActions()],
|
||||
showSuggestionsInPreview: [this.userPreferenceService.getShowSuggestionsInPreview()],
|
||||
});
|
||||
this.initialFormValue = this.form.getRawValue();
|
||||
}
|
||||
@ -33,6 +35,9 @@ export class PreferencesComponent extends BaseFormComponent {
|
||||
if (this.form.controls.autoExpandFiltersOnActions.value !== this.userPreferenceService.getAutoExpandFiltersOnActions()) {
|
||||
await this.userPreferenceService.toggleAutoExpandFiltersOnActions();
|
||||
}
|
||||
if (this.form.controls.showSuggestionsInPreview.value !== this.userPreferenceService.getShowSuggestionsInPreview()) {
|
||||
await this.userPreferenceService.toggleShowSuggestionsInPreview();
|
||||
}
|
||||
await this.userPreferenceService.reload();
|
||||
this.form.patchValue({ autoExpandFiltersOnActions: this.userPreferenceService.getAutoExpandFiltersOnActions() });
|
||||
this.initialFormValue = this.form.getRawValue();
|
||||
|
||||
@ -39,6 +39,7 @@ import { PdfViewer } from '../../../pdf-viewer/services/pdf-viewer.service';
|
||||
import { REDAnnotationManager } from '../../../pdf-viewer/services/annotation-manager.service';
|
||||
import { AnnotationsListingService } from '../../services/annotations-listing.service';
|
||||
import { REDDocumentViewer } from '../../../pdf-viewer/services/document-viewer.service';
|
||||
import { UserPreferenceService } from '@users/user-preference.service';
|
||||
|
||||
const COMMAND_KEY_ARRAY = ['ArrowLeft', 'ArrowRight', 'ArrowUp', 'ArrowDown', 'Escape'];
|
||||
const ALL_HOTKEY_ARRAY = ['ArrowLeft', 'ArrowRight', 'ArrowUp', 'ArrowDown'];
|
||||
@ -83,6 +84,8 @@ export class FileWorkloadComponent extends AutoUnsubscribe implements OnDestroy
|
||||
readonly excludedPagesService: ExcludedPagesService,
|
||||
private readonly _changeDetectorRef: ChangeDetectorRef,
|
||||
private readonly _annotationProcessingService: AnnotationProcessingService,
|
||||
private readonly _viewModeService: ViewModeService,
|
||||
private readonly _userPreferencesService: UserPreferenceService,
|
||||
) {
|
||||
super();
|
||||
|
||||
@ -380,6 +383,10 @@ export class FileWorkloadComponent extends AutoUnsubscribe implements OnDestroy
|
||||
return;
|
||||
}
|
||||
|
||||
if (this._viewModeService.isRedacted && !this._userPreferencesService.getShowSuggestionsInPreview()) {
|
||||
annotations = annotations.filter(a => !a.isSuggestion);
|
||||
}
|
||||
|
||||
this.displayedAnnotations = this._annotationProcessingService.filterAndGroupAnnotations(annotations, primary, secondary);
|
||||
const pagesThatDisplayAnnotations = [...this.displayedAnnotations.keys()];
|
||||
const enabledFilters = this.filterService.enabledFlatFilters;
|
||||
|
||||
@ -250,6 +250,11 @@ export class FilePreviewScreenComponent
|
||||
|
||||
this._annotationManager.show(redactions);
|
||||
this._annotationManager.hide(nonRedactionEntries);
|
||||
|
||||
if (!this.userPreferenceService.getShowSuggestionsInPreview()) {
|
||||
const suggestions = redactions.filter(a => bool(a.getCustomData('suggestion')));
|
||||
this._annotationManager.hide(suggestions);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case ViewModes.TEXT_HIGHLIGHTS: {
|
||||
|
||||
@ -152,6 +152,7 @@ export class AnnotationDrawService {
|
||||
this._annotationManager.isHidden(annotationWrapper.annotationId);
|
||||
annotation.setCustomData('redact-manager', 'true');
|
||||
annotation.setCustomData('redaction', String(annotationWrapper.previewAnnotation));
|
||||
annotation.setCustomData('suggestion', String(annotationWrapper.isSuggestion));
|
||||
annotation.setCustomData('skipped', String(annotationWrapper.isSkipped));
|
||||
annotation.setCustomData('changeLog', String(annotationWrapper.isChangeLogEntry));
|
||||
annotation.setCustomData('changeLogRemoved', String(annotationWrapper.isChangeLogRemoved));
|
||||
|
||||
@ -7,6 +7,7 @@ const KEYS = {
|
||||
lastDossierTemplate: 'Last-Dossier-Template',
|
||||
filesListingMode: 'Files-Listing-Mode',
|
||||
autoExpandFiltersOnActions: 'Auto-Expand-Filters-On-Actions',
|
||||
showSuggestionsInPreview: 'Show-Suggestions-In-Preview',
|
||||
} as const;
|
||||
|
||||
@Injectable({
|
||||
@ -50,6 +51,14 @@ export class UserPreferenceService extends IqserUserPreferenceService {
|
||||
await this._save(KEYS.autoExpandFiltersOnActions, nextValue);
|
||||
}
|
||||
|
||||
getShowSuggestionsInPreview(): boolean {
|
||||
return this._getAttribute(KEYS.showSuggestionsInPreview, 'false') === 'true';
|
||||
}
|
||||
async toggleShowSuggestionsInPreview(): Promise<void> {
|
||||
const nexValue = (!this.getShowSuggestionsInPreview()).toString();
|
||||
await this._save(KEYS.showSuggestionsInPreview, nexValue);
|
||||
}
|
||||
|
||||
getFilesListingMode(): ListingMode {
|
||||
return this._getAttribute(KEYS.filesListingMode) as ListingMode;
|
||||
}
|
||||
|
||||
@ -1798,7 +1798,8 @@
|
||||
"save": ""
|
||||
},
|
||||
"form": {
|
||||
"auto-expand-filters-on-action": ""
|
||||
"auto-expand-filters-on-action": "",
|
||||
"show-suggestions-in-preview": ""
|
||||
},
|
||||
"label": "",
|
||||
"title": ""
|
||||
|
||||
@ -1799,7 +1799,8 @@
|
||||
"save": "Save changes"
|
||||
},
|
||||
"form": {
|
||||
"auto-expand-filters-on-action": "Auto expand filters on my actions"
|
||||
"auto-expand-filters-on-action": "Auto expand filters on my actions",
|
||||
"show-suggestions-in-preview": "Show suggestions in preview"
|
||||
},
|
||||
"label": "Preferences",
|
||||
"title": "Edit preferences"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user