API Rework
This commit is contained in:
parent
2c16124011
commit
ec7b4b0dc8
@ -26,16 +26,21 @@
|
|||||||
<form [formGroup]="configForm" (keyup)="configChanged()">
|
<form [formGroup]="configForm" (keyup)="configChanged()">
|
||||||
<div class="red-input-group">
|
<div class="red-input-group">
|
||||||
<label translate="watermark-screen.form.text"></label>
|
<label translate="watermark-screen.form.text"></label>
|
||||||
<textarea formControlName="text" name="text" type="text" rows="3"></textarea>
|
<textarea formControlName="text" name="text" type="text" rows="10"></textarea>
|
||||||
</div>
|
</div>
|
||||||
<div class="red-input-group">
|
<div class="red-input-group">
|
||||||
<label translate="watermark-screen.form.color"></label>
|
<label translate="watermark-screen.form.color"></label>
|
||||||
<input formControlName="color" name="color" type="text" placeholder="{{ 'add-edit-dictionary.form.color-placeholder' | translate }}" />
|
<input
|
||||||
|
formControlName="hexColor"
|
||||||
|
name="hexColor"
|
||||||
|
type="text"
|
||||||
|
placeholder="{{ 'add-edit-dictionary.form.color-placeholder' | translate }}"
|
||||||
|
/>
|
||||||
<div
|
<div
|
||||||
class="input-icon"
|
class="input-icon"
|
||||||
[colorPicker]="configForm.get('color').value"
|
[colorPicker]="configForm.get('hexColor').value"
|
||||||
[cpOutputFormat]="'hex'"
|
[cpOutputFormat]="'hex'"
|
||||||
(colorPickerChange)="configForm.get('color').setValue($event); configChanged()"
|
(colorPickerChange)="configForm.get('hexColor').setValue($event); configChanged()"
|
||||||
>
|
>
|
||||||
<mat-icon svgIcon="red:color-picker"></mat-icon>
|
<mat-icon svgIcon="red:color-picker"></mat-icon>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -7,6 +7,21 @@ import { environment } from '../../../../environments/environment';
|
|||||||
import { HttpClient } from '@angular/common/http';
|
import { HttpClient } from '@angular/common/http';
|
||||||
import { FormBuilder, FormGroup } from '@angular/forms';
|
import { FormBuilder, FormGroup } from '@angular/forms';
|
||||||
import { debounce } from '../../../utils/debounce';
|
import { debounce } from '../../../utils/debounce';
|
||||||
|
import { WatermarkControllerService, WatermarkModel } from '@redaction/red-ui-http';
|
||||||
|
import { NotificationService, NotificationType } from '../../../notification/notification.service';
|
||||||
|
|
||||||
|
export const DEFAULT_WATERMARK: WatermarkModel = {
|
||||||
|
text:
|
||||||
|
'This document was submitted to the European Food Safety Authority by a Syngenta Group company.\n' +
|
||||||
|
'It may be subject to rights such as intellectual property and copy rights of the owner and third parties.\n' +
|
||||||
|
'Furthermore, this document may fall under a regulatory data protection regime.\n' +
|
||||||
|
'Consequently, any publication, distribution, reproduction and/or publishing and any commercial exploitation \n' +
|
||||||
|
'and use of this document or its contents without the permission of the owner of this document\n' +
|
||||||
|
'may therefore be prohibited and violate the rights of its owner.',
|
||||||
|
hexColor: '#dd4d50',
|
||||||
|
opacity: 70,
|
||||||
|
fontSize: 11
|
||||||
|
};
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'redaction-watermark-screen',
|
selector: 'redaction-watermark-screen',
|
||||||
@ -15,12 +30,8 @@ import { debounce } from '../../../utils/debounce';
|
|||||||
})
|
})
|
||||||
export class WatermarkScreenComponent implements OnInit {
|
export class WatermarkScreenComponent implements OnInit {
|
||||||
private _instance: WebViewerInstance;
|
private _instance: WebViewerInstance;
|
||||||
private _initialConfig = {
|
|
||||||
text: 'Watermark\nWatermark line 2\nWatermark line3',
|
private _watermark: WatermarkModel = {};
|
||||||
color: '#000000',
|
|
||||||
opacity: 50,
|
|
||||||
fontSize: 40
|
|
||||||
};
|
|
||||||
|
|
||||||
@ViewChild('viewer', { static: true })
|
@ViewChild('viewer', { static: true })
|
||||||
private _viewer: ElementRef;
|
private _viewer: ElementRef;
|
||||||
@ -28,34 +39,65 @@ export class WatermarkScreenComponent implements OnInit {
|
|||||||
public viewReady = false;
|
public viewReady = false;
|
||||||
public configForm: FormGroup;
|
public configForm: FormGroup;
|
||||||
|
|
||||||
|
get changed(): boolean {
|
||||||
|
for (const key of Object.keys(this._watermark)) {
|
||||||
|
if (this._watermark[key] !== this.configForm.get(key).value) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
public readonly permissionsService: PermissionsService,
|
public readonly permissionsService: PermissionsService,
|
||||||
public readonly appStateService: AppStateService,
|
public readonly appStateService: AppStateService,
|
||||||
|
private readonly _watermarkControllerService: WatermarkControllerService,
|
||||||
|
private readonly _notificationService: NotificationService,
|
||||||
private readonly _fileDownloadService: FileDownloadService,
|
private readonly _fileDownloadService: FileDownloadService,
|
||||||
private readonly _http: HttpClient,
|
private readonly _http: HttpClient,
|
||||||
private readonly _changeDetectorRef: ChangeDetectorRef,
|
private readonly _changeDetectorRef: ChangeDetectorRef,
|
||||||
private readonly _formBuilder: FormBuilder
|
private readonly _formBuilder: FormBuilder
|
||||||
) {
|
) {
|
||||||
this.configForm = this._formBuilder.group({
|
this._initForm();
|
||||||
text: [this._initialConfig.text],
|
|
||||||
color: [this._initialConfig.color],
|
|
||||||
opacity: [this._initialConfig.opacity],
|
|
||||||
fontSize: [this._initialConfig.fontSize]
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
this._loadViewer();
|
this._watermarkControllerService.getWatermark().subscribe(
|
||||||
|
(watermark) => {
|
||||||
|
this._watermark = watermark;
|
||||||
|
this.configForm.setValue(this._watermark);
|
||||||
|
this._loadViewer();
|
||||||
|
},
|
||||||
|
() => {
|
||||||
|
this._watermark = DEFAULT_WATERMARK;
|
||||||
|
this.configForm.setValue(this._watermark);
|
||||||
|
this._loadViewer();
|
||||||
|
}
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public get changed(): boolean {
|
@debounce()
|
||||||
for (const key of Object.keys(this._initialConfig)) {
|
public configChanged() {
|
||||||
if (this._initialConfig[key] !== this.configForm.get(key).value) {
|
this._drawWatermark();
|
||||||
return true;
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
public save() {
|
||||||
|
const watermark = {
|
||||||
|
...this.configForm.getRawValue()
|
||||||
|
};
|
||||||
|
this._watermarkControllerService.saveWatermark(watermark).subscribe(
|
||||||
|
() => {
|
||||||
|
this._notificationService.showToastNotification('Watermark Saved', null, NotificationType.SUCCESS);
|
||||||
|
},
|
||||||
|
() => {
|
||||||
|
this._notificationService.showToastNotification('Failed to update Watermark', null, NotificationType.ERROR);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public revert() {
|
||||||
|
this.configForm.setValue(this._watermark);
|
||||||
|
this.configChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
private _loadViewer() {
|
private _loadViewer() {
|
||||||
@ -91,8 +133,8 @@ export class WatermarkScreenComponent implements OnInit {
|
|||||||
|
|
||||||
this._instance.docViewer.setWatermark({
|
this._instance.docViewer.setWatermark({
|
||||||
custom: (ctx, pageNumber, pageWidth, pageHeight) => {
|
custom: (ctx, pageNumber, pageWidth, pageHeight) => {
|
||||||
ctx.fillStyle = this.configForm.get('color').value;
|
ctx.fillStyle = this.configForm.get('hexColor').value;
|
||||||
ctx.font = `${fontSize}pt Arial`;
|
ctx.font = `${fontSize}pt Times`;
|
||||||
ctx.globalAlpha = this.configForm.get('opacity').value / 100;
|
ctx.globalAlpha = this.configForm.get('opacity').value / 100;
|
||||||
|
|
||||||
for (let idx = 0; idx < lines.length; ++idx) {
|
for (let idx = 0; idx < lines.length; ++idx) {
|
||||||
@ -110,19 +152,12 @@ export class WatermarkScreenComponent implements OnInit {
|
|||||||
this._instance.docViewer.updateView([0], 0);
|
this._instance.docViewer.updateView([0], 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@debounce()
|
private _initForm() {
|
||||||
public configChanged() {
|
this.configForm = this._formBuilder.group({
|
||||||
this._drawWatermark();
|
text: null,
|
||||||
}
|
hexColor: null,
|
||||||
|
opacity: null,
|
||||||
public save() {
|
fontSize: null
|
||||||
this._initialConfig = {
|
});
|
||||||
...this.configForm.getRawValue()
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
public revert() {
|
|
||||||
this.configForm.setValue(this._initialConfig);
|
|
||||||
this.configChanged();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -7,7 +7,6 @@ import { DictionaryControllerService } from './api/dictionaryController.service'
|
|||||||
import { FileManagementControllerService } from './api/fileManagementController.service';
|
import { FileManagementControllerService } from './api/fileManagementController.service';
|
||||||
import { LicenseReportControllerService } from './api/licenseReportController.service';
|
import { LicenseReportControllerService } from './api/licenseReportController.service';
|
||||||
import { ManualRedactionControllerService } from './api/manualRedactionController.service';
|
import { ManualRedactionControllerService } from './api/manualRedactionController.service';
|
||||||
import { PdfMetaDataConfigurationControllerService } from './api/pdfMetaDataConfigurationController.service';
|
|
||||||
import { ProjectControllerService } from './api/projectController.service';
|
import { ProjectControllerService } from './api/projectController.service';
|
||||||
import { ReanalysisControllerService } from './api/reanalysisController.service';
|
import { ReanalysisControllerService } from './api/reanalysisController.service';
|
||||||
import { RedactionLogControllerService } from './api/redactionLogController.service';
|
import { RedactionLogControllerService } from './api/redactionLogController.service';
|
||||||
@ -17,6 +16,7 @@ import { UserControllerService } from './api/userController.service';
|
|||||||
import { VersionsControllerService } from './api/versionsController.service';
|
import { VersionsControllerService } from './api/versionsController.service';
|
||||||
import { ViewedPagesControllerService } from './api/viewedPagesController.service';
|
import { ViewedPagesControllerService } from './api/viewedPagesController.service';
|
||||||
import { LegalBasisMappingControllerService } from './api/legalBasisMappingController.service';
|
import { LegalBasisMappingControllerService } from './api/legalBasisMappingController.service';
|
||||||
|
import { WatermarkControllerService } from './api/watermarkController.service';
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
imports: [],
|
imports: [],
|
||||||
@ -28,7 +28,6 @@ import { LegalBasisMappingControllerService } from './api/legalBasisMappingContr
|
|||||||
FileManagementControllerService,
|
FileManagementControllerService,
|
||||||
LicenseReportControllerService,
|
LicenseReportControllerService,
|
||||||
ManualRedactionControllerService,
|
ManualRedactionControllerService,
|
||||||
PdfMetaDataConfigurationControllerService,
|
|
||||||
ProjectControllerService,
|
ProjectControllerService,
|
||||||
ReanalysisControllerService,
|
ReanalysisControllerService,
|
||||||
RedactionLogControllerService,
|
RedactionLogControllerService,
|
||||||
@ -37,7 +36,8 @@ import { LegalBasisMappingControllerService } from './api/legalBasisMappingContr
|
|||||||
StatusControllerService,
|
StatusControllerService,
|
||||||
VersionsControllerService,
|
VersionsControllerService,
|
||||||
ViewedPagesControllerService,
|
ViewedPagesControllerService,
|
||||||
LegalBasisMappingControllerService
|
LegalBasisMappingControllerService,
|
||||||
|
WatermarkControllerService
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
export class ApiModule {
|
export class ApiModule {
|
||||||
|
|||||||
@ -6,7 +6,6 @@ import { DictionaryControllerService } from './dictionaryController.service';
|
|||||||
import { FileManagementControllerService } from './fileManagementController.service';
|
import { FileManagementControllerService } from './fileManagementController.service';
|
||||||
import { LicenseReportControllerService } from './licenseReportController.service';
|
import { LicenseReportControllerService } from './licenseReportController.service';
|
||||||
import { ManualRedactionControllerService } from './manualRedactionController.service';
|
import { ManualRedactionControllerService } from './manualRedactionController.service';
|
||||||
import { PdfMetaDataConfigurationControllerService } from './pdfMetaDataConfigurationController.service';
|
|
||||||
import { ProjectControllerService } from './projectController.service';
|
import { ProjectControllerService } from './projectController.service';
|
||||||
import { ReanalysisControllerService } from './reanalysisController.service';
|
import { ReanalysisControllerService } from './reanalysisController.service';
|
||||||
import { RedactionLogControllerService } from './redactionLogController.service';
|
import { RedactionLogControllerService } from './redactionLogController.service';
|
||||||
@ -15,6 +14,7 @@ import { StatusControllerService } from './statusController.service';
|
|||||||
import { UserControllerService } from './userController.service';
|
import { UserControllerService } from './userController.service';
|
||||||
import { ViewedPagesControllerService } from './viewedPagesController.service';
|
import { ViewedPagesControllerService } from './viewedPagesController.service';
|
||||||
import { LegalBasisMappingControllerService } from './legalBasisMappingController.service';
|
import { LegalBasisMappingControllerService } from './legalBasisMappingController.service';
|
||||||
|
import { WatermarkControllerService } from './watermarkController.service';
|
||||||
|
|
||||||
export * from './dictionaryController.service';
|
export * from './dictionaryController.service';
|
||||||
|
|
||||||
@ -24,8 +24,6 @@ export * from './licenseReportController.service';
|
|||||||
|
|
||||||
export * from './manualRedactionController.service';
|
export * from './manualRedactionController.service';
|
||||||
|
|
||||||
export * from './pdfMetaDataConfigurationController.service';
|
|
||||||
|
|
||||||
export * from './projectController.service';
|
export * from './projectController.service';
|
||||||
|
|
||||||
export * from './reanalysisController.service';
|
export * from './reanalysisController.service';
|
||||||
@ -44,13 +42,14 @@ export * from './viewedPagesController.service';
|
|||||||
|
|
||||||
export * from './legalBasisMappingController.service';
|
export * from './legalBasisMappingController.service';
|
||||||
|
|
||||||
|
export * from './watermarkController.service';
|
||||||
|
|
||||||
export const APIS = [
|
export const APIS = [
|
||||||
DebugControllerService,
|
DebugControllerService,
|
||||||
DictionaryControllerService,
|
DictionaryControllerService,
|
||||||
FileManagementControllerService,
|
FileManagementControllerService,
|
||||||
LicenseReportControllerService,
|
LicenseReportControllerService,
|
||||||
ManualRedactionControllerService,
|
ManualRedactionControllerService,
|
||||||
PdfMetaDataConfigurationControllerService,
|
|
||||||
ProjectControllerService,
|
ProjectControllerService,
|
||||||
ReanalysisControllerService,
|
ReanalysisControllerService,
|
||||||
RedactionLogControllerService,
|
RedactionLogControllerService,
|
||||||
@ -59,5 +58,6 @@ export const APIS = [
|
|||||||
UserControllerService,
|
UserControllerService,
|
||||||
VersionsControllerService,
|
VersionsControllerService,
|
||||||
ViewedPagesControllerService,
|
ViewedPagesControllerService,
|
||||||
LegalBasisMappingControllerService
|
LegalBasisMappingControllerService,
|
||||||
|
WatermarkControllerService
|
||||||
];
|
];
|
||||||
|
|||||||
@ -1,180 +0,0 @@
|
|||||||
/**
|
|
||||||
* API Documentation for Redaction Gateway
|
|
||||||
* Description for redaction
|
|
||||||
*
|
|
||||||
* OpenAPI spec version: 1.0
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* NOTE: This class is auto generated by the swagger code generator program.
|
|
||||||
* https://github.com/swagger-api/swagger-codegen.git
|
|
||||||
* Do not edit the class manually.
|
|
||||||
*/ /* tslint:disable:no-unused-variable member-ordering */
|
|
||||||
|
|
||||||
import { Inject, Injectable, Optional } from '@angular/core';
|
|
||||||
import { HttpClient, HttpEvent, HttpHeaders, HttpResponse } from '@angular/common/http';
|
|
||||||
|
|
||||||
import { Observable } from 'rxjs';
|
|
||||||
|
|
||||||
import { PdfMetaData } from '../model/pdfMetaData';
|
|
||||||
|
|
||||||
import { BASE_PATH } from '../variables';
|
|
||||||
import { Configuration } from '../configuration';
|
|
||||||
|
|
||||||
@Injectable()
|
|
||||||
export class PdfMetaDataConfigurationControllerService {
|
|
||||||
public defaultHeaders = new HttpHeaders();
|
|
||||||
public configuration = new Configuration();
|
|
||||||
protected basePath = '';
|
|
||||||
|
|
||||||
constructor(
|
|
||||||
protected httpClient: HttpClient,
|
|
||||||
@Optional() @Inject(BASE_PATH) basePath: string,
|
|
||||||
@Optional() configuration: Configuration
|
|
||||||
) {
|
|
||||||
if (basePath) {
|
|
||||||
this.basePath = basePath;
|
|
||||||
}
|
|
||||||
if (configuration) {
|
|
||||||
this.configuration = configuration;
|
|
||||||
this.basePath = basePath || configuration.basePath || this.basePath;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the currently configured meta data that will be included in the redacted pdf.
|
|
||||||
* None
|
|
||||||
* @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 getPdfMetaData(observe?: 'body', reportProgress?: boolean): Observable<PdfMetaData>;
|
|
||||||
|
|
||||||
public getPdfMetaData(
|
|
||||||
observe?: 'response',
|
|
||||||
reportProgress?: boolean
|
|
||||||
): Observable<HttpResponse<PdfMetaData>>;
|
|
||||||
|
|
||||||
public getPdfMetaData(
|
|
||||||
observe?: 'events',
|
|
||||||
reportProgress?: boolean
|
|
||||||
): Observable<HttpEvent<PdfMetaData>>;
|
|
||||||
|
|
||||||
public getPdfMetaData(observe: any = 'body', reportProgress: boolean = false): Observable<any> {
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
// to determine the Content-Type header
|
|
||||||
const consumes: string[] = [];
|
|
||||||
|
|
||||||
return this.httpClient.request<PdfMetaData>('get', `${this.basePath}/metaData`, {
|
|
||||||
withCredentials: this.configuration.withCredentials,
|
|
||||||
headers: headers,
|
|
||||||
observe: observe,
|
|
||||||
reportProgress: reportProgress
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Configured which meta data will be included in the redacted pdf.
|
|
||||||
* None
|
|
||||||
* @param body pdfMetaData
|
|
||||||
* @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 setPdfMetaData(
|
|
||||||
body: PdfMetaData,
|
|
||||||
observe?: 'body',
|
|
||||||
reportProgress?: boolean
|
|
||||||
): Observable<any>;
|
|
||||||
|
|
||||||
public setPdfMetaData(
|
|
||||||
body: PdfMetaData,
|
|
||||||
observe?: 'response',
|
|
||||||
reportProgress?: boolean
|
|
||||||
): Observable<HttpResponse<any>>;
|
|
||||||
|
|
||||||
public setPdfMetaData(
|
|
||||||
body: PdfMetaData,
|
|
||||||
observe?: 'events',
|
|
||||||
reportProgress?: boolean
|
|
||||||
): Observable<HttpEvent<any>>;
|
|
||||||
|
|
||||||
public setPdfMetaData(
|
|
||||||
body: PdfMetaData,
|
|
||||||
observe: any = 'body',
|
|
||||||
reportProgress: boolean = false
|
|
||||||
): Observable<any> {
|
|
||||||
if (body === null || body === undefined) {
|
|
||||||
throw new Error(
|
|
||||||
'Required parameter body was null or undefined when calling setPdfMetaData.'
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
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[] = [];
|
|
||||||
const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(
|
|
||||||
httpHeaderAccepts
|
|
||||||
);
|
|
||||||
if (httpHeaderAcceptSelected !== undefined) {
|
|
||||||
headers = headers.set('Accept', httpHeaderAcceptSelected);
|
|
||||||
}
|
|
||||||
|
|
||||||
// to determine the Content-Type header
|
|
||||||
const consumes: string[] = ['application/json'];
|
|
||||||
const httpContentTypeSelected:
|
|
||||||
| string
|
|
||||||
| undefined = this.configuration.selectHeaderContentType(consumes);
|
|
||||||
if (httpContentTypeSelected !== undefined) {
|
|
||||||
headers = headers.set('Content-Type', httpContentTypeSelected);
|
|
||||||
}
|
|
||||||
|
|
||||||
return this.httpClient.request<any>('post', `${this.basePath}/metaData`, {
|
|
||||||
body: body,
|
|
||||||
withCredentials: this.configuration.withCredentials,
|
|
||||||
headers: headers,
|
|
||||||
observe: observe,
|
|
||||||
reportProgress: reportProgress
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param consumes string[] mime-types
|
|
||||||
* @return true: consumes contains 'multipart/form-data', false: otherwise
|
|
||||||
*/
|
|
||||||
private canConsumeForm(consumes: string[]): boolean {
|
|
||||||
const form = 'multipart/form-data';
|
|
||||||
for (const consume of consumes) {
|
|
||||||
if (form === consume) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
171
libs/red-ui-http/src/lib/api/watermarkController.service.ts
Normal file
171
libs/red-ui-http/src/lib/api/watermarkController.service.ts
Normal file
@ -0,0 +1,171 @@
|
|||||||
|
/**
|
||||||
|
* API Documentation for Redaction Gateway
|
||||||
|
* Description for redaction
|
||||||
|
*
|
||||||
|
* OpenAPI spec version: 1.0
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* NOTE: This class is auto generated by the swagger code generator program.
|
||||||
|
* https://github.com/swagger-api/swagger-codegen.git
|
||||||
|
* Do not edit the class manually.
|
||||||
|
*/ /* tslint:disable:no-unused-variable member-ordering */
|
||||||
|
|
||||||
|
import { Inject, Injectable, Optional } from '@angular/core';
|
||||||
|
import { HttpClient, HttpHeaders, HttpParams, HttpResponse, HttpEvent } from '@angular/common/http';
|
||||||
|
import { CustomHttpUrlEncodingCodec } from '../encoder';
|
||||||
|
|
||||||
|
import { Observable } from 'rxjs';
|
||||||
|
|
||||||
|
import { WatermarkModel } from '../model/watermarkModel';
|
||||||
|
|
||||||
|
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
|
||||||
|
import { Configuration } from '../configuration';
|
||||||
|
|
||||||
|
@Injectable()
|
||||||
|
export class WatermarkControllerService {
|
||||||
|
protected basePath = '';
|
||||||
|
public defaultHeaders = new HttpHeaders();
|
||||||
|
public configuration = new Configuration();
|
||||||
|
|
||||||
|
constructor(protected httpClient: HttpClient, @Optional() @Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) {
|
||||||
|
if (basePath) {
|
||||||
|
this.basePath = basePath;
|
||||||
|
}
|
||||||
|
if (configuration) {
|
||||||
|
this.configuration = configuration;
|
||||||
|
this.basePath = basePath || configuration.basePath || this.basePath;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param consumes string[] mime-types
|
||||||
|
* @return true: consumes contains 'multipart/form-data', false: otherwise
|
||||||
|
*/
|
||||||
|
private canConsumeForm(consumes: string[]): boolean {
|
||||||
|
const form = 'multipart/form-data';
|
||||||
|
for (const consume of consumes) {
|
||||||
|
if (form === consume) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove watermark configuration
|
||||||
|
* None
|
||||||
|
* @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 deleteWatermark(observe?: 'body', reportProgress?: boolean): Observable<any>;
|
||||||
|
public deleteWatermark(observe?: 'response', reportProgress?: boolean): Observable<HttpResponse<any>>;
|
||||||
|
public deleteWatermark(observe?: 'events', reportProgress?: boolean): Observable<HttpEvent<any>>;
|
||||||
|
public deleteWatermark(observe: any = 'body', reportProgress: boolean = false): Observable<any> {
|
||||||
|
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[] = [];
|
||||||
|
const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
||||||
|
if (httpHeaderAcceptSelected !== undefined) {
|
||||||
|
headers = headers.set('Accept', httpHeaderAcceptSelected);
|
||||||
|
}
|
||||||
|
|
||||||
|
// to determine the Content-Type header
|
||||||
|
const consumes: string[] = [];
|
||||||
|
|
||||||
|
return this.httpClient.request<any>('delete', `${this.basePath}/watermark`, {
|
||||||
|
withCredentials: this.configuration.withCredentials,
|
||||||
|
headers: headers,
|
||||||
|
observe: observe,
|
||||||
|
reportProgress: reportProgress
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the current watermark configuration
|
||||||
|
* None
|
||||||
|
* @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 getWatermark(observe?: 'body', reportProgress?: boolean): Observable<WatermarkModel>;
|
||||||
|
public getWatermark(observe?: 'response', reportProgress?: boolean): Observable<HttpResponse<WatermarkModel>>;
|
||||||
|
public getWatermark(observe?: 'events', reportProgress?: boolean): Observable<HttpEvent<WatermarkModel>>;
|
||||||
|
public getWatermark(observe: any = 'body', reportProgress: boolean = false): Observable<any> {
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
// to determine the Content-Type header
|
||||||
|
const consumes: string[] = [];
|
||||||
|
|
||||||
|
return this.httpClient.request<WatermarkModel>('get', `${this.basePath}/watermark`, {
|
||||||
|
withCredentials: this.configuration.withCredentials,
|
||||||
|
headers: headers,
|
||||||
|
observe: observe,
|
||||||
|
reportProgress: reportProgress
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Save/Update watermark configuration
|
||||||
|
* None
|
||||||
|
* @param body watermark
|
||||||
|
* @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 saveWatermark(body: WatermarkModel, observe?: 'body', reportProgress?: boolean): Observable<WatermarkModel>;
|
||||||
|
public saveWatermark(body: WatermarkModel, observe?: 'response', reportProgress?: boolean): Observable<HttpResponse<WatermarkModel>>;
|
||||||
|
public saveWatermark(body: WatermarkModel, observe?: 'events', reportProgress?: boolean): Observable<HttpEvent<WatermarkModel>>;
|
||||||
|
public saveWatermark(body: WatermarkModel, observe: any = 'body', reportProgress: boolean = false): Observable<any> {
|
||||||
|
if (body === null || body === undefined) {
|
||||||
|
throw new Error('Required parameter body was null or undefined when calling saveWatermark.');
|
||||||
|
}
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
// to determine the Content-Type header
|
||||||
|
const consumes: string[] = ['application/json'];
|
||||||
|
const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes);
|
||||||
|
if (httpContentTypeSelected !== undefined) {
|
||||||
|
headers = headers.set('Content-Type', httpContentTypeSelected);
|
||||||
|
}
|
||||||
|
|
||||||
|
return this.httpClient.request<WatermarkModel>('post', `${this.basePath}/watermark`, {
|
||||||
|
body: body,
|
||||||
|
withCredentials: this.configuration.withCredentials,
|
||||||
|
headers: headers,
|
||||||
|
observe: observe,
|
||||||
|
reportProgress: reportProgress
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -30,4 +30,12 @@ export interface Dictionary {
|
|||||||
* True if the type just for hint, not for redaction, default is false.
|
* True if the type just for hint, not for redaction, default is false.
|
||||||
*/
|
*/
|
||||||
hint?: boolean;
|
hint?: boolean;
|
||||||
|
/**
|
||||||
|
* The rank of this dictionary, higher rank means higher importance.
|
||||||
|
*/
|
||||||
|
rank?: number;
|
||||||
|
/**
|
||||||
|
* True if the type just for recommendations, not for redaction, default is false.
|
||||||
|
*/
|
||||||
|
recommendation?: boolean;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -22,6 +22,10 @@ export interface FileStatus {
|
|||||||
* Shows if all manual changes have been applied by a reanalysis.
|
* Shows if all manual changes have been applied by a reanalysis.
|
||||||
*/
|
*/
|
||||||
allManualRedactionsApplied?: boolean;
|
allManualRedactionsApplied?: boolean;
|
||||||
|
/**
|
||||||
|
* Shows the date of approval, if approved.
|
||||||
|
*/
|
||||||
|
approvalDate?: string;
|
||||||
/**
|
/**
|
||||||
* The current reviewer's (if any) user id.
|
* The current reviewer's (if any) user id.
|
||||||
*/
|
*/
|
||||||
@ -63,7 +67,7 @@ export interface FileStatus {
|
|||||||
*/
|
*/
|
||||||
lastUpdated?: string;
|
lastUpdated?: string;
|
||||||
/**
|
/**
|
||||||
* Date and time when the file was last uploaded.
|
* Shows last date the document was uploaded.
|
||||||
*/
|
*/
|
||||||
lastUploaded?: string;
|
lastUploaded?: string;
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -1,6 +1,9 @@
|
|||||||
export * from './addCommentRequest';
|
export * from './addCommentRequest';
|
||||||
export * from './addRedactionRequest';
|
export * from './addRedactionRequest';
|
||||||
|
export * from './approveRequest';
|
||||||
export * from './authInfo';
|
export * from './authInfo';
|
||||||
|
export * from './bulkDownloadRedactedRequest';
|
||||||
|
export * from './cellRectangle';
|
||||||
export * from './colors';
|
export * from './colors';
|
||||||
export * from './comment';
|
export * from './comment';
|
||||||
export * from './commentResponse';
|
export * from './commentResponse';
|
||||||
@ -9,13 +12,13 @@ export * from './fileIds';
|
|||||||
export * from './fileStatus';
|
export * from './fileStatus';
|
||||||
export * from './fileUploadResult';
|
export * from './fileUploadResult';
|
||||||
export * from './idRemoval';
|
export * from './idRemoval';
|
||||||
|
export * from './legalBasisMapping';
|
||||||
export * from './licenseReport';
|
export * from './licenseReport';
|
||||||
export * from './licenseReportRequest';
|
export * from './licenseReportRequest';
|
||||||
export * from './manualAddResponse';
|
export * from './manualAddResponse';
|
||||||
export * from './manualRedactionEntry';
|
export * from './manualRedactionEntry';
|
||||||
export * from './manualRedactions';
|
export * from './manualRedactions';
|
||||||
export * from './modelFile';
|
export * from './modelFile';
|
||||||
export * from './pdfMetaData';
|
|
||||||
export * from './point';
|
export * from './point';
|
||||||
export * from './project';
|
export * from './project';
|
||||||
export * from './projectRequest';
|
export * from './projectRequest';
|
||||||
@ -24,7 +27,10 @@ export * from './redactionLog';
|
|||||||
export * from './redactionLogEntry';
|
export * from './redactionLogEntry';
|
||||||
export * from './removeRedactionRequest';
|
export * from './removeRedactionRequest';
|
||||||
export * from './reportData';
|
export * from './reportData';
|
||||||
|
export * from './rolesRequest';
|
||||||
export * from './rules';
|
export * from './rules';
|
||||||
|
export * from './sectionGrid';
|
||||||
|
export * from './sectionRectangle';
|
||||||
export * from './typeResponse';
|
export * from './typeResponse';
|
||||||
export * from './typeValue';
|
export * from './typeValue';
|
||||||
export * from './updateTypeValue';
|
export * from './updateTypeValue';
|
||||||
@ -34,9 +40,4 @@ export * from './userResponse';
|
|||||||
export * from './versionsResponse';
|
export * from './versionsResponse';
|
||||||
export * from './viewedPages';
|
export * from './viewedPages';
|
||||||
export * from './viewedPagesRequest';
|
export * from './viewedPagesRequest';
|
||||||
export * from './approveRequest';
|
export * from './watermarkModel';
|
||||||
export * from './bulkDownloadRedactedRequest';
|
|
||||||
export * from './sectionGrid';
|
|
||||||
export * from './sectionRectangle';
|
|
||||||
export * from './legalBasisMapping';
|
|
||||||
export * from './cellRectangle';
|
|
||||||
|
|||||||
@ -13,6 +13,7 @@ import { Rectangle } from './rectangle';
|
|||||||
|
|
||||||
export interface RedactionLogEntry {
|
export interface RedactionLogEntry {
|
||||||
color?: Array<number>;
|
color?: Array<number>;
|
||||||
|
dictionaryEntry?: boolean;
|
||||||
hint?: boolean;
|
hint?: boolean;
|
||||||
id?: string;
|
id?: string;
|
||||||
legalBasis?: string;
|
legalBasis?: string;
|
||||||
@ -21,6 +22,7 @@ export interface RedactionLogEntry {
|
|||||||
matchedRule?: number;
|
matchedRule?: number;
|
||||||
positions?: Array<Rectangle>;
|
positions?: Array<Rectangle>;
|
||||||
reason?: string;
|
reason?: string;
|
||||||
|
recommendation?: boolean;
|
||||||
redacted?: boolean;
|
redacted?: boolean;
|
||||||
section?: string;
|
section?: string;
|
||||||
sectionNumber?: number;
|
sectionNumber?: number;
|
||||||
|
|||||||
@ -21,16 +21,7 @@ export interface ReportData {
|
|||||||
status?: ReportData.StatusEnum;
|
status?: ReportData.StatusEnum;
|
||||||
}
|
}
|
||||||
export namespace ReportData {
|
export namespace ReportData {
|
||||||
export type StatusEnum =
|
export type StatusEnum = 'UNPROCESSED' | 'REPROCESS' | 'PROCESSING' | 'ERROR' | 'DELETED' | 'UNASSIGNED' | 'UNDER_REVIEW' | 'UNDER_APPROVAL' | 'APPROVED';
|
||||||
| 'UNPROCESSED'
|
|
||||||
| 'REPROCESS'
|
|
||||||
| 'PROCESSING'
|
|
||||||
| 'ERROR'
|
|
||||||
| 'DELETED'
|
|
||||||
| 'UNASSIGNED'
|
|
||||||
| 'UNDER_REVIEW'
|
|
||||||
| 'UNDER_APPROVAL'
|
|
||||||
| 'APPROVED';
|
|
||||||
export const StatusEnum = {
|
export const StatusEnum = {
|
||||||
UNPROCESSED: 'UNPROCESSED' as StatusEnum,
|
UNPROCESSED: 'UNPROCESSED' as StatusEnum,
|
||||||
REPROCESS: 'REPROCESS' as StatusEnum,
|
REPROCESS: 'REPROCESS' as StatusEnum,
|
||||||
|
|||||||
@ -10,13 +10,12 @@
|
|||||||
* Do not edit the class manually.
|
* Do not edit the class manually.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
export interface PdfMetaData {
|
/**
|
||||||
author?: boolean;
|
* Object containing information about roles request.
|
||||||
creationDate?: boolean;
|
*/
|
||||||
creator?: boolean;
|
export interface RolesRequest {
|
||||||
keywords?: boolean;
|
/**
|
||||||
modDate?: boolean;
|
* The users' ids to whom the request is applied.
|
||||||
producer?: boolean;
|
*/
|
||||||
subject?: boolean;
|
userIds?: Array<string>;
|
||||||
title?: boolean;
|
|
||||||
}
|
}
|
||||||
@ -27,16 +27,20 @@ export interface TypeValue {
|
|||||||
* True if the type just for hint, not for redaction, default is false.
|
* True if the type just for hint, not for redaction, default is false.
|
||||||
*/
|
*/
|
||||||
hint?: boolean;
|
hint?: boolean;
|
||||||
|
/**
|
||||||
|
* The rank of this dictionary, higher rank means higher importance.
|
||||||
|
*/
|
||||||
|
rank?: number;
|
||||||
|
/**
|
||||||
|
* True if the type just for recommendations, not for redaction, default is false.
|
||||||
|
*/
|
||||||
|
recommendation?: boolean;
|
||||||
/**
|
/**
|
||||||
* The nonnull entry type.
|
* The nonnull entry type.
|
||||||
*/
|
*/
|
||||||
type?: string;
|
type?: string;
|
||||||
/**
|
|
||||||
* Rank of this dictionary
|
|
||||||
*/
|
|
||||||
rank?: number;
|
|
||||||
|
|
||||||
isDefaultFilter?: boolean;
|
isDefaultFilter?: boolean;
|
||||||
|
|
||||||
virtual?: boolean;
|
virtual?: boolean;
|
||||||
label?: string;
|
label?: string;
|
||||||
entries?: string[];
|
entries?: string[];
|
||||||
|
|||||||
@ -26,4 +26,12 @@ export interface UpdateTypeValue {
|
|||||||
* True if the type just for hint, not for redaction, default is false.
|
* True if the type just for hint, not for redaction, default is false.
|
||||||
*/
|
*/
|
||||||
hint?: boolean;
|
hint?: boolean;
|
||||||
|
/**
|
||||||
|
* The rank of this dictionary, higher rank means higher importance.
|
||||||
|
*/
|
||||||
|
rank?: number;
|
||||||
|
/**
|
||||||
|
* True if the type just for recommendations, not for redaction, default is false.
|
||||||
|
*/
|
||||||
|
recommendation?: boolean;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
/**
|
/**
|
||||||
* Api Documentation
|
* API Documentation for Redaction Gateway
|
||||||
* Api Documentation
|
* Description for redaction
|
||||||
*
|
*
|
||||||
* OpenAPI spec version: 1.0
|
* OpenAPI spec version: 1.0
|
||||||
*
|
*
|
||||||
@ -10,6 +10,9 @@
|
|||||||
* Do not edit the class manually.
|
* Do not edit the class manually.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
export interface DefaultColor {
|
export interface WatermarkModel {
|
||||||
color?: Array<number>;
|
fontSize?: number;
|
||||||
|
hexColor?: string;
|
||||||
|
opacity?: number;
|
||||||
|
text?: string;
|
||||||
}
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user