Pull request #243: RED-1830
Merge in RED/ui from RED-1830 to master * commit '92f9b822b390f2d47e27e31ae8d66e6fa4d361ac': various issue fixes update api
This commit is contained in:
commit
8352be3781
@ -7,7 +7,7 @@ To re-generate http rune swagger
|
|||||||
YOu need swagger-codegen installed `brew install swagger-codegen`
|
YOu need swagger-codegen installed `brew install swagger-codegen`
|
||||||
|
|
||||||
```
|
```
|
||||||
BASE=https://red-staging.iqser.cloud/
|
BASE=https://dev-06.iqser.cloud/
|
||||||
URL="$BASE"redaction-gateway-v1/v2/api-docs?group=redaction-gateway-v1
|
URL="$BASE"redaction-gateway-v1/v2/api-docs?group=redaction-gateway-v1
|
||||||
rm -Rf /tmp/swagger
|
rm -Rf /tmp/swagger
|
||||||
mkdir -p /tmp/swagger
|
mkdir -p /tmp/swagger
|
||||||
|
|||||||
@ -8,6 +8,7 @@ export class AnnotationWrapper {
|
|||||||
| 'remove-only-here'
|
| 'remove-only-here'
|
||||||
| 'change-legal-basis'
|
| 'change-legal-basis'
|
||||||
| 'suggestion-change-legal-basis'
|
| 'suggestion-change-legal-basis'
|
||||||
|
| 'suggestion-recategorize-image'
|
||||||
| 'suggestion-add-dictionary'
|
| 'suggestion-add-dictionary'
|
||||||
| 'suggestion-force-redaction'
|
| 'suggestion-force-redaction'
|
||||||
| 'suggestion-remove-dictionary'
|
| 'suggestion-remove-dictionary'
|
||||||
@ -137,7 +138,11 @@ export class AnnotationWrapper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
get isSuggestion() {
|
get isSuggestion() {
|
||||||
return this.isSuggestionAdd || this.isSuggestionRemove || this.isSuggestionChangeLegalBasis;
|
return this.isSuggestionAdd || this.isSuggestionRemove || this.isSuggestionChangeLegalBasis || this.isSuggestionRecategorizeImage;
|
||||||
|
}
|
||||||
|
|
||||||
|
get isSuggestionRecategorizeImage() {
|
||||||
|
return this.superType === 'suggestion-recategorize-image';
|
||||||
}
|
}
|
||||||
|
|
||||||
get isSuggestionChangeLegalBasis() {
|
get isSuggestionChangeLegalBasis() {
|
||||||
@ -229,6 +234,11 @@ export class AnnotationWrapper {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (redactionLogEntryWrapper.status === 'DECLINED') {
|
||||||
|
annotationWrapper.superType = 'declined-suggestion';
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (redactionLogEntryWrapper.manualRedactionType === 'FORCE_REDACT') {
|
if (redactionLogEntryWrapper.manualRedactionType === 'FORCE_REDACT') {
|
||||||
annotationWrapper.force = true;
|
annotationWrapper.force = true;
|
||||||
|
|
||||||
@ -251,9 +261,10 @@ export class AnnotationWrapper {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (redactionLogEntryWrapper.status === 'DECLINED') {
|
if (redactionLogEntryWrapper.manualRedactionType === 'RECATEGORIZE') {
|
||||||
annotationWrapper.superType = 'declined-suggestion';
|
if (redactionLogEntryWrapper.status === 'REQUESTED') {
|
||||||
return;
|
annotationWrapper.superType = 'suggestion-recategorize-image';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (annotationWrapper.dictionary?.toLowerCase() === 'false_positive') {
|
if (annotationWrapper.dictionary?.toLowerCase() === 'false_positive') {
|
||||||
|
|||||||
@ -8,7 +8,7 @@ export interface RedactionLogEntryWrapper {
|
|||||||
legalBasis?: string;
|
legalBasis?: string;
|
||||||
legalBasisMapping?: Array<LegalBasisMapping>;
|
legalBasisMapping?: Array<LegalBasisMapping>;
|
||||||
manual?: boolean;
|
manual?: boolean;
|
||||||
manualRedactionType?: 'ADD' | 'REMOVE' | 'UNDO' | 'LEGAL_BASIS_CHANGE' | 'FORCE_REDACT';
|
manualRedactionType?: 'ADD' | 'REMOVE' | 'UNDO' | 'LEGAL_BASIS_CHANGE' | 'FORCE_REDACT' | 'RECATEGORIZE';
|
||||||
matchedRule?: number;
|
matchedRule?: number;
|
||||||
positions?: Array<Rectangle>;
|
positions?: Array<Rectangle>;
|
||||||
reason?: string;
|
reason?: string;
|
||||||
|
|||||||
@ -160,27 +160,15 @@ export class AppStateService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static _isFileOverviewRoute(event: Event) {
|
private static _isFileOverviewRoute(event: Event) {
|
||||||
return (
|
return event instanceof ResolveStart && event.url.includes('/main/dossiers/') && event.url.includes('/file/');
|
||||||
event instanceof ResolveStart &&
|
|
||||||
event.url.includes('/main/dossiers/') &&
|
|
||||||
event.url.includes('/file/')
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static _isDossierOverviewRoute(event: Event) {
|
private static _isDossierOverviewRoute(event: Event) {
|
||||||
return (
|
return event instanceof ResolveStart && event.url.includes('/main/dossiers/') && !event.url.includes('/file/');
|
||||||
event instanceof ResolveStart &&
|
|
||||||
event.url.includes('/main/dossiers/') &&
|
|
||||||
!event.url.includes('/file/')
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static _isRandomRoute(event: Event) {
|
private static _isRandomRoute(event: Event) {
|
||||||
return (
|
return event instanceof NavigationEnd && !event.url.includes('/main/dossiers/') && !event.url.includes('/file/');
|
||||||
event instanceof NavigationEnd &&
|
|
||||||
!event.url.includes('/main/dossiers/') &&
|
|
||||||
!event.url.includes('/file/')
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async reloadActiveDossierFilesIfNecessary() {
|
async reloadActiveDossierFilesIfNecessary() {
|
||||||
@ -194,10 +182,7 @@ export class AppStateService {
|
|||||||
dossierTemplateId = this.activeDossier.dossierTemplateId;
|
dossierTemplateId = this.activeDossier.dossierTemplateId;
|
||||||
}
|
}
|
||||||
if (!dossierTemplateId) {
|
if (!dossierTemplateId) {
|
||||||
dossierTemplateId =
|
dossierTemplateId = this.dossierTemplates.length > 0 ? this.dossierTemplates[0].dossierTemplateId : undefined;
|
||||||
this.dossierTemplates.length > 0
|
|
||||||
? this.dossierTemplates[0].dossierTemplateId
|
|
||||||
: undefined;
|
|
||||||
}
|
}
|
||||||
if (!dossierTemplateId) {
|
if (!dossierTemplateId) {
|
||||||
return undefined;
|
return undefined;
|
||||||
@ -216,10 +201,7 @@ export class AppStateService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!dossierTemplateId) {
|
if (!dossierTemplateId) {
|
||||||
dossierTemplateId =
|
dossierTemplateId = this.dossierTemplates.length > 0 ? this.dossierTemplates[0].dossierTemplateId : undefined;
|
||||||
this.dossierTemplates.length > 0
|
|
||||||
? this.dossierTemplates[0].dossierTemplateId
|
|
||||||
: undefined;
|
|
||||||
}
|
}
|
||||||
if (!dossierTemplateId) {
|
if (!dossierTemplateId) {
|
||||||
return undefined;
|
return undefined;
|
||||||
@ -240,13 +222,9 @@ export class AppStateService {
|
|||||||
async loadAllDossiers(emitEvents: boolean = true) {
|
async loadAllDossiers(emitEvents: boolean = true) {
|
||||||
const dossiers = await this._dossierControllerService.getDossiers().toPromise();
|
const dossiers = await this._dossierControllerService.getDossiers().toPromise();
|
||||||
if (dossiers) {
|
if (dossiers) {
|
||||||
const mappedDossiers = dossiers.map(
|
const mappedDossiers = dossiers.map(p => new DossierWrapper(p, this._getExistingFiles(p.dossierId)));
|
||||||
p => new DossierWrapper(p, this._getExistingFiles(p.dossierId))
|
|
||||||
);
|
|
||||||
|
|
||||||
const fileData = await this._statusControllerService
|
const fileData = await this._statusControllerService.getFileStatusForDossiers(mappedDossiers.map(p => p.dossierId)).toPromise();
|
||||||
.getFileStatusForDossiers(mappedDossiers.map(p => p.dossierId))
|
|
||||||
.toPromise();
|
|
||||||
|
|
||||||
for (const dossierId of Object.keys(fileData)) {
|
for (const dossierId of Object.keys(fileData)) {
|
||||||
const dossier = mappedDossiers.find(p => p.dossierId === dossierId);
|
const dossier = mappedDossiers.find(p => p.dossierId === dossierId);
|
||||||
@ -263,9 +241,7 @@ export class AppStateService {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
const oldProcessedDate = this.activeFile.lastProcessed;
|
const oldProcessedDate = this.activeFile.lastProcessed;
|
||||||
const activeFile = await this._statusControllerService
|
const activeFile = await this._statusControllerService.getFileStatus(this.activeDossierId, this.activeFileId).toPromise();
|
||||||
.getFileStatus(this.activeDossierId, this.activeFileId)
|
|
||||||
.toPromise();
|
|
||||||
|
|
||||||
const activeFileWrapper = new FileStatusWrapper(
|
const activeFileWrapper = new FileStatusWrapper(
|
||||||
activeFile,
|
activeFile,
|
||||||
@ -289,9 +265,7 @@ export class AppStateService {
|
|||||||
if (!dossier) {
|
if (!dossier) {
|
||||||
dossier = this.activeDossier;
|
dossier = this.activeDossier;
|
||||||
}
|
}
|
||||||
const files = await this._statusControllerService
|
const files = await this._statusControllerService.getDossierStatus(dossier.dossierId).toPromise();
|
||||||
.getDossierStatus(dossier.dossierId)
|
|
||||||
.toPromise();
|
|
||||||
|
|
||||||
return this._processFiles(dossier, files, emitEvents);
|
return this._processFiles(dossier, files, emitEvents);
|
||||||
}
|
}
|
||||||
@ -317,21 +291,18 @@ export class AppStateService {
|
|||||||
|
|
||||||
updateDossierDictionary(dossierTemplateId: string, dossierId: string) {
|
updateDossierDictionary(dossierTemplateId: string, dossierId: string) {
|
||||||
// dossier exists, load it's dictionary
|
// dossier exists, load it's dictionary
|
||||||
this._dictionaryControllerService
|
this._dictionaryControllerService.getDictionaryForType(dossierTemplateId, 'dossier_redaction', dossierId).subscribe(
|
||||||
.getDictionaryForType(dossierTemplateId, 'dossier_redaction', dossierId)
|
typeData => {
|
||||||
.subscribe(
|
this.activeDossier.type = typeData;
|
||||||
typeData => {
|
},
|
||||||
this.activeDossier.type = typeData;
|
() => {
|
||||||
},
|
this.activeDossier.type = null;
|
||||||
() => {
|
}
|
||||||
this.activeDossier.type = null;
|
);
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
activateFile(dossierId: string, fileId: string) {
|
activateFile(dossierId: string, fileId: string) {
|
||||||
if (this._appState.activeDossierId === dossierId && this._appState.activeFileId === fileId)
|
if (this._appState.activeDossierId === dossierId && this._appState.activeFileId === fileId) return;
|
||||||
return;
|
|
||||||
this.activateDossier(dossierId);
|
this.activateDossier(dossierId);
|
||||||
if (this.activeDossier) {
|
if (this.activeDossier) {
|
||||||
this._appState.activeFileId = fileId;
|
this._appState.activeFileId = fileId;
|
||||||
@ -357,9 +328,7 @@ export class AppStateService {
|
|||||||
this._appState.activeDictionaryType = dictionaryType;
|
this._appState.activeDictionaryType = dictionaryType;
|
||||||
if (!this.activeDictionary) {
|
if (!this.activeDictionary) {
|
||||||
this._appState.activeDictionaryType = null;
|
this._appState.activeDictionaryType = null;
|
||||||
this._router.navigate([
|
this._router.navigate(['/main/admin/dossier-templates/' + this.activeDossierTemplateId]);
|
||||||
'/main/admin/dossier-templates/' + this.activeDossierTemplateId
|
|
||||||
]);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -377,9 +346,7 @@ export class AppStateService {
|
|||||||
.toPromise()
|
.toPromise()
|
||||||
.then(
|
.then(
|
||||||
() => {
|
() => {
|
||||||
const index = this._appState.dossiers.findIndex(
|
const index = this._appState.dossiers.findIndex(p => p.dossier.dossierId === dossier.dossierId);
|
||||||
p => p.dossier.dossierId === dossier.dossierId
|
|
||||||
);
|
|
||||||
this._appState.dossiers.splice(index, 1);
|
this._appState.dossiers.splice(index, 1);
|
||||||
this._appState.dossiers = [...this._appState.dossiers];
|
this._appState.dossiers = [...this._appState.dossiers];
|
||||||
},
|
},
|
||||||
@ -395,12 +362,8 @@ export class AppStateService {
|
|||||||
|
|
||||||
async addOrUpdateDossier(dossier: Dossier) {
|
async addOrUpdateDossier(dossier: Dossier) {
|
||||||
try {
|
try {
|
||||||
const updatedDossier = await this._dossierControllerService
|
const updatedDossier = await this._dossierControllerService.createOrUpdateDossier(dossier).toPromise();
|
||||||
.createOrUpdateDossier(dossier)
|
let foundDossier = this._appState.dossiers.find(p => p.dossier.dossierId === updatedDossier.dossierId);
|
||||||
.toPromise();
|
|
||||||
let foundDossier = this._appState.dossiers.find(
|
|
||||||
p => p.dossier.dossierId === updatedDossier.dossierId
|
|
||||||
);
|
|
||||||
if (foundDossier) {
|
if (foundDossier) {
|
||||||
Object.assign((foundDossier.dossier = updatedDossier));
|
Object.assign((foundDossier.dossier = updatedDossier));
|
||||||
} else {
|
} else {
|
||||||
@ -412,9 +375,7 @@ export class AppStateService {
|
|||||||
} catch (error) {
|
} catch (error) {
|
||||||
this._notificationService.showToastNotification(
|
this._notificationService.showToastNotification(
|
||||||
this._translateService.instant(
|
this._translateService.instant(
|
||||||
error.status === 409
|
error.status === 409 ? 'add-dossier-dialog.errors.dossier-already-exists' : 'add-dossier-dialog.errors.generic'
|
||||||
? 'add-dossier-dialog.errors.dossier-already-exists'
|
|
||||||
: 'add-dossier-dialog.errors.generic'
|
|
||||||
),
|
),
|
||||||
null,
|
null,
|
||||||
NotificationType.ERROR
|
NotificationType.ERROR
|
||||||
@ -429,19 +390,14 @@ export class AppStateService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async loadAllDossierTemplates() {
|
async loadAllDossierTemplates() {
|
||||||
const dossierTemplates = await this._dossierTemplateControllerService
|
const dossierTemplates = await this._dossierTemplateControllerService.getAllDossierTemplates().toPromise();
|
||||||
.getAllDossierTemplates()
|
this._appState.dossierTemplates = dossierTemplates.map(dossierTemplate => new DossierTemplateModelWrapper(dossierTemplate));
|
||||||
.toPromise();
|
|
||||||
this._appState.dossierTemplates = dossierTemplates.map(
|
|
||||||
dossierTemplate => new DossierTemplateModelWrapper(dossierTemplate)
|
|
||||||
);
|
|
||||||
this._appState.fileAttributesConfig = {};
|
this._appState.fileAttributesConfig = {};
|
||||||
for (const dossierTemplate of this._appState.dossierTemplates) {
|
for (const dossierTemplate of this._appState.dossierTemplates) {
|
||||||
this._appState.fileAttributesConfig[dossierTemplate.dossierTemplateId] =
|
this._appState.fileAttributesConfig[dossierTemplate.dossierTemplateId] = await this._fileAttributesService
|
||||||
await this._fileAttributesService
|
.getFileAttributesConfiguration(dossierTemplate.dossierTemplateId)
|
||||||
.getFileAttributesConfiguration(dossierTemplate.dossierTemplateId)
|
.pipe(catchError(() => of({})))
|
||||||
.pipe(catchError(() => of({})))
|
.toPromise();
|
||||||
.toPromise();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -465,10 +421,7 @@ export class AppStateService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
getDictionaryDataForDossierTemplateObservables(
|
getDictionaryDataForDossierTemplateObservables(dossierTemplateId: string, dictionaryData: { [key: string]: any }): Observable<any>[] {
|
||||||
dossierTemplateId: string,
|
|
||||||
dictionaryData: { [key: string]: any }
|
|
||||||
): Observable<any>[] {
|
|
||||||
const typeObs = this._dictionaryControllerService.getAllTypes(dossierTemplateId).pipe(
|
const typeObs = this._dictionaryControllerService.getAllTypes(dossierTemplateId).pipe(
|
||||||
tap(typesResponse => {
|
tap(typesResponse => {
|
||||||
for (const type of typesResponse.types) {
|
for (const type of typesResponse.types) {
|
||||||
@ -568,6 +521,14 @@ export class AppStateService {
|
|||||||
null,
|
null,
|
||||||
true
|
true
|
||||||
);
|
);
|
||||||
|
dictionaryData['suggestion-recategorize-image'] = new TypeValueWrapper(
|
||||||
|
{
|
||||||
|
hexColor: colors.requestAdd,
|
||||||
|
type: 'suggestion-recategorize-image'
|
||||||
|
},
|
||||||
|
null,
|
||||||
|
true
|
||||||
|
);
|
||||||
dictionaryData['suggestion-add-dictionary'] = new TypeValueWrapper(
|
dictionaryData['suggestion-add-dictionary'] = new TypeValueWrapper(
|
||||||
{
|
{
|
||||||
hexColor: colors.dictionaryRequestColor,
|
hexColor: colors.dictionaryRequestColor,
|
||||||
@ -704,11 +665,7 @@ export class AppStateService {
|
|||||||
return found ? found.files : [];
|
return found ? found.files : [];
|
||||||
}
|
}
|
||||||
|
|
||||||
private _processFiles(
|
private _processFiles(dossier: DossierWrapper, files: FileStatus[], emitEvents: boolean = true) {
|
||||||
dossier: DossierWrapper,
|
|
||||||
files: FileStatus[],
|
|
||||||
emitEvents: boolean = true
|
|
||||||
) {
|
|
||||||
const oldFiles = [...dossier.files];
|
const oldFiles = [...dossier.files];
|
||||||
|
|
||||||
const fileStatusChangedEvent = [];
|
const fileStatusChangedEvent = [];
|
||||||
|
|||||||
@ -242,6 +242,7 @@
|
|||||||
"suggestion-add": "Suggested redaction",
|
"suggestion-add": "Suggested redaction",
|
||||||
"suggestion-add-dictionary": "Suggested dictionary add",
|
"suggestion-add-dictionary": "Suggested dictionary add",
|
||||||
"suggestion-change-legal-basis": "Suggested change legal basis",
|
"suggestion-change-legal-basis": "Suggested change legal basis",
|
||||||
|
"suggestion-recategorize-image": "Suggested recategorize image",
|
||||||
"suggestion-force-redaction": "Suggestion force redaction",
|
"suggestion-force-redaction": "Suggestion force redaction",
|
||||||
"suggestion-remove": "Suggested redaction removal",
|
"suggestion-remove": "Suggested redaction removal",
|
||||||
"suggestion-remove-dictionary": "Suggested dictionary removal"
|
"suggestion-remove-dictionary": "Suggested dictionary removal"
|
||||||
|
|||||||
@ -13,7 +13,5 @@
|
|||||||
export interface ImageRecategorizationRequest {
|
export interface ImageRecategorizationRequest {
|
||||||
annotationId?: string;
|
annotationId?: string;
|
||||||
comment?: string;
|
comment?: string;
|
||||||
legalBasis?: string;
|
|
||||||
redacted?: boolean;
|
|
||||||
type?: string;
|
type?: string;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -50,4 +50,8 @@ export interface TypeValue {
|
|||||||
* The nonnull entry type.
|
* The nonnull entry type.
|
||||||
*/
|
*/
|
||||||
type?: string;
|
type?: string;
|
||||||
|
/**
|
||||||
|
* The label of this type
|
||||||
|
*/
|
||||||
|
label?: string;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -42,4 +42,8 @@ export interface UpdateTypeValue {
|
|||||||
* True if the type just for recommendations, not for redaction, default is false.
|
* True if the type just for recommendations, not for redaction, default is false.
|
||||||
*/
|
*/
|
||||||
recommendation?: boolean;
|
recommendation?: boolean;
|
||||||
|
/**
|
||||||
|
* The label of this type
|
||||||
|
*/
|
||||||
|
label?: string;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user