manual redaction fixes

This commit is contained in:
Timo 2021-07-23 09:09:16 +03:00
parent ea753f02d6
commit b8df7ab452
6 changed files with 31 additions and 170 deletions

View File

@ -12,10 +12,7 @@ import { DossierWrapper } from '@state/model/dossier.wrapper';
export class NeedsWorkBadgeComponent {
@Input() needsWorkInput: FileStatusWrapper | DossierWrapper;
constructor(
private readonly _appStateService: AppStateService,
private readonly _permissionsService: PermissionsService
) {}
constructor(private readonly _appStateService: AppStateService, private readonly _permissionsService: PermissionsService) {}
get suggestionColor() {
return this._getDictionaryColor('suggestion');
@ -50,10 +47,7 @@ export class NeedsWorkBadgeComponent {
}
get hasAnnotationComments(): boolean {
return (
this.needsWorkInput instanceof FileStatusWrapper &&
(<any>this.needsWorkInput).hasAnnotationComments
);
return this.needsWorkInput instanceof FileStatusWrapper && (<any>this.needsWorkInput).hasAnnotationComments;
}
reanalysisRequired() {
@ -65,11 +59,6 @@ export class NeedsWorkBadgeComponent {
}
private _getDictionaryColor(type: string) {
let dossierTemplateId = null;
if (this.needsWorkInput instanceof DossierWrapper) {
dossierTemplateId = this.needsWorkInput.dossierTemplateId;
}
return this._appStateService.getDictionaryColor(type, dossierTemplateId);
return this._appStateService.getDictionaryColor(type);
}
}

View File

@ -583,7 +583,7 @@ export class FilePreviewScreenComponent extends AutoUnsubscribeComponent impleme
/* Get the documentElement (<html>) to display the page in fullscreen */
private _cleanupAndRedrawManualAnnotations() {
this._fileDownloadService.loadActiveFileRedactionLogPreview().subscribe(redactionLogPreview => {
this._fileDownloadService.loadActiveFileRedactionLog().subscribe(redactionLogPreview => {
this.fileData.redactionLog = redactionLogPreview;
this._annotationDrawService.drawAnnotations(
this._instance,
@ -599,7 +599,7 @@ export class FilePreviewScreenComponent extends AutoUnsubscribeComponent impleme
const currentPageAnnotationIds = currentPageAnnotations.map(a => a.id);
this.fileData.fileStatus = await this.appStateService.reloadActiveFile();
this._fileDownloadService.loadActiveFileRedactionLogPreview().subscribe(redactionLogPreview => {
this._fileDownloadService.loadActiveFileRedactionLog().subscribe(redactionLogPreview => {
this.fileData.redactionLog = redactionLogPreview;
this.rebuildFilters();
if (this.viewMode === 'STANDARD') {

View File

@ -23,8 +23,8 @@ export class PdfViewerDataService {
private readonly _viewedPagesControllerService: ViewedPagesControllerService
) {}
loadActiveFileRedactionLogPreview() {
return this._redactionLogControllerService.getRedactionLogPreview(
loadActiveFileRedactionLog() {
return this._redactionLogControllerService.getRedactionLog(
this._appStateService.activeDossierId,
this._appStateService.activeFileId
);
@ -37,9 +37,7 @@ export class PdfViewerDataService {
this._man.getManualRedaction(dossierId, fileId).subscribe();
const file$ = this.downloadOriginalFile(this._appStateService.activeFile);
const reactionLog$ = this._redactionLogControllerService
.getRedactionLogPreview(dossierId, fileId)
.pipe(catchError(() => of({})));
const reactionLog$ = this._redactionLogControllerService.getRedactionLog(dossierId, fileId).pipe(catchError(() => of({})));
const redactionChangeLog$ = this._redactionLogControllerService
.getRedactionChangeLog(dossierId, fileId)
.pipe(catchError(() => of({})));
@ -53,10 +51,7 @@ export class PdfViewerDataService {
getViewedPagesForActiveFile() {
if (this._permissionsService.canMarkPagesAsViewed()) {
return this._viewedPagesControllerService
.getViewedPages(
this._appStateService.activeDossierId,
this._appStateService.activeFileId
)
.getViewedPages(this._appStateService.activeDossierId, this._appStateService.activeFileId)
.pipe(catchError(() => of({ pages: [] })));
}
return of({ pages: [] });

View File

@ -174,7 +174,7 @@ export class AppStateService {
dossierTemplateId = this.dossierTemplates[0]?.dossierTemplateId;
}
if (!dossierTemplateId) {
return undefined;
return '#cccccc';
}
const color = this._dictionaryData[dossierTemplateId][type]?.hexColor;
return color ?? this._dictionaryData[dossierTemplateId]['default'].hexColor;

View File

@ -1,6 +1,6 @@
{
"OAUTH_URL": "https://red-staging.iqser.cloud/auth/realms/redaction",
"API_URL": "https://red-staging.iqser.cloud/redaction-gateway-v1",
"OAUTH_URL": "https://dev-06.iqser.cloud/auth/realms/redaction",
"API_URL": "https://dev-06.iqser.cloud/redaction-gateway-v1",
"OAUTH_CLIENT_ID": "redaction",
"BACKEND_APP_VERSION": "4.4.40",
"FRONTEND_APP_VERSION": "1.1",

View File

@ -78,15 +78,11 @@ export class RedactionLogControllerService {
reportProgress: boolean = false
): Observable<any> {
if (dossierId === null || dossierId === undefined) {
throw new Error(
'Required parameter dossierId was null or undefined when calling getRedactionLog.'
);
throw new Error('Required parameter dossierId was null or undefined when calling getRedactionLog.');
}
if (fileId === null || fileId === undefined) {
throw new Error(
'Required parameter fileId was null or undefined when calling getRedactionLog.'
);
throw new Error('Required parameter fileId was null or undefined when calling getRedactionLog.');
}
let headers = this.defaultHeaders;
@ -94,25 +90,20 @@ export class RedactionLogControllerService {
// authentication (RED-OAUTH) required
if (this.configuration.accessToken) {
const accessToken =
typeof this.configuration.accessToken === 'function'
? this.configuration.accessToken()
: this.configuration.accessToken;
typeof this.configuration.accessToken === 'function' ? this.configuration.accessToken() : this.configuration.accessToken;
headers = headers.set('Authorization', 'Bearer ' + accessToken);
}
// to determine the Accept header
const httpHeaderAccepts: string[] = ['application/json'];
const httpHeaderAcceptSelected: string | undefined =
this.configuration.selectHeaderAccept(httpHeaderAccepts);
const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts);
if (httpHeaderAcceptSelected !== undefined) {
headers = headers.set('Accept', httpHeaderAcceptSelected);
}
return this.httpClient.request<RedactionChangeLog>(
'get',
`${this.basePath}/redactionChnageLog/${encodeURIComponent(
String(dossierId)
)}/${encodeURIComponent(String(fileId))}`,
`${this.basePath}/redactionChnageLog/${encodeURIComponent(String(dossierId))}/${encodeURIComponent(String(fileId))}`,
{
withCredentials: this.configuration.withCredentials,
headers: headers,
@ -130,12 +121,7 @@ export class RedactionLogControllerService {
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
* @param reportProgress flag to report request and response progress.
*/
public getRedactionLog(
dossierId: string,
fileId: string,
observe?: 'body',
reportProgress?: boolean
): Observable<RedactionLog>;
public getRedactionLog(dossierId: string, fileId: string, observe?: 'body', reportProgress?: boolean): Observable<RedactionLog>;
public getRedactionLog(
dossierId: string,
@ -151,22 +137,13 @@ export class RedactionLogControllerService {
reportProgress?: boolean
): Observable<HttpEvent<RedactionLog>>;
public getRedactionLog(
dossierId: string,
fileId: string,
observe: any = 'body',
reportProgress: boolean = false
): Observable<any> {
public getRedactionLog(dossierId: string, fileId: string, observe: any = 'body', reportProgress: boolean = false): Observable<any> {
if (dossierId === null || dossierId === undefined) {
throw new Error(
'Required parameter dossierId was null or undefined when calling getRedactionLog1.'
);
throw new Error('Required parameter dossierId was null or undefined when calling getRedactionLog1.');
}
if (fileId === null || fileId === undefined) {
throw new Error(
'Required parameter fileId was null or undefined when calling getRedactionLog1.'
);
throw new Error('Required parameter fileId was null or undefined when calling getRedactionLog1.');
}
let headers = this.defaultHeaders;
@ -174,101 +151,20 @@ export class RedactionLogControllerService {
// authentication (RED-OAUTH) required
if (this.configuration.accessToken) {
const accessToken =
typeof this.configuration.accessToken === 'function'
? this.configuration.accessToken()
: this.configuration.accessToken;
typeof this.configuration.accessToken === 'function' ? this.configuration.accessToken() : this.configuration.accessToken;
headers = headers.set('Authorization', 'Bearer ' + accessToken);
}
// to determine the Accept header
const httpHeaderAccepts: string[] = ['application/json'];
const httpHeaderAcceptSelected: string | undefined =
this.configuration.selectHeaderAccept(httpHeaderAccepts);
const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts);
if (httpHeaderAcceptSelected !== undefined) {
headers = headers.set('Accept', httpHeaderAcceptSelected);
}
return this.httpClient.request<RedactionLog>(
'get',
`${this.basePath}/redactionLog/${encodeURIComponent(
String(dossierId)
)}/${encodeURIComponent(String(fileId))}`,
{
withCredentials: this.configuration.withCredentials,
headers: headers,
observe: observe,
reportProgress: reportProgress
}
);
}
/**
* Gets the redaction log preview
* None
* @param dossierId dossierId
* @param fileId fileId
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
* @param reportProgress flag to report request and response progress.
*/
public getRedactionLogPreview(
dossierId: string,
fileId: string,
observe?: 'body',
reportProgress?: boolean
): Observable<RedactionLog>;
public getRedactionLogPreview(
dossierId: string,
fileId: string,
observe?: 'response',
reportProgress?: boolean
): Observable<HttpResponse<RedactionLog>>;
public getRedactionLogPreview(
dossierId: string,
fileId: string,
observe?: 'events',
reportProgress?: boolean
): Observable<HttpEvent<RedactionLog>>;
public getRedactionLogPreview(
dossierId: string,
fileId: string,
observe: any = 'body',
reportProgress: boolean = false
): Observable<any> {
if (dossierId === null || dossierId === undefined) {
throw new Error(
'Required parameter dossierId was null or undefined when calling getRedactionLogPreview.'
);
}
if (fileId === null || fileId === undefined) {
throw new Error(
'Required parameter fileId was null or undefined when calling getRedactionLogPreview.'
);
}
let headers = this.defaultHeaders;
// authentication (RED-OAUTH) required
if (this.configuration.accessToken) {
const accessToken =
typeof this.configuration.accessToken === 'function'
? this.configuration.accessToken()
: this.configuration.accessToken;
headers = headers.set('Authorization', 'Bearer ' + accessToken);
}
// to determine the Accept header
const httpHeaderAccepts: string[] = ['application/json'];
const httpHeaderAcceptSelected: string | undefined =
this.configuration.selectHeaderAccept(httpHeaderAccepts);
if (httpHeaderAcceptSelected !== undefined) {
headers = headers.set('Accept', httpHeaderAcceptSelected);
}
return this.httpClient.request<RedactionLog>(
'get',
`${this.basePath}/sectionGrid/${encodeURIComponent(
String(dossierId)
)}/${encodeURIComponent(String(fileId))}/preview`,
`${this.basePath}/redactionLog/${encodeURIComponent(String(dossierId))}/${encodeURIComponent(String(fileId))}`,
{
withCredentials: this.configuration.withCredentials,
headers: headers,
@ -286,12 +182,7 @@ export class RedactionLogControllerService {
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
* @param reportProgress flag to report request and response progress.
*/
public getSectionGrid(
dossierId: string,
fileId: string,
observe?: 'body',
reportProgress?: boolean
): Observable<SectionGrid>;
public getSectionGrid(dossierId: string, fileId: string, observe?: 'body', reportProgress?: boolean): Observable<SectionGrid>;
public getSectionGrid(
dossierId: string,
@ -307,22 +198,13 @@ export class RedactionLogControllerService {
reportProgress?: boolean
): Observable<HttpEvent<SectionGrid>>;
public getSectionGrid(
dossierId: string,
fileId: string,
observe: any = 'body',
reportProgress: boolean = false
): Observable<any> {
public getSectionGrid(dossierId: string, fileId: string, observe: any = 'body', reportProgress: boolean = false): Observable<any> {
if (dossierId === null || dossierId === undefined) {
throw new Error(
'Required parameter dossierId was null or undefined when calling getSectionGrid.'
);
throw new Error('Required parameter dossierId was null or undefined when calling getSectionGrid.');
}
if (fileId === null || fileId === undefined) {
throw new Error(
'Required parameter fileId was null or undefined when calling getSectionGrid.'
);
throw new Error('Required parameter fileId was null or undefined when calling getSectionGrid.');
}
let headers = this.defaultHeaders;
@ -330,25 +212,20 @@ export class RedactionLogControllerService {
// authentication (RED-OAUTH) required
if (this.configuration.accessToken) {
const accessToken =
typeof this.configuration.accessToken === 'function'
? this.configuration.accessToken()
: this.configuration.accessToken;
typeof this.configuration.accessToken === 'function' ? this.configuration.accessToken() : this.configuration.accessToken;
headers = headers.set('Authorization', 'Bearer ' + accessToken);
}
// to determine the Accept header
const httpHeaderAccepts: string[] = ['application/json'];
const httpHeaderAcceptSelected: string | undefined =
this.configuration.selectHeaderAccept(httpHeaderAccepts);
const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts);
if (httpHeaderAcceptSelected !== undefined) {
headers = headers.set('Accept', httpHeaderAcceptSelected);
}
return this.httpClient.request<SectionGrid>(
'get',
`${this.basePath}/sectionGrid/${encodeURIComponent(
String(dossierId)
)}/${encodeURIComponent(String(fileId))}`,
`${this.basePath}/sectionGrid/${encodeURIComponent(String(dossierId))}/${encodeURIComponent(String(fileId))}`,
{
withCredentials: this.configuration.withCredentials,
headers: headers,