diff --git a/apps/red-ui/src/app/app.module.ts b/apps/red-ui/src/app/app.module.ts index b2224da4e..d48a71def 100644 --- a/apps/red-ui/src/app/app.module.ts +++ b/apps/red-ui/src/app/app.module.ts @@ -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, diff --git a/apps/red-ui/src/app/common/hidden-action/hidden-action.component.html b/apps/red-ui/src/app/common/hidden-action/hidden-action.component.html new file mode 100644 index 000000000..a10177834 --- /dev/null +++ b/apps/red-ui/src/app/common/hidden-action/hidden-action.component.html @@ -0,0 +1,3 @@ +
+ +
diff --git a/apps/red-ui/src/app/common/hidden-action/hidden-action.component.scss b/apps/red-ui/src/app/common/hidden-action/hidden-action.component.scss new file mode 100644 index 000000000..e69de29bb diff --git a/apps/red-ui/src/app/common/hidden-action/hidden-action.component.ts b/apps/red-ui/src/app/common/hidden-action/hidden-action.component.ts new file mode 100644 index 000000000..91a7667db --- /dev/null +++ b/apps/red-ui/src/app/common/hidden-action/hidden-action.component.ts @@ -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); + } +} diff --git a/apps/red-ui/src/app/common/service/user-preference.service.ts b/apps/red-ui/src/app/common/service/user-preference.service.ts new file mode 100644 index 000000000..f092492ef --- /dev/null +++ b/apps/red-ui/src/app/common/service/user-preference.service.ts @@ -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(); + } +} diff --git a/apps/red-ui/src/app/screens/file/file-preview-screen/file-preview-screen.component.html b/apps/red-ui/src/app/screens/file/file-preview-screen/file-preview-screen.component.html index 19b508bf5..4f54bd33c 100644 --- a/apps/red-ui/src/app/screens/file/file-preview-screen/file-preview-screen.component.html +++ b/apps/red-ui/src/app/screens/file/file-preview-screen/file-preview-screen.component.html @@ -39,13 +39,19 @@
-
- -
+ +
+ +
+
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); diff --git a/apps/red-ui/src/app/screens/file/model/file-data.model.ts b/apps/red-ui/src/app/screens/file/model/file-data.model.ts index 2dbb5c79f..e3d264939 100644 --- a/apps/red-ui/src/app/screens/file/model/file-data.model.ts +++ b/apps/red-ui/src/app/screens/file/model/file-data.model.ts @@ -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 {