add redaction log service
This commit is contained in:
parent
9d7797e280
commit
df5dc1c30e
@ -1,11 +1,12 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Core, WebViewerInstance } from '@pdftron/webviewer';
|
||||
import { Rectangle, RedactionLogControllerService, SectionGrid, SectionRectangle } from '@redaction/red-ui-http';
|
||||
import { Rectangle, SectionGrid, SectionRectangle } from '@redaction/red-ui-http';
|
||||
import { hexToRgb } from '@utils/functions';
|
||||
import { AppStateService } from '@state/app-state.service';
|
||||
import { AnnotationWrapper } from '@models/file/annotation.wrapper';
|
||||
import { UserPreferenceService } from '@services/user-preference.service';
|
||||
import { DossiersService } from '@services/entity-services/dossiers.service';
|
||||
import { RedactionLogService } from './redaction-log.service';
|
||||
import Annotation = Core.Annotations.Annotation;
|
||||
|
||||
@Injectable()
|
||||
@ -13,7 +14,7 @@ export class AnnotationDrawService {
|
||||
constructor(
|
||||
private readonly _appStateService: AppStateService,
|
||||
private readonly _dossiersService: DossiersService,
|
||||
private readonly _redactionLogControllerService: RedactionLogControllerService,
|
||||
private readonly _redactionLogService: RedactionLogService,
|
||||
private readonly _userPreferenceService: UserPreferenceService,
|
||||
) {}
|
||||
|
||||
@ -29,7 +30,7 @@ export class AnnotationDrawService {
|
||||
annotationManager.drawAnnotationsFromList(annotations);
|
||||
|
||||
if (this._userPreferenceService.areDevFeaturesEnabled) {
|
||||
this._redactionLogControllerService
|
||||
this._redactionLogService
|
||||
.getSectionGrid(this._dossiersService.activeDossierId, this._appStateService.activeFileId)
|
||||
.subscribe(sectionGrid => {
|
||||
this._drawSections(activeViewer, sectionGrid);
|
||||
|
||||
@ -1,13 +1,14 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { forkJoin, Observable, of } from 'rxjs';
|
||||
import { catchError, map, tap } from 'rxjs/operators';
|
||||
import { RedactionLogControllerService, ViewedPagesControllerService } from '@redaction/red-ui-http';
|
||||
import { ViewedPagesControllerService } from '@redaction/red-ui-http';
|
||||
import { FileDataModel } from '@models/file/file-data.model';
|
||||
import { AppStateService } from '@state/app-state.service';
|
||||
import { PermissionsService } from '@services/permissions.service';
|
||||
import { File } from '@models/file/file';
|
||||
import { DossiersService } from '@services/entity-services/dossiers.service';
|
||||
import { FileManagementService } from '../shared/services/file-management.service';
|
||||
import { RedactionLogService } from './redaction-log.service';
|
||||
|
||||
@Injectable()
|
||||
export class PdfViewerDataService {
|
||||
@ -16,19 +17,17 @@ export class PdfViewerDataService {
|
||||
private readonly _dossiersService: DossiersService,
|
||||
private readonly _permissionsService: PermissionsService,
|
||||
private readonly _fileManagementService: FileManagementService,
|
||||
private readonly _redactionLogControllerService: RedactionLogControllerService,
|
||||
private readonly _redactionLogService: RedactionLogService,
|
||||
private readonly _viewedPagesControllerService: ViewedPagesControllerService,
|
||||
) {}
|
||||
|
||||
loadActiveFileRedactionLog() {
|
||||
return this._redactionLogControllerService
|
||||
.getRedactionLog(this._dossiersService.activeDossierId, this._appStateService.activeFileId)
|
||||
.pipe(
|
||||
tap(
|
||||
redactionLog => redactionLog.redactionLogEntry.sort((a, b) => a.positions[0].page - b.positions[0].page),
|
||||
catchError(() => of({})),
|
||||
),
|
||||
);
|
||||
return this._redactionLogService.getRedactionLog(this._dossiersService.activeDossierId, this._appStateService.activeFileId).pipe(
|
||||
tap(
|
||||
redactionLog => redactionLog.redactionLogEntry.sort((a, b) => a.positions[0].page - b.positions[0].page),
|
||||
catchError(() => of({})),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
loadActiveFileData(): Observable<FileDataModel> {
|
||||
|
||||
@ -0,0 +1,27 @@
|
||||
import { Injectable, Injector } from '@angular/core';
|
||||
import { GenericService, QueryParam, RequiredParam, Validate } from '@iqser/common-ui';
|
||||
import { RedactionLog, SectionGrid } from '@redaction/red-ui-http';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class RedactionLogService extends GenericService<unknown> {
|
||||
constructor(protected readonly _injector: Injector) {
|
||||
super(_injector, '');
|
||||
}
|
||||
|
||||
@Validate()
|
||||
getRedactionLog(@RequiredParam() dossierId: string, @RequiredParam() fileId: string, withManualRedactions?: boolean) {
|
||||
const queryParams: QueryParam[] = [];
|
||||
if (withManualRedactions) {
|
||||
queryParams.push({ key: 'withManualRedactions', value: withManualRedactions });
|
||||
}
|
||||
|
||||
return this._getOne<RedactionLog>([dossierId, fileId], 'redactionLog', queryParams);
|
||||
}
|
||||
|
||||
@Validate()
|
||||
getSectionGrid(@RequiredParam() dossierId: string, @RequiredParam() fileId: string) {
|
||||
return this._getOne<SectionGrid>([dossierId, fileId], 'sectionGrid');
|
||||
}
|
||||
}
|
||||
@ -1,7 +1,6 @@
|
||||
import { ModuleWithProviders, NgModule, Optional, SkipSelf } from '@angular/core';
|
||||
import { Configuration } from './configuration';
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
import { RedactionLogControllerService } from './api/redactionLogController.service';
|
||||
import { ReportTemplateControllerService } from './api/reportTemplateController.service';
|
||||
import { RulesControllerService } from './api/rulesController.service';
|
||||
import { SmtpConfigurationControllerService } from './api/smtpConfigurationController.service';
|
||||
@ -16,7 +15,6 @@ import { NotificationControllerService } from './api/notificationController.serv
|
||||
declarations: [],
|
||||
exports: [],
|
||||
providers: [
|
||||
RedactionLogControllerService,
|
||||
ReportTemplateControllerService,
|
||||
RulesControllerService,
|
||||
SmtpConfigurationControllerService,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user