DM-314 use display name of annotations

This commit is contained in:
Dan Percic 2023-06-26 17:08:06 +03:00
parent e7924dcce0
commit a512a68956
7 changed files with 23 additions and 16 deletions

View File

@ -1,9 +1,9 @@
<section class="dialog">
<div class="dialog-header heading-l" [translate]="'rss-dialog.title'"></div>
<div [translate]="'rss-dialog.title'" class="dialog-header heading-l"></div>
<hr />
<div class="dialog-content">
<div *ngIf="rssData$ | async as rssEntry" class="table output-data">
<div *ngIf="rssData() | log as rssEntry" class="table output-data">
<div class="table-header">Component</div>
<div class="table-header">Value</div>
<div class="table-header">Transformation</div>
@ -45,7 +45,7 @@
ruleNumber: annotation.ruleNumber,
pageCount: annotation.pages.length,
pages: annotation.pages.join(','),
type: annotation.type
type: annotation.displayName
}
"
class="mb-8"
@ -79,7 +79,7 @@
label="Export All"
></iqser-icon-button>
<div class="all-caps-label cancel" mat-dialog-close [translate]="'rss-dialog.actions.close'"></div>
<div [translate]="'rss-dialog.actions.close'" class="all-caps-label cancel" mat-dialog-close></div>
</div>
<iqser-circle-button (action)="close()" class="dialog-close" icon="iqser:close"></iqser-circle-button>

View File

@ -1,9 +1,9 @@
import { Component, Inject, OnInit } from '@angular/core';
import { Component, Inject, OnInit, signal } from '@angular/core';
import { BaseDialogComponent, CircleButtonTypes } from '@iqser/common-ui';
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
import { RssService } from '@services/files/rss.service';
import { IFile, RssEntry } from '@red/domain';
import { BehaviorSubject, firstValueFrom } from 'rxjs';
import { firstValueFrom } from 'rxjs';
import { FilesMapService } from '@services/files/files-map.service';
import { UserPreferenceService } from '@users/user-preference.service';
@ -18,7 +18,7 @@ interface RssData {
export class RssDialogComponent extends BaseDialogComponent implements OnInit {
readonly circleButtonTypes = CircleButtonTypes;
rssData$ = new BehaviorSubject<RssEntry>(null);
readonly rssData = signal<RssEntry | undefined>(undefined);
constructor(
protected readonly _dialogRef: MatDialogRef<RssDialogComponent>,
@ -71,7 +71,7 @@ export class RssDialogComponent extends BaseDialogComponent implements OnInit {
async #loadData(): Promise<void> {
this._loadingService.start();
const rssData = await firstValueFrom(this._rssService.getRSSData(this.data.file.dossierId, this.data.file.fileId));
this.rssData$.next(rssData);
this.rssData.set(rssData);
this._loadingService.stop();
}
}

View File

@ -17,6 +17,7 @@ import {
IqserRoutes,
IqserUploadFileModule,
IqserUsersModule,
LogPipe,
PreventDefaultDirective,
RoundCheckboxComponent,
StatusBarComponent,
@ -143,6 +144,7 @@ const components = [
IqserAllowDirective,
IqserDenyDirective,
TenantPipe,
LogPipe,
],
providers: [FilePreviewDialogService, ManualRedactionService, DocumentUnloadedGuard, SuggestionsService],
})

View File

@ -1,7 +1,7 @@
{
"ADMIN_CONTACT_NAME": null,
"ADMIN_CONTACT_URL": null,
"API_URL": "https://dev-08.iqser.cloud/redaction-gateway-v1",
"API_URL": "https://qa5.iqser.cloud/redaction-gateway-v1",
"APP_NAME": "RedactManager",
"AUTO_READ_TIME": 3,
"BACKEND_APP_VERSION": "4.4.40",
@ -11,13 +11,13 @@
"MAX_RETRIES_ON_SERVER_ERROR": 3,
"OAUTH_CLIENT_ID": "redaction",
"OAUTH_IDP_HINT": null,
"OAUTH_URL": "https://dev-08.iqser.cloud/auth",
"OAUTH_URL": "https://qa5.iqser.cloud/auth",
"RECENT_PERIOD_IN_HOURS": 24,
"SELECTION_MODE": "structural",
"MANUAL_BASE_URL": "https://docs.redactmanager.com/preview",
"ANNOTATIONS_THRESHOLD": 1000,
"THEME": "redact",
"BASE_TRANSLATIONS_DIRECTORY": "/assets/i18n/redact/",
"THEME": "scm",
"BASE_TRANSLATIONS_DIRECTORY": "/assets/i18n/scm/",
"AVAILABLE_NOTIFICATIONS_DAYS": 30,
"AVAILABLE_OLD_NOTIFICATIONS_MINUTES": 60,
"NOTIFICATIONS_THRESHOLD": 1000,

View File

@ -4,7 +4,7 @@
<meta charset="utf-8" />
<base href="/" />
<meta content="width=device-width, initial-scale=1" name="viewport" />
<link href="favicon.ico" rel="icon" type="image/x-icon" />
<link href="favicon.ico" id="favicon" rel="icon" type="image/x-icon" />
<link href="manifest.webmanifest" rel="manifest" />
<meta content="#1976d2" name="theme-color" />
</head>

View File

@ -15,7 +15,6 @@ export class RssEntry implements IRssEntry {
const mappedResult: Record<string, RssResult> = {};
for (const key of Object.keys(entry.result)) {
const newKey = key.replace(new RegExp('_', 'g'), ' ');
console.log([key, newKey]);
mappedResult[newKey] = new RssResult(entry.result[key], key);
}
this.result = mappedResult;

View File

@ -12,16 +12,22 @@ export interface IRssResult {
readonly transformation: string;
}
export type RssResultAnnotation = IScmAnnotation & { readonly displayName: string };
export class RssResult implements IRssResult {
readonly value: string;
readonly originalValue: string;
readonly scmAnnotations: IScmAnnotation[];
readonly scmAnnotations: RssResultAnnotation[];
readonly transformation: string;
constructor(result: IRssResult, readonly originalKey: string) {
this.value = result.value;
this.originalValue = result.originalValue;
this.scmAnnotations = result.scmAnnotations;
const scmAnnotations = result.scmAnnotations ?? [];
this.scmAnnotations = scmAnnotations.map(annotation => ({
...annotation,
displayName: annotation.reason.split('found')?.[0]?.trim(),
}));
this.transformation = result.transformation;
}
}