added hidden action component wrapper and ability to hide ignore annotations
This commit is contained in:
parent
9c6288a75d
commit
f1786d7283
@ -78,6 +78,7 @@ import { TypeFilterComponent } from './components/type-filter/type-filter.compon
|
||||
import { DictionaryAnnotationIconComponent } from './components/dictionary-annotation-icon/dictionary-annotation-icon.component';
|
||||
import { BulkActionsComponent } from './screens/project-overview-screen/bulk-actions/bulk-actions.component';
|
||||
import { HttpCacheInterceptor } from '@redaction/red-cache';
|
||||
import { HiddenActionComponent } from './common/hidden-action/hidden-action.component';
|
||||
|
||||
export function HttpLoaderFactory(httpClient: HttpClient) {
|
||||
return new TranslateHttpLoader(httpClient, '/assets/i18n/', '.json');
|
||||
@ -123,7 +124,8 @@ export function HttpLoaderFactory(httpClient: HttpClient) {
|
||||
TypeFilterComponent,
|
||||
DictionaryAnnotationIconComponent,
|
||||
BulkActionsComponent,
|
||||
FileActionsComponent
|
||||
FileActionsComponent,
|
||||
HiddenActionComponent
|
||||
],
|
||||
imports: [
|
||||
BrowserModule,
|
||||
|
||||
@ -0,0 +1,3 @@
|
||||
<div (click)="countActions()">
|
||||
<ng-content></ng-content>
|
||||
</div>
|
||||
@ -0,0 +1,26 @@
|
||||
import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
|
||||
|
||||
@Component({
|
||||
selector: 'redaction-hidden-action',
|
||||
templateUrl: './hidden-action.component.html',
|
||||
styleUrls: ['./hidden-action.component.scss']
|
||||
})
|
||||
export class HiddenActionComponent implements OnInit {
|
||||
private _clickCount = 0;
|
||||
private _clickCountTimeout: any;
|
||||
|
||||
@Input() requiredClicks: number = 7;
|
||||
@Output() action = new EventEmitter();
|
||||
|
||||
countActions() {
|
||||
this._clickCount += 1;
|
||||
if (this._clickCount === this.requiredClicks) {
|
||||
this._clickCount = 0;
|
||||
this.action.emit();
|
||||
}
|
||||
clearTimeout(this._clickCountTimeout);
|
||||
this._clickCountTimeout = setTimeout(() => {
|
||||
this._clickCount = 0;
|
||||
}, 10000);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,19 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class UserPreferenceService {
|
||||
get areIgnoredAnnotationsEnabled() {
|
||||
const value = sessionStorage.getItem('redaction.enable-ignore-annotations');
|
||||
if (value) {
|
||||
return value === 'true';
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public toggleIgnoredAnnotationsEnabled() {
|
||||
sessionStorage.setItem('redaction.enable-ignore-annotations', `${!this.areIgnoredAnnotationsEnabled}`);
|
||||
window.location.reload();
|
||||
}
|
||||
}
|
||||
@ -39,13 +39,19 @@
|
||||
</div>
|
||||
|
||||
<div class="right-fixed-container">
|
||||
<div class="right-title heading" translate="file-preview.tabs.annotations.label">
|
||||
<redaction-filter
|
||||
(filtersChanged)="filtersChanged($event)"
|
||||
[filterTemplate]="annotationFilterTemplate"
|
||||
[filters]="annotationFilters"
|
||||
></redaction-filter>
|
||||
</div>
|
||||
<redaction-hidden-action (action)="userPreferenceService.toggleIgnoredAnnotationsEnabled()">
|
||||
<div
|
||||
class="right-title heading"
|
||||
translate="file-preview.tabs.annotations.label"
|
||||
[class.primary]="userPreferenceService.areIgnoredAnnotationsEnabled"
|
||||
>
|
||||
<redaction-filter
|
||||
(filtersChanged)="filtersChanged($event)"
|
||||
[filterTemplate]="annotationFilterTemplate"
|
||||
[filters]="annotationFilters"
|
||||
></redaction-filter>
|
||||
</div>
|
||||
</redaction-hidden-action>
|
||||
|
||||
<div class="right-content">
|
||||
<div
|
||||
|
||||
@ -24,6 +24,7 @@ import { FileStatusWrapper } from '../model/file-status.wrapper';
|
||||
import { PermissionsService } from '../../../common/service/permissions.service';
|
||||
import { Subscription, timer } from 'rxjs';
|
||||
import { processFilters } from '../../../common/filter/utils/filter-utils';
|
||||
import { UserPreferenceService } from '../../../common/service/user-preference.service';
|
||||
|
||||
const KEY_ARRAY = ['ArrowLeft', 'ArrowRight', 'ArrowUp', 'ArrowDown'];
|
||||
|
||||
@ -58,6 +59,7 @@ export class FilePreviewScreenComponent implements OnInit, OnDestroy {
|
||||
constructor(
|
||||
public readonly appStateService: AppStateService,
|
||||
public readonly permissionsService: PermissionsService,
|
||||
public readonly userPreferenceService: UserPreferenceService,
|
||||
private readonly _changeDetectorRef: ChangeDetectorRef,
|
||||
private readonly _activatedRoute: ActivatedRoute,
|
||||
private readonly _dialogService: DialogService,
|
||||
@ -160,7 +162,11 @@ export class FilePreviewScreenComponent implements OnInit, OnDestroy {
|
||||
const existingAnnotations = this.annotations.map((a) => this.activeViewer.annotManager.getAnnotationById(a.id));
|
||||
this.activeViewer.annotManager.deleteAnnotations(existingAnnotations, true, true);
|
||||
}
|
||||
this.annotations = this.fileData.getAnnotations(this.appStateService.dictionaryData, this.permissionsService.currentUser);
|
||||
this.annotations = this.fileData.getAnnotations(
|
||||
this.appStateService.dictionaryData,
|
||||
this.permissionsService.currentUser,
|
||||
this.userPreferenceService.areIgnoredAnnotationsEnabled
|
||||
);
|
||||
const annotationFilters = this._annotationProcessingService.getAnnotationFilter(this.annotations);
|
||||
this.annotationFilters = processFilters(this.annotationFilters, annotationFilters);
|
||||
this.filtersChanged(this.annotationFilters);
|
||||
|
||||
@ -25,7 +25,7 @@ export class FileDataModel {
|
||||
return this.redactionLog.redactionLogEntry;
|
||||
}
|
||||
|
||||
getAnnotations(dictionaryData: { [p: string]: TypeValue }, currentUser: UserWrapper): AnnotationWrapper[] {
|
||||
getAnnotations(dictionaryData: { [p: string]: TypeValue }, currentUser: UserWrapper, areIgnoreAnnotationsEnabled: boolean): AnnotationWrapper[] {
|
||||
const annotations = [];
|
||||
|
||||
const pairs: AnnotationPair[] = this._createPairs();
|
||||
@ -41,6 +41,10 @@ export class FileDataModel {
|
||||
pair.comments
|
||||
);
|
||||
if (annotation) {
|
||||
if (annotation.isIgnored && !areIgnoreAnnotationsEnabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (annotation.isReadyForAnalysis && annotation.isApproved) {
|
||||
//
|
||||
} else {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user